Damage Control

- Updated dependencies to 1.18.2
- Started work on compilation errors
This commit is contained in:
simibubi 2022-03-21 02:38:03 +01:00
parent a8c368f426
commit 727b0a463e
28 changed files with 183 additions and 224 deletions

View File

@ -4,9 +4,9 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.4f mod_version = 0.4.1
minecraft_version = 1.18.1 minecraft_version = 1.18.2
forge_version = 39.1.0 forge_version = 40.0.19
# build dependency versions # build dependency versions
forgegradle_version = 5.1.+ forgegradle_version = 5.1.+
@ -15,13 +15,13 @@ mixin_version = 0.8.5
librarian_version = 1.+ librarian_version = 1.+
shadow_version = 7.1.0 shadow_version = 7.1.0
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0
parchment_version = 2022.01.23 parchment_version = 2022.03.13
# dependency versions # dependency versions
registrate_version = MC1.18-1.0.21 registrate_version = MC1.18.2-1.0.24
flywheel_version = 1.18-0.6.1.62 flywheel_version = 1.18-0.6.2.64
jei_minecraft_version = 1.18.1 jei_minecraft_version = 1.18.2
jei_version = 9.4.1.112 jei_version = 9.5.3.143
# curseforge information # curseforge information
projectId = 328085 projectId = 328085

View File

@ -62,7 +62,7 @@ import com.tterrag.registrate.util.entry.ItemEntry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags; 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.food.FoodProperties;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -370,7 +370,7 @@ public class AllItems {
} }
@SafeVarargs @SafeVarargs
private static ItemEntry<Item> taggedIngredient(String name, Tag.Named<Item>... tags) { private static ItemEntry<Item> taggedIngredient(String name, TagKey<Item>... tags) {
return REGISTRATE.item(name, Item::new) return REGISTRATE.item(name, Item::new)
.tag(tags) .tag(tags)
.register(); .register();

View File

@ -17,7 +17,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ItemTags; 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.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -34,24 +34,24 @@ public class AllTags {
private static final CreateRegistrate REGISTRATE = Create.registrate() private static final CreateRegistrate REGISTRATE = Create.registrate()
.creativeModeTab(() -> Create.BASE_CREATIVE_TAB); .creativeModeTab(() -> Create.BASE_CREATIVE_TAB);
public static <T> Tag.Named<T> tag(Function<ResourceLocation, Tag.Named<T>> wrapperFactory, String namespace, public static <T> TagKey<T> tag(Function<ResourceLocation, TagKey<T>> wrapperFactory, String namespace,
String path) { String path) {
return wrapperFactory.apply(new ResourceLocation(namespace, path)); return wrapperFactory.apply(new ResourceLocation(namespace, path));
} }
public static <T> Tag.Named<T> forgeTag(Function<ResourceLocation, Tag.Named<T>> wrapperFactory, String path) { public static <T> TagKey<T> forgeTag(Function<ResourceLocation, TagKey<T>> wrapperFactory, String path) {
return tag(wrapperFactory, "forge", path); return tag(wrapperFactory, "forge", path);
} }
public static Tag.Named<Block> forgeBlockTag(String path) { public static TagKey<Block> forgeBlockTag(String path) {
return forgeTag(BlockTags::createOptional, path); return forgeTag(BlockTags::createOptional, path);
} }
public static Tag.Named<Item> forgeItemTag(String path) { public static TagKey<Item> forgeItemTag(String path) {
return forgeTag(ItemTags::createOptional, path); return forgeTag(ItemTags::createOptional, path);
} }
public static Tag.Named<Fluid> forgeFluidTag(String path) { public static TagKey<Fluid> forgeFluidTag(String path) {
return forgeTag(FluidTags::createOptional, path); return forgeTag(FluidTags::createOptional, path);
} }
@ -124,7 +124,7 @@ public class AllTags {
; ;
public final Tag.Named<Block> tag; public final TagKey<Block> tag;
AllBlockTags() { AllBlockTags() {
this(MOD); this(MOD);
@ -167,7 +167,7 @@ public class AllTags {
.add(values)); .add(values));
} }
public void includeIn(Tag.Named<Block> parent) { public void includeIn(TagKey<Block> parent) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent)
.addTag(tag)); .addTag(tag));
} }
@ -176,7 +176,7 @@ public class AllTags {
includeIn(parent.tag); includeIn(parent.tag);
} }
public void includeAll(Tag.Named<Block> child) { public void includeAll(TagKey<Block> child) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }
@ -200,7 +200,7 @@ public class AllTags {
; ;
public final Tag.Named<Item> tag; public final TagKey<Item> tag;
AllItemTags() { AllItemTags() {
this(MOD); this(MOD);
@ -239,7 +239,7 @@ public class AllTags {
.add(values)); .add(values));
} }
public void includeIn(Tag.Named<Item> parent) { public void includeIn(TagKey<Item> parent) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent) REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent)
.addTag(tag)); .addTag(tag));
} }
@ -248,7 +248,7 @@ public class AllTags {
includeIn(parent.tag); includeIn(parent.tag);
} }
public void includeAll(Tag.Named<Item> child) { public void includeAll(TagKey<Item> child) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag) REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }
@ -264,7 +264,7 @@ public class AllTags {
; ;
public final Tag.Named<Fluid> tag; public final TagKey<Fluid> tag;
AllFluidTags() { AllFluidTags() {
this(MOD); this(MOD);
@ -303,7 +303,7 @@ public class AllTags {
.add(values)); .add(values));
} }
public void includeIn(Tag.Named<Fluid> parent) { public void includeIn(TagKey<Fluid> parent) {
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(parent) REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(parent)
.addTag(tag)); .addTag(tag));
} }
@ -312,7 +312,7 @@ public class AllTags {
includeIn(parent.tag); includeIn(parent.tag);
} }
public void includeAll(Tag.Named<Fluid> child) { public void includeAll(TagKey<Fluid> child) {
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag) REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }

View File

@ -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.data.recipe.StandardRecipeGen;
import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.worldgen.AllWorldFeatures; 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.core.particles.ParticleType;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
@ -74,7 +74,7 @@ public class Create {
public static final ServerLagger LAGGER = new ServerLagger(); public static final ServerLagger LAGGER = new ServerLagger();
public static final Random RANDOM = new Random(); public static final Random RANDOM = new Random();
private static final NonNullLazyValue<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID); private static final NonNullSupplier<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID);
public Create() { public Create() {
onCtor(); onCtor();

View File

@ -8,7 +8,7 @@ import com.simibubi.create.Create;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.resources.ResourceLocation; 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.DyeColor;
import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.DyeItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -32,7 +32,7 @@ public final class ToolboxColoringRecipeMaker {
.map(color -> { .map(color -> {
DyeItem dye = DyeItem.byColor(color); DyeItem dye = DyeItem.byColor(color);
ItemStack dyeStack = new ItemStack(dye); ItemStack dyeStack = new ItemStack(dye);
Tag<Item> colorTag = color.getTag(); TagKey<Item> colorTag = color.getTag();
Ingredient.Value dyeList = new Ingredient.ItemValue(dyeStack); Ingredient.Value dyeList = new Ingredient.ItemValue(dyeStack);
Ingredient.Value colorList = new Ingredient.TagValue(colorTag); Ingredient.Value colorList = new Ingredient.TagValue(colorTag);
Stream<Ingredient.Value> colorIngredientStream = Stream.of(dyeList, colorList); Stream<Ingredient.Value> colorIngredientStream = Stream.of(dyeList, colorList);

View File

@ -534,7 +534,7 @@ public class KineticTileEntity extends SmartTileEntity
.forEach(offset -> { .forEach(offset -> {
if (axis.choose(offset.getX(), offset.getY(), offset.getZ()) != 0) if (axis.choose(offset.getX(), offset.getY(), offset.getZ()) != 0)
return; return;
if (offset.distSqr(0, 0, 0, false) != BlockPos.ZERO.distSqr(1, 1, 0, false)) if (offset.distSqr(BlockPos.ZERO) != 2)
return; return;
neighbours.add(worldPosition.offset(offset)); neighbours.add(worldPosition.offset(offset));
}); });

View File

@ -15,7 +15,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuild
import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.resources.ResourceLocation; 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.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
@ -52,7 +52,7 @@ public class SequencedAssemblyRecipeBuilder {
return require(Ingredient.of(ingredient)); return require(Ingredient.of(ingredient));
} }
public SequencedAssemblyRecipeBuilder require(Tag.Named<Item> tag) { public SequencedAssemblyRecipeBuilder require(TagKey<Item> tag) {
return require(Ingredient.of(tag)); return require(Ingredient.of(tag));
} }

View File

@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.resources.ResourceLocation; 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.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
@ -103,7 +103,7 @@ public class ProcessingRecipeBuilder<T extends ProcessingRecipe<?>> {
// Datagen shortcuts // Datagen shortcuts
public ProcessingRecipeBuilder<T> require(Tag.Named<Item> tag) { public ProcessingRecipeBuilder<T> require(TagKey<Item> tag) {
return require(Ingredient.of(tag)); return require(Ingredient.of(tag));
} }
@ -120,7 +120,7 @@ public class ProcessingRecipeBuilder<T extends ProcessingRecipe<?>> {
return require(FluidIngredient.fromFluid(fluid, amount)); return require(FluidIngredient.fromFluid(fluid, amount));
} }
public ProcessingRecipeBuilder<T> require(Tag.Named<Fluid> fluidTag, int amount) { public ProcessingRecipeBuilder<T> require(TagKey<Fluid> fluidTag, int amount) {
return require(FluidIngredient.fromTag(fluidTag, amount)); return require(FluidIngredient.fromTag(fluidTag, amount));
} }

View File

@ -28,7 +28,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity {
BlockPos.betweenClosedStream(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) BlockPos.betweenClosedStream(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1))
.forEach(offset -> { .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)); neighbours.add(worldPosition.offset(offset));
}); });
return neighbours; return neighbours;

View File

@ -119,7 +119,7 @@ public class SoulPulseEffect {
for (int z = 0; z < MAX_DISTANCE; z++) { for (int z = 0; z < MAX_DISTANCE; z++) {
BlockPos candidate = new BlockPos(x, y, 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) if (dist > MAX_DISTANCE)
continue; continue;
if (dist <= 0) if (dist <= 0)

View File

@ -25,7 +25,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.tags.ItemTags; 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.inventory.CraftingContainer;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; 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) if (!active || empty)
return; return;
@ -279,7 +280,7 @@ public class BlueprintOverlayRenderer {
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0)); ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
if (fromNBT instanceof ItemAttribute.InTag) { if (fromNBT instanceof ItemAttribute.InTag) {
ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT; ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT;
Tag<Item> itag = ItemTags.getAllTags() TagKey<Item> itag = ItemTags.getAllTags()
.getTag(inTag.tagName); .getTag(inTag.tagName);
if (itag != null) if (itag != null)
return Ingredient.of(itag) return Ingredient.of(itag)

View File

@ -29,6 +29,7 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.Container; import net.minecraft.world.Container;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -49,6 +50,7 @@ import net.minecraftforge.fml.ModList;
import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper; import net.minecraftforge.items.wrapper.RecipeWrapper;
import net.minecraftforge.registries.ForgeRegistries;
public interface ItemAttribute { public interface ItemAttribute {
@ -131,14 +133,16 @@ public interface ItemAttribute {
DUMMY(s -> false), DUMMY(s -> false),
PLACEABLE(s -> s.getItem() instanceof BlockItem), PLACEABLE(s -> s.getItem() instanceof BlockItem),
CONSUMABLE(ItemStack::isEdible), 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), ENCHANTED(ItemStack::isEnchanted),
MAX_ENCHANTED(StandardTraits::maxEnchanted), MAX_ENCHANTED(StandardTraits::maxEnchanted),
RENAMED(ItemStack::hasCustomHoverName), RENAMED(ItemStack::hasCustomHoverName),
DAMAGED(ItemStack::isDamaged), DAMAGED(ItemStack::isDamaged),
BADLY_DAMAGED(s -> s.isDamaged() && s.getDamageValue() / s.getMaxDamage() > 3 / 4f), BADLY_DAMAGED(s -> s.isDamaged() && s.getDamageValue() / s.getMaxDamage() > 3 / 4f),
NOT_STACKABLE(((Predicate<ItemStack>) ItemStack::isStackable).negate()), NOT_STACKABLE(((Predicate<ItemStack>) 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), FURNACE_FUEL(AbstractFurnaceBlockEntity::isFuel),
WASHABLE(InWorldProcessing::isWashable), WASHABLE(InWorldProcessing::isWashable),
HAUNTABLE(InWorldProcessing::isHauntable), HAUNTABLE(InWorldProcessing::isHauntable),
@ -167,7 +171,8 @@ public interface ItemAttribute {
return EnchantmentHelper.getEnchantments(s) return EnchantmentHelper.getEnchantments(s)
.entrySet() .entrySet()
.stream() .stream()
.anyMatch(e -> e.getKey().getMaxLevel() <= e.getValue()); .anyMatch(e -> e.getKey()
.getMaxLevel() <= e.getValue());
} }
private StandardTraits(BiPredicate<ItemStack, Level> test) { private StandardTraits(BiPredicate<ItemStack, Level> test) {
@ -235,16 +240,19 @@ public interface ItemAttribute {
@Override @Override
public boolean appliesTo(ItemStack stack) { public boolean appliesTo(ItemStack stack) {
return stack.getItem() return ForgeRegistries.ITEMS.getHolder(stack.getItem())
.getTags() .get()
.contains(tagName); .tags()
.anyMatch(t -> t.location()
.equals(tagName));
} }
@Override @Override
public List<ItemAttribute> listAttributesOf(ItemStack stack) { public List<ItemAttribute> listAttributesOf(ItemStack stack) {
return stack.getItem() return ForgeRegistries.ITEMS.getHolder(stack.getItem())
.getTags() .get()
.stream() .tags()
.map(TagKey::location)
.map(InTag::new) .map(InTag::new)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -12,7 +12,7 @@ import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.util.nullness.NonNullSupplier; import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.tags.ItemTags; 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.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
@ -60,7 +60,7 @@ public enum AllPaletteStoneTypes {
public NonNullSupplier<Block> baseBlock; public NonNullSupplier<Block> baseBlock;
public PaletteBlockPattern[] variantTypes; public PaletteBlockPattern[] variantTypes;
public Tag.Named<Item> materialTag; public TagKey<Item> materialTag;
private AllPaletteStoneTypes(PaletteBlockPattern[] variantTypes, private AllPaletteStoneTypes(PaletteBlockPattern[] variantTypes,
Function<CreateRegistrate, NonNullSupplier<Block>> factory) { Function<CreateRegistrate, NonNullSupplier<Block>> factory) {

View File

@ -23,7 +23,7 @@ import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags; 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.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -90,9 +90,9 @@ public abstract class PaletteBlockPartial<B extends Block> {
return true; return true;
} }
protected abstract Iterable<Tag.Named<Block>> getBlockTags(); protected abstract Iterable<TagKey<Block>> getBlockTags();
protected abstract Iterable<Tag.Named<Item>> getItemTags(); protected abstract Iterable<TagKey<Item>> getItemTags();
protected abstract B createBlock(Supplier<? extends Block> block); protected abstract B createBlock(Supplier<? extends Block> block);
@ -121,12 +121,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
} }
@Override @Override
protected Iterable<Tag.Named<Block>> getBlockTags() { protected Iterable<TagKey<Block>> getBlockTags() {
return Arrays.asList(BlockTags.STAIRS); return Arrays.asList(BlockTags.STAIRS);
} }
@Override @Override
protected Iterable<Tag.Named<Item>> getItemTags() { protected Iterable<TagKey<Item>> getItemTags() {
return Arrays.asList(ItemTags.STAIRS); return Arrays.asList(ItemTags.STAIRS);
} }
@ -184,12 +184,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
} }
@Override @Override
protected Iterable<Tag.Named<Block>> getBlockTags() { protected Iterable<TagKey<Block>> getBlockTags() {
return Arrays.asList(BlockTags.SLABS); return Arrays.asList(BlockTags.SLABS);
} }
@Override @Override
protected Iterable<Tag.Named<Item>> getItemTags() { protected Iterable<TagKey<Item>> getItemTags() {
return Arrays.asList(ItemTags.SLABS); return Arrays.asList(ItemTags.SLABS);
} }
@ -242,12 +242,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
} }
@Override @Override
protected Iterable<Tag.Named<Block>> getBlockTags() { protected Iterable<TagKey<Block>> getBlockTags() {
return Arrays.asList(BlockTags.WALLS); return Arrays.asList(BlockTags.WALLS);
} }
@Override @Override
protected Iterable<Tag.Named<Item>> getItemTags() { protected Iterable<TagKey<Item>> getItemTags() {
return Arrays.asList(ItemTags.WALLS); return Arrays.asList(ItemTags.WALLS);
} }

View File

@ -28,7 +28,7 @@ import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.resources.ResourceLocation; 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.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
@ -71,8 +71,8 @@ public class PaletteBlockPattern {
private String[] textures; private String[] textures;
private String id; private String id;
private boolean isTranslucent; private boolean isTranslucent;
private Tag.Named<Block>[] blockTags; private TagKey<Block>[] blockTags;
private Tag.Named<Item>[] itemTags; private TagKey<Item>[] itemTags;
private Optional<Function<String, ConnectedTextureBehaviour>> ctFactory; private Optional<Function<String, ConnectedTextureBehaviour>> ctFactory;
private IPatternBlockStateGenerator blockStateGenerator; private IPatternBlockStateGenerator blockStateGenerator;
@ -106,11 +106,11 @@ public class PaletteBlockPattern {
return isTranslucent; return isTranslucent;
} }
public Tag.Named<Block>[] getBlockTags() { public TagKey<Block>[] getBlockTags() {
return blockTags; return blockTags;
} }
public Tag.Named<Item>[] getItemTags() { public TagKey<Item>[] getItemTags() {
return itemTags; return itemTags;
} }

View File

@ -13,7 +13,7 @@ import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullSupplier; import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.renderer.RenderType; 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.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -41,10 +41,10 @@ public class PalettesVariantEntry {
ItemBuilder<BlockItem, ? extends BlockBuilder<? extends Block, CreateRegistrate>> itemBuilder = ItemBuilder<BlockItem, ? extends BlockBuilder<? extends Block, CreateRegistrate>> itemBuilder =
builder.item(); builder.item();
Tag.Named<Block>[] blockTags = pattern.getBlockTags(); TagKey<Block>[] blockTags = pattern.getBlockTags();
if (blockTags != null) if (blockTags != null)
builder.tag(blockTags); builder.tag(blockTags);
Tag.Named<Item>[] itemTags = pattern.getItemTags(); TagKey<Item>[] itemTags = pattern.getItemTags();
if (itemTags != null) if (itemTags != null)
itemBuilder.tag(itemTags); itemBuilder.tag(itemTags);

View File

@ -8,13 +8,13 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess; import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkHolder;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.TagContainer;
import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -82,7 +82,7 @@ public class SchematicChunkSource extends ChunkSource {
} }
@Override @Override
public void tick(BooleanSupplier pHasTimeLeft) {} public void tick(BooleanSupplier p_202162_, boolean p_202163_) {}
@Override @Override
public int getLoadedChunksCount() { public int getLoadedChunksCount() {
@ -94,7 +94,7 @@ public class SchematicChunkSource extends ChunkSource {
private static final class DummyLevel extends Level { private static final class DummyLevel extends Level {
private RegistryAccess access; private RegistryAccess access;
private DummyLevel(WritableLevelData p_46450_, ResourceKey<Level> p_46451_, DimensionType p_46452_, private DummyLevel(WritableLevelData p_46450_, ResourceKey<Level> p_46451_, Holder<DimensionType> p_46452_,
Supplier<ProfilerFiller> p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_) { Supplier<ProfilerFiller> 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_); 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 @Override
public Biome getUncachedNoiseBiome(int pX, int pY, int pZ) { public Holder<Biome> getUncachedNoiseBiome(int pX, int pY, int pZ) {
return null; return null;
} }
@ -139,12 +139,12 @@ public class SchematicChunkSource extends ChunkSource {
public void sendBlockUpdated(BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) {} public void sendBlockUpdated(BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) {}
@Override @Override
public void playSound(Player pPlayer, double pX, double pY, double pZ, SoundEvent pSound, SoundSource pCategory, public void playSound(Player pPlayer, double pX, double pY, double pZ, SoundEvent pSound,
float pVolume, float pPitch) {} SoundSource pCategory, float pVolume, float pPitch) {}
@Override @Override
public void playSound(Player pPlayer, Entity pEntity, SoundEvent pEvent, SoundSource pCategory, float pVolume, public void playSound(Player pPlayer, Entity pEntity, SoundEvent pEvent, SoundSource pCategory,
float pPitch) {} float pVolume, float pPitch) {}
@Override @Override
public String gatherChunkSourceStats() { public String gatherChunkSourceStats() {
@ -182,11 +182,6 @@ public class SchematicChunkSource extends ChunkSource {
return null; return null;
} }
@Override
public TagContainer getTagManager() {
return null;
}
@Override @Override
protected LevelEntityGetter<Entity> getEntities() { protected LevelEntityGetter<Entity> getEntities() {
return null; return null;
@ -203,9 +198,9 @@ public class SchematicChunkSource extends ChunkSource {
} }
} }
private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, RegistryAccess.BUILTIN.get()
RegistryAccess.builtin().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionType.OVERWORLD_LOCATION), .registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY)
null, false, false, 0); .getHolderOrThrow(DimensionType.OVERWORLD_LOCATION), null, false, false, 0);
public EmptierChunk(RegistryAccess registryAccess) { public EmptierChunk(RegistryAccess registryAccess) {
super(DUMMY_LEVEL.withAccess(registryAccess), null); super(DUMMY_LEVEL.withAccess(registryAccess), null);

View File

@ -14,6 +14,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.decoration.ArmorStand;
@ -138,8 +139,9 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor
} }
@Override @Override
public Biome getBiome(BlockPos pos) { public Holder<Biome> getBiome(BlockPos pos) {
return ForgeRegistries.BIOMES.getValue(Biomes.PLAINS.location()); return ForgeRegistries.BIOMES.getHolder(Biomes.PLAINS.location())
.orElse(null);
} }
@Override @Override
@ -168,8 +170,7 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor
} }
@Override @Override
public <T extends Entity> List<T> getEntitiesOfClass(Class<T> arg0, AABB arg1, public <T extends Entity> List<T> getEntitiesOfClass(Class<T> arg0, AABB arg1, Predicate<? super T> arg2) {
Predicate<? super T> arg2) {
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -23,7 +23,6 @@ import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory; import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory;
import com.tterrag.registrate.builders.Builder; import com.tterrag.registrate.builders.Builder;
import com.tterrag.registrate.builders.FluidBuilder; import com.tterrag.registrate.builders.FluidBuilder;
import com.tterrag.registrate.util.NonNullLazyValue;
import com.tterrag.registrate.util.entry.RegistryEntry; import com.tterrag.registrate.util.entry.RegistryEntry;
import com.tterrag.registrate.util.nullness.NonNullBiFunction; import com.tterrag.registrate.util.nullness.NonNullBiFunction;
import com.tterrag.registrate.util.nullness.NonNullConsumer; import com.tterrag.registrate.util.nullness.NonNullConsumer;
@ -55,9 +54,9 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
super(modid); super(modid);
} }
public static NonNullLazyValue<CreateRegistrate> lazy(String modid) { public static NonNullSupplier<CreateRegistrate> lazy(String modid) {
return new NonNullLazyValue<>( return NonNullSupplier
() -> new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get() .lazy(() -> new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get()
.getModEventBus())); .getModEventBus()));
} }
@ -187,7 +186,8 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
/* Util */ /* Util */
public static <T extends Block> NonNullConsumer<? super T> connectedTextures(Supplier<ConnectedTextureBehaviour> behavior) { public static <T extends Block> NonNullConsumer<? super T> connectedTextures(
Supplier<ConnectedTextureBehaviour> behavior) {
return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior)); return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior));
} }

View File

@ -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<T> implements Tag.Named<T> {
private final ResourceLocation id;
private final Tag<T> tag;
public NamedTag(@Nullable Tag<T> 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<T> getValues() {
if (tag == null)
return Collections.emptyList();
return tag.getValues();
}
}

View File

@ -13,7 +13,7 @@ import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.tags.ItemTags; 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.Item;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
@ -48,27 +48,27 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
protected static class I { protected static class I {
static Tag.Named<Item> redstone() { static TagKey<Item> redstone() {
return Tags.Items.DUSTS_REDSTONE; return Tags.Items.DUSTS_REDSTONE;
} }
static Tag.Named<Item> planks() { static TagKey<Item> planks() {
return ItemTags.PLANKS; return ItemTags.PLANKS;
} }
static Tag.Named<Item> woodSlab() { static TagKey<Item> woodSlab() {
return ItemTags.WOODEN_SLABS; return ItemTags.WOODEN_SLABS;
} }
static Tag.Named<Item> gold() { static TagKey<Item> gold() {
return AllTags.forgeItemTag("ingots/gold"); return AllTags.forgeItemTag("ingots/gold");
} }
static Tag.Named<Item> goldSheet() { static TagKey<Item> goldSheet() {
return AllTags.forgeItemTag("plates/gold"); return AllTags.forgeItemTag("plates/gold");
} }
static Tag.Named<Item> stone() { static TagKey<Item> stone() {
return Tags.Items.STONE; return Tags.Items.STONE;
} }
@ -92,27 +92,27 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
return AllBlocks.ANDESITE_CASING.get(); return AllBlocks.ANDESITE_CASING.get();
} }
static Tag.Named<Item> brass() { static TagKey<Item> brass() {
return AllTags.forgeItemTag("ingots/brass"); return AllTags.forgeItemTag("ingots/brass");
} }
static Tag.Named<Item> brassSheet() { static TagKey<Item> brassSheet() {
return AllTags.forgeItemTag("plates/brass"); return AllTags.forgeItemTag("plates/brass");
} }
static Tag.Named<Item> iron() { static TagKey<Item> iron() {
return Tags.Items.INGOTS_IRON; return Tags.Items.INGOTS_IRON;
} }
static Tag.Named<Item> ironNugget() { static TagKey<Item> ironNugget() {
return AllTags.forgeItemTag("nuggets/iron"); return AllTags.forgeItemTag("nuggets/iron");
} }
static Tag.Named<Item> zinc() { static TagKey<Item> zinc() {
return AllTags.forgeItemTag("ingots/zinc"); return AllTags.forgeItemTag("ingots/zinc");
} }
static Tag.Named<Item> ironSheet() { static TagKey<Item> ironSheet() {
return AllTags.forgeItemTag("plates/iron"); return AllTags.forgeItemTag("plates/iron");
} }
@ -132,11 +132,11 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
return Items.COPPER_BLOCK; return Items.COPPER_BLOCK;
} }
static Tag.Named<Item> brassBlock() { static TagKey<Item> brassBlock() {
return AllTags.forgeItemTag("storage_blocks/brass"); return AllTags.forgeItemTag("storage_blocks/brass");
} }
static Tag.Named<Item> zincBlock() { static TagKey<Item> zincBlock() {
return AllTags.forgeItemTag("storage_blocks/zinc"); return AllTags.forgeItemTag("storage_blocks/zinc");
} }
@ -144,19 +144,19 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
return Items.COPPER_INGOT; return Items.COPPER_INGOT;
} }
static Tag.Named<Item> copperSheet() { static TagKey<Item> copperSheet() {
return AllTags.forgeItemTag("plates/copper"); return AllTags.forgeItemTag("plates/copper");
} }
static Tag.Named<Item> copperNugget() { static TagKey<Item> copperNugget() {
return AllTags.forgeItemTag("nuggets/copper"); return AllTags.forgeItemTag("nuggets/copper");
} }
static Tag.Named<Item> brassNugget() { static TagKey<Item> brassNugget() {
return AllTags.forgeItemTag("nuggets/brass"); return AllTags.forgeItemTag("nuggets/brass");
} }
static Tag.Named<Item> zincNugget() { static TagKey<Item> zincNugget() {
return AllTags.forgeItemTag("nuggets/zinc"); return AllTags.forgeItemTag("nuggets/zinc");
} }

View File

@ -41,7 +41,7 @@ import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
import net.minecraft.data.recipes.SpecialRecipeBuilder; import net.minecraft.data.recipes.SpecialRecipeBuilder;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags; 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.DyeColor;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -1122,13 +1122,13 @@ public class StandardRecipeGen extends CreateRecipeProvider {
} }
GeneratedRecipe metalCompacting(List<ItemProviderEntry<? extends ItemLike>> variants, GeneratedRecipe metalCompacting(List<ItemProviderEntry<? extends ItemLike>> variants,
List<Supplier<Tag<Item>>> ingredients) { List<Supplier<TagKey<Item>>> ingredients) {
GeneratedRecipe result = null; GeneratedRecipe result = null;
for (int i = 0; i + 1 < variants.size(); i++) { for (int i = 0; i + 1 < variants.size(); i++) {
ItemProviderEntry<? extends ItemLike> currentEntry = variants.get(i); ItemProviderEntry<? extends ItemLike> currentEntry = variants.get(i);
ItemProviderEntry<? extends ItemLike> nextEntry = variants.get(i + 1); ItemProviderEntry<? extends ItemLike> nextEntry = variants.get(i + 1);
Supplier<Tag<Item>> currentIngredient = ingredients.get(i); Supplier<TagKey<Item>> currentIngredient = ingredients.get(i);
Supplier<Tag<Item>> nextIngredient = ingredients.get(i + 1); Supplier<TagKey<Item>> nextIngredient = ingredients.get(i + 1);
result = create(nextEntry).withSuffix("_from_compacting") result = create(nextEntry).withSuffix("_from_compacting")
.unlockedBy(currentEntry::get) .unlockedBy(currentEntry::get)
@ -1197,7 +1197,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
return this; return this;
} }
GeneratedRecipeBuilder unlockedByTag(Supplier<Tag<Item>> tag) { GeneratedRecipeBuilder unlockedByTag(Supplier<TagKey<Item>> tag) {
this.unlockedBy = () -> ItemPredicate.Builder.item() this.unlockedBy = () -> ItemPredicate.Builder.item()
.of(tag.get()) .of(tag.get())
.build(); .build();
@ -1258,7 +1258,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
return unlockedBy(item).viaCookingIngredient(() -> Ingredient.of(item.get())); return unlockedBy(item).viaCookingIngredient(() -> Ingredient.of(item.get()));
} }
GeneratedCookingRecipeBuilder viaCookingTag(Supplier<Tag<Item>> tag) { GeneratedCookingRecipeBuilder viaCookingTag(Supplier<TagKey<Item>> tag) {
return unlockedByTag(tag).viaCookingIngredient(() -> Ingredient.of(tag.get())); return unlockedByTag(tag).viaCookingIngredient(() -> Ingredient.of(tag.get()));
} }

View File

@ -19,7 +19,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.SerializationTags; import net.minecraft.tags.SerializationTags;
import net.minecraft.tags.Tag; import net.minecraft.tags.TagKey;
import net.minecraft.util.GsonHelper; import net.minecraft.util.GsonHelper;
import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
@ -31,7 +31,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
public List<FluidStack> matchingFluidStacks; public List<FluidStack> matchingFluidStacks;
public static FluidIngredient fromTag(Tag.Named<Fluid> tag, int amount) { public static FluidIngredient fromTag(TagKey<Fluid> tag, int amount) {
FluidTagIngredient ingredient = new FluidTagIngredient(); FluidTagIngredient ingredient = new FluidTagIngredient();
ingredient.tag = tag; ingredient.tag = tag;
ingredient.amountRequired = amount; ingredient.amountRequired = amount;
@ -198,7 +198,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
public static class FluidTagIngredient extends FluidIngredient { public static class FluidTagIngredient extends FluidIngredient {
protected Tag<Fluid> tag; protected TagKey<Fluid> tag;
@Override @Override
protected boolean testInternal(FluidStack t) { protected boolean testInternal(FluidStack t) {

View File

@ -436,7 +436,7 @@ public class WorldSectionElement extends AnimatedSceneElement {
} }
if (!fluidState.isEmpty() && ItemBlockRenderTypes.canRenderInLayer(fluidState, layer)) if (!fluidState.isEmpty() && ItemBlockRenderTypes.canRenderInLayer(fluidState, layer))
dispatcher.renderLiquid(pos, world, builder, fluidState); dispatcher.renderLiquid(pos, world, builder, state, fluidState);
poseStack.popPose(); poseStack.popPose();
}); });

View File

@ -5,7 +5,6 @@ import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
import mezz.jei.api.MethodsReturnNonnullByDefault;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -27,15 +26,14 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class WrappedClientWorld extends ClientLevel { public class WrappedClientWorld extends ClientLevel {
private static final Minecraft mc = Minecraft.getInstance(); private static final Minecraft mc = Minecraft.getInstance();
protected Level world; protected Level world;
private WrappedClientWorld(Level world) { private WrappedClientWorld(Level world) {
super(mc.getConnection(), mc.level.getLevelData(), world.dimension(), world.dimensionType(), super(mc.getConnection(), mc.level.getLevelData(), world.dimension(), world.dimensionTypeRegistration(),
mc.getConnection().serverChunkRadius, mc.level.getServerSimulationDistance(), mc.getConnection().serverChunkRadius, mc.level.getServerSimulationDistance(), world.getProfilerSupplier(),
world.getProfilerSupplier(), mc.levelRenderer, world.isDebug(), world.getBiomeManager().biomeZoomSeed); mc.levelRenderer, world.isDebug(), world.getBiomeManager().biomeZoomSeed);
this.world = world; this.world = world;
} }
@ -47,7 +45,7 @@ public class WrappedClientWorld extends ClientLevel {
public boolean hasChunkAt(BlockPos pos) { public boolean hasChunkAt(BlockPos pos) {
return world.hasChunkAt(pos); return world.hasChunkAt(pos);
} }
@Override @Override
public boolean isLoaded(BlockPos pos) { public boolean isLoaded(BlockPos pos) {
return world.isLoaded(pos); return world.isLoaded(pos);
@ -58,8 +56,8 @@ public class WrappedClientWorld extends ClientLevel {
return world.getBlockState(pos); return world.getBlockState(pos);
} }
// FIXME: blockstate#getCollisionShape with WrappedClientWorld gives unreliable data (maybe) // FIXME: blockstate#getCollisionShape with WrappedClientWorld gives unreliable
// data (maybe)
@Override @Override
public int getBrightness(LightLayer type, BlockPos pos) { public int getBrightness(LightLayer type, BlockPos pos) {
@ -78,7 +76,8 @@ public class WrappedClientWorld extends ClientLevel {
@Nullable @Nullable
@Override @Override
public <T extends LivingEntity> T getNearestEntity(List<? extends T> 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 extends LivingEntity> T getNearestEntity(List<? extends T> 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_); 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 // FIXME: Emissive Lighting might not light stuff properly
@Override @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_); world.addParticle(p_195594_1_, p_195594_2_, p_195594_4_, p_195594_6_, p_195594_8_, p_195594_10_, p_195594_12_);
} }
@Override @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_) { public void addParticle(ParticleOptions p_195590_1_, boolean p_195590_2_, double p_195590_3_, double p_195590_5_,
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_); 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 @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_) { public void addAlwaysVisibleParticle(ParticleOptions p_195589_1_, double p_195589_2_, double p_195589_4_,
world.addAlwaysVisibleParticle(p_195589_1_, p_195589_2_, p_195589_4_, p_195589_6_, p_195589_8_, p_195589_10_, p_195589_12_); 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 @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_) { public void addAlwaysVisibleParticle(ParticleOptions p_217404_1_, boolean p_217404_2_, double p_217404_3_,
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_); 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 @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_) { public void playLocalSound(double p_184134_1_, double p_184134_3_, double p_184134_5_, SoundEvent p_184134_7_,
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_); 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 @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_) { public void playSound(@Nullable Player p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_,
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_); 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 @Nullable
@ -125,6 +134,7 @@ public class WrappedClientWorld extends ClientLevel {
public BlockEntity getBlockEntity(BlockPos p_175625_1_) { public BlockEntity getBlockEntity(BlockPos p_175625_1_) {
return world.getBlockEntity(p_175625_1_); return world.getBlockEntity(p_175625_1_);
} }
public Level getWrappedWorld() { public Level getWrappedWorld() {
return world; return world;
} }

View File

@ -8,12 +8,12 @@ import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.TagContainer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeManager;
@ -34,7 +34,7 @@ public class WrappedServerWorld extends ServerLevel {
public WrappedServerWorld(Level world) { public WrappedServerWorld(Level world) {
super(world.getServer(), Util.backgroundExecutor(), world.getServer().storageSource, 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(), new DummyStatusListener(), ((ServerChunkCache) world.getChunkSource()).getGenerator(), world.isDebug(),
world.getBiomeManager().biomeZoomSeed, Collections.emptyList(), false); world.getBiomeManager().biomeZoomSeed, Collections.emptyList(), false);
this.world = world; this.world = world;
@ -59,15 +59,14 @@ public class WrappedServerWorld extends ServerLevel {
public LevelTicks<Block> getBlockTicks() { public LevelTicks<Block> getBlockTicks() {
return super.getBlockTicks(); return super.getBlockTicks();
} }
@Override @Override
public LevelTicks<Fluid> getFluidTicks() { public LevelTicks<Fluid> getFluidTicks() {
return super.getFluidTicks(); return super.getFluidTicks();
} }
@Override @Override
public void levelEvent(Player player, int type, BlockPos pos, int data) { public void levelEvent(Player player, int type, BlockPos pos, int data) {}
}
@Override @Override
public List<ServerPlayer> players() { public List<ServerPlayer> players() {
@ -76,13 +75,11 @@ public class WrappedServerWorld extends ServerLevel {
@Override @Override
public void playSound(Player player, double x, double y, double z, SoundEvent soundIn, SoundSource category, public void playSound(Player player, double x, double y, double z, SoundEvent soundIn, SoundSource category,
float volume, float pitch) { float volume, float pitch) {}
}
@Override @Override
public void playSound(Player p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, public void playSound(Player p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundSource p_217384_4_,
SoundSource p_217384_4_, float p_217384_5_, float p_217384_6_) { float p_217384_5_, float p_217384_6_) {}
}
@Override @Override
public Entity getEntity(int id) { public Entity getEntity(int id) {
@ -101,8 +98,7 @@ public class WrappedServerWorld extends ServerLevel {
} }
@Override @Override
public void setMapData(String mapId, MapItemSavedData mapDataIn) { public void setMapData(String mapId, MapItemSavedData mapDataIn) {}
}
@Override @Override
public int getFreeMapId() { public int getFreeMapId() {
@ -110,8 +106,7 @@ public class WrappedServerWorld extends ServerLevel {
} }
@Override @Override
public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) {}
}
@Override @Override
public RecipeManager getRecipeManager() { public RecipeManager getRecipeManager() {
@ -119,12 +114,8 @@ public class WrappedServerWorld extends ServerLevel {
} }
@Override @Override
public TagContainer getTagManager() { public Holder<Biome> getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) {
return world.getTagManager();
}
@Override
public Biome 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_); return world.getUncachedNoiseBiome(p_225604_1_, p_225604_2_, p_225604_3_);
} }
} }

View File

@ -8,11 +8,11 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.core.RegistryAccess; import net.minecraft.core.RegistryAccess;
import net.minecraft.core.SectionPos; import net.minecraft.core.SectionPos;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.TagContainer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeManager;
@ -39,8 +39,8 @@ public class WrappedWorld extends Level {
protected LevelEntityGetter<Entity> entityGetter = new DummyLevelEntityGetter<>(); protected LevelEntityGetter<Entity> entityGetter = new DummyLevelEntityGetter<>();
public WrappedWorld(Level world) { public WrappedWorld(Level world) {
super((WritableLevelData) world.getLevelData(), world.dimension(), world.dimensionType(), world::getProfiler, super((WritableLevelData) world.getLevelData(), world.dimension(), world.dimensionTypeRegistration(),
world.isClientSide, world.isDebug(), 0); world::getProfiler, world.isClientSide, world.isDebug(), 0);
this.world = world; this.world = world;
} }
@ -136,8 +136,7 @@ public class WrappedWorld extends Level {
} }
@Override @Override
public void setMapData(String pMapId, MapItemSavedData pData) { public void setMapData(String pMapId, MapItemSavedData pData) {}
}
@Override @Override
public int getFreeMapId() { public int getFreeMapId() {
@ -158,12 +157,7 @@ public class WrappedWorld extends Level {
} }
@Override @Override
public TagContainer getTagManager() { public Holder<Biome> getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) {
return world.getTagManager();
}
@Override
public Biome 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_); return world.getUncachedNoiseBiome(p_225604_1_, p_225604_2_, p_225604_3_);
} }
@ -183,12 +177,10 @@ public class WrappedWorld extends Level {
} }
@Override @Override
public void updateNeighbourForOutputSignal(BlockPos p_175666_1_, Block p_175666_2_) { public void updateNeighbourForOutputSignal(BlockPos p_175666_1_, Block p_175666_2_) {}
}
@Override @Override
public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) { public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) {}
}
@Override @Override
public String gatherChunkSourceStats() { public String gatherChunkSourceStats() {
@ -200,9 +192,12 @@ public class WrappedWorld extends Level {
return entityGetter; return entityGetter;
} }
// Intentionally copied from LevelHeightAccessor. Workaround for issues caused when other mods (such as Lithium) // Intentionally copied from LevelHeightAccessor. Workaround for issues caused
// override the vanilla implementations in ways which cause WrappedWorlds to return incorrect, default height info. // when other mods (such as Lithium)
// WrappedWorld subclasses should implement their own getMinBuildHeight and getHeight overrides where they deviate // 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. // from the defaults for their dimension.
@Override @Override

View File

@ -1,6 +1,6 @@
{ {
"pack": { "pack": {
"description": "Create resources", "description": "Create resources",
"pack_format": 8 "pack_format": 9
} }
} }