You have my world

- Progress on compilation errors
This commit is contained in:
simibubi 2023-06-29 00:29:19 +02:00
parent d191aa9af3
commit 4a9b8eda06
102 changed files with 307 additions and 273 deletions

View file

@ -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<Item> exclusionPredicate = makeExclusionPredicate();
List<ItemOrdering> orderings = makeOrderings();

View file

@ -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();
}

View file

@ -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));
}
}

View file

@ -98,23 +98,23 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
return true;
}
public static List<CondensedBlockCuttingRecipe> condenseRecipes(List<Recipe<?>> stoneCuttingRecipes) {
List<CondensedBlockCuttingRecipe> 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<CondensedBlockCuttingRecipe> condenseRecipes(List<Recipe<?>> stoneCuttingRecipes) {
List<CondensedBlockCuttingRecipe> 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;
}
}

View file

@ -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<T extends Recipe<?>> 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();

View file

@ -95,7 +95,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132, 27)
.setBackground(getRenderedSlot(), -1, -1)
.addItemStack(recipe.getResultItem());
.addItemStack(getResultItem(recipe));
}
@Override

View file

@ -45,7 +45,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
@Override
public void setRecipe(IRecipeLayoutBuilder builder, CraftingRecipe recipe, IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.OUTPUT, 134, 81)
.addItemStack(recipe.getResultItem());
.addItemStack(getResultItem(recipe));
int x = getXPadding(recipe);
int y = getYPadding(recipe);

View file

@ -64,7 +64,7 @@ public class PackingCategory extends BasinCategory {
builder
.addSlot(RecipeIngredientRole.OUTPUT, 142, 51)
.setBackground(getRenderedSlot(), -1, -1)
.addItemStack(recipe.getResultItem());
.addItemStack(getResultItem(recipe));
}
@Override

View file

@ -46,7 +46,7 @@ public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends Crea
builder
.addSlot(RecipeIngredientRole.OUTPUT, 141, 48)
.setBackground(getRenderedSlot(), -1, -1)
.addItemStack(recipe.getResultItem());
.addItemStack(getResultItem(recipe));
}
@Override

View file

@ -52,7 +52,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132 + xOffset, 91)
.setBackground(getRenderedSlot(recipe.getOutputChance()), -1 , -1)
.addItemStack(recipe.getResultItem())
.addItemStack(getResultItem(recipe))
.addTooltipCallback((recipeSlotView, tooltip) -> {
if (noRandomOutput)
return;

View file

@ -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<FillingRecipe> {
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<FillingRecipe> {
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132, 51)
.setBackground(getRenderedSlot(), -1, -1)
.addItemStack(recipe.getResultItem());
.addItemStack(getResultItem(recipe));
}
@Override

View file

@ -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();
}

View file

@ -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)

View file

@ -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));

View file

@ -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<Stic
}
@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 Class<StickerBlockEntity> getBlockEntityClass() {

View file

@ -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) {

View file

@ -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;

View file

@ -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();

View file

@ -46,7 +46,7 @@ public class PlacardRenderer extends SafeBlockEntityRenderer<PlacardBlockEntity>
.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();
}

View file

@ -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()];
}
}

View file

@ -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<BacktankBlockItem> blockItem;
public BacktankItem(ArmorMaterial material, Properties properties, ResourceLocation textureLoc, Supplier<BacktankBlockItem> placeable) {
super(material, SLOT, properties, textureLoc);
super(material, TYPE, properties, textureLoc);
this.blockItem = placeable;
}

View file

@ -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;
}

View file

@ -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) {

View file

@ -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

View file

@ -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;

View file

@ -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()) {

View file

@ -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<Ingredient> 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;

View file

@ -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<BlueprintSection> {
}
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<BlueprintSection> {
}
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();

View file

@ -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()) {

View file

@ -106,7 +106,8 @@ public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
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();

View file

@ -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);
});
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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(

View file

@ -116,7 +116,7 @@ public class ItemDrainRenderer extends SmartBlockEntityRenderer<ItemDrainBlockEn
ms.scale(.5f, .5f, .5f);
if (!blockItem && !renderUpright)
msr.rotateX(90);
itemRenderer.renderStatic(itemStack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0);
itemRenderer.renderStatic(itemStack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0);
ms.popPose();
if (!renderUpright) {

View file

@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
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;
@ -24,10 +25,10 @@ public abstract class AbstractEncasedShaftBlock extends RotatedPillarKineticBloc
}
@Override
public boolean shouldCheckWeakPower(BlockState state, LevelReader world, BlockPos pos, Direction side) {
public boolean shouldCheckWeakPower(BlockState state, SignalGetter level, BlockPos pos, Direction side) {
return false;
}
@Override
public PushReaction getPistonPushReaction(@Nullable BlockState state) {
return PushReaction.NORMAL;

View file

@ -19,6 +19,7 @@ import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
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.Mirror;
import net.minecraft.world.level.block.Rotation;
@ -44,9 +45,9 @@ public class ChainDriveBlock extends RotatedPillarKineticBlock
}
@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 PushReaction getPistonPushReaction(BlockState state) {

View file

@ -76,7 +76,7 @@ public class MechanicalCrafterRenderer extends SafeBlockEntityRenderer<Mechanica
ms.mulPose(Axis.YP.rotationDegrees(180));
Minecraft.getInstance()
.getItemRenderer()
.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0);
.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0);
ms.popPose();
}
} else {
@ -127,7 +127,7 @@ public class MechanicalCrafterRenderer extends SafeBlockEntityRenderer<Mechanica
.translate(0, 0, (x + y * 3 + offset * 9) / 1024f );
Minecraft.getInstance()
.getItemRenderer()
.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0);
.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0);
ms.popPose();
});
@ -156,7 +156,7 @@ public class MechanicalCrafterRenderer extends SafeBlockEntityRenderer<Mechanica
ms.mulPose(Axis.YP.rotationDegrees(180));
Minecraft.getInstance()
.getItemRenderer()
.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0);
.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, be.getLevel(), 0);
ms.popPose();
});
}

View file

@ -28,7 +28,7 @@ public class MechanicalCraftingRecipe extends ShapedRecipe {
private static MechanicalCraftingRecipe fromShaped(ShapedRecipe recipe, boolean acceptMirrored) {
return new MechanicalCraftingRecipe(recipe.getId(), recipe.getGroup(), recipe.getWidth(), recipe.getHeight(),
recipe.getIngredients(), recipe.getResultItem(), acceptMirrored);
recipe.getIngredients(), recipe.getResultItem(null), acceptMirrored);
}
@Override

View file

@ -145,8 +145,8 @@ public class CrushingWheelControllerBlockEntity extends SmartBlockEntity {
// Output Items
if (facing != Direction.UP) {
BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f),
facing.getAxis() == Axis.Z ? 1f * offset : 0f);
BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1 * offset : 0, -1,
facing.getAxis() == Axis.Z ? 1 * offset : 0);
DirectBeltInputBehaviour behaviour =
BlockEntityBehaviour.get(level, nextPos, DirectBeltInputBehaviour.TYPE);
if (behaviour != null) {

View file

@ -96,7 +96,7 @@ public class BeltDeployerCallbacks {
DeployerBlockEntity blockEntity, Recipe<?> recipe) {
List<TransportedItemStack> 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();

View file

@ -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();
}

View file

@ -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)

View file

@ -105,7 +105,7 @@ public class DeployerRenderer extends SafeBlockEntityRenderer<DeployerBlockEntit
transform = punching ? ItemDisplayContext.THIRD_PERSON_RIGHT_HAND : ItemDisplayContext.FIXED;
}
itemRenderer.renderStatic(be.heldItem, transform, light, overlay, ms, buffer, 0);
itemRenderer.renderStatic(be.heldItem, transform, light, overlay, ms, buffer, be.getLevel(), 0);
ms.popPose();
}

View file

@ -152,14 +152,14 @@ public class FanProcessing {
SPLASHING_WRAPPER.setItem(0, stack);
Optional<SplashingRecipe> 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<HauntingRecipe> 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;
}

View file

@ -102,7 +102,7 @@ public class ArmRenderer extends KineticBlockEntityRenderer<ArmBlockEntity> {
.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();
}

View file

@ -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<ItemStack> outputs = RecipeApplier.applyRecipeOn(
List<ItemStack> outputs = RecipeApplier.applyRecipeOn(level,
canProcessInBulk() ? input.stack : ItemHandlerHelper.copyStackWithSize(input.stack, 1), recipe.get());
for (ItemStack created : outputs) {

View file

@ -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<CuttingRecipe> 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<Recipe<?>> types = RecipeConditions.isOfType(AllRecipeTypes.CUTTING.getType(),

View file

@ -134,7 +134,7 @@ public class SawRenderer extends SafeBlockEntityRenderer<SawBlockEntity> {
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;
}

View file

@ -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,

View file

@ -45,7 +45,7 @@ public class ChuteRenderer extends SafeBlockEntityRenderer<ChuteBlockEntity> {
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();
}

View file

@ -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<DepotBlockEntity> {
@ -69,7 +69,7 @@ public class DepotRenderer extends SafeBlockEntityRenderer<DepotBlockEntity> {
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<DepotBlockEntity> {
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<DepotBlockEntity> {
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) {

View file

@ -71,7 +71,7 @@ public class EjectorRenderer extends ShaftRenderer<EjectorBlockEntity> {
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();
}

View file

@ -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);
}
}

View file

@ -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<SmartInventory> {
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<SmartInventory> {
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<SmartInventory> {
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;
}

View file

@ -133,9 +133,9 @@ public class BasinRenderer extends SmartBlockEntityRenderer<BasinBlockEntity> {
}
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,

View file

@ -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,

View file

@ -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) {

View file

@ -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

View file

@ -114,7 +114,7 @@ public class NixieTubeRenderer extends SafeBlockEntityRenderer<NixieTubeBlockEnt
public static void drawInWorldString(PoseStack ms, MultiBufferSource buffer, String c, int color) {
Font fontRenderer = Minecraft.getInstance().font;
fontRenderer.drawInBatch(c, 0, 0, color, false, ms.last()
.pose(), buffer, false, 0, LightTexture.FULL_BRIGHT);
.pose(), buffer, Font.DisplayMode.NORMAL, 0, LightTexture.FULL_BRIGHT);
if (buffer instanceof BufferSource) {
BakedGlyph texturedglyph = fontRenderer.getFontSet(Style.DEFAULT_FONT)
.whiteGlyph();

View file

@ -12,7 +12,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.profiling.ProfilerFiller;
@ -31,6 +31,7 @@ import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkSource;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LightChunk;
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.entity.LevelEntityGetter;
@ -56,7 +57,7 @@ public class SchematicChunkSource extends ChunkSource {
@Nullable
@Override
public BlockGetter getChunkForLighting(int x, int z) {
public LightChunk getChunkForLighting(int x, int z) {
return getChunk(x, z);
}
@ -267,8 +268,8 @@ public class SchematicChunkSource extends ChunkSource {
return true;
}
public ChunkHolder.FullChunkStatus getFullStatus() {
return ChunkHolder.FullChunkStatus.BORDER;
public FullChunkStatus getFullStatus() {
return FullChunkStatus.FULL;
}
}
}

View file

@ -187,7 +187,7 @@ public class SchematicannonRenderer extends SafeBlockEntityRenderer<Schematicann
ms.scale(scale, scale, scale);
Minecraft.getInstance()
.getItemRenderer()
.renderStatic(launched.stack, ItemDisplayContext.GROUND, light, overlay, ms, buffer, 0);
.renderStatic(launched.stack, ItemDisplayContext.GROUND, light, overlay, ms, buffer, blockEntity.getLevel(), 0);
}
ms.popPose();

View file

@ -314,11 +314,7 @@ public class SchematicHandler implements IGuiOverlay {
private boolean itemLost(Player player) {
for (int i = 0; i < Inventory.getSelectionSize(); i++) {
if (!player.getInventory()
.getItem(i)
.sameItem(activeSchematicItem))
continue;
if (!ItemStack.tagMatches(player.getInventory()
if (!ItemStack.matches(player.getInventory()
.getItem(i), activeSchematicItem))
continue;
return false;

View file

@ -4,8 +4,6 @@ import java.util.List;
import org.joml.Matrix4f;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.StringSplitter;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.font.FontSet;
@ -27,64 +25,51 @@ public class NoShadowFontWrapper extends Font {
public FontSet getFontSet(ResourceLocation pFontLocation) {
return wrapped.getFontSet(pFontLocation);
}
public int drawShadow(PoseStack pPoseStack, String pText, float pX, float pY, int pColor) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
@Override
public int drawInBatch(Component pText, float pX, float pY, int pColor, boolean pDropShadow, Matrix4f pMatrix,
MultiBufferSource pBuffer, DisplayMode pDisplayMode, int pBackgroundColor, int pPackedLightCoords) {
return wrapped.drawInBatch(pText, pX, pY, pColor, false, pMatrix, pBuffer, pDisplayMode, pBackgroundColor,
pPackedLightCoords);
}
public int drawShadow(PoseStack pPoseStack, String pText, float pX, float pY, int pColor, boolean pTransparent) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
@Override
public int drawInBatch(FormattedCharSequence pText, float pX, float pY, int pColor, boolean pDropShadow,
Matrix4f pMatrix, MultiBufferSource pBuffer, DisplayMode pDisplayMode, int pBackgroundColor,
int pPackedLightCoords) {
return wrapped.drawInBatch(pText, pX, pY, pColor, false, pMatrix, pBuffer, pDisplayMode, pBackgroundColor,
pPackedLightCoords);
}
public int draw(PoseStack pPoseStack, String pText, float pX, float pY, int pColor) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
@Override
public int drawInBatch(String pText, float pX, float pY, int pColor, boolean pDropShadow, Matrix4f pMatrix,
MultiBufferSource pBuffer, DisplayMode pDisplayMode, int pBackgroundColor, int pPackedLightCoords) {
return wrapped.drawInBatch(pText, pX, pY, pColor, false, pMatrix, pBuffer, pDisplayMode, pBackgroundColor,
pPackedLightCoords);
}
public int drawShadow(PoseStack pPoseStack, FormattedCharSequence pText, float pX, float pY, int pColor) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
@Override
public int drawInBatch(String pText, float pX, float pY, int pColor, boolean pDropShadow, Matrix4f pMatrix,
MultiBufferSource pBuffer, DisplayMode pDisplayMode, int pBackgroundColor, int pPackedLightCoords,
boolean pBidirectional) {
return wrapped.drawInBatch(pText, pX, pY, pColor, false, pMatrix, pBuffer, pDisplayMode, pBackgroundColor,
pPackedLightCoords, pBidirectional);
}
public int drawShadow(PoseStack pPoseStack, Component pText, float pX, float pY, int pColor) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
@Override
public FormattedText ellipsize(FormattedText text, int maxWidth) {
return wrapped.ellipsize(text, maxWidth);
}
public int draw(PoseStack pPoseStack, FormattedCharSequence pText, float pX, float pY, int pColor) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
}
public int draw(PoseStack pPoseStack, Component pText, float pX, float pY, int pColor) {
return wrapped.draw(pPoseStack, pText, pX, pY, pColor);
@Override
public int wordWrapHeight(FormattedText pText, int pMaxWidth) {
return wrapped.wordWrapHeight(pText, pMaxWidth);
}
public String bidirectionalShaping(String pText) {
return wrapped.bidirectionalShaping(pText);
}
public int drawInBatch(String pText, float pX, float pY, int pColor, boolean pDropShadow, Matrix4f pMatrix,
MultiBufferSource pBuffer, boolean pTransparent, int pBackgroundColor, int pPackedLight) {
return wrapped.drawInBatch(pText, pX, pY, pColor, pDropShadow, pMatrix, pBuffer, pTransparent, pBackgroundColor,
pPackedLight);
}
public int drawInBatch(String pText, float pX, float pY, int pColor, boolean pDropShadow, Matrix4f pMatrix,
MultiBufferSource pBuffer, boolean pTransparent, int pBackgroundColor, int pPackedLight, boolean pBidiFlag) {
return wrapped.drawInBatch(pText, pX, pY, pColor, pDropShadow, pMatrix, pBuffer, pTransparent, pBackgroundColor,
pPackedLight, pBidiFlag);
}
public int drawInBatch(Component pText, float pX, float pY, int pColor, boolean pDropShadow, Matrix4f pMatrix,
MultiBufferSource pBuffer, boolean pTransparent, int pBackgroundColor, int pPackedLight) {
return wrapped.drawInBatch(pText, pX, pY, pColor, pDropShadow, pMatrix, pBuffer, pTransparent, pBackgroundColor,
pPackedLight);
}
public int drawInBatch(FormattedCharSequence pText, float pX, float pY, int pColor, boolean pDropShadow,
Matrix4f pMatrix, MultiBufferSource pBuffer, boolean pTransparent, int pBackgroundColor, int pPackedLight) {
return wrapped.drawInBatch(pText, pX, pY, pColor, pDropShadow, pMatrix, pBuffer, pTransparent, pBackgroundColor,
pPackedLight);
}
public void drawInBatch8xOutline(FormattedCharSequence pText, float pX, float pY, int pColor, int pBackgroundColor,
Matrix4f pMatrix, MultiBufferSource pBuffer, int pPackedLightCoords) {
wrapped.drawInBatch8xOutline(pText, pX, pY, pColor, pBackgroundColor, pMatrix, pBuffer, pPackedLightCoords);
@ -114,10 +99,6 @@ public class NoShadowFontWrapper extends Font {
return wrapped.substrByWidth(pText, pMaxWidth);
}
public void drawWordWrap(FormattedText pText, int pX, int pY, int pMaxWidth, int pColor) {
wrapped.drawWordWrap(pText, pX, pY, pMaxWidth, pColor);
}
public int wordWrapHeight(String pStr, int pMaxWidth) {
return wrapped.wordWrapHeight(pStr, pMaxWidth);
}

View file

@ -154,7 +154,8 @@ public class StationMarker {
poseStack.scale(0.8f, 0.8f, 1.0F);
poseStack.translate(-f6 / 2f + .5f, 0, 0);
// poseStack.scale(f7, f7, 1.0F);
font.drawInBatch(component, 0.0F, 0.0F, -1, false, poseStack.last().pose(), bufferSource, false, Integer.MIN_VALUE, 15728880);
font.drawInBatch(component, 0.0F, 0.0F, -1, false, poseStack.last()
.pose(), bufferSource, Font.DisplayMode.NORMAL, Integer.MIN_VALUE, packedLight);
poseStack.popPose();
}

View file

@ -499,7 +499,7 @@ public class TrackBlock extends Block
continue;
for (int side : Iterate.positiveAndNegative) {
BlockPos girderPos = pPos.below()
.offset(vec3.z * side, 0, vec3.x * side);
.offset(BlockPos.containing(vec3.z * side, 0, vec3.x * side));
BlockState girderState = pLevel.getBlockState(girderPos);
if (girderState.getBlock() instanceof GirderBlock girderBlock
&& !blockTicks.hasScheduledTick(girderPos, girderBlock))

View file

@ -14,9 +14,9 @@ import net.minecraft.advancements.FrameType;
import net.minecraft.advancements.critereon.EnchantmentPredicate;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.advancements.critereon.NbtPredicate;
import net.minecraft.advancements.critereon.PlacedBlockTrigger;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
@ -170,7 +170,7 @@ public class CreateAdvancement {
}
Builder whenBlockPlaced(Block block) {
return externalTrigger(PlacedBlockTrigger.TriggerInstance.placedBlock(block));
return externalTrigger(ItemUsedOnLocationTrigger.TriggerInstance.placedBlock(block));
}
Builder whenIconCollected() {

View file

@ -17,8 +17,8 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.DeserializationContext;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SerializationContext;
import net.minecraft.server.level.ServerPlayer;
@ -83,7 +83,7 @@ public abstract class StringSerializableTrigger<T> extends CriterionTriggerBase<
private final StringSerializableTrigger<T> trigger;
public Instance(StringSerializableTrigger<T> trigger, @Nullable Set<T> entries) {
super(trigger.getId(), EntityPredicate.Composite.ANY);
super(trigger.getId(), ContextAwarePredicate.ANY);
this.trigger = trigger;
this.entries = entries;
}

View file

@ -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);
}
}

View file

@ -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();
}

View file

@ -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<T extends BlockEntity, P> extends BlockEnt
}
protected void registerInstance() {
OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, $ -> {
OneTimeEventReceiver.addModListener(Create.REGISTRATE, FMLClientSetupEvent.class, $ -> {
NonNullSupplier<BiFunction<MaterialManager, T, BlockEntityInstance<? super T>>> instanceFactory =
this.instanceFactory;
if (instanceFactory != null) {

View file

@ -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<T extends Entity, P> extends EntityBuilder<T, P
}
protected void registerInstance() {
OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, $ -> {
OneTimeEventReceiver.addModListener(Create.REGISTRATE, FMLClientSetupEvent.class, $ -> {
NonNullSupplier<BiFunction<MaterialManager, T, EntityInstance<? super T>>> instanceFactory = this.instanceFactory;
if (instanceFactory != null) {
NonNullPredicate<T> renderNormally = this.renderNormally;

View file

@ -271,12 +271,12 @@ public class TagGen {
}
public CreateTagAppender<T> tag(TagKey<T> tag) {
TagBuilder tagbuilder = provider.getOrCreateRawBuilder(tag);
TagBuilder tagbuilder = getOrCreateRawBuilder(tag);
return new CreateTagAppender<>(tagbuilder, keyExtractor, Create.ID);
}
public TagBuilder getOrCreateRawBuilder(TagKey<T> tag) {
return provider.getOrCreateRawBuilder(tag);
return provider.addTag(tag).getInternalBuilder();
}
}

View file

@ -81,7 +81,7 @@ public class WindowGen {
$ -> new ResourceLocation("block/" + woodName + "_planks");
NonNullFunction<String, ResourceLocation> 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> windowBlock(String name, Supplier<? extends ItemLike> ingredient,

View file

@ -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<ItemStack> 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));

View file

@ -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;
}

View file

@ -31,7 +31,7 @@ public interface ICustomParticleData<T extends ParticleOptions> {
@OnlyIn(Dist.CLIENT)
public default void register(ParticleType<T> type, RegisterParticleProvidersEvent event) {
event.register(type, getFactory());
event.registerSpecial(type, getFactory());
}
}

View file

@ -37,7 +37,7 @@ public interface ICustomParticleDataWithSprite<T extends ParticleOptions> extend
@Override
@OnlyIn(Dist.CLIENT)
public default void register(ParticleType<T> type, RegisterParticleProvidersEvent event) {
event.register(type, getMetaFactory());
event.registerSpriteSet(type, getMetaFactory());
}
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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<ItemStack> stacks = applyRecipeOn(entity.getItem(), recipe);
List<ItemStack> stacks = applyRecipeOn(entity.level(), entity.getItem(), recipe);
if (stacks == null)
return;
if (stacks.isEmpty()) {
@ -30,7 +31,7 @@ public class RecipeApplier {
}
}
public static List<ItemStack> applyRecipeOn(ItemStack stackIn, Recipe<?> recipe) {
public static List<ItemStack> applyRecipeOn(Level level, ItemStack stackIn, Recipe<?> recipe) {
List<ItemStack> 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);
}

View file

@ -31,7 +31,7 @@ public class RecipeConditions {
}
public static Predicate<Recipe<?>> outputMatchesFilter(FilteringBehaviour filtering) {
return r -> filtering.test(r.getResultItem());
return r -> filtering.test(r.getResultItem(filtering.getWorld().registryAccess()));
}

View file

@ -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)

View file

@ -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;
}

View file

@ -18,7 +18,6 @@ public class LangNumberFormat {
public void update() {
format = NumberFormat.getInstance(Minecraft.getInstance()
.getLanguageManager()
.getSelected()
.getJavaLocale());
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(0);

View file

@ -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;
});
}

View file

@ -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;
}

View file

@ -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!"));

View file

@ -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;

View file

@ -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

View file

@ -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;
}));

View file

@ -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;
});
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}));

View file

@ -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);
}

View file

@ -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;
});

View file

@ -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);
}
}

View file

@ -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);
});
}

Some files were not shown because too many files have changed in this diff Show more