From 727b0a463e7cffde79fbfafaa16cb0407f2bde84 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 21 Mar 2022 02:38:03 +0100 Subject: [PATCH] Damage Control - Updated dependencies to 1.18.2 - Started work on compilation errors --- gradle.properties | 16 +++--- .../java/com/simibubi/create/AllItems.java | 4 +- .../java/com/simibubi/create/AllTags.java | 30 +++++------ src/main/java/com/simibubi/create/Create.java | 4 +- .../jei/ToolboxColoringRecipeMaker.java | 4 +- .../contraptions/base/KineticTileEntity.java | 2 +- .../SequencedAssemblyRecipeBuilder.java | 4 +- .../processing/ProcessingRecipeBuilder.java | 6 +-- .../elementary/SimpleKineticTileEntity.java | 2 +- .../curiosities/bell/SoulPulseEffect.java | 2 +- .../tools/BlueprintOverlayRenderer.java | 7 +-- .../logistics/item/filter/ItemAttribute.java | 26 ++++++---- .../palettes/AllPaletteStoneTypes.java | 4 +- .../content/palettes/PaletteBlockPartial.java | 18 +++---- .../content/palettes/PaletteBlockPattern.java | 10 ++-- .../palettes/PalettesVariantEntry.java | 6 +-- .../schematics/SchematicChunkSource.java | 27 ++++------ .../content/schematics/SchematicWorld.java | 9 ++-- .../foundation/data/CreateRegistrate.java | 10 ++-- .../create/foundation/data/NamedTag.java | 42 --------------- .../data/recipe/CreateRecipeProvider.java | 38 +++++++------- .../data/recipe/StandardRecipeGen.java | 12 ++--- .../foundation/fluid/FluidIngredient.java | 6 +-- .../ponder/element/WorldSectionElement.java | 2 +- .../worldWrappers/WrappedClientWorld.java | 52 +++++++++++-------- .../worldWrappers/WrappedServerWorld.java | 31 ++++------- .../utility/worldWrappers/WrappedWorld.java | 31 +++++------ src/main/resources/pack.mcmeta | 2 +- 28 files changed, 183 insertions(+), 224 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/foundation/data/NamedTag.java diff --git a/gradle.properties b/gradle.properties index c121035f5..504689cf8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false # mod version info -mod_version = 0.4f -minecraft_version = 1.18.1 -forge_version = 39.1.0 +mod_version = 0.4.1 +minecraft_version = 1.18.2 +forge_version = 40.0.19 # build dependency versions forgegradle_version = 5.1.+ @@ -15,13 +15,13 @@ mixin_version = 0.8.5 librarian_version = 1.+ shadow_version = 7.1.0 cursegradle_version = 1.4.0 -parchment_version = 2022.01.23 +parchment_version = 2022.03.13 # dependency versions -registrate_version = MC1.18-1.0.21 -flywheel_version = 1.18-0.6.1.62 -jei_minecraft_version = 1.18.1 -jei_version = 9.4.1.112 +registrate_version = MC1.18.2-1.0.24 +flywheel_version = 1.18-0.6.2.64 +jei_minecraft_version = 1.18.2 +jei_version = 9.5.3.143 # curseforge information projectId = 328085 diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 9113d0f7c..f87b7aea6 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -62,7 +62,7 @@ import com.tterrag.registrate.util.entry.ItemEntry; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; @@ -370,7 +370,7 @@ public class AllItems { } @SafeVarargs - private static ItemEntry taggedIngredient(String name, Tag.Named... tags) { + private static ItemEntry taggedIngredient(String name, TagKey... tags) { return REGISTRATE.item(name, Item::new) .tag(tags) .register(); diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index 82d724a79..b571387ba 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -17,7 +17,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -34,24 +34,24 @@ public class AllTags { private static final CreateRegistrate REGISTRATE = Create.registrate() .creativeModeTab(() -> Create.BASE_CREATIVE_TAB); - public static Tag.Named tag(Function> wrapperFactory, String namespace, + public static TagKey tag(Function> wrapperFactory, String namespace, String path) { return wrapperFactory.apply(new ResourceLocation(namespace, path)); } - public static Tag.Named forgeTag(Function> wrapperFactory, String path) { + public static TagKey forgeTag(Function> wrapperFactory, String path) { return tag(wrapperFactory, "forge", path); } - public static Tag.Named forgeBlockTag(String path) { + public static TagKey forgeBlockTag(String path) { return forgeTag(BlockTags::createOptional, path); } - public static Tag.Named forgeItemTag(String path) { + public static TagKey forgeItemTag(String path) { return forgeTag(ItemTags::createOptional, path); } - public static Tag.Named forgeFluidTag(String path) { + public static TagKey forgeFluidTag(String path) { return forgeTag(FluidTags::createOptional, path); } @@ -124,7 +124,7 @@ public class AllTags { ; - public final Tag.Named tag; + public final TagKey tag; AllBlockTags() { this(MOD); @@ -167,7 +167,7 @@ public class AllTags { .add(values)); } - public void includeIn(Tag.Named parent) { + public void includeIn(TagKey parent) { REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent) .addTag(tag)); } @@ -176,7 +176,7 @@ public class AllTags { includeIn(parent.tag); } - public void includeAll(Tag.Named child) { + public void includeAll(TagKey child) { REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag) .addTag(child)); } @@ -200,7 +200,7 @@ public class AllTags { ; - public final Tag.Named tag; + public final TagKey tag; AllItemTags() { this(MOD); @@ -239,7 +239,7 @@ public class AllTags { .add(values)); } - public void includeIn(Tag.Named parent) { + public void includeIn(TagKey parent) { REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent) .addTag(tag)); } @@ -248,7 +248,7 @@ public class AllTags { includeIn(parent.tag); } - public void includeAll(Tag.Named child) { + public void includeAll(TagKey child) { REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag) .addTag(child)); } @@ -264,7 +264,7 @@ public class AllTags { ; - public final Tag.Named tag; + public final TagKey tag; AllFluidTags() { this(MOD); @@ -303,7 +303,7 @@ public class AllTags { .add(values)); } - public void includeIn(Tag.Named parent) { + public void includeIn(TagKey parent) { REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(parent) .addTag(tag)); } @@ -312,7 +312,7 @@ public class AllTags { includeIn(parent.tag); } - public void includeAll(Tag.Named child) { + public void includeAll(TagKey child) { REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag) .addTag(child)); } diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 41e28504c..8aeaae1ff 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -31,7 +31,7 @@ import com.simibubi.create.foundation.data.recipe.SequencedAssemblyRecipeGen; import com.simibubi.create.foundation.data.recipe.StandardRecipeGen; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.worldgen.AllWorldFeatures; -import com.tterrag.registrate.util.NonNullLazyValue; +import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.core.particles.ParticleType; import net.minecraft.data.DataGenerator; @@ -74,7 +74,7 @@ public class Create { public static final ServerLagger LAGGER = new ServerLagger(); public static final Random RANDOM = new Random(); - private static final NonNullLazyValue REGISTRATE = CreateRegistrate.lazy(ID); + private static final NonNullSupplier REGISTRATE = CreateRegistrate.lazy(ID); public Create() { onCtor(); diff --git a/src/main/java/com/simibubi/create/compat/jei/ToolboxColoringRecipeMaker.java b/src/main/java/com/simibubi/create/compat/jei/ToolboxColoringRecipeMaker.java index 4098d62a8..74999d5ec 100644 --- a/src/main/java/com/simibubi/create/compat/jei/ToolboxColoringRecipeMaker.java +++ b/src/main/java/com/simibubi/create/compat/jei/ToolboxColoringRecipeMaker.java @@ -8,7 +8,7 @@ import com.simibubi.create.Create; import net.minecraft.core.NonNullList; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.Item; @@ -32,7 +32,7 @@ public final class ToolboxColoringRecipeMaker { .map(color -> { DyeItem dye = DyeItem.byColor(color); ItemStack dyeStack = new ItemStack(dye); - Tag colorTag = color.getTag(); + TagKey colorTag = color.getTag(); Ingredient.Value dyeList = new Ingredient.ItemValue(dyeStack); Ingredient.Value colorList = new Ingredient.TagValue(colorTag); Stream colorIngredientStream = Stream.of(dyeList, colorList); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index 543465645..753d54586 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -534,7 +534,7 @@ public class KineticTileEntity extends SmartTileEntity .forEach(offset -> { if (axis.choose(offset.getX(), offset.getY(), offset.getZ()) != 0) return; - if (offset.distSqr(0, 0, 0, false) != BlockPos.ZERO.distSqr(1, 1, 0, false)) + if (offset.distSqr(BlockPos.ZERO) != 2) return; neighbours.add(worldPosition.offset(offset)); }); diff --git a/src/main/java/com/simibubi/create/content/contraptions/itemAssembly/SequencedAssemblyRecipeBuilder.java b/src/main/java/com/simibubi/create/content/contraptions/itemAssembly/SequencedAssemblyRecipeBuilder.java index e42a5837a..18924d88a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/itemAssembly/SequencedAssemblyRecipeBuilder.java +++ b/src/main/java/com/simibubi/create/content/contraptions/itemAssembly/SequencedAssemblyRecipeBuilder.java @@ -15,7 +15,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuild import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; @@ -52,7 +52,7 @@ public class SequencedAssemblyRecipeBuilder { return require(Ingredient.of(ingredient)); } - public SequencedAssemblyRecipeBuilder require(Tag.Named tag) { + public SequencedAssemblyRecipeBuilder require(TagKey tag) { return require(Ingredient.of(tag)); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeBuilder.java b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeBuilder.java index b87345a22..4d5ab1e33 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeBuilder.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeBuilder.java @@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo; import net.minecraft.core.NonNullList; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; @@ -103,7 +103,7 @@ public class ProcessingRecipeBuilder> { // Datagen shortcuts - public ProcessingRecipeBuilder require(Tag.Named tag) { + public ProcessingRecipeBuilder require(TagKey tag) { return require(Ingredient.of(tag)); } @@ -120,7 +120,7 @@ public class ProcessingRecipeBuilder> { return require(FluidIngredient.fromFluid(fluid, amount)); } - public ProcessingRecipeBuilder require(Tag.Named fluidTag, int amount) { + public ProcessingRecipeBuilder require(TagKey fluidTag, int amount) { return require(FluidIngredient.fromTag(fluidTag, amount)); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java index 267f7f9b0..87c9243d2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java @@ -28,7 +28,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity { BlockPos.betweenClosedStream(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) .forEach(offset -> { - if (offset.distSqr(0, 0, 0, false) == BlockPos.ZERO.distSqr(1, 1, 0, false)) + if (offset.distSqr(BlockPos.ZERO) == 2) neighbours.add(worldPosition.offset(offset)); }); return neighbours; diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java index 745f67a60..892020b1f 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java @@ -119,7 +119,7 @@ public class SoulPulseEffect { for (int z = 0; z < MAX_DISTANCE; z++) { BlockPos candidate = new BlockPos(x, y, z); - int dist = (int) Math.round(Math.sqrt(candidate.distSqr(0, 0, 0, false))); + int dist = (int) Math.round(Math.sqrt(candidate.distSqr(BlockPos.ZERO))); if (dist > MAX_DISTANCE) continue; if (dist <= 0) diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java index d3be9e46e..8748d0837 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java @@ -25,7 +25,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -206,7 +206,8 @@ public class BlueprintOverlayRenderer { } } - public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) { + public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, + int height) { if (!active || empty) return; @@ -279,7 +280,7 @@ public class BlueprintOverlayRenderer { ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0)); if (fromNBT instanceof ItemAttribute.InTag) { ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT; - Tag itag = ItemTags.getAllTags() + TagKey itag = ItemTags.getAllTags() .getTag(inTag.tagName); if (itag != null) return Ingredient.of(itag) diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java index 6a2e7e982..2e14f7435 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java @@ -29,6 +29,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; import net.minecraft.world.Container; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; @@ -49,6 +50,7 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.RecipeWrapper; +import net.minecraftforge.registries.ForgeRegistries; public interface ItemAttribute { @@ -131,14 +133,16 @@ public interface ItemAttribute { DUMMY(s -> false), PLACEABLE(s -> s.getItem() instanceof BlockItem), CONSUMABLE(ItemStack::isEdible), - FLUID_CONTAINER(s -> s.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY).isPresent()), + FLUID_CONTAINER(s -> s.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY) + .isPresent()), ENCHANTED(ItemStack::isEnchanted), MAX_ENCHANTED(StandardTraits::maxEnchanted), RENAMED(ItemStack::hasCustomHoverName), DAMAGED(ItemStack::isDamaged), BADLY_DAMAGED(s -> s.isDamaged() && s.getDamageValue() / s.getMaxDamage() > 3 / 4f), NOT_STACKABLE(((Predicate) ItemStack::isStackable).negate()), - EQUIPABLE(s -> LivingEntity.getEquipmentSlotForItem(s).getType() != EquipmentSlot.Type.HAND), + EQUIPABLE(s -> LivingEntity.getEquipmentSlotForItem(s) + .getType() != EquipmentSlot.Type.HAND), FURNACE_FUEL(AbstractFurnaceBlockEntity::isFuel), WASHABLE(InWorldProcessing::isWashable), HAUNTABLE(InWorldProcessing::isHauntable), @@ -167,7 +171,8 @@ public interface ItemAttribute { return EnchantmentHelper.getEnchantments(s) .entrySet() .stream() - .anyMatch(e -> e.getKey().getMaxLevel() <= e.getValue()); + .anyMatch(e -> e.getKey() + .getMaxLevel() <= e.getValue()); } private StandardTraits(BiPredicate test) { @@ -235,16 +240,19 @@ public interface ItemAttribute { @Override public boolean appliesTo(ItemStack stack) { - return stack.getItem() - .getTags() - .contains(tagName); + return ForgeRegistries.ITEMS.getHolder(stack.getItem()) + .get() + .tags() + .anyMatch(t -> t.location() + .equals(tagName)); } @Override public List listAttributesOf(ItemStack stack) { - return stack.getItem() - .getTags() - .stream() + return ForgeRegistries.ITEMS.getHolder(stack.getItem()) + .get() + .tags() + .map(TagKey::location) .map(InTag::new) .collect(Collectors.toList()); } diff --git a/src/main/java/com/simibubi/create/content/palettes/AllPaletteStoneTypes.java b/src/main/java/com/simibubi/create/content/palettes/AllPaletteStoneTypes.java index 92299feb7..c13c9ed0f 100644 --- a/src/main/java/com/simibubi/create/content/palettes/AllPaletteStoneTypes.java +++ b/src/main/java/com/simibubi/create/content/palettes/AllPaletteStoneTypes.java @@ -12,7 +12,7 @@ import com.simibubi.create.foundation.utility.Lang; import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -60,7 +60,7 @@ public enum AllPaletteStoneTypes { public NonNullSupplier baseBlock; public PaletteBlockPattern[] variantTypes; - public Tag.Named materialTag; + public TagKey materialTag; private AllPaletteStoneTypes(PaletteBlockPattern[] variantTypes, Function> factory) { diff --git a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java index 835a07c36..5d917b39e 100644 --- a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java +++ b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java @@ -23,7 +23,7 @@ import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -90,9 +90,9 @@ public abstract class PaletteBlockPartial { return true; } - protected abstract Iterable> getBlockTags(); + protected abstract Iterable> getBlockTags(); - protected abstract Iterable> getItemTags(); + protected abstract Iterable> getItemTags(); protected abstract B createBlock(Supplier block); @@ -121,12 +121,12 @@ public abstract class PaletteBlockPartial { } @Override - protected Iterable> getBlockTags() { + protected Iterable> getBlockTags() { return Arrays.asList(BlockTags.STAIRS); } @Override - protected Iterable> getItemTags() { + protected Iterable> getItemTags() { return Arrays.asList(ItemTags.STAIRS); } @@ -184,12 +184,12 @@ public abstract class PaletteBlockPartial { } @Override - protected Iterable> getBlockTags() { + protected Iterable> getBlockTags() { return Arrays.asList(BlockTags.SLABS); } @Override - protected Iterable> getItemTags() { + protected Iterable> getItemTags() { return Arrays.asList(ItemTags.SLABS); } @@ -242,12 +242,12 @@ public abstract class PaletteBlockPartial { } @Override - protected Iterable> getBlockTags() { + protected Iterable> getBlockTags() { return Arrays.asList(BlockTags.WALLS); } @Override - protected Iterable> getItemTags() { + protected Iterable> getItemTags() { return Arrays.asList(ItemTags.WALLS); } diff --git a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPattern.java b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPattern.java index 64a483349..2c80a9a02 100644 --- a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPattern.java +++ b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPattern.java @@ -28,7 +28,7 @@ import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.Direction.Axis; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; @@ -71,8 +71,8 @@ public class PaletteBlockPattern { private String[] textures; private String id; private boolean isTranslucent; - private Tag.Named[] blockTags; - private Tag.Named[] itemTags; + private TagKey[] blockTags; + private TagKey[] itemTags; private Optional> ctFactory; private IPatternBlockStateGenerator blockStateGenerator; @@ -106,11 +106,11 @@ public class PaletteBlockPattern { return isTranslucent; } - public Tag.Named[] getBlockTags() { + public TagKey[] getBlockTags() { return blockTags; } - public Tag.Named[] getItemTags() { + public TagKey[] getItemTags() { return itemTags; } diff --git a/src/main/java/com/simibubi/create/content/palettes/PalettesVariantEntry.java b/src/main/java/com/simibubi/create/content/palettes/PalettesVariantEntry.java index 656abe88b..f6d8c1435 100644 --- a/src/main/java/com/simibubi/create/content/palettes/PalettesVariantEntry.java +++ b/src/main/java/com/simibubi/create/content/palettes/PalettesVariantEntry.java @@ -13,7 +13,7 @@ import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.client.renderer.RenderType; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -41,10 +41,10 @@ public class PalettesVariantEntry { ItemBuilder> itemBuilder = builder.item(); - Tag.Named[] blockTags = pattern.getBlockTags(); + TagKey[] blockTags = pattern.getBlockTags(); if (blockTags != null) builder.tag(blockTags); - Tag.Named[] itemTags = pattern.getItemTags(); + TagKey[] itemTags = pattern.getItemTags(); if (itemTags != null) itemBuilder.tag(itemTags); diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicChunkSource.java b/src/main/java/com/simibubi/create/content/schematics/SchematicChunkSource.java index 48b250207..1a51bb12b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicChunkSource.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicChunkSource.java @@ -8,13 +8,13 @@ import javax.annotation.Nullable; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ChunkHolder; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.TagContainer; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -82,7 +82,7 @@ public class SchematicChunkSource extends ChunkSource { } @Override - public void tick(BooleanSupplier pHasTimeLeft) {} + public void tick(BooleanSupplier p_202162_, boolean p_202163_) {} @Override public int getLoadedChunksCount() { @@ -94,7 +94,7 @@ public class SchematicChunkSource extends ChunkSource { private static final class DummyLevel extends Level { private RegistryAccess access; - private DummyLevel(WritableLevelData p_46450_, ResourceKey p_46451_, DimensionType p_46452_, + private DummyLevel(WritableLevelData p_46450_, ResourceKey p_46451_, Holder p_46452_, Supplier p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_) { super(p_46450_, p_46451_, p_46452_, p_46453_, p_46454_, p_46455_, p_46456_); } @@ -126,7 +126,7 @@ public class SchematicChunkSource extends ChunkSource { } @Override - public Biome getUncachedNoiseBiome(int pX, int pY, int pZ) { + public Holder getUncachedNoiseBiome(int pX, int pY, int pZ) { return null; } @@ -139,12 +139,12 @@ public class SchematicChunkSource extends ChunkSource { public void sendBlockUpdated(BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) {} @Override - public void playSound(Player pPlayer, double pX, double pY, double pZ, SoundEvent pSound, SoundSource pCategory, - float pVolume, float pPitch) {} + public void playSound(Player pPlayer, double pX, double pY, double pZ, SoundEvent pSound, + SoundSource pCategory, float pVolume, float pPitch) {} @Override - public void playSound(Player pPlayer, Entity pEntity, SoundEvent pEvent, SoundSource pCategory, float pVolume, - float pPitch) {} + public void playSound(Player pPlayer, Entity pEntity, SoundEvent pEvent, SoundSource pCategory, + float pVolume, float pPitch) {} @Override public String gatherChunkSourceStats() { @@ -182,11 +182,6 @@ public class SchematicChunkSource extends ChunkSource { return null; } - @Override - public TagContainer getTagManager() { - return null; - } - @Override protected LevelEntityGetter getEntities() { return null; @@ -203,9 +198,9 @@ public class SchematicChunkSource extends ChunkSource { } } - private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, - RegistryAccess.builtin().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionType.OVERWORLD_LOCATION), - null, false, false, 0); + private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, RegistryAccess.BUILTIN.get() + .registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY) + .getHolderOrThrow(DimensionType.OVERWORLD_LOCATION), null, false, false, 0); public EmptierChunk(RegistryAccess registryAccess) { super(DUMMY_LEVEL.withAccess(registryAccess), null); diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index 2fa4526b9..b03fc9b00 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -14,6 +14,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.ArmorStand; @@ -138,8 +139,9 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor } @Override - public Biome getBiome(BlockPos pos) { - return ForgeRegistries.BIOMES.getValue(Biomes.PLAINS.location()); + public Holder getBiome(BlockPos pos) { + return ForgeRegistries.BIOMES.getHolder(Biomes.PLAINS.location()) + .orElse(null); } @Override @@ -168,8 +170,7 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor } @Override - public List getEntitiesOfClass(Class arg0, AABB arg1, - Predicate arg2) { + public List getEntitiesOfClass(Class arg0, AABB arg1, Predicate arg2) { return Collections.emptyList(); } diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index 7a1e8502b..92b34bdc9 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -23,7 +23,6 @@ import com.tterrag.registrate.builders.BlockBuilder; import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory; import com.tterrag.registrate.builders.Builder; import com.tterrag.registrate.builders.FluidBuilder; -import com.tterrag.registrate.util.NonNullLazyValue; import com.tterrag.registrate.util.entry.RegistryEntry; import com.tterrag.registrate.util.nullness.NonNullBiFunction; import com.tterrag.registrate.util.nullness.NonNullConsumer; @@ -55,9 +54,9 @@ public class CreateRegistrate extends AbstractRegistrate { super(modid); } - public static NonNullLazyValue lazy(String modid) { - return new NonNullLazyValue<>( - () -> new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get() + public static NonNullSupplier lazy(String modid) { + return NonNullSupplier + .lazy(() -> new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get() .getModEventBus())); } @@ -187,7 +186,8 @@ public class CreateRegistrate extends AbstractRegistrate { /* Util */ - public static NonNullConsumer connectedTextures(Supplier behavior) { + public static NonNullConsumer connectedTextures( + Supplier behavior) { return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior)); } diff --git a/src/main/java/com/simibubi/create/foundation/data/NamedTag.java b/src/main/java/com/simibubi/create/foundation/data/NamedTag.java deleted file mode 100644 index 5a7293a5d..000000000 --- a/src/main/java/com/simibubi/create/foundation/data/NamedTag.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.simibubi.create.foundation.data; - -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - -import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; - -@ParametersAreNonnullByDefault -@MethodsReturnNonnullByDefault -public class NamedTag implements Tag.Named { - private final ResourceLocation id; - private final Tag tag; - - public NamedTag(@Nullable Tag tag, ResourceLocation id) { - this.tag = tag; - this.id = id; - } - - @Override - public ResourceLocation getName() { - return id; - } - - @Override - public boolean contains(T p_230235_1_) { - if (tag == null) - return false; - return tag.contains(p_230235_1_); - } - - @Override - public List getValues() { - if (tag == null) - return Collections.emptyList(); - return tag.getValues(); - } -} diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/CreateRecipeProvider.java b/src/main/java/com/simibubi/create/foundation/data/recipe/CreateRecipeProvider.java index b978da112..894d493d7 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/CreateRecipeProvider.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/CreateRecipeProvider.java @@ -13,7 +13,7 @@ import net.minecraft.data.DataGenerator; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.ItemLike; @@ -48,27 +48,27 @@ public abstract class CreateRecipeProvider extends RecipeProvider { protected static class I { - static Tag.Named redstone() { + static TagKey redstone() { return Tags.Items.DUSTS_REDSTONE; } - static Tag.Named planks() { + static TagKey planks() { return ItemTags.PLANKS; } - static Tag.Named woodSlab() { + static TagKey woodSlab() { return ItemTags.WOODEN_SLABS; } - static Tag.Named gold() { + static TagKey gold() { return AllTags.forgeItemTag("ingots/gold"); } - static Tag.Named goldSheet() { + static TagKey goldSheet() { return AllTags.forgeItemTag("plates/gold"); } - static Tag.Named stone() { + static TagKey stone() { return Tags.Items.STONE; } @@ -92,27 +92,27 @@ public abstract class CreateRecipeProvider extends RecipeProvider { return AllBlocks.ANDESITE_CASING.get(); } - static Tag.Named brass() { + static TagKey brass() { return AllTags.forgeItemTag("ingots/brass"); } - static Tag.Named brassSheet() { + static TagKey brassSheet() { return AllTags.forgeItemTag("plates/brass"); } - static Tag.Named iron() { + static TagKey iron() { return Tags.Items.INGOTS_IRON; } - static Tag.Named ironNugget() { + static TagKey ironNugget() { return AllTags.forgeItemTag("nuggets/iron"); } - static Tag.Named zinc() { + static TagKey zinc() { return AllTags.forgeItemTag("ingots/zinc"); } - static Tag.Named ironSheet() { + static TagKey ironSheet() { return AllTags.forgeItemTag("plates/iron"); } @@ -132,11 +132,11 @@ public abstract class CreateRecipeProvider extends RecipeProvider { return Items.COPPER_BLOCK; } - static Tag.Named brassBlock() { + static TagKey brassBlock() { return AllTags.forgeItemTag("storage_blocks/brass"); } - static Tag.Named zincBlock() { + static TagKey zincBlock() { return AllTags.forgeItemTag("storage_blocks/zinc"); } @@ -144,19 +144,19 @@ public abstract class CreateRecipeProvider extends RecipeProvider { return Items.COPPER_INGOT; } - static Tag.Named copperSheet() { + static TagKey copperSheet() { return AllTags.forgeItemTag("plates/copper"); } - static Tag.Named copperNugget() { + static TagKey copperNugget() { return AllTags.forgeItemTag("nuggets/copper"); } - static Tag.Named brassNugget() { + static TagKey brassNugget() { return AllTags.forgeItemTag("nuggets/brass"); } - static Tag.Named zincNugget() { + static TagKey zincNugget() { return AllTags.forgeItemTag("nuggets/zinc"); } diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index 36c3f301e..937f48edc 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -41,7 +41,7 @@ import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; import net.minecraft.data.recipes.SpecialRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -1122,13 +1122,13 @@ public class StandardRecipeGen extends CreateRecipeProvider { } GeneratedRecipe metalCompacting(List> variants, - List>> ingredients) { + List>> ingredients) { GeneratedRecipe result = null; for (int i = 0; i + 1 < variants.size(); i++) { ItemProviderEntry currentEntry = variants.get(i); ItemProviderEntry nextEntry = variants.get(i + 1); - Supplier> currentIngredient = ingredients.get(i); - Supplier> nextIngredient = ingredients.get(i + 1); + Supplier> currentIngredient = ingredients.get(i); + Supplier> nextIngredient = ingredients.get(i + 1); result = create(nextEntry).withSuffix("_from_compacting") .unlockedBy(currentEntry::get) @@ -1197,7 +1197,7 @@ public class StandardRecipeGen extends CreateRecipeProvider { return this; } - GeneratedRecipeBuilder unlockedByTag(Supplier> tag) { + GeneratedRecipeBuilder unlockedByTag(Supplier> tag) { this.unlockedBy = () -> ItemPredicate.Builder.item() .of(tag.get()) .build(); @@ -1258,7 +1258,7 @@ public class StandardRecipeGen extends CreateRecipeProvider { return unlockedBy(item).viaCookingIngredient(() -> Ingredient.of(item.get())); } - GeneratedCookingRecipeBuilder viaCookingTag(Supplier> tag) { + GeneratedCookingRecipeBuilder viaCookingTag(Supplier> tag) { return unlockedByTag(tag).viaCookingIngredient(() -> Ingredient.of(tag.get())); } diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java index 5695d738c..614b05090 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java @@ -19,7 +19,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.SerializationTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.util.GsonHelper; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; @@ -31,7 +31,7 @@ public abstract class FluidIngredient implements Predicate { public List matchingFluidStacks; - public static FluidIngredient fromTag(Tag.Named tag, int amount) { + public static FluidIngredient fromTag(TagKey tag, int amount) { FluidTagIngredient ingredient = new FluidTagIngredient(); ingredient.tag = tag; ingredient.amountRequired = amount; @@ -198,7 +198,7 @@ public abstract class FluidIngredient implements Predicate { public static class FluidTagIngredient extends FluidIngredient { - protected Tag tag; + protected TagKey tag; @Override protected boolean testInternal(FluidStack t) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java index 5eedc857e..ad2549630 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java @@ -436,7 +436,7 @@ public class WorldSectionElement extends AnimatedSceneElement { } if (!fluidState.isEmpty() && ItemBlockRenderTypes.canRenderInLayer(fluidState, layer)) - dispatcher.renderLiquid(pos, world, builder, fluidState); + dispatcher.renderLiquid(pos, world, builder, state, fluidState); poseStack.popPose(); }); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java index ea5e0fb16..fb8025832 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java @@ -5,7 +5,6 @@ import java.util.List; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.api.MethodsReturnNonnullByDefault; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; @@ -27,15 +26,14 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @SuppressWarnings("deprecation") @ParametersAreNonnullByDefault -@MethodsReturnNonnullByDefault public class WrappedClientWorld extends ClientLevel { private static final Minecraft mc = Minecraft.getInstance(); protected Level world; private WrappedClientWorld(Level world) { - super(mc.getConnection(), mc.level.getLevelData(), world.dimension(), world.dimensionType(), - mc.getConnection().serverChunkRadius, mc.level.getServerSimulationDistance(), - world.getProfilerSupplier(), mc.levelRenderer, world.isDebug(), world.getBiomeManager().biomeZoomSeed); + super(mc.getConnection(), mc.level.getLevelData(), world.dimension(), world.dimensionTypeRegistration(), + mc.getConnection().serverChunkRadius, mc.level.getServerSimulationDistance(), world.getProfilerSupplier(), + mc.levelRenderer, world.isDebug(), world.getBiomeManager().biomeZoomSeed); this.world = world; } @@ -47,7 +45,7 @@ public class WrappedClientWorld extends ClientLevel { public boolean hasChunkAt(BlockPos pos) { return world.hasChunkAt(pos); } - + @Override public boolean isLoaded(BlockPos pos) { return world.isLoaded(pos); @@ -58,8 +56,8 @@ public class WrappedClientWorld extends ClientLevel { return world.getBlockState(pos); } - // FIXME: blockstate#getCollisionShape with WrappedClientWorld gives unreliable data (maybe) - + // FIXME: blockstate#getCollisionShape with WrappedClientWorld gives unreliable + // data (maybe) @Override public int getBrightness(LightLayer type, BlockPos pos) { @@ -78,7 +76,8 @@ public class WrappedClientWorld extends ClientLevel { @Nullable @Override - public T getNearestEntity(List p_217361_1_, TargetingConditions p_217361_2_, @Nullable LivingEntity p_217361_3_, double p_217361_4_, double p_217361_6_, double p_217361_8_) { + public T getNearestEntity(List p_217361_1_, TargetingConditions p_217361_2_, + @Nullable LivingEntity p_217361_3_, double p_217361_4_, double p_217361_6_, double p_217361_8_) { return world.getNearestEntity(p_217361_1_, p_217361_2_, p_217361_3_, p_217361_4_, p_217361_6_, p_217361_8_); } @@ -89,35 +88,45 @@ public class WrappedClientWorld extends ClientLevel { // FIXME: Emissive Lighting might not light stuff properly - @Override - public void addParticle(ParticleOptions p_195594_1_, double p_195594_2_, double p_195594_4_, double p_195594_6_, double p_195594_8_, double p_195594_10_, double p_195594_12_) { + public void addParticle(ParticleOptions p_195594_1_, double p_195594_2_, double p_195594_4_, double p_195594_6_, + double p_195594_8_, double p_195594_10_, double p_195594_12_) { world.addParticle(p_195594_1_, p_195594_2_, p_195594_4_, p_195594_6_, p_195594_8_, p_195594_10_, p_195594_12_); } @Override - public void addParticle(ParticleOptions p_195590_1_, boolean p_195590_2_, double p_195590_3_, double p_195590_5_, double p_195590_7_, double p_195590_9_, double p_195590_11_, double p_195590_13_) { - world.addParticle(p_195590_1_, p_195590_2_, p_195590_3_, p_195590_5_, p_195590_7_, p_195590_9_, p_195590_11_, p_195590_13_); + public void addParticle(ParticleOptions p_195590_1_, boolean p_195590_2_, double p_195590_3_, double p_195590_5_, + double p_195590_7_, double p_195590_9_, double p_195590_11_, double p_195590_13_) { + world.addParticle(p_195590_1_, p_195590_2_, p_195590_3_, p_195590_5_, p_195590_7_, p_195590_9_, p_195590_11_, + p_195590_13_); } @Override - public void addAlwaysVisibleParticle(ParticleOptions p_195589_1_, double p_195589_2_, double p_195589_4_, double p_195589_6_, double p_195589_8_, double p_195589_10_, double p_195589_12_) { - world.addAlwaysVisibleParticle(p_195589_1_, p_195589_2_, p_195589_4_, p_195589_6_, p_195589_8_, p_195589_10_, p_195589_12_); + public void addAlwaysVisibleParticle(ParticleOptions p_195589_1_, double p_195589_2_, double p_195589_4_, + double p_195589_6_, double p_195589_8_, double p_195589_10_, double p_195589_12_) { + world.addAlwaysVisibleParticle(p_195589_1_, p_195589_2_, p_195589_4_, p_195589_6_, p_195589_8_, p_195589_10_, + p_195589_12_); } @Override - public void addAlwaysVisibleParticle(ParticleOptions p_217404_1_, boolean p_217404_2_, double p_217404_3_, double p_217404_5_, double p_217404_7_, double p_217404_9_, double p_217404_11_, double p_217404_13_) { - world.addAlwaysVisibleParticle(p_217404_1_, p_217404_2_, p_217404_3_, p_217404_5_, p_217404_7_, p_217404_9_, p_217404_11_, p_217404_13_); + public void addAlwaysVisibleParticle(ParticleOptions p_217404_1_, boolean p_217404_2_, double p_217404_3_, + double p_217404_5_, double p_217404_7_, double p_217404_9_, double p_217404_11_, double p_217404_13_) { + world.addAlwaysVisibleParticle(p_217404_1_, p_217404_2_, p_217404_3_, p_217404_5_, p_217404_7_, p_217404_9_, + p_217404_11_, p_217404_13_); } @Override - public void playLocalSound(double p_184134_1_, double p_184134_3_, double p_184134_5_, SoundEvent p_184134_7_, SoundSource p_184134_8_, float p_184134_9_, float p_184134_10_, boolean p_184134_11_) { - world.playLocalSound(p_184134_1_, p_184134_3_, p_184134_5_, p_184134_7_,p_184134_8_, p_184134_9_, p_184134_10_, p_184134_11_); + public void playLocalSound(double p_184134_1_, double p_184134_3_, double p_184134_5_, SoundEvent p_184134_7_, + SoundSource p_184134_8_, float p_184134_9_, float p_184134_10_, boolean p_184134_11_) { + world.playLocalSound(p_184134_1_, p_184134_3_, p_184134_5_, p_184134_7_, p_184134_8_, p_184134_9_, p_184134_10_, + p_184134_11_); } @Override - public void playSound(@Nullable Player p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundSource p_184148_9_, float p_184148_10_, float p_184148_11_) { - world.playSound(p_184148_1_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_); + public void playSound(@Nullable Player p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, + SoundEvent p_184148_8_, SoundSource p_184148_9_, float p_184148_10_, float p_184148_11_) { + world.playSound(p_184148_1_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_8_, p_184148_9_, p_184148_10_, + p_184148_11_); } @Nullable @@ -125,6 +134,7 @@ public class WrappedClientWorld extends ClientLevel { public BlockEntity getBlockEntity(BlockPos p_175625_1_) { return world.getBlockEntity(p_175625_1_); } + public Level getWrappedWorld() { return world; } diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java index 41c1205a6..9996c4ddb 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java @@ -8,12 +8,12 @@ import javax.annotation.ParametersAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.TagContainer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.crafting.RecipeManager; @@ -34,7 +34,7 @@ public class WrappedServerWorld extends ServerLevel { public WrappedServerWorld(Level world) { super(world.getServer(), Util.backgroundExecutor(), world.getServer().storageSource, - (ServerLevelData) world.getLevelData(), world.dimension(), world.dimensionType(), + (ServerLevelData) world.getLevelData(), world.dimension(), world.dimensionTypeRegistration(), new DummyStatusListener(), ((ServerChunkCache) world.getChunkSource()).getGenerator(), world.isDebug(), world.getBiomeManager().biomeZoomSeed, Collections.emptyList(), false); this.world = world; @@ -59,15 +59,14 @@ public class WrappedServerWorld extends ServerLevel { public LevelTicks getBlockTicks() { return super.getBlockTicks(); } - + @Override public LevelTicks getFluidTicks() { return super.getFluidTicks(); } @Override - public void levelEvent(Player player, int type, BlockPos pos, int data) { - } + public void levelEvent(Player player, int type, BlockPos pos, int data) {} @Override public List players() { @@ -76,13 +75,11 @@ public class WrappedServerWorld extends ServerLevel { @Override public void playSound(Player player, double x, double y, double z, SoundEvent soundIn, SoundSource category, - float volume, float pitch) { - } + float volume, float pitch) {} @Override - public void playSound(Player p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, - SoundSource p_217384_4_, float p_217384_5_, float p_217384_6_) { - } + public void playSound(Player p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundSource p_217384_4_, + float p_217384_5_, float p_217384_6_) {} @Override public Entity getEntity(int id) { @@ -101,8 +98,7 @@ public class WrappedServerWorld extends ServerLevel { } @Override - public void setMapData(String mapId, MapItemSavedData mapDataIn) { - } + public void setMapData(String mapId, MapItemSavedData mapDataIn) {} @Override public int getFreeMapId() { @@ -110,8 +106,7 @@ public class WrappedServerWorld extends ServerLevel { } @Override - public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { - } + public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) {} @Override public RecipeManager getRecipeManager() { @@ -119,12 +114,8 @@ public class WrappedServerWorld extends ServerLevel { } @Override - public TagContainer getTagManager() { - return world.getTagManager(); - } - - @Override - public Biome getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) { + public Holder getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) { return world.getUncachedNoiseBiome(p_225604_1_, p_225604_2_, p_225604_3_); } + } diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java index e27910d2e..871f848da 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java @@ -8,11 +8,11 @@ import javax.annotation.Nullable; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.RegistryAccess; import net.minecraft.core.SectionPos; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.TagContainer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.crafting.RecipeManager; @@ -39,8 +39,8 @@ public class WrappedWorld extends Level { protected LevelEntityGetter entityGetter = new DummyLevelEntityGetter<>(); public WrappedWorld(Level world) { - super((WritableLevelData) world.getLevelData(), world.dimension(), world.dimensionType(), world::getProfiler, - world.isClientSide, world.isDebug(), 0); + super((WritableLevelData) world.getLevelData(), world.dimension(), world.dimensionTypeRegistration(), + world::getProfiler, world.isClientSide, world.isDebug(), 0); this.world = world; } @@ -136,8 +136,7 @@ public class WrappedWorld extends Level { } @Override - public void setMapData(String pMapId, MapItemSavedData pData) { - } + public void setMapData(String pMapId, MapItemSavedData pData) {} @Override public int getFreeMapId() { @@ -158,12 +157,7 @@ public class WrappedWorld extends Level { } @Override - public TagContainer getTagManager() { - return world.getTagManager(); - } - - @Override - public Biome getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) { + public Holder getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) { return world.getUncachedNoiseBiome(p_225604_1_, p_225604_2_, p_225604_3_); } @@ -183,12 +177,10 @@ public class WrappedWorld extends Level { } @Override - public void updateNeighbourForOutputSignal(BlockPos p_175666_1_, Block p_175666_2_) { - } + public void updateNeighbourForOutputSignal(BlockPos p_175666_1_, Block p_175666_2_) {} @Override - public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) { - } + public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) {} @Override public String gatherChunkSourceStats() { @@ -200,9 +192,12 @@ public class WrappedWorld extends Level { return entityGetter; } - // Intentionally copied from LevelHeightAccessor. Workaround for issues caused when other mods (such as Lithium) - // override the vanilla implementations in ways which cause WrappedWorlds to return incorrect, default height info. - // WrappedWorld subclasses should implement their own getMinBuildHeight and getHeight overrides where they deviate + // Intentionally copied from LevelHeightAccessor. Workaround for issues caused + // when other mods (such as Lithium) + // override the vanilla implementations in ways which cause WrappedWorlds to + // return incorrect, default height info. + // WrappedWorld subclasses should implement their own getMinBuildHeight and + // getHeight overrides where they deviate // from the defaults for their dimension. @Override diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 768dbe3db..121c35266 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Create resources", - "pack_format": 8 + "pack_format": 9 } }