diff --git a/src/main/java/com/simibubi/create/AllCreativeModeTabs.java b/src/main/java/com/simibubi/create/AllCreativeModeTabs.java index 7d031eaa8..a6f439d13 100644 --- a/src/main/java/com/simibubi/create/AllCreativeModeTabs.java +++ b/src/main/java/com/simibubi/create/AllCreativeModeTabs.java @@ -7,7 +7,6 @@ import java.util.Set; import java.util.function.Function; import java.util.function.Predicate; -import com.simibubi.create.AllCreativeModeTabs.RegistrateDisplayItemsGenerator.ItemOrdering.Type; import com.simibubi.create.content.contraptions.actors.seat.SeatBlock; import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks; import com.simibubi.create.content.equipment.armor.BacktankUtil; @@ -30,10 +29,10 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab.DisplayItemsGenerator; +import net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters; import net.minecraft.world.item.CreativeModeTab.Output; import net.minecraft.world.item.CreativeModeTab.TabVisibility; import net.minecraft.world.item.CreativeModeTabs; @@ -49,6 +48,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @EventBusSubscriber(bus = Bus.MOD) public class AllCreativeModeTabs { + public static final ResourceLocation BASE_TAB_ID = Create.asResource("base"); public static final ResourceLocation PALETTES_TAB_ID = Create.asResource("palettes"); @@ -225,7 +225,7 @@ public class AllCreativeModeTabs { } @Override - public void accept(FeatureFlagSet features, Output output, boolean isOperator) { + public void accept(ItemDisplayParameters pParameters, Output output) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); Predicate exclusionPredicate = makeExclusionPredicate(); List orderings = makeOrderings(); diff --git a/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java b/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java index 4fc4ca145..ad1971ec5 100644 --- a/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java +++ b/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java @@ -60,7 +60,10 @@ public class GogglesCurioRenderer implements ICurioRenderer { } // Render - Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, renderTypeBuffer, 0); + Minecraft mc = Minecraft.getInstance(); + mc.getItemRenderer() + .renderStatic(stack, ItemDisplayContext.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, + renderTypeBuffer, mc.level, 0); matrixStack.popPose(); } diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index d03851fe7..d28f744f2 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -65,6 +65,7 @@ import com.simibubi.create.content.trains.schedule.ScheduleScreen; import com.simibubi.create.foundation.config.ConfigBase.ConfigBool; import com.simibubi.create.foundation.data.recipe.LogStrippingFakeRecipes; import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.recipe.IRecipeTypeInfo; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.infrastructure.config.AllConfigs; @@ -85,6 +86,7 @@ import mezz.jei.api.registration.IRecipeTransferRegistration; import mezz.jei.api.registration.ISubtypeRegistration; import mezz.jei.api.runtime.IIngredientManager; import net.minecraft.client.Minecraft; +import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -224,7 +226,7 @@ public class CreateJEI implements IModPlugin { blockCutting = builder(CondensedBlockCuttingRecipe.class) .enableWhen(c -> c.allowStonecuttingOnSaw) - .addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(RecipeType.STONECUTTING, AllRecipeTypes::shouldIgnoreInAutomation))) + .addRecipes(() -> BlockCuttingCategory.condenseRecipes(getTypedRecipesExcluding(RecipeType.STONECUTTING, AllRecipeTypes::shouldIgnoreInAutomation))) .catalyst(AllBlocks.MECHANICAL_SAW::get) .doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), Items.STONE_BRICK_STAIRS) .emptyBackground(177, 70) @@ -233,7 +235,7 @@ public class CreateJEI implements IModPlugin { woodCutting = builder(CondensedBlockCuttingRecipe.class) .enableIf(c -> c.allowWoodcuttingOnSaw.get() && ModList.get() .isLoaded("druidcraft")) - .addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(SawBlockEntity.woodcuttingRecipeType.get(), AllRecipeTypes::shouldIgnoreInAutomation))) + .addRecipes(() -> BlockCuttingCategory.condenseRecipes(getTypedRecipesExcluding(SawBlockEntity.woodcuttingRecipeType.get(), AllRecipeTypes::shouldIgnoreInAutomation))) .catalyst(AllBlocks.MECHANICAL_SAW::get) .doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), Items.OAK_STAIRS) .emptyBackground(177, 70) @@ -570,7 +572,8 @@ public class CreateJEI implements IModPlugin { } public static boolean doOutputsMatch(Recipe recipe1, Recipe recipe2) { - return ItemStack.isSame(recipe1.getResultItem(), recipe2.getResultItem()); + RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); + return ItemHelper.sameItem(recipe1.getResultItem(registryAccess), recipe2.getResultItem(registryAccess)); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java index 3d7fe8a1b..86cc92264 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java @@ -98,23 +98,23 @@ public class BlockCuttingCategory extends CreateRecipeCategory condenseRecipes(List> stoneCuttingRecipes) { - List condensed = new ArrayList<>(); - Recipes: for (Recipe recipe : stoneCuttingRecipes) { - Ingredient i1 = recipe.getIngredients().get(0); - for (CondensedBlockCuttingRecipe condensedRecipe : condensed) { - if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) { - condensedRecipe.addOutput(recipe.getResultItem()); - continue Recipes; - } + } + + public static List condenseRecipes(List> stoneCuttingRecipes) { + List condensed = new ArrayList<>(); + Recipes: for (Recipe recipe : stoneCuttingRecipes) { + Ingredient i1 = recipe.getIngredients().get(0); + for (CondensedBlockCuttingRecipe condensedRecipe : condensed) { + if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) { + condensedRecipe.addOutput(getResultItem(recipe)); + continue Recipes; } - CondensedBlockCuttingRecipe cr = new CondensedBlockCuttingRecipe(i1); - cr.addOutput(recipe.getResultItem()); - condensed.add(cr); } - return condensed; + CondensedBlockCuttingRecipe cr = new CondensedBlockCuttingRecipe(i1); + cr.addOutput(getResultItem(recipe)); + condensed.add(cr); } - + return condensed; } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java index 5267022fc..b672341d1 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java @@ -26,7 +26,9 @@ import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeRegistration; import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Recipe; @@ -99,6 +101,13 @@ public abstract class CreateRecipeCategory> implements IReci return CHANCE_SLOT; } + public static ItemStack getResultItem(Recipe recipe) { + ClientLevel level = Minecraft.getInstance().level; + if (level == null) + return ItemStack.EMPTY; + return recipe.getResultItem(level.registryAccess()); + } + public static IRecipeSlotTooltipCallback addStochasticTooltip(ProcessingOutput output) { return (view, tooltip) -> { float chance = output.getChance(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java index 35c32afe5..136dcaeec 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java @@ -95,7 +95,7 @@ public class ItemDrainCategory extends CreateRecipeCategory { builder .addSlot(RecipeIngredientRole.OUTPUT, 132, 27) .setBackground(getRenderedSlot(), -1, -1) - .addItemStack(recipe.getResultItem()); + .addItemStack(getResultItem(recipe)); } @Override diff --git a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java index 762b83931..90aacf601 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java @@ -45,7 +45,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory> extends Crea builder .addSlot(RecipeIngredientRole.OUTPUT, 141, 48) .setBackground(getRenderedSlot(), -1, -1) - .addItemStack(recipe.getResultItem()); + .addItemStack(getResultItem(recipe)); } @Override diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SequencedAssemblyCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SequencedAssemblyCategory.java index 19e61f221..5867ad153 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SequencedAssemblyCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SequencedAssemblyCategory.java @@ -52,7 +52,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory { if (noRandomOutput) return; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java index 40fddc1c6..d987c8a6a 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java @@ -13,6 +13,7 @@ import com.simibubi.create.content.fluids.transfer.GenericItemFilling; import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder; import com.simibubi.create.foundation.fluid.FluidIngredient; import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.RegisteredObjects; import mezz.jei.api.constants.VanillaTypes; @@ -72,7 +73,7 @@ public class SpoutCategory extends CreateRecipeCategory { fluidCopy.setAmount(1000); fhi.fill(fluidCopy, FluidAction.EXECUTE); ItemStack container = fhi.getContainer(); - if (container.sameItem(copy)) + if (ItemHelper.sameItem(container, copy)) return; if (container.isEmpty()) return; @@ -106,7 +107,7 @@ public class SpoutCategory extends CreateRecipeCategory { builder .addSlot(RecipeIngredientRole.OUTPUT, 132, 51) .setBackground(getRenderedSlot(), -1, -1) - .addItemStack(recipe.getResultItem()); + .addItemStack(getResultItem(recipe)); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/harvester/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/actors/harvester/HarvesterMovementBehaviour.java index fff0f5601..a4bae1db5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/harvester/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/harvester/HarvesterMovementBehaviour.java @@ -11,6 +11,7 @@ import com.simibubi.create.content.contraptions.behaviour.MovementContext; import com.simibubi.create.content.contraptions.render.ActorInstance; import com.simibubi.create.content.contraptions.render.ContraptionMatrices; import com.simibubi.create.content.contraptions.render.ContraptionRenderDispatcher; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.infrastructure.config.AllConfigs; @@ -98,7 +99,7 @@ public class HarvesterMovementBehaviour implements MovementBehaviour { BlockState state = stateVisited; BlockHelper.destroyBlockAs(world, pos, null, item, effectChance, stack -> { if (AllConfigs.server().kinetics.harvesterReplants.get() && !seedSubtracted.getValue() - && stack.sameItem(new ItemStack(state.getBlock()))) { + && ItemHelper.sameItem(stack, new ItemStack(state.getBlock()))) { stack.shrink(1); seedSubtracted.setTrue(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/DropperMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/DropperMovementBehaviour.java index 3f854219e..2086ea5ab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/DropperMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/DropperMovementBehaviour.java @@ -42,7 +42,7 @@ public class DropperMovementBehaviour implements MovementBehaviour { .filter(itemStack -> !itemStack.isEmpty() && itemStack.getItem() != Items.AIR && itemStack.getMaxStackSize() > itemStack.getCount()) .forEach(itemStack -> itemStack.grow(ItemHelper - .extract(context.contraption.getSharedInventory(), itemStack::sameItem, + .extract(context.contraption.getSharedInventory(), ItemHelper.sameItemPredicate(itemStack), ItemHelper.ExtractionCountMode.UPTO, itemStack.getMaxStackSize() - itemStack.getCount(), false) .getCount())); } @@ -69,8 +69,8 @@ public class DropperMovementBehaviour implements MovementBehaviour { if (testStack == null || testStack.isEmpty()) continue; if (testStack.getMaxStackSize() == 1) { - location = new DispenseItemLocation(false, ItemHelper - .findFirstMatchingSlotIndex(context.contraption.getSharedInventory(), testStack::sameItem)); + location = new DispenseItemLocation(false, ItemHelper.findFirstMatchingSlotIndex( + context.contraption.getSharedInventory(), ItemHelper.sameItemPredicate(testStack))); if (!getItemStackAt(location, context).isEmpty()) useable.add(location); } else if (testStack.getCount() >= 2) diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/IMovedDispenseItemBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/IMovedDispenseItemBehaviour.java index 899398435..f1deec3e8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/IMovedDispenseItemBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/dispenser/IMovedDispenseItemBehaviour.java @@ -43,7 +43,7 @@ public interface IMovedDispenseItemBehaviour { if (context.world instanceof ServerLevel) { EntityType entityType = ((SpawnEggItem) itemStack.getItem()).getType(itemStack.getTag()); Entity spawnedEntity = entityType.spawn((ServerLevel) context.world, itemStack, null, - pos.offset(facing.x + .7, facing.y + .7, facing.z + .7), MobSpawnType.DISPENSER, facing.y < .5, + pos.offset(BlockPos.containing(facing.x + .7, facing.y + .7, facing.z + .7)), MobSpawnType.DISPENSER, facing.y < .5, false); if (spawnedEntity != null) spawnedEntity.setDeltaMovement(context.motion.scale(2)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/chassis/StickerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/chassis/StickerBlock.java index d2f71a28b..7cbc4b8c9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/chassis/StickerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/chassis/StickerBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -70,9 +70,9 @@ public class StickerBlock extends WrenchableDirectionalBlock implements IBE getBlockEntityClass() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactBlock.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactBlock.java index 875a4a893..6e7534b3e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactBlock.java @@ -21,19 +21,17 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; -import net.minecraft.core.NonNullList; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -181,9 +179,9 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock } @Override - public boolean shouldCheckWeakPower(BlockState state, LevelReader level, BlockPos pos, Direction side) { - return false; - } + public boolean shouldCheckWeakPower(BlockState state, SignalGetter level, BlockPos pos, Direction side) { + return false; + } @Override public boolean isSignalSource(BlockState state) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java index a91afb300..2d1400b11 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java @@ -131,7 +131,8 @@ public class ContraptionRenderDispatcher { for (StructureTemplate.StructureBlockInfo info : c.getBlocks() .values()) // Skip individual lighting updates to prevent lag with large contraptions - renderWorld.setBlock(info.pos(), info.state(), Block.UPDATE_SUPPRESS_LIGHT); + // FIXME 1.20 this '0' used to be Block.UPDATE_SUPPRESS_LIGHT, yet VirtualRenderWorld didn't actually parse the flags at all + renderWorld.setBlock(info.pos(), info.state(), 0); renderWorld.runLightingEngine(); return renderWorld; diff --git a/src/main/java/com/simibubi/create/content/decoration/palettes/PalettesVariantEntry.java b/src/main/java/com/simibubi/create/content/decoration/palettes/PalettesVariantEntry.java index 14371e531..e5edcf55c 100644 --- a/src/main/java/com/simibubi/create/content/decoration/palettes/PalettesVariantEntry.java +++ b/src/main/java/com/simibubi/create/content/decoration/palettes/PalettesVariantEntry.java @@ -20,7 +20,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; public class PalettesVariantEntry { @@ -75,10 +74,9 @@ public class PalettesVariantEntry { Create.REGISTRATE.addDataGenerator(ProviderType.RECIPE, p -> p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), RecipeCategory.BUILDING_BLOCKS, baseBlock)); - Create.REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, p -> p.tag(paletteStoneVariants.materialTag) - .add(ForgeRegistries.ITEMS.getResourceKey(baseBlock.get() - .asItem()) - .get())); + Create.REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, p -> p.addTag(paletteStoneVariants.materialTag) + .add(baseBlock.get() + .asItem())); this.registeredBlocks = registeredBlocks.build(); this.registeredPartials = registeredPartials.build(); diff --git a/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java b/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java index ccf2b37f8..2f6f93abc 100644 --- a/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java +++ b/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java @@ -46,7 +46,7 @@ public class PlacardRenderer extends SafeBlockEntityRenderer .translate(0, 0, 4.5 / 16f) .scale(blockItem ? .5f : .375f); - itemRenderer.renderStatic(heldItem, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(heldItem, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/AllArmorMaterials.java b/src/main/java/com/simibubi/create/content/equipment/armor/AllArmorMaterials.java index 3064b5bcf..446069c10 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/AllArmorMaterials.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/AllArmorMaterials.java @@ -7,19 +7,19 @@ import com.simibubi.create.AllSoundEvents; import com.simibubi.create.Create; import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem.Type; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; public enum AllArmorMaterials implements ArmorMaterial { - COPPER(Create.asResource("copper").toString(), 7, new int[] { 1, 3, 4, 2 }, 25, () -> AllSoundEvents.COPPER_ARMOR_EQUIP.getMainEvent(), 0.0F, 0.0F, + COPPER(Create.asResource("copper").toString(), 7, new int[] { 2, 4, 3, 1 }, 25, () -> AllSoundEvents.COPPER_ARMOR_EQUIP.getMainEvent(), 0.0F, 0.0F, () -> Ingredient.of(Items.COPPER_INGOT)) ; - private static final int[] MAX_DAMAGE_ARRAY = new int[] { 13, 15, 16, 11 }; + private static final int[] MAX_DAMAGE_ARRAY = new int[] { 11, 16, 15, 13 }; private final String name; private final int maxDamageFactor; private final int[] damageReductionAmountArray; @@ -41,16 +41,6 @@ public enum AllArmorMaterials implements ArmorMaterial { this.repairMaterial = Suppliers.memoize(repairMaterial::get); } - @Override - public int getDurabilityForSlot(EquipmentSlot slot) { - return MAX_DAMAGE_ARRAY[slot.getIndex()] * this.maxDamageFactor; - } - - @Override - public int getDefenseForSlot(EquipmentSlot slot) { - return this.damageReductionAmountArray[slot.getIndex()]; - } - @Override public int getEnchantmentValue() { return this.enchantability; @@ -81,4 +71,14 @@ public enum AllArmorMaterials implements ArmorMaterial { return this.knockbackResistance; } + @Override + public int getDurabilityForType(Type pType) { + return MAX_DAMAGE_ARRAY[pType.ordinal()] * this.maxDamageFactor; + } + + @Override + public int getDefenseForType(Type pType) { + return this.damageReductionAmountArray[pType.ordinal()]; + } + } diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankItem.java index e59e6da02..b5787a501 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankItem.java @@ -15,6 +15,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; @@ -24,12 +25,13 @@ import net.minecraft.world.level.block.Block; public class BacktankItem extends BaseArmorItem implements ICapacityEnchantable { public static final EquipmentSlot SLOT = EquipmentSlot.CHEST; + public static final ArmorItem.Type TYPE = ArmorItem.Type.CHESTPLATE; public static final int BAR_COLOR = 0xEFEFEF; private final Supplier blockItem; public BacktankItem(ArmorMaterial material, Properties properties, ResourceLocation textureLoc, Supplier placeable) { - super(material, SLOT, properties, textureLoc); + super(material, TYPE, properties, textureLoc); this.blockItem = placeable; } diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/BaseArmorItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/BaseArmorItem.java index 5c1fbeb14..66908b53f 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/BaseArmorItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/BaseArmorItem.java @@ -12,8 +12,8 @@ import net.minecraft.world.item.ItemStack; public class BaseArmorItem extends ArmorItem { protected final ResourceLocation textureLoc; - public BaseArmorItem(ArmorMaterial armorMaterial, EquipmentSlot slot, Properties properties, ResourceLocation textureLoc) { - super(armorMaterial, slot, properties.stacksTo(1)); + public BaseArmorItem(ArmorMaterial armorMaterial, ArmorItem.Type type, Properties properties, ResourceLocation textureLoc) { + super(armorMaterial, type, properties.stacksTo(1)); this.textureLoc = textureLoc; } diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java index 77e63b815..ce69fc0d0 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java @@ -11,6 +11,7 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; @@ -21,9 +22,10 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber public class DivingBootsItem extends BaseArmorItem { public static final EquipmentSlot SLOT = EquipmentSlot.FEET; + public static final ArmorItem.Type TYPE = ArmorItem.Type.BOOTS; public DivingBootsItem(ArmorMaterial material, Properties properties, ResourceLocation textureLoc) { - super(material, SLOT, properties, textureLoc); + super(material, TYPE, properties, textureLoc); } public static boolean isWornBy(Entity entity) { diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java index fa62101a3..b315e2a81 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java @@ -14,6 +14,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; @@ -26,9 +27,10 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber public class DivingHelmetItem extends BaseArmorItem { public static final EquipmentSlot SLOT = EquipmentSlot.HEAD; + public static final ArmorItem.Type TYPE = ArmorItem.Type.HELMET; public DivingHelmetItem(ArmorMaterial material, Properties properties, ResourceLocation textureLoc) { - super(material, SLOT, properties, textureLoc); + super(material, TYPE, properties, textureLoc); } @Override diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java index 01ab7e942..375268c5f 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java @@ -35,7 +35,7 @@ public class BlueprintAssignCompleteRecipePacket extends SimplePacketBase { player.level() .getRecipeManager() .byKey(recipeID) - .ifPresent(r -> BlueprintItem.assignCompleteRecipe(c.ghostInventory, r)); + .ifPresent(r -> BlueprintItem.assignCompleteRecipe(c.player.level(), c.ghostInventory, r)); } }); return true; diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java index ae143a0e8..e5aa920fc 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java @@ -395,7 +395,7 @@ public class BlueprintEntity extends HangingEntity recipe = level().getRecipeManager() .getRecipeFor(RecipeType.CRAFTING, craftingInventory, level()); ItemStack result = recipe.filter(r -> r.matches(craftingInventory, level())) - .map(r -> r.assemble(craftingInventory)) + .map(r -> r.assemble(craftingInventory, level().registryAccess())) .orElse(ItemStack.EMPTY); if (result.isEmpty()) { diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintItem.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintItem.java index fb9791da3..ef299606a 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintItem.java @@ -72,12 +72,12 @@ public class BlueprintItem extends Item { return p_200127_1_.mayUseItemAt(p_200127_4_, p_200127_2_, p_200127_3_); } - public static void assignCompleteRecipe(ItemStackHandler inv, Recipe recipe) { + public static void assignCompleteRecipe(Level level, ItemStackHandler inv, Recipe recipe) { NonNullList ingredients = recipe.getIngredients(); for (int i = 0; i < 9; i++) inv.setStackInSlot(i, ItemStack.EMPTY); - inv.setStackInSlot(9, recipe.getResultItem()); + inv.setStackInSlot(9, recipe.getResultItem(level.registryAccess())); if (recipe instanceof IShapedRecipe) { IShapedRecipe shapedRecipe = (IShapedRecipe) recipe; diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintMenu.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintMenu.java index 4aaf0bb39..9cb003991 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintMenu.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintMenu.java @@ -19,6 +19,7 @@ import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; @@ -60,7 +61,8 @@ public class BlueprintMenu extends GhostItemMenu { } public void onCraftMatrixChanged() { - if (contentHolder.getBlueprintWorld().isClientSide) + Level level = contentHolder.getBlueprintWorld(); + if (level.isClientSide) return; ServerPlayer serverplayerentity = (ServerPlayer) player; @@ -83,7 +85,7 @@ public class BlueprintMenu extends GhostItemMenu { } CraftingRecipe icraftingrecipe = optional.get(); - ItemStack itemstack = icraftingrecipe.assemble(craftingInventory); + ItemStack itemstack = icraftingrecipe.assemble(craftingInventory, level.registryAccess()); ghostInventory.setStackInSlot(9, itemstack); contentHolder.inferredIcon = true; ItemStack toSend = itemstack.copy(); diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintOverlayRenderer.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintOverlayRenderer.java index 16cb150e3..d13b0cbf4 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintOverlayRenderer.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import com.google.j2objc.annotations.ReflectionSupport.Level; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllItems; import com.simibubi.create.content.equipment.blueprint.BlueprintEntity.BlueprintCraftingInventory; @@ -186,7 +187,7 @@ public class BlueprintOverlayRenderer { recipe = mc.level.getRecipeManager() .getRecipeFor(RecipeType.CRAFTING, craftingInventory, mc.level); ItemStack resultFromRecipe = recipe.filter(r -> r.matches(craftingInventory, mc.level)) - .map(r -> r.assemble(craftingInventory)) + .map(r -> r.assemble(craftingInventory, mc.level.registryAccess())) .orElse(ItemStack.EMPTY); if (resultFromRecipe.isEmpty()) { diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java index e10002a9b..aec4876ac 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java @@ -106,7 +106,8 @@ public class BlueprintRenderer extends EntityRenderer { Minecraft.getInstance() .getItemRenderer() - .renderStatic(stack, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); + .renderStatic(stack, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, + buffer, entity.level(), 0); squashedMS.popPose(); }); squashedMS.popPose(); diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java index ecfba8036..76a309f03 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java @@ -28,10 +28,10 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { @Override protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { - ItemRenderer itemRenderer = Minecraft.getInstance() - .getItemRenderer(); + Minecraft mc = Minecraft.getInstance(); + ItemRenderer itemRenderer = mc.getItemRenderer(); renderer.render(model.getOriginalModel(), light); - LocalPlayer player = Minecraft.getInstance().player; + LocalPlayer player = mc.player; boolean mainHand = player.getMainHandItem() == stack; boolean offHand = player.getOffhandItem() == stack; boolean leftHanded = player.getMainArm() == HumanoidArm.LEFT; @@ -61,7 +61,8 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { localMs.scale(.5f, .5f, .5f); TransformStack.cast(localMs) .rotateY(-34); - itemRenderer.renderStatic(ammo, ItemDisplayContext.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer, 0); + itemRenderer.renderStatic(ammo, ItemDisplayContext.GUI, light, OverlayTexture.NO_OVERLAY, localMs, + buffer, mc.level, 0); }); } diff --git a/src/main/java/com/simibubi/create/content/equipment/sandPaper/SandPaperItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/sandPaper/SandPaperItemRenderer.java index 341074eb9..278a92581 100644 --- a/src/main/java/com/simibubi/create/content/equipment/sandPaper/SandPaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/sandPaper/SandPaperItemRenderer.java @@ -57,7 +57,7 @@ public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer { } ItemStack toPolish = ItemStack.of(tag.getCompound("Polishing")); - itemRenderer.renderStatic(toPolish, ItemDisplayContext.NONE, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(toPolish, ItemDisplayContext.NONE, light, overlay, ms, buffer, player.level(), 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDyeingRecipe.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDyeingRecipe.java index 949a6f8bb..d9a336ea9 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDyeingRecipe.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDyeingRecipe.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.equipment.toolbox; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllRecipeTypes; +import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.DyeColor; @@ -46,7 +47,7 @@ public class ToolboxDyeingRecipe extends CustomRecipe { } @Override - public ItemStack assemble(CraftingContainer inventory) { + public ItemStack assemble(CraftingContainer inventory, RegistryAccess pRegistryAccess) { ItemStack toolbox = ItemStack.EMPTY; DyeColor color = DyeColor.BROWN; diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java index 1922cb739..7e8e668d5 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java @@ -88,7 +88,7 @@ public class ToolboxHandlerClient { continue; if (inSlot.getItem() != result.getItem()) continue; - if (!ItemStack.tagMatches(inSlot, result)) + if (!ItemStack.matches(inSlot, result)) continue; AllPackets.getChannel().sendToServer( diff --git a/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java b/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java index 2ac238835..39781051b 100644 --- a/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java +++ b/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java @@ -116,7 +116,7 @@ public class ItemDrainRenderer extends SmartBlockEntityRenderer recipe) { List collect = - RecipeApplier.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(transported.stack, 1), recipe) + RecipeApplier.applyRecipeOn(blockEntity.getLevel(), ItemHandlerHelper.copyStackWithSize(transported.stack, 1), recipe) .stream() .map(stack -> { TransportedItemStack copy = transported.copy(); diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerApplicationRecipe.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerApplicationRecipe.java index 7aa694345..79eca9ee0 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerApplicationRecipe.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerApplicationRecipe.java @@ -14,6 +14,7 @@ import com.simibubi.create.content.processing.sequenced.IAssemblyRecipe; import com.simibubi.create.foundation.utility.Components; import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -42,7 +43,7 @@ public class DeployerApplicationRecipe extends ItemApplicationRecipe implements .getPath() + "_using_deployer")).require(sandpaperRecipe.getIngredients() .get(0)) .require(AllItemTags.SANDPAPER.tag) - .output(sandpaperRecipe.getResultItem()) + .output(sandpaperRecipe.getResultItem(Minecraft.getInstance().level.registryAccess())) .build(); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java index bedf82b0f..ed6e4e7d1 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java @@ -137,9 +137,6 @@ public class DeployerFakePlayer extends FakePlayer { return false; } - @Override - protected void playEquipSound(ItemStack p_217042_) {} - @Override public void remove(RemovalReason p_150097_) { if (blockBreakingProgress != null && !level().isClientSide) diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java index e9470f565..cbc75aeef 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java @@ -105,7 +105,7 @@ public class DeployerRenderer extends SafeBlockEntityRenderer recipe = AllRecipeTypes.SPLASHING.find(SPLASHING_WRAPPER, world); if (recipe.isPresent()) - return RecipeApplier.applyRecipeOn(stack, recipe.get()); + return RecipeApplier.applyRecipeOn(world, stack, recipe.get()); return null; } if (type == Type.HAUNTING) { HAUNTING_WRAPPER.setItem(0, stack); Optional recipe = AllRecipeTypes.HAUNTING.find(HAUNTING_WRAPPER, world); if (recipe.isPresent()) - return RecipeApplier.applyRecipeOn(stack, recipe.get()); + return RecipeApplier.applyRecipeOn(world, stack, recipe.get()); return null; } @@ -183,7 +183,7 @@ public class FanProcessing { .getResultItem(registryAccess), smeltingRecipe.get() .getResultItem(registryAccess))) { - return RecipeApplier.applyRecipeOn(stack, smeltingRecipe.get()); + return RecipeApplier.applyRecipeOn(world, stack, smeltingRecipe.get()); } } @@ -191,7 +191,7 @@ public class FanProcessing { } if (type == Type.SMOKING && smokingRecipe.isPresent()) - return RecipeApplier.applyRecipeOn(stack, smokingRecipe.get()); + return RecipeApplier.applyRecipeOn(world, stack, smokingRecipe.get()); return null; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java index 10bf67486..65563c180 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java @@ -102,7 +102,7 @@ public class ArmRenderer extends KineticBlockEntityRenderer { .mul(msLocal.last() .pose()); - itemRenderer.renderStatic(item, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(item, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/press/MechanicalPressBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/press/MechanicalPressBlockEntity.java index 45fda1df0..a0095a587 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/press/MechanicalPressBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/press/MechanicalPressBlockEntity.java @@ -128,7 +128,7 @@ public class MechanicalPressBlockEntity extends BasinOperatingBlockEntity implem itemCreated = itemEntity.getItem() .copy(); } else { - for (ItemStack result : RecipeApplier.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(item, 1), + for (ItemStack result : RecipeApplier.applyRecipeOn(level, ItemHandlerHelper.copyStackWithSize(item, 1), recipe.get())) { if (itemCreated.isEmpty()) itemCreated = result.copy(); @@ -154,7 +154,7 @@ public class MechanicalPressBlockEntity extends BasinOperatingBlockEntity implem if (simulate) return true; pressingBehaviour.particleItems.add(input.stack); - List outputs = RecipeApplier.applyRecipeOn( + List outputs = RecipeApplier.applyRecipeOn(level, canProcessInBulk() ? input.stack : ItemHandlerHelper.copyStackWithSize(input.stack, 1), recipe.get()); for (ItemStack created : outputs) { diff --git a/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java index a7b361c6f..adc3b855e 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java @@ -209,7 +209,7 @@ public class SawBlockEntity extends BlockBreakingKineticBlockEntity { } } - BlockPos nextPos = worldPosition.offset(itemMovement.x, itemMovement.y, itemMovement.z); + BlockPos nextPos = worldPosition.offset(BlockPos.containing(itemMovement)); DirectBeltInputBehaviour behaviour = BlockEntityBehaviour.get(level, nextPos, DirectBeltInputBehaviour.TYPE); if (behaviour != null) { boolean changed = false; @@ -343,7 +343,7 @@ public class SawBlockEntity extends BlockBreakingKineticBlockEntity { if (recipe instanceof CuttingRecipe) results = ((CuttingRecipe) recipe).rollResults(); else if (recipe instanceof StonecutterRecipe || recipe.getType() == woodcuttingRecipeType.get()) - results.add(recipe.getResultItem() + results.add(recipe.getResultItem(level.registryAccess()) .copy()); for (int i = 0; i < results.size(); i++) { @@ -362,7 +362,7 @@ public class SawBlockEntity extends BlockBreakingKineticBlockEntity { Optional assemblyRecipe = SequencedAssemblyRecipe.getRecipe(level, inventory.getStackInSlot(0), AllRecipeTypes.CUTTING.getType(), CuttingRecipe.class); if (assemblyRecipe.isPresent() && filtering.test(assemblyRecipe.get() - .getResultItem())) + .getResultItem(level.registryAccess()))) return ImmutableList.of(assemblyRecipe.get()); Predicate> types = RecipeConditions.isOfType(AllRecipeTypes.CUTTING.getType(), diff --git a/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java index f35dbd64b..c00a53d92 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java @@ -134,7 +134,7 @@ public class SawRenderer extends SafeBlockEntityRenderer { if (alongZ) ms.mulPose(Axis.YP.rotationDegrees(90)); ms.mulPose(Axis.XP.rotationDegrees(90)); - itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0); break; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/transmission/sequencer/SequencedGearshiftBlock.java b/src/main/java/com/simibubi/create/content/kinetics/transmission/sequencer/SequencedGearshiftBlock.java index d765dd9b6..0963f530b 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/transmission/sequencer/SequencedGearshiftBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/transmission/sequencer/SequencedGearshiftBlock.java @@ -25,6 +25,7 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -51,9 +52,9 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen } @Override - public boolean shouldCheckWeakPower(BlockState state, LevelReader world, BlockPos pos, Direction side) { - return false; - } + public boolean shouldCheckWeakPower(BlockState state, SignalGetter level, BlockPos pos, Direction side) { + return false; + } @Override public void neighborChanged(BlockState state, Level worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, diff --git a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java index f9a162d84..b14838fd8 100644 --- a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java @@ -45,7 +45,7 @@ public class ChuteRenderer extends SafeBlockEntityRenderer { ms.scale(itemScale, itemScale, itemScale); msr.rotateX(itemPosition * 180); msr.rotateY(itemPosition * 180); - itemRenderer.renderStatic(be.item, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(be.item, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java b/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java index 143f6d6dd..5a239842f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java @@ -13,7 +13,6 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemDisplayContext; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; @@ -21,6 +20,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; public class DepotRenderer extends SafeBlockEntityRenderer { @@ -69,7 +69,7 @@ public class DepotRenderer extends SafeBlockEntityRenderer { ItemStack itemStack = tis.stack; int angle = tis.angle; Random r = new Random(0); - renderItem(ms, buffer, light, overlay, itemStack, angle, r, itemPosition); + renderItem(be.getLevel(), ms, buffer, light, overlay, itemStack, angle, r, itemPosition); ms.popPose(); } @@ -91,14 +91,14 @@ public class DepotRenderer extends SafeBlockEntityRenderer { msr.rotateY(-(360 / 8f * i)); Random r = new Random(i + 1); int angle = (int) (360 * r.nextFloat()); - renderItem(ms, buffer, light, overlay, stack, renderUpright ? angle + 90 : angle, r, itemPosition); + renderItem(be.getLevel(), ms, buffer, light, overlay, stack, renderUpright ? angle + 90 : angle, r, itemPosition); ms.popPose(); } ms.popPose(); } - public static void renderItem(PoseStack ms, MultiBufferSource buffer, int light, int overlay, ItemStack itemStack, + public static void renderItem(Level level, PoseStack ms, MultiBufferSource buffer, int light, int overlay, ItemStack itemStack, int angle, Random r, Vec3 itemPosition) { ItemRenderer itemRenderer = Minecraft.getInstance() .getItemRenderer(); @@ -132,7 +132,7 @@ public class DepotRenderer extends SafeBlockEntityRenderer { ms.translate(0, -3 / 16f, 0); msr.rotateX(90); } - itemRenderer.renderStatic(itemStack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(itemStack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, level, 0); ms.popPose(); if (!renderUpright) { diff --git a/src/main/java/com/simibubi/create/content/logistics/depot/EjectorRenderer.java b/src/main/java/com/simibubi/create/content/logistics/depot/EjectorRenderer.java index 81192f401..ccb33d9dd 100644 --- a/src/main/java/com/simibubi/create/content/logistics/depot/EjectorRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/depot/EjectorRenderer.java @@ -71,7 +71,7 @@ public class EjectorRenderer extends ShaftRenderer { msr.translateBack(itemRotOffset); Minecraft.getInstance() .getItemRenderer() - .renderStatic(intAttached.getValue(), ItemDisplayContext.GROUND, light, overlay, ms, buffer, 0); + .renderStatic(intAttached.getValue(), ItemDisplayContext.GROUND, light, overlay, ms, buffer, be.getLevel(), 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java b/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java index da04be990..9dcaa7c2a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java @@ -10,6 +10,7 @@ import com.simibubi.create.AllItems; import com.simibubi.create.AllKeys; import com.simibubi.create.content.fluids.transfer.GenericItemEmptying; import com.simibubi.create.content.logistics.filter.AttributeFilterMenu.WhitelistMode; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.Components; import com.simibubi.create.foundation.utility.Lang; @@ -331,7 +332,7 @@ public class FilterItem extends Item implements MenuProvider { if (matchNBT) { return ItemHandlerHelper.canItemStacksStack(filter, stack); } else { - return ItemStack.isSame(filter, stack); + return ItemHelper.sameItem(filter, stack); } } diff --git a/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java b/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java index 591ee71a8..9d3678f5e 100644 --- a/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java +++ b/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java @@ -21,6 +21,7 @@ import com.simibubi.create.foundation.recipe.DummyCraftingContainer; import com.simibubi.create.foundation.recipe.IRecipeTypeInfo; import com.simibubi.create.foundation.utility.Iterate; +import net.minecraft.client.Minecraft; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.Ingredient; @@ -38,7 +39,8 @@ public class BasinRecipe extends ProcessingRecipe { if (filter == null) return false; - boolean filterTest = filter.test(recipe.getResultItem()); + boolean filterTest = filter.test(recipe.getResultItem(basin.getLevel() + .registryAccess())); if (recipe instanceof BasinRecipe) { BasinRecipe basinRecipe = (BasinRecipe) recipe; if (basinRecipe.getRollableResults() @@ -151,7 +153,8 @@ public class BasinRecipe extends ProcessingRecipe { recipeOutputFluids.addAll(basinRecipe.getFluidResults()); recipeOutputItems.addAll(basinRecipe.getRemainingItems(basin.getInputInventory())); } else { - recipeOutputItems.add(recipe.getResultItem()); + recipeOutputItems.add(recipe.getResultItem(basin.getLevel() + .registryAccess())); if (recipe instanceof CraftingRecipe craftingRecipe) { recipeOutputItems.addAll(craftingRecipe.getRemainingItems(new DummyCraftingContainer(availableItems, extractedItemsFromSlot))); @@ -169,7 +172,7 @@ public class BasinRecipe extends ProcessingRecipe { public static BasinRecipe convertShapeless(Recipe recipe) { BasinRecipe basinRecipe = new ProcessingRecipeBuilder<>(BasinRecipe::new, recipe.getId()).withItemIngredients(recipe.getIngredients()) - .withSingleItemOutput(recipe.getResultItem()) + .withSingleItemOutput(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())) .build(); return basinRecipe; } diff --git a/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java b/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java index 9e4120e07..6b47a0e9c 100644 --- a/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java +++ b/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java @@ -133,9 +133,9 @@ public class BasinRenderer extends SmartBlockEntityRenderer { } protected void renderItem(PoseStack ms, MultiBufferSource buffer, int light, int overlay, ItemStack stack) { - Minecraft.getInstance() - .getItemRenderer() - .renderStatic(stack, ItemDisplayContext.GROUND, light, overlay, ms, buffer, 0); + Minecraft mc = Minecraft.getInstance(); + mc.getItemRenderer() + .renderStatic(stack, ItemDisplayContext.GROUND, light, overlay, ms, buffer, mc.level, 0); } protected float renderFluids(BasinBlockEntity basin, float partialTicks, PoseStack ms, MultiBufferSource buffer, diff --git a/src/main/java/com/simibubi/create/content/redstone/RoseQuartzLampBlock.java b/src/main/java/com/simibubi/create/content/redstone/RoseQuartzLampBlock.java index c5b70b24f..7fb27315b 100644 --- a/src/main/java/com/simibubi/create/content/redstone/RoseQuartzLampBlock.java +++ b/src/main/java/com/simibubi/create/content/redstone/RoseQuartzLampBlock.java @@ -22,7 +22,7 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; @@ -57,9 +57,9 @@ public class RoseQuartzLampBlock extends Block implements IWrenchable { } @Override - public boolean shouldCheckWeakPower(BlockState state, LevelReader level, BlockPos pos, Direction side) { - return false; - } + public boolean shouldCheckWeakPower(BlockState state, SignalGetter level, BlockPos pos, Direction side) { + return false; + } @Override public void neighborChanged(BlockState pState, Level pLevel, BlockPos pPos, Block pBlock, BlockPos pFromPos, diff --git a/src/main/java/com/simibubi/create/content/redstone/contact/RedstoneContactBlock.java b/src/main/java/com/simibubi/create/content/redstone/contact/RedstoneContactBlock.java index 40bde7345..2cfe84aca 100644 --- a/src/main/java/com/simibubi/create/content/redstone/contact/RedstoneContactBlock.java +++ b/src/main/java/com/simibubi/create/content/redstone/contact/RedstoneContactBlock.java @@ -21,7 +21,7 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition.Builder; @@ -119,9 +119,9 @@ public class RedstoneContactBlock extends WrenchableDirectionalBlock { } @Override - public boolean shouldCheckWeakPower(BlockState state, LevelReader level, BlockPos pos, Direction side) { - return false; - } + public boolean shouldCheckWeakPower(BlockState state, SignalGetter level, BlockPos pos, Direction side) { + return false; + } @Override public boolean isSignalSource(BlockState state) { diff --git a/src/main/java/com/simibubi/create/content/redstone/displayLink/target/SignDisplayTarget.java b/src/main/java/com/simibubi/create/content/redstone/displayLink/target/SignDisplayTarget.java index 77efd5436..9bef2fac4 100644 --- a/src/main/java/com/simibubi/create/content/redstone/displayLink/target/SignDisplayTarget.java +++ b/src/main/java/com/simibubi/create/content/redstone/displayLink/target/SignDisplayTarget.java @@ -3,10 +3,12 @@ package com.simibubi.create.content.redstone.displayLink.target; import java.util.List; import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext; +import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.minecraft.world.level.block.entity.SignText; public class SignDisplayTarget extends DisplayTarget { @@ -17,18 +19,22 @@ public class SignDisplayTarget extends DisplayTarget { return; boolean changed = false; + SignText signText = new SignText(); for (int i = 0; i < text.size() && i + line < 4; i++) { if (i == 0) reserve(i + line, sign, context); if (i > 0 && isReserved(i + line, sign, context)) break; - sign.setMessage(i + line, text.get(i)); + signText.setMessage(i + line, text.get(i)); changed = true; } if (changed) - context.level().sendBlockUpdated(context.getTargetPos(), sign.getBlockState(), sign.getBlockState(), 2); + for (boolean side : Iterate.trueAndFalse) + sign.setText(signText, side); + context.level() + .sendBlockUpdated(context.getTargetPos(), sign.getBlockState(), sign.getBlockState(), 2); } @Override diff --git a/src/main/java/com/simibubi/create/content/redstone/nixieTube/NixieTubeRenderer.java b/src/main/java/com/simibubi/create/content/redstone/nixieTube/NixieTubeRenderer.java index e1cf7edfc..087636090 100644 --- a/src/main/java/com/simibubi/create/content/redstone/nixieTube/NixieTubeRenderer.java +++ b/src/main/java/com/simibubi/create/content/redstone/nixieTube/NixieTubeRenderer.java @@ -114,7 +114,7 @@ public class NixieTubeRenderer extends SafeBlockEntityRenderer extends CriterionTriggerBase< private final StringSerializableTrigger trigger; public Instance(StringSerializableTrigger trigger, @Nullable Set entries) { - super(trigger.getId(), EntityPredicate.Composite.ANY); + super(trigger.getId(), ContextAwarePredicate.ANY); this.trigger = trigger; this.entries = entries; } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java index 95b3cc5bb..2160f66e0 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java @@ -232,7 +232,7 @@ public class ValueBox extends ChasingAABBOutline { private static void drawString(PoseStack ms, MultiBufferSource buffer, Component text, float x, float y, int color) { Minecraft.getInstance().font.drawInBatch(text, x, y, color, false, ms.last() - .pose(), buffer, false, 0, LightTexture.FULL_BRIGHT); + .pose(), buffer, Font.DisplayMode.NORMAL, 0, LightTexture.FULL_BRIGHT); } } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java index 07e279463..7774df305 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java @@ -25,15 +25,16 @@ public class ValueBoxRenderer { public static void renderItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { - ItemRenderer itemRenderer = Minecraft.getInstance() - .getItemRenderer(); + Minecraft mc = Minecraft.getInstance(); + ItemRenderer itemRenderer = mc.getItemRenderer(); BakedModel modelWithOverrides = itemRenderer.getModel(filter, null, null, 0); - boolean blockItem = modelWithOverrides.isGui3d() && modelWithOverrides.getRenderPasses(filter, false).size() <= 1; + boolean blockItem = + modelWithOverrides.isGui3d() && modelWithOverrides.getRenderPasses(filter, false).size() <= 1; float scale = (!blockItem ? .5f : 1f) + 1 / 64f; float zOffset = (!blockItem ? -.15f : 0) + customZOffset(filter.getItem()); ms.scale(scale, scale, scale); ms.translate(0, 0, zOffset); - itemRenderer.renderStatic(filter, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(filter, ItemDisplayContext.FIXED, light, overlay, ms, buffer, mc.level, 0); } public static void renderFlatItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light, @@ -67,9 +68,9 @@ public class ValueBoxRenderer { squashedMS.last() .normal() .set(copy); - Minecraft.getInstance() - .getItemRenderer() - .renderStatic(filter, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); + Minecraft mc = Minecraft.getInstance(); + mc.getItemRenderer() + .renderStatic(filter, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, mc.level, 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateBlockEntityBuilder.java b/src/main/java/com/simibubi/create/foundation/data/CreateBlockEntityBuilder.java index cdf40b42d..6ca1b4e3a 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateBlockEntityBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateBlockEntityBuilder.java @@ -10,6 +10,8 @@ import javax.annotation.Nullable; import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry; import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; +import com.simibubi.create.AllBlockEntityTypes; +import com.simibubi.create.Create; import com.tterrag.registrate.AbstractRegistrate; import com.tterrag.registrate.builders.BlockEntityBuilder; import com.tterrag.registrate.builders.BuilderCallback; @@ -83,7 +85,7 @@ public class CreateBlockEntityBuilder extends BlockEnt } protected void registerInstance() { - OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, $ -> { + OneTimeEventReceiver.addModListener(Create.REGISTRATE, FMLClientSetupEvent.class, $ -> { NonNullSupplier>> instanceFactory = this.instanceFactory; if (instanceFactory != null) { diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateEntityBuilder.java b/src/main/java/com/simibubi/create/foundation/data/CreateEntityBuilder.java index ee411cfdc..2fbde67eb 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateEntityBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateEntityBuilder.java @@ -8,6 +8,7 @@ import javax.annotation.ParametersAreNonnullByDefault; import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry; import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance; +import com.simibubi.create.Create; import com.tterrag.registrate.AbstractRegistrate; import com.tterrag.registrate.builders.BuilderCallback; import com.tterrag.registrate.builders.EntityBuilder; @@ -57,7 +58,7 @@ public class CreateEntityBuilder extends EntityBuilder { + OneTimeEventReceiver.addModListener(Create.REGISTRATE, FMLClientSetupEvent.class, $ -> { NonNullSupplier>> instanceFactory = this.instanceFactory; if (instanceFactory != null) { NonNullPredicate renderNormally = this.renderNormally; diff --git a/src/main/java/com/simibubi/create/foundation/data/TagGen.java b/src/main/java/com/simibubi/create/foundation/data/TagGen.java index a49e66378..7037fa3e7 100644 --- a/src/main/java/com/simibubi/create/foundation/data/TagGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/TagGen.java @@ -271,12 +271,12 @@ public class TagGen { } public CreateTagAppender tag(TagKey tag) { - TagBuilder tagbuilder = provider.getOrCreateRawBuilder(tag); + TagBuilder tagbuilder = getOrCreateRawBuilder(tag); return new CreateTagAppender<>(tagbuilder, keyExtractor, Create.ID); } public TagBuilder getOrCreateRawBuilder(TagKey tag) { - return provider.getOrCreateRawBuilder(tag); + return provider.addTag(tag).getInternalBuilder(); } } diff --git a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java index 2f26d154e..a51f5aef1 100644 --- a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java @@ -81,7 +81,7 @@ public class WindowGen { $ -> new ResourceLocation("block/" + woodName + "_planks"); NonNullFunction side_texture = n -> Create.asResource(palettesDir() + n); return windowBlock(name, () -> planksBlock, () -> AllSpriteShifts.getWoodenWindow(woodType), renderType, - translucent, end_texture, side_texture, planksBlock::defaultMaterialColor); + translucent, end_texture, side_texture, planksBlock::defaultMapColor); } public static BlockEntry windowBlock(String name, Supplier ingredient, diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java b/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java index 4e668c711..fa812ceb9 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java @@ -23,6 +23,14 @@ import net.minecraftforge.items.ItemHandlerHelper; public class ItemHelper { + public static boolean sameItem(ItemStack stack, ItemStack otherStack) { + return !otherStack.isEmpty() && stack.is(otherStack.getItem()); + } + + public static Predicate sameItemPredicate(ItemStack stack) { + return s -> sameItem(stack, s); + } + public static void dropContents(Level world, BlockPos pos, IItemHandler inv) { for (int slot = 0; slot < inv.getSlots(); slot++) Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), inv.getStackInSlot(slot)); diff --git a/src/main/java/com/simibubi/create/foundation/item/LayeredArmorItem.java b/src/main/java/com/simibubi/create/foundation/item/LayeredArmorItem.java index 487a147d1..1ba552fce 100644 --- a/src/main/java/com/simibubi/create/foundation/item/LayeredArmorItem.java +++ b/src/main/java/com/simibubi/create/foundation/item/LayeredArmorItem.java @@ -26,7 +26,7 @@ public interface LayeredArmorItem extends CustomRenderedArmorItem { if (!(stack.getItem() instanceof ArmorItem item)) { return; } - if (item.getSlot() != slot) { + if (!item.canEquip(stack, slot, entity)) { return; } diff --git a/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleData.java b/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleData.java index d75f3b35e..fce8b6a62 100644 --- a/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleData.java +++ b/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleData.java @@ -31,7 +31,7 @@ public interface ICustomParticleData { @OnlyIn(Dist.CLIENT) public default void register(ParticleType type, RegisterParticleProvidersEvent event) { - event.register(type, getFactory()); + event.registerSpecial(type, getFactory()); } } diff --git a/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleDataWithSprite.java b/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleDataWithSprite.java index 5afedf7d4..75d9121f0 100644 --- a/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleDataWithSprite.java +++ b/src/main/java/com/simibubi/create/foundation/particle/ICustomParticleDataWithSprite.java @@ -37,7 +37,7 @@ public interface ICustomParticleDataWithSprite extend @Override @OnlyIn(Dist.CLIENT) public default void register(ParticleType type, RegisterParticleProvidersEvent event) { - event.register(type, getMetaFactory()); + event.registerSpriteSet(type, getMetaFactory()); } } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java index c2401c8c3..da157497d 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java @@ -5,6 +5,7 @@ import java.util.List; import com.google.common.base.Strings; import com.mojang.blaze3d.platform.InputConstants; import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.ponder.ui.NavigatableSimiScreen; import com.simibubi.create.foundation.ponder.ui.PonderUI; import com.simibubi.create.foundation.utility.Color; @@ -111,7 +112,7 @@ public class PonderTooltipHandler { if (inPonderUI) { PonderUI ponderUI = (PonderUI) currentScreen; - if (stack.sameItem(ponderUI.getSubject())) + if (ItemHelper.sameItem(stack, ponderUI.getSubject())) subject = true; } @@ -120,7 +121,7 @@ public class PonderTooltipHandler { if (!PonderRegistry.ALL.containsKey(RegisteredObjects.getKeyOrThrow(stack.getItem()))) return; - if (prevStack.isEmpty() || !prevStack.sameItem(stack)) + if (prevStack.isEmpty() || !ItemHelper.sameItem(prevStack, stack)) holdWProgress.startWithValue(0); hoveredStack = stack; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java index 8c751668d..4799e6061 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java @@ -23,6 +23,7 @@ import com.simibubi.create.foundation.gui.Theme; import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.gui.element.BoxElement; import com.simibubi.create.foundation.gui.element.GuiGameElement; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.ponder.PonderChapter; import com.simibubi.create.foundation.ponder.PonderRegistry; import com.simibubi.create.foundation.ponder.PonderScene; @@ -994,7 +995,7 @@ public class PonderUI extends NavigatableSimiScreen { @Override public boolean isEquivalentTo(NavigatableSimiScreen other) { if (other instanceof PonderUI) - return stack.sameItem(((PonderUI) other).stack); + return ItemHelper.sameItem(stack, ((PonderUI) other).stack); return super.isEquivalentTo(other); } diff --git a/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java b/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java index 21adf4519..f575218ff 100644 --- a/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java +++ b/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java @@ -11,11 +11,12 @@ import com.simibubi.create.foundation.item.ItemHelper; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.level.Level; import net.minecraftforge.items.ItemHandlerHelper; public class RecipeApplier { public static void applyRecipeOn(ItemEntity entity, Recipe recipe) { - List stacks = applyRecipeOn(entity.getItem(), recipe); + List stacks = applyRecipeOn(entity.level(), entity.getItem(), recipe); if (stacks == null) return; if (stacks.isEmpty()) { @@ -30,7 +31,7 @@ public class RecipeApplier { } } - public static List applyRecipeOn(ItemStack stackIn, Recipe recipe) { + public static List applyRecipeOn(Level level, ItemStack stackIn, Recipe recipe) { List stacks; if (recipe instanceof ProcessingRecipe pr) { @@ -57,7 +58,7 @@ public class RecipeApplier { } } } else { - ItemStack out = recipe.getResultItem() + ItemStack out = recipe.getResultItem(level.registryAccess()) .copy(); stacks = ItemHelper.multipliedOutput(stackIn, out); } diff --git a/src/main/java/com/simibubi/create/foundation/recipe/RecipeConditions.java b/src/main/java/com/simibubi/create/foundation/recipe/RecipeConditions.java index 41073e4a2..989527e04 100644 --- a/src/main/java/com/simibubi/create/foundation/recipe/RecipeConditions.java +++ b/src/main/java/com/simibubi/create/foundation/recipe/RecipeConditions.java @@ -31,7 +31,7 @@ public class RecipeConditions { } public static Predicate> outputMatchesFilter(FilteringBehaviour filtering) { - return r -> filtering.test(r.getResultItem()); + return r -> filtering.test(r.getResultItem(filtering.getWorld().registryAccess())); } diff --git a/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java b/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java index 3051f2e17..5a18d8298 100644 --- a/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java +++ b/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java @@ -80,7 +80,7 @@ public class RenderTypes extends RenderStateShard { private static final RenderType ADDITIVE = RenderType.create(createLayerName("additive"), DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 256, true, true, RenderType.CompositeState.builder() - .setShaderState(BLOCK_SHADER) + .setShaderState(RENDERTYPE_SOLID_SHADER) .setTextureState(new RenderStateShard.TextureStateShard(InventoryMenu.BLOCK_ATLAS, false, false)) .setTransparencyState(ADDITIVE_TRANSPARENCY) .setCullState(NO_CULL) diff --git a/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java b/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java index 71dc27547..d3564acc7 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java @@ -80,7 +80,7 @@ public final class FontHelper { MultiBufferSource.BufferSource irendertypebuffer$impl = MultiBufferSource.immediate(Tesselator.getInstance() .getBuilder()); int i = font.drawInBatch(p_228078_1_, p_228078_2_, p_228078_3_, p_228078_4_, p_228078_6_, p_228078_5_, - irendertypebuffer$impl, false, 0, LightTexture.FULL_BRIGHT); + irendertypebuffer$impl, Font.DisplayMode.NORMAL, 0, LightTexture.FULL_BRIGHT); irendertypebuffer$impl.endBatch(); return i; } diff --git a/src/main/java/com/simibubi/create/foundation/utility/LangNumberFormat.java b/src/main/java/com/simibubi/create/foundation/utility/LangNumberFormat.java index 79a0f1dfa..05c4fe7bd 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/LangNumberFormat.java +++ b/src/main/java/com/simibubi/create/foundation/utility/LangNumberFormat.java @@ -18,7 +18,6 @@ public class LangNumberFormat { public void update() { format = NumberFormat.getInstance(Minecraft.getInstance() .getLanguageManager() - .getSelected() .getJavaLocale()); format.setMaximumFractionDigits(2); format.setMinimumFractionDigits(0); diff --git a/src/main/java/com/simibubi/create/infrastructure/command/ClearBufferCacheCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/ClearBufferCacheCommand.java index 3c921eefd..600c2ba8c 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/ClearBufferCacheCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/ClearBufferCacheCommand.java @@ -18,7 +18,7 @@ public class ClearBufferCacheCommand { .executes(ctx -> { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> ClearBufferCacheCommand::execute); ctx.getSource() - .sendSuccess(Components.literal("Cleared rendering buffers."), true); + .sendSuccess(() -> Components.literal("Cleared rendering buffers."), true); return 1; }); } diff --git a/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java index 4cf7a7c22..e5ad32f15 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java @@ -46,7 +46,7 @@ public class CloneCommand { BlockPosArgument.getLoadedBlockPos(ctx, "destination"), true))))) .executes(ctx -> { ctx.getSource() - .sendSuccess(Components.literal( + .sendSuccess(() -> Components.literal( "Clones all blocks as well as super glue from the specified area to the target destination"), true); @@ -77,9 +77,9 @@ public class CloneCommand { int gluePastes = cloneGlue(sourceArea, world, diffToTarget); if (cloneBlocks) - source.sendSuccess(Components.literal("Successfully cloned " + blockPastes + " Blocks"), true); + source.sendSuccess(() -> Components.literal("Successfully cloned " + blockPastes + " Blocks"), true); - source.sendSuccess(Components.literal("Successfully applied glue " + gluePastes + " times"), true); + source.sendSuccess(() -> Components.literal("Successfully applied glue " + gluePastes + " times"), true); return blockPastes + gluePastes; } diff --git a/src/main/java/com/simibubi/create/infrastructure/command/ConfigCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/ConfigCommand.java index a673129a5..ee5f50958 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/ConfigCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/ConfigCommand.java @@ -71,7 +71,7 @@ public class ConfigCommand { try { ConfigHelper.setConfigValue(configPath, value); - ctx.getSource().sendSuccess(Components.literal("Great Success!"), false); + ctx.getSource().sendSuccess(() -> Components.literal("Great Success!"), false); return Command.SINGLE_SUCCESS; } catch (ConfigHelper.InvalidValueException e) { ctx.getSource().sendFailure(Components.literal("Config could not be set the the specified value!")); diff --git a/src/main/java/com/simibubi/create/infrastructure/command/CouplingCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/CouplingCommand.java index c653ac600..de26b29a0 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/CouplingCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/CouplingCommand.java @@ -105,7 +105,7 @@ public class CouplingCommand { cart1.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); if (!cart1Capability.isPresent()) { ctx.getSource() - .sendSuccess(Components.literal("Minecart has no Couplings Attached"), true); + .sendSuccess(() -> Components.literal("Minecart has no Couplings Attached"), true); return 0; } @@ -115,7 +115,7 @@ public class CouplingCommand { + (cart1Controller.isLeadingCoupling() ? 1 : 0); if (cart1Couplings == 0) { ctx.getSource() - .sendSuccess(Components.literal("Minecart has no Couplings Attached"), true); + .sendSuccess(() -> Components.literal("Minecart has no Couplings Attached"), true); return 0; } @@ -138,7 +138,7 @@ public class CouplingCommand { } ctx.getSource() - .sendSuccess(Components.literal("The specified Carts are not coupled"), true); + .sendSuccess(() -> Components.literal("The specified Carts are not coupled"), true); return 0; })))) @@ -153,7 +153,7 @@ public class CouplingCommand { cart.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); if (!capability.isPresent()) { ctx.getSource() - .sendSuccess(Components.literal("Minecart has no Couplings Attached"), true); + .sendSuccess(() -> Components.literal("Minecart has no Couplings Attached"), true); return 0; } @@ -163,14 +163,14 @@ public class CouplingCommand { (controller.isConnectedToCoupling() ? 1 : 0) + (controller.isLeadingCoupling() ? 1 : 0); if (couplings == 0) { ctx.getSource() - .sendSuccess(Components.literal("Minecart has no Couplings Attached"), true); + .sendSuccess(() -> Components.literal("Minecart has no Couplings Attached"), true); return 0; } controller.decouple(); ctx.getSource() - .sendSuccess( + .sendSuccess(() -> Components.literal("Removed " + couplings + " couplings from the Minecart"), true); return couplings; diff --git a/src/main/java/com/simibubi/create/infrastructure/command/CreateTestCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/CreateTestCommand.java index 6650eac18..98644ba33 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/CreateTestCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/CreateTestCommand.java @@ -71,7 +71,7 @@ public class CreateTestCommand { } private static void sendSuccess(CommandSourceStack source, String text, ChatFormatting color) { - source.sendSuccess(Components.literal(text).withStyle(color), true); + source.sendSuccess(() -> Components.literal(text).withStyle(color), true); } // find existing tests and folders for autofill diff --git a/src/main/java/com/simibubi/create/infrastructure/command/DebugValueCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/DebugValueCommand.java index 86e2f5ac9..39bfd2985 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/DebugValueCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/DebugValueCommand.java @@ -17,7 +17,7 @@ public class DebugValueCommand { .then(Commands.argument("value", FloatArgumentType.floatArg()) .executes((ctx) -> { value = FloatArgumentType.getFloat(ctx, "value"); - ctx.getSource().sendSuccess(Components.literal("Set value to: "+value), true); + ctx.getSource().sendSuccess(() -> Components.literal("Set value to: "+value), true); return 1; })); diff --git a/src/main/java/com/simibubi/create/infrastructure/command/DumpRailwaysCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/DumpRailwaysCommand.java index 68ec98c7c..54a9ac8af 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/DumpRailwaysCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/DumpRailwaysCommand.java @@ -36,8 +36,8 @@ public class DumpRailwaysCommand { .executes(ctx -> { CommandSourceStack source = ctx.getSource(); fillReport(source.getLevel(), source.getPosition(), - (s, f) -> source.sendSuccess(Components.literal(s).withStyle(st -> st.withColor(f)), false), - (c) -> source.sendSuccess(c, false)); + (s, f) -> source.sendSuccess(() -> Components.literal(s).withStyle(st -> st.withColor(f)), false), + (c) -> source.sendSuccess(() -> c, false)); return 1; }); } diff --git a/src/main/java/com/simibubi/create/infrastructure/command/FixLightingCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/FixLightingCommand.java index 8b6fce3fb..fe5d91b85 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/FixLightingCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/FixLightingCommand.java @@ -20,7 +20,7 @@ public class FixLightingCommand { new SConfigureConfigPacket(SConfigureConfigPacket.Actions.fixLighting.name(), String.valueOf(true))); ctx.getSource() - .sendSuccess( + .sendSuccess(() -> Components.literal("Forge's experimental block rendering pipeline is now enabled."), true); return 1; diff --git a/src/main/java/com/simibubi/create/infrastructure/command/FlySpeedCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/FlySpeedCommand.java index abe63297b..08a87d00a 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/FlySpeedCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/FlySpeedCommand.java @@ -38,7 +38,7 @@ public class FlySpeedCommand { player.connection.send(packet); ctx.getSource() - .sendSuccess(Components.literal("Temporarily set " + player.getName() + .sendSuccess(() -> Components.literal("Temporarily set " + player.getName() .getString() + "'s Flying Speed to: " + speed), true); return Command.SINGLE_SUCCESS; diff --git a/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java index 9883032fb..2d45b163d 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java @@ -59,7 +59,7 @@ public class HighlightCommand { } private static void sendMissMessage(CommandSourceStack source) { - source.sendSuccess( + source.sendSuccess(() -> Components.literal("Try looking at a Block that has failed to assemble a Contraption and try again."), true); } @@ -94,7 +94,7 @@ public class HighlightCommand { } if (!exception.hasPosition()) { - source.sendSuccess(Components.literal("Can't highlight a specific position for this issue"), true); + source.sendSuccess(() -> Components.literal("Can't highlight a specific position for this issue"), true); return Command.SINGLE_SUCCESS; } diff --git a/src/main/java/com/simibubi/create/infrastructure/command/KillTPSCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/KillTPSCommand.java index fafc48b77..c031584a7 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/KillTPSCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/KillTPSCommand.java @@ -16,14 +16,14 @@ public class KillTPSCommand { .executes(ctx -> { // killtps no arguments ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.slowed_by.0", + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.slowed_by.0", Create.LAGGER.isLagging() ? Create.LAGGER.getTickTime() : 0), true); if (Create.LAGGER.isLagging()) ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.usage.0"), true); + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.usage.0"), true); else ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.usage.1"), true); + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.usage.1"), true); return 1; }) @@ -34,13 +34,13 @@ public class KillTPSCommand { if (tickTime > 0) { Create.LAGGER.setLagging(true); ctx.getSource() - .sendSuccess((Lang.translateDirect("command.killTPSCommand.status.slowed_by.1", tickTime)), + .sendSuccess(() -> (Lang.translateDirect("command.killTPSCommand.status.slowed_by.1", tickTime)), true); ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.usage.0"), true); + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.usage.0"), true); } else { ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.usage.1"), true); + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.usage.1"), true); } return 1; @@ -55,10 +55,10 @@ public class KillTPSCommand { Create.LAGGER.setTickTime(tickTime); Create.LAGGER.setLagging(true); ctx.getSource() - .sendSuccess((Lang.translateDirect("command.killTPSCommand.status.slowed_by.1", tickTime)), + .sendSuccess(() -> (Lang.translateDirect("command.killTPSCommand.status.slowed_by.1", tickTime)), true); ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.usage.0"), true); + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.usage.0"), true); return 1; }))) @@ -67,7 +67,7 @@ public class KillTPSCommand { // killtps stop Create.LAGGER.setLagging(false); ctx.getSource() - .sendSuccess(Lang.translateDirect("command.killTPSCommand.status.slowed_by.2"), false); + .sendSuccess(() -> Lang.translateDirect("command.killTPSCommand.status.slowed_by.2"), false); return 1; })); diff --git a/src/main/java/com/simibubi/create/infrastructure/command/KillTrainCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/KillTrainCommand.java index 0fcdfa278..d476e4517 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/KillTrainCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/KillTrainCommand.java @@ -33,7 +33,7 @@ public class KillTrainCommand { } train.invalid = true; - source.sendSuccess(Components.literal("Train '").append(train.name) + source.sendSuccess(() -> Components.literal("Train '").append(train.name) .append("' removed successfully"), true); } diff --git a/src/main/java/com/simibubi/create/infrastructure/command/OverlayConfigCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/OverlayConfigCommand.java index f2b61a47e..0129d255c 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/OverlayConfigCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/OverlayConfigCommand.java @@ -26,7 +26,7 @@ public class OverlayConfigCommand { new SConfigureConfigPacket(SConfigureConfigPacket.Actions.overlayReset.name(), ""))); ctx.getSource() - .sendSuccess(Components.literal("reset overlay offset"), true); + .sendSuccess(() -> Components.literal("reset overlay offset"), true); return 1; }) @@ -40,7 +40,7 @@ public class OverlayConfigCommand { new SConfigureConfigPacket(SConfigureConfigPacket.Actions.overlayScreen.name(), ""))); ctx.getSource() - .sendSuccess(Components.literal("window opened"), true); + .sendSuccess(() -> Components.literal("window opened"), true); return 1; }); diff --git a/src/main/java/com/simibubi/create/infrastructure/command/ReplaceInCommandBlocksCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/ReplaceInCommandBlocksCommand.java index 867940b09..2a0e479fd 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/ReplaceInCommandBlocksCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/ReplaceInCommandBlocksCommand.java @@ -59,10 +59,10 @@ public class ReplaceInCommandBlocksCommand { }); int intValue = blocks.intValue(); if (intValue == 0) { - source.sendSuccess(Components.literal("Couldn't find \"" + toReplace + "\" anywhere."), true); + source.sendSuccess(() -> Components.literal("Couldn't find \"" + toReplace + "\" anywhere."), true); return; } - source.sendSuccess(Components.literal("Replaced occurrences in " + intValue + " blocks."), true); + source.sendSuccess(() -> Components.literal("Replaced occurrences in " + intValue + " blocks."), true); } } diff --git a/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java b/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java index f339d01d0..58ec79f9c 100644 --- a/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java +++ b/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java @@ -64,7 +64,7 @@ public class TestProcessing { SequencedAssemblyRecipe recipe = (SequencedAssemblyRecipe) helper.getLevel().getRecipeManager() .byKey(Create.asResource("sequenced_assembly/precision_mechanism")) .orElseThrow(() -> new GameTestAssertException("Precision Mechanism recipe not found")); - Item result = recipe.getResultItem().getItem(); + Item result = recipe.getResultItem(helper.getLevel().registryAccess()).getItem(); Item[] possibleResults = recipe.resultPool.stream() .map(ProcessingOutput::getStack) .map(ItemStack::getItem) @@ -103,7 +103,7 @@ public class TestProcessing { helper.succeedWhen(() -> { helper.assertContainerContains(output, expected); IItemHandler handler = helper.itemStorageAt(output); - ItemHelper.extract(handler, stack -> stack.sameItem(expected), 6, false); + ItemHelper.extract(handler, ItemHelper.sameItemPredicate(expected), 6, false); helper.assertContainerEmpty(output); }); } diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/DebugScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/DebugScenes.java index 2e432c4e8..f87c5553e 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/DebugScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/DebugScenes.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.content.kinetics.base.IRotate.SpeedLevel; import com.simibubi.create.content.kinetics.base.RotationIndicatorParticleData; +import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.ponder.ElementLink; import com.simibubi.create.foundation.ponder.PonderPalette; import com.simibubi.create.foundation.ponder.PonderStoryBoardEntry.PonderStoryBoard; @@ -420,14 +421,14 @@ public class DebugScenes { scene.idle(20); scene.world.modifyEntities(ItemEntity.class, entity -> { - if (copperItem.sameItem(entity.getItem())) + if (ItemHelper.sameItem(copperItem, entity.getItem())) entity.setNoGravity(true); }); scene.idle(20); scene.world.modifyEntities(ItemEntity.class, entity -> { - if (brassItem.sameItem(entity.getItem())) + if (ItemHelper.sameItem(brassItem, entity.getItem())) entity.setDeltaMovement(util.vector.of(-.15f, .5f, 0)); }); diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DeployerScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DeployerScenes.java index 8ee70294f..985469c9e 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DeployerScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DeployerScenes.java @@ -22,6 +22,7 @@ import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.WalkAnimationState; import net.minecraft.world.entity.animal.Sheep; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; @@ -185,7 +186,9 @@ public class DeployerScenes { entity.xo = p.x; entity.yo = p.y; entity.zo = p.z; - entity.animationPosition = 0; + WalkAnimationState animation = entity.walkAnimation; + animation.update(-animation.position(), 1); + animation.setSpeed(1); entity.yRotO = 210; entity.setYRot(210); entity.yHeadRotO = 210;