They port for sport

- Progress on compilation errors
- Added Creative tab register
This commit is contained in:
simibubi 2023-06-29 15:14:05 +02:00
parent 35ce91bf8a
commit 26ec011382
31 changed files with 152 additions and 130 deletions

View file

@ -2139,7 +2139,7 @@ public class AllBlocks {
});
public static final BlockEntry<SlidingDoorBlock> ANDESITE_DOOR =
REGISTRATE.block("andesite_door", p -> new SlidingDoorBlock(p, true))
REGISTRATE.block("andesite_door", p -> SlidingDoorBlock.metal(p, true))
.transform(BuilderTransformers.slidingDoor("andesite"))
.properties(p -> p.mapColor(MapColor.STONE)
.sound(SoundType.STONE)
@ -2147,7 +2147,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<SlidingDoorBlock> BRASS_DOOR =
REGISTRATE.block("brass_door", p -> new SlidingDoorBlock(p, false))
REGISTRATE.block("brass_door", p -> SlidingDoorBlock.metal(p, false))
.transform(BuilderTransformers.slidingDoor("brass"))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)
.sound(SoundType.STONE)
@ -2155,7 +2155,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<SlidingDoorBlock> COPPER_DOOR =
REGISTRATE.block("copper_door", p -> new SlidingDoorBlock(p, true))
REGISTRATE.block("copper_door", p -> SlidingDoorBlock.metal(p, true))
.transform(BuilderTransformers.slidingDoor("copper"))
.properties(p -> p.mapColor(MapColor.COLOR_ORANGE)
.sound(SoundType.STONE)
@ -2163,7 +2163,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<SlidingDoorBlock> TRAIN_DOOR =
REGISTRATE.block("train_door", p -> new SlidingDoorBlock(p, false))
REGISTRATE.block("train_door", p -> SlidingDoorBlock.metal(p, false))
.transform(BuilderTransformers.slidingDoor("train"))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_CYAN)
.sound(SoundType.NETHERITE_BLOCK)
@ -2179,7 +2179,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<SlidingDoorBlock> FRAMED_GLASS_DOOR =
REGISTRATE.block("framed_glass_door", p -> new SlidingDoorBlock(p, false))
REGISTRATE.block("framed_glass_door", p -> SlidingDoorBlock.glass(p, false))
.transform(BuilderTransformers.slidingDoor("glass"))
.properties(p -> p.mapColor(MapColor.NONE)
.sound(SoundType.GLASS)

View file

@ -28,58 +28,56 @@ import net.minecraft.client.renderer.entity.ItemRenderer;
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.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;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
@EventBusSubscriber(bus = Bus.MOD)
public class AllCreativeModeTabs {
private static final DeferredRegister<CreativeModeTab> TAB_REGISTER =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Create.ID);
public static RegistryObject<CreativeModeTab> MAIN_TAB = TAB_REGISTER.register("base",
() -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.create.base"))
.icon(() -> AllBlocks.COGWHEEL.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(true))
.build());
public static RegistryObject<CreativeModeTab> BUILDING_BLOCKS_TAB = TAB_REGISTER.register("palettes",
() -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.create.palettes"))
.icon(() -> AllPaletteBlocks.ORNATE_IRON_WINDOW.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(false))
.build());
public static final ResourceLocation BASE_TAB_ID = Create.asResource("base");
public static final ResourceLocation PALETTES_TAB_ID = Create.asResource("palettes");
private static CreativeModeTab baseTab;
private static CreativeModeTab palettesTab;
@SubscribeEvent
public static void onCreativeModeTabRegister(CreativeModeTabEvent.Register event) {
// FIXME: 1.19.3 this used to filter by AllSections.PALETTES
baseTab = event.registerCreativeModeTab(BASE_TAB_ID, List.of(PALETTES_TAB_ID), List.of(CreativeModeTabs.SPAWN_EGGS), builder -> {
builder.title(Component.translatable("itemGroup.create.base"))
.icon(() -> AllBlocks.COGWHEEL.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(true));
});
palettesTab = event.registerCreativeModeTab(PALETTES_TAB_ID, List.of(), List.of(CreativeModeTabs.SPAWN_EGGS, BASE_TAB_ID), builder -> {
builder.title(Component.translatable("itemGroup.create.palettes"))
.icon(() -> AllPaletteBlocks.ORNATE_IRON_WINDOW.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(false));
});
public static void register(IEventBus modEventBus) {
TAB_REGISTER.register(modEventBus);
}
public static CreativeModeTab getBaseTab() {
return baseTab;
return MAIN_TAB.get();
}
public static CreativeModeTab getPalettesTab() {
return palettesTab;
return BUILDING_BLOCKS_TAB.get();
}
private static class RegistrateDisplayItemsGenerator implements DisplayItemsGenerator {
public static class RegistrateDisplayItemsGenerator implements DisplayItemsGenerator {
// private final EnumSet<AllSections> sections;
private final boolean addItems;

View file

@ -129,6 +129,7 @@ public class Create {
AllEntityDataSerializers.register(modEventBus);
AllFeatures.register(modEventBus);
AllPlacementModifiers.register(modEventBus);
AllCreativeModeTabs.register(modEventBus);
BogeySizes.init();
AllBogeyStyles.register();

View file

@ -1,6 +1,6 @@
package com.simibubi.create.compat.jei;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
@ -11,7 +11,9 @@ import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.menu.GhostItemMenu;
import com.simibubi.create.foundation.gui.menu.GhostItemSubmitPacket;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
import mezz.jei.api.ingredients.ITypedIngredient;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.world.inventory.Slot;
@ -23,23 +25,24 @@ public class GhostIngredientHandler<T extends GhostItemMenu<?>>
implements IGhostIngredientHandler<AbstractSimiContainerScreen<T>> {
@Override
public <I> List<Target<I>> getTargets(AbstractSimiContainerScreen<T> gui, I ingredient, boolean doStart) {
List<Target<I>> targets = new ArrayList<>();
public <I> List<Target<I>> getTargetsTyped(AbstractSimiContainerScreen<T> gui, ITypedIngredient<I> ingredient,
boolean doStart) {
boolean isAttributeFilter = gui instanceof AttributeFilterScreen;
if (ingredient instanceof ItemStack) {
List<Target<I>> targets = new LinkedList<>();
if (ingredient.getType() == VanillaTypes.ITEM_STACK) {
for (int i = 36; i < gui.getMenu().slots.size(); i++) {
if (gui.getMenu().slots.get(i)
.isActive())
targets.add(new GhostTarget<>(gui, i - 36, isAttributeFilter));
// Only accept items in 1st slot. 2nd is used for functionality, don't wanna
// override that one
if (isAttributeFilter)
break;
}
}
return targets;
}

View file

@ -117,7 +117,7 @@ public class HarvesterMovementBehaviour implements MovementBehaviour {
if (state.getBlock() instanceof CropBlock) {
CropBlock crop = (CropBlock) state.getBlock();
if (harvestPartial)
return state.getValue(crop.getAgeProperty()) != 0 || !replant;
return state != crop.getStateForAge(0) || !replant;
return crop.isMaxAge(state);
}

View file

@ -28,7 +28,7 @@ import net.minecraft.world.level.block.FarmBlock;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.NetherPortalBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
@ -122,11 +122,10 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
if (brokenState.getBlock() == Blocks.SNOW && context.world instanceof ServerLevel) {
ServerLevel world = (ServerLevel) context.world;
brokenState
.getDrops(new LootContext.Builder(world).withParameter(LootContextParams.BLOCK_STATE, brokenState)
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos))
.withParameter(LootContextParams.THIS_ENTITY, getPlayer(context))
.withParameter(LootContextParams.TOOL, new ItemStack(Items.IRON_SHOVEL)))
brokenState.getDrops(new LootParams.Builder(world).withParameter(LootContextParams.BLOCK_STATE, brokenState)
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos))
.withParameter(LootContextParams.THIS_ENTITY, getPlayer(context))
.withParameter(LootContextParams.TOOL, new ItemStack(Items.IRON_SHOVEL)))
.forEach(s -> dropItem(context, s));
}
}

View file

@ -84,7 +84,6 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
}
@Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rotation) {
if (rotation == Rotation.NONE)
return state;

View file

@ -50,7 +50,7 @@ import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.block.state.properties.RailShape;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
@ -264,7 +264,7 @@ public class CartAssemblerBlock extends BaseRailBlock
@Override
@SuppressWarnings("deprecation")
@Nonnull
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> drops = super.getDrops(state, builder);
drops.addAll(getRailBlock(state).getDrops(builder));
return drops;
@ -273,11 +273,11 @@ public class CartAssemblerBlock extends BaseRailBlock
@SuppressWarnings("deprecation")
public List<ItemStack> getDropsNoRail(BlockState state, ServerLevel world, BlockPos pos,
@Nullable BlockEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_) {
return super.getDrops(state, (new LootContext.Builder(world)).withRandom(world.random)
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(pos))
.withParameter(LootContextParams.TOOL, p_220077_5_)
.withOptionalParameter(LootContextParams.THIS_ENTITY, p_220077_4_)
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, p_220077_3_));
return super.getDrops(state,
(new LootParams.Builder(world)).withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(pos))
.withParameter(LootContextParams.TOOL, p_220077_5_)
.withOptionalParameter(LootContextParams.THIS_ENTITY, p_220077_4_)
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, p_220077_3_));
}
@Override

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.decoration;
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorBlock;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
@ -19,7 +19,7 @@ import net.minecraft.world.phys.BlockHitResult;
public class TrainTrapdoorBlock extends TrapDoorBlock implements IWrenchable {
public TrainTrapdoorBlock(Properties p_57526_) {
super(p_57526_, SoundEvents.IRON_TRAPDOOR_CLOSE, SoundEvents.IRON_TRAPDOOR_OPEN);
super(p_57526_, SlidingDoorBlock.TRAIN_SET_TYPE.get());
}
public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand,

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.decoration.slidingDoor;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import com.simibubi.create.AllBlockEntityTypes;
@ -24,10 +26,12 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DoorHingeSide;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
@ -38,11 +42,31 @@ import net.minecraft.world.phys.shapes.VoxelShape;
public class SlidingDoorBlock extends DoorBlock implements IWrenchable, IBE<SlidingDoorBlockEntity> {
public static final Supplier<BlockSetType> TRAIN_SET_TYPE =
() -> new BlockSetType("train", true, SoundType.NETHERITE_BLOCK, SoundEvents.IRON_DOOR_CLOSE,
SoundEvents.IRON_DOOR_OPEN, SoundEvents.IRON_TRAPDOOR_CLOSE, SoundEvents.IRON_TRAPDOOR_OPEN,
SoundEvents.METAL_PRESSURE_PLATE_CLICK_OFF, SoundEvents.METAL_PRESSURE_PLATE_CLICK_ON,
SoundEvents.STONE_BUTTON_CLICK_OFF, SoundEvents.STONE_BUTTON_CLICK_ON);
public static final Supplier<BlockSetType> GLASS_SET_TYPE =
() -> new BlockSetType("train", true, SoundType.NETHERITE_BLOCK, SoundEvents.IRON_DOOR_CLOSE,
SoundEvents.IRON_DOOR_OPEN, SoundEvents.IRON_TRAPDOOR_CLOSE, SoundEvents.IRON_TRAPDOOR_OPEN,
SoundEvents.METAL_PRESSURE_PLATE_CLICK_OFF, SoundEvents.METAL_PRESSURE_PLATE_CLICK_ON,
SoundEvents.STONE_BUTTON_CLICK_OFF, SoundEvents.STONE_BUTTON_CLICK_ON);
public static final BooleanProperty VISIBLE = BooleanProperty.create("visible");
private boolean folds;
public SlidingDoorBlock(Properties p_52737_, boolean folds) {
super(p_52737_, SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN);
public static SlidingDoorBlock metal(Properties p_52737_, boolean folds) {
return new SlidingDoorBlock(p_52737_, TRAIN_SET_TYPE.get(), folds);
}
public static SlidingDoorBlock glass(Properties p_52737_, boolean folds) {
return new SlidingDoorBlock(p_52737_, GLASS_SET_TYPE.get(), folds);
}
public SlidingDoorBlock(Properties p_52737_, BlockSetType type, boolean folds) {
super(p_52737_, type);
this.folds = folds;
}

View file

@ -47,6 +47,7 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.inventory.TransientCraftingContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
@ -460,7 +461,7 @@ public class BlueprintEntity extends HangingEntity
return section;
}
static class BlueprintCraftingInventory extends CraftingContainer {
static class BlueprintCraftingInventory extends TransientCraftingContainer {
private static final AbstractContainerMenu dummyContainer = new AbstractContainerMenu(null, -1) {
public boolean stillValid(Player playerIn) {

View file

@ -16,6 +16,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.TransientCraftingContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
@ -141,7 +142,7 @@ public class BlueprintMenu extends GhostItemMenu<BlueprintSection> {
return contentHolder != null && contentHolder.canPlayerUse(player);
}
static class BlueprintCraftingInventory extends CraftingContainer {
static class BlueprintCraftingInventory extends TransientCraftingContainer {
public BlueprintCraftingInventory(AbstractContainerMenu menu, ItemStackHandler items) {
super(menu, 3, 3);

View file

@ -7,7 +7,6 @@ import java.util.LinkedList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllPackets;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.logistics.filter.FilterScreenPacket;
@ -24,7 +23,6 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintMenu> {
@ -87,20 +85,16 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintMenu>
@Override
protected void renderTooltip(GuiGraphics graphics, int x, int y) {
if (!menu.getCarried()
.isEmpty() || this.hoveredSlot == null || this.hoveredSlot.hasItem()
|| hoveredSlot.container == menu.playerInventory) {
.isEmpty() || this.hoveredSlot == null || hoveredSlot.container == menu.playerInventory) {
super.renderTooltip(graphics, x, y);
return;
}
graphics.renderComponentTooltip(font, addToTooltip(new LinkedList<>(), hoveredSlot.getSlotIndex(), true), x, y);
}
@Override
public List<Component> getTooltipFromItem(ItemStack stack) {
List<Component> list = super.getTooltipFromItem(stack);
if (hoveredSlot.container == menu.playerInventory)
return list;
return hoveredSlot != null ? addToTooltip(list, hoveredSlot.getSlotIndex(), false) : list;
List<Component> list = new LinkedList<>();
if (hoveredSlot.hasItem())
list = getTooltipFromContainerItem(hoveredSlot.getItem());
graphics.renderComponentTooltip(font, addToTooltip(list, hoveredSlot.getSlotIndex(), true), x, y);
}
private List<Component> addToTooltip(List<Component> list, int slot, boolean isEmptySlot) {

View file

@ -31,7 +31,7 @@ import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -139,11 +139,10 @@ public class ClipboardBlock extends FaceAttachedHorizontalDirectionalBlock
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState pState, LootContext.Builder pBuilder) {
public List<ItemStack> getDrops(BlockState pState, LootParams.Builder pBuilder) {
if (!(pBuilder.getOptionalParameter(LootContextParams.BLOCK_ENTITY) instanceof ClipboardBlockEntity cbe))
return super.getDrops(pState, pBuilder);
pBuilder.withDynamicDrop(ShulkerBoxBlock.CONTENTS,
(p_56218_, p_56219_) -> p_56219_.accept(cbe.dataContainer.copy()));
pBuilder.withDynamicDrop(ShulkerBoxBlock.CONTENTS, p_56219_ -> p_56219_.accept(cbe.dataContainer.copy()));
return ImmutableList.of(cbe.dataContainer.copy());
}

View file

@ -30,7 +30,8 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RenderLevelLastEvent;
import net.minecraftforge.client.event.RenderLevelStageEvent;
import net.minecraftforge.client.event.RenderLevelStageEvent.Stage;
import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
@ -84,7 +85,10 @@ public class SymmetryHandler {
@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void render(RenderLevelLastEvent event) {
public static void onRenderWorld(RenderLevelStageEvent event) {
if (event.getStage() != Stage.AFTER_PARTICLES)
return;
Minecraft mc = Minecraft.getInstance();
LocalPlayer player = mc.player;
RandomSource random = RandomSource.create();

View file

@ -56,7 +56,6 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
}
// TODO: Update once MinecraftForge#9163 is merged
@SuppressWarnings("removal")
@Override
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);

View file

@ -73,6 +73,7 @@ import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
@ -139,8 +140,7 @@ public class BeltBlock extends HorizontalKineticBlock
@SuppressWarnings("deprecation")
@Override
public List<ItemStack> getDrops(BlockState state,
net.minecraft.world.level.storage.loot.LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> drops = super.getDrops(state, builder);
BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
if (blockEntity instanceof BeltBlockEntity && ((BeltBlockEntity) blockEntity).hasPulley())

View file

@ -6,10 +6,10 @@ import com.simibubi.create.content.kinetics.crafter.RecipeGridHandler.GroupedIte
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.inventory.TransientCraftingContainer;
import net.minecraft.world.item.ItemStack;
public class MechanicalCraftingInventory extends CraftingContainer {
public class MechanicalCraftingInventory extends TransientCraftingContainer {
private static final AbstractContainerMenu dummyContainer = new AbstractContainerMenu(null, -1) {
public boolean stillValid(Player playerIn) {

View file

@ -40,9 +40,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.UsernameCache;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.living.LivingChangeTargetEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -149,8 +149,8 @@ public class DeployerFakePlayer extends FakePlayer {
}
@SubscribeEvent
public static void entitiesDontRetaliate(LivingSetAttackTargetEvent event) {
if (!(event.getTarget() instanceof DeployerFakePlayer))
public static void entitiesDontRetaliate(LivingChangeTargetEvent event) {
if (!(event.getNewTarget() instanceof DeployerFakePlayer))
return;
LivingEntity entityLiving = event.getEntity();
if (!(entityLiving instanceof Mob))

View file

@ -19,7 +19,7 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.storage.loot.LootContext.Builder;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.HitResult;
public class GearboxBlock extends RotatedPillarKineticBlock implements IBE<GearboxBlockEntity> {
@ -35,7 +35,7 @@ public class GearboxBlock extends RotatedPillarKineticBlock implements IBE<Gearb
@SuppressWarnings("deprecation")
@Override
public List<ItemStack> getDrops(BlockState state, Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
if (state.getValue(AXIS).isVertical())
return super.getDrops(state, builder);
return Arrays.asList(new ItemStack(AllItems.VERTICAL_GEARBOX.get()));

View file

@ -79,7 +79,6 @@ public class DirectedDirectionalBlock extends HorizontalDirectionalBlock impleme
}
@Override
@SuppressWarnings("deprecation")
public BlockState transform(BlockState state, StructureTransform transform) {
if (transform.mirror != null)
state = mirror(state, transform.mirror);

View file

@ -20,7 +20,6 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedControllerMenu> {
@ -90,20 +89,16 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
@Override
protected void renderTooltip(GuiGraphics graphics, int x, int y) {
if (!menu.getCarried()
.isEmpty() || this.hoveredSlot == null || this.hoveredSlot.hasItem()
|| hoveredSlot.container == menu.playerInventory) {
.isEmpty() || this.hoveredSlot == null || hoveredSlot.container == menu.playerInventory) {
super.renderTooltip(graphics, x, y);
return;
}
graphics.renderComponentTooltip(font, addToTooltip(new LinkedList<>(), hoveredSlot.getSlotIndex()), x, y);
}
@Override
public List<Component> getTooltipFromItem(ItemStack stack) {
List<Component> list = super.getTooltipFromItem(stack);
if (hoveredSlot.container == menu.playerInventory)
return list;
return hoveredSlot != null ? addToTooltip(list, hoveredSlot.getSlotIndex()) : list;
List<Component> list = new LinkedList<>();
if (hoveredSlot.hasItem())
list = getTooltipFromContainerItem(hoveredSlot.getItem());
graphics.renderComponentTooltip(font, addToTooltip(list, hoveredSlot.getSlotIndex()), x, y);
}
private List<Component> addToTooltip(List<Component> list, int slot) {

View file

@ -20,7 +20,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.crafting.RecipeManager;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
@ -97,19 +96,21 @@ public class SchematicChunkSource extends ChunkSource {
public static class EmptierChunk extends LevelChunk {
private static final class DummyLevel extends Level {
private final RegistryAccess access;
private DummyLevel(WritableLevelData p_46450_, ResourceKey<Level> p_46451_, Holder<DimensionType> p_46452_,
Supplier<ProfilerFiller> p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_, int p_220359_,
RegistryAccess access) {
super(p_46450_, p_46451_, p_46452_, p_46453_, p_46454_, p_46455_, p_46456_, p_220359_);
this.access = access;
private DummyLevel(WritableLevelData pLevelData, ResourceKey<Level> pDimension,
RegistryAccess pRegistryAccess, Holder<DimensionType> pDimensionTypeRegistration,
Supplier<ProfilerFiller> pProfiler, boolean pIsClientSide, boolean pIsDebug, long pBiomeZoomSeed,
int pMaxChainedNeighborUpdates) {
super(pLevelData, pDimension, pRegistryAccess, pDimensionTypeRegistration, pProfiler, pIsClientSide, pIsDebug,
pBiomeZoomSeed, pMaxChainedNeighborUpdates);
access = pRegistryAccess;
}
private final RegistryAccess access;
private DummyLevel(RegistryAccess access) {
this(null, null, access
.registryOrThrow(Registries.DIMENSION_TYPE)
.getHolderOrThrow(BuiltinDimensionTypes.OVERWORLD), null, false, false, 0, 0, access);
this(null, null, access, access.registryOrThrow(Registries.DIMENSION_TYPE)
.getHolderOrThrow(BuiltinDimensionTypes.OVERWORLD), null, false, false, 0, 0);
}
@Override

View file

@ -177,7 +177,6 @@ public class DamageTypeData {
* <li>{@link DeathMessageType#INTENTIONAL_GAME_DESIGN}: "death.attack." + msgId, wrapped in brackets, linking to MCPE-28723</li>
* </ul>
*/
@SuppressWarnings("JavadocReference")
public Builder deathMessageType(DeathMessageType type) {
this.deathMessageType = type;
return this;

View file

@ -141,7 +141,7 @@ public class BuilderTransformers {
}
public static <B extends SlidingDoorBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> slidingDoor(String type) {
return b -> b.initialProperties(Material.NETHER_WOOD) // for villager AI. FIXME 1.20.1 consider a blocksettype?
return b -> b.initialProperties(() -> Blocks.IRON_DOOR)
.properties(p -> p.requiresCorrectToolForDrops()
.strength(3.0F, 6.0F))
.blockstate((c, p) -> {

View file

@ -38,8 +38,8 @@ import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
import net.minecraft.data.recipes.SmithingTransformRecipeBuilder;
import net.minecraft.data.recipes.SpecialRecipeBuilder;
import net.minecraft.data.recipes.UpgradeRecipeBuilder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
@ -1111,18 +1111,18 @@ public class StandardRecipeGen extends CreateRecipeProvider {
.requires(Items.BONE_MEAL)),
NETHERITE_DIVING_HELMET =
create(AllItems.NETHERITE_DIVING_HELMET).viaSmithing(AllItems.COPPER_DIVING_HELMET::get, I::netherite),
create(AllItems.NETHERITE_DIVING_HELMET).viaNetheriteSmithing(AllItems.COPPER_DIVING_HELMET::get, I::netherite),
NETHERITE_BACKTANK =
create(AllItems.NETHERITE_BACKTANK).viaSmithing(AllItems.COPPER_BACKTANK::get, I::netherite),
create(AllItems.NETHERITE_BACKTANK).viaNetheriteSmithing(AllItems.COPPER_BACKTANK::get, I::netherite),
NETHERITE_DIVING_BOOTS =
create(AllItems.NETHERITE_DIVING_BOOTS).viaSmithing(AllItems.COPPER_DIVING_BOOTS::get, I::netherite),
create(AllItems.NETHERITE_DIVING_BOOTS).viaNetheriteSmithing(AllItems.COPPER_DIVING_BOOTS::get, I::netherite),
NETHERITE_DIVING_HELMET_2 = create(AllItems.NETHERITE_DIVING_HELMET).withSuffix("_from_netherite")
.viaSmithing(() -> Items.NETHERITE_HELMET, () -> Ingredient.of(AllItems.COPPER_DIVING_HELMET.get())),
.viaNetheriteSmithing(() -> Items.NETHERITE_HELMET, () -> Ingredient.of(AllItems.COPPER_DIVING_HELMET.get())),
NETHERITE_BACKTANK_2 = create(AllItems.NETHERITE_BACKTANK).withSuffix("_from_netherite")
.viaSmithing(() -> Items.NETHERITE_CHESTPLATE, () -> Ingredient.of(AllItems.COPPER_BACKTANK.get())),
.viaNetheriteSmithing(() -> Items.NETHERITE_CHESTPLATE, () -> Ingredient.of(AllItems.COPPER_BACKTANK.get())),
NETHERITE_DIVING_BOOTS_2 = create(AllItems.NETHERITE_DIVING_BOOTS).withSuffix("_from_netherite")
.viaSmithing(() -> Items.NETHERITE_BOOTS, () -> Ingredient.of(AllItems.COPPER_DIVING_BOOTS.get()))
.viaNetheriteSmithing(() -> Items.NETHERITE_BOOTS, () -> Ingredient.of(AllItems.COPPER_DIVING_BOOTS.get()))
;
@ -1367,11 +1367,12 @@ public class StandardRecipeGen extends CreateRecipeProvider {
});
}
GeneratedRecipe viaSmithing(Supplier<? extends Item> base, Supplier<Ingredient> upgradeMaterial) {
GeneratedRecipe viaNetheriteSmithing(Supplier<? extends Item> base, Supplier<Ingredient> upgradeMaterial) {
return register(consumer -> {
UpgradeRecipeBuilder b = UpgradeRecipeBuilder.smithing(Ingredient.of(base.get()), upgradeMaterial.get(),
RecipeCategory.COMBAT, result.get()
.asItem());
SmithingTransformRecipeBuilder b =
SmithingTransformRecipeBuilder.smithing(Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE),
Ingredient.of(base.get()), upgradeMaterial.get(), RecipeCategory.COMBAT, result.get()
.asItem());
b.unlocks("has_item", inventoryTrigger(ItemPredicate.Builder.item()
.of(base.get())
.build()));

View file

@ -85,7 +85,8 @@ import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
import net.minecraftforge.client.event.RegisterGuiOverlaysEvent;
import net.minecraftforge.client.event.RenderLevelLastEvent;
import net.minecraftforge.client.event.RenderLevelStageEvent;
import net.minecraftforge.client.event.RenderLevelStageEvent.Stage;
import net.minecraftforge.client.event.RenderTooltipEvent;
import net.minecraftforge.client.event.ViewportEvent;
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
@ -204,7 +205,10 @@ public class ClientEvents {
}
@SubscribeEvent
public static void onRenderWorld(RenderLevelLastEvent event) {
public static void onRenderWorld(RenderLevelStageEvent event) {
if (event.getStage() != Stage.AFTER_PARTICLES)
return;
PoseStack ms = event.getPoseStack();
ms.pushPose();
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();

View file

@ -4,11 +4,11 @@ import org.jetbrains.annotations.NotNull;
import net.minecraft.core.NonNullList;
import net.minecraft.world.entity.player.StackedContents;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.inventory.TransientCraftingContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
public class DummyCraftingContainer extends CraftingContainer {
public class DummyCraftingContainer extends TransientCraftingContainer {
private final NonNullList<ItemStack> inv;

View file

@ -218,7 +218,7 @@ public class BlockHelper {
int idx = chunk.getSectionIndex(target.getY());
LevelChunkSection chunksection = chunk.getSection(idx);
if (chunksection == null) {
chunksection = new LevelChunkSection(chunk.getSectionYFromSectionIndex(idx), world.registryAccess()
chunksection = new LevelChunkSection(world.registryAccess()
.registryOrThrow(Registries.BIOME));
chunk.getSections()[idx] = chunksection;
}

View file

@ -36,7 +36,7 @@ public class WrappedServerWorld extends ServerLevel {
(ServerLevelData) world.getLevelData(), world.dimension(),
new LevelStem(world.dimensionTypeRegistration(), world.getChunkSource().getGenerator()),
new DummyStatusListener(), world.isDebug(), world.getBiomeManager().biomeZoomSeed,
Collections.emptyList(), false);
Collections.emptyList(), false, world.getRandomSequences());
this.world = world;
}

View file

@ -14,6 +14,7 @@ public net.minecraft.server.network.ServerGamePacketListenerImpl f_9737_ # above
public net.minecraft.server.network.ServerGamePacketListenerImpl f_9739_ # aboveGroundVehicleTickCount
public net.minecraft.world.entity.Entity f_146795_ # removalReason
public net.minecraft.world.entity.Entity f_19853_ # level
protected net.minecraft.world.entity.Entity m_19956_(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity$MoveFunction;)V # positionRider
public net.minecraft.world.entity.LivingEntity f_20899_ # jumping