Found and Replaced

- Progress on compilation errors
This commit is contained in:
simibubi 2023-06-28 01:04:43 +02:00
parent 133756f571
commit 55562e5d16
301 changed files with 1092 additions and 1156 deletions

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@ import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; 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.contraptions.actors.seat.SeatBlock;
import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks; import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks;
import com.simibubi.create.content.equipment.armor.BacktankUtil; import com.simibubi.create.content.equipment.armor.BacktankUtil;

View file

@ -332,7 +332,7 @@ public class AllSoundEvents {
} }
public static void playItemPickup(Player player) { public static void playItemPickup(Player player) {
player.level.playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f, player.level().playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f,
1f + Create.RANDOM.nextFloat()); 1f + Create.RANDOM.nextFloat());
} }
@ -509,7 +509,7 @@ public class AllSoundEvents {
public void playFrom(Entity entity, float volume, float pitch) { public void playFrom(Entity entity, float volume, float pitch) {
if (!entity.isSilent()) if (!entity.isSilent())
play(entity.level, null, entity.blockPosition(), volume, pitch); play(entity.level(), null, entity.blockPosition(), volume, pitch);
} }
public void play(Level world, Player entity, Vec3i pos, float volume, float pitch) { public void play(Level world, Player entity, Vec3i pos, float volume, float pitch) {

View file

@ -23,11 +23,10 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
public class ConnectivityHandler { public class ConnectivityHandler {
@ -361,10 +360,10 @@ public class ConnectivityHandler {
} }
if (be instanceof IMultiBlockEntityContainer.Inventory inv && inv.hasInventory()) if (be instanceof IMultiBlockEntityContainer.Inventory inv && inv.hasInventory())
be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) be.getCapability(ForgeCapabilities.ITEM_HANDLER)
.invalidate(); .invalidate();
if (be instanceof IMultiBlockEntityContainer.Fluid fluid && fluid.hasTank()) if (be instanceof IMultiBlockEntityContainer.Fluid fluid && fluid.hasTank())
be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) be.getCapability(ForgeCapabilities.FLUID_HANDLER)
.invalidate(); .invalidate();
if (tryReconnect) if (tryReconnect)

View file

@ -14,12 +14,12 @@ import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -60,7 +60,7 @@ public class GogglesCurioRenderer implements ICurioRenderer {
} }
// Render // Render
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, renderTypeBuffer, 0); Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, renderTypeBuffer, 0);
matrixStack.popPose(); matrixStack.popPose();
} }

View file

@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.GuiGraphics;
public class ScreenResourceWrapper implements IDrawable { public class ScreenResourceWrapper implements IDrawable {
@ -27,7 +27,7 @@ public class ScreenResourceWrapper implements IDrawable {
@Override @Override
public void draw(PoseStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
resource.bind(); resource.bind();
GuiComponent.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, GuiGraphics.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width,
resource.height, 256, 256); resource.height, 256, 256);
} }

View file

@ -25,9 +25,9 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.item.PotionItem; import net.minecraft.world.item.PotionItem;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidHandlerItem;
@ -54,12 +54,12 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
} }
LazyOptional<IFluidHandlerItem> capability = LazyOptional<IFluidHandlerItem> capability =
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM);
if (!capability.isPresent()) if (!capability.isPresent())
continue; continue;
ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
capability = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); capability = copy.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM);
IFluidHandlerItem handler = capability.orElse(null); IFluidHandlerItem handler = capability.orElse(null);
FluidStack extracted = handler.drain(1000, FluidAction.EXECUTE); FluidStack extracted = handler.drain(1000, FluidAction.EXECUTE);
ItemStack result = handler.getContainer(); ItemStack result = handler.getContainer();

View file

@ -28,9 +28,9 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.item.PotionItem; import net.minecraft.world.item.PotionItem;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidHandlerItem;
@ -58,13 +58,13 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
} }
LazyOptional<IFluidHandlerItem> capability = LazyOptional<IFluidHandlerItem> capability =
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM);
if (!capability.isPresent()) if (!capability.isPresent())
continue; continue;
for (FluidStack fluidStack : fluidStacks) { for (FluidStack fluidStack : fluidStacks) {
ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY) copy.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM)
.ifPresent(fhi -> { .ifPresent(fhi -> {
if (!GenericItemFilling.isFluidHandlerValid(copy, fhi)) if (!GenericItemFilling.isFluidHandlerValid(copy, fhi))
return; return;

View file

@ -12,8 +12,8 @@ import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
@ -34,7 +34,7 @@ public class SpoutCasting extends BlockSpoutingBehaviour {
if (blockEntity == null) if (blockEntity == null)
return 0; return 0;
IFluidHandler handler = blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, Direction.UP) IFluidHandler handler = blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER, Direction.UP)
.orElse(null); .orElse(null);
if (handler == null) if (handler == null)
return 0; return 0;

View file

@ -112,7 +112,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
this.contraption = contraption; this.contraption = contraption;
if (contraption == null) if (contraption == null)
return; return;
if (level.isClientSide) if (level().isClientSide)
return; return;
contraption.onEntityCreated(this); contraption.onEntityCreated(this);
} }
@ -133,7 +133,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
} }
protected void contraptionInitialize() { protected void contraptionInitialize() {
contraption.onEntityInitialize(level, this); contraption.onEntityInitialize(level(), this);
initialized = true; initialized = true;
} }
@ -160,7 +160,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
passenger.startRiding(this, true); passenger.startRiding(this, true);
if (passenger instanceof TamableAnimal ta) if (passenger instanceof TamableAnimal ta)
ta.setInSittingPose(true); ta.setInSittingPose(true);
if (level.isClientSide) if (level().isClientSide)
return; return;
contraption.getSeatMapping() contraption.getSeatMapping()
.put(passenger.getUUID(), seatIndex); .put(passenger.getUUID(), seatIndex);
@ -174,7 +174,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
super.removePassenger(passenger); super.removePassenger(passenger);
if (passenger instanceof TamableAnimal ta) if (passenger instanceof TamableAnimal ta)
ta.setInSittingPose(false); ta.setInSittingPose(false);
if (level.isClientSide) if (level().isClientSide)
return; return;
if (transformedVector != null) if (transformedVector != null)
passenger.getPersistentData() passenger.getPersistentData()
@ -269,7 +269,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
} }
public void stopControlling(BlockPos controlsLocalPos) { public void stopControlling(BlockPos controlsLocalPos) {
getControllingPlayer().map(level::getPlayerByUUID) getControllingPlayer().map(level()::getPlayerByUUID)
.map(p -> (p instanceof ServerPlayer) ? ((ServerPlayer) p) : null) .map(p -> (p instanceof ServerPlayer) ? ((ServerPlayer) p) : null)
.ifPresent(p -> AllPackets.getChannel().send(PacketDistributor.PLAYER.with(() -> p), .ifPresent(p -> AllPackets.getChannel().send(PacketDistributor.PLAYER.with(() -> p),
new ControlsStopControllingPacket())); new ControlsStopControllingPacket()));
@ -305,16 +305,16 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
} }
} }
if (toDismount != null && !level.isClientSide) { if (toDismount != null && !level().isClientSide) {
Vec3 transformedVector = getPassengerPosition(toDismount, 1); Vec3 transformedVector = getPassengerPosition(toDismount, 1);
toDismount.stopRiding(); toDismount.stopRiding();
if (transformedVector != null) if (transformedVector != null)
toDismount.teleportTo(transformedVector.x, transformedVector.y, transformedVector.z); toDismount.teleportTo(transformedVector.x, transformedVector.y, transformedVector.z);
} }
if (level.isClientSide) if (level().isClientSide)
return true; return true;
addSittingPassenger(SeatBlock.getLeashed(level, player) addSittingPassenger(SeatBlock.getLeashed(level(), player)
.or(player), indexOfSeat); .or(player), indexOfSeat);
return true; return true;
} }
@ -370,7 +370,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
tickContraption(); tickContraption();
super.tick(); super.tick();
if (level.isClientSide()) if (level().isClientSide())
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
if (!contraption.deferInvalidate) if (!contraption.deferInvalidate)
return; return;
@ -378,7 +378,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
ContraptionRenderDispatcher.invalidate(contraption); ContraptionRenderDispatcher.invalidate(contraption);
}); });
if (!(level instanceof ServerLevelAccessor sl)) if (!(level() instanceof ServerLevelAccessor sl))
return; return;
for (Entity entity : getPassengers()) { for (Entity entity : getPassengers()) {
@ -404,7 +404,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
float prevAngle = living.getYRot(); float prevAngle = living.getYRot();
float angle = AngleHelper.deg(-Mth.atan2(motion.x, motion.z)); float angle = AngleHelper.deg(-Mth.atan2(motion.x, motion.z));
angle = AngleHelper.angleLerp(0.4f, prevAngle, angle); angle = AngleHelper.angleLerp(0.4f, prevAngle, angle);
if (level.isClientSide) { if (level().isClientSide) {
living.lerpTo(0, 0, 0, 0, 0, 0, false); living.lerpTo(0, 0, 0, 0, 0, 0, false);
living.lerpHeadTo(0, 0); living.lerpHeadTo(0, 0);
living.setYRot(angle); living.setYRot(angle);
@ -418,7 +418,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
public void setBlock(BlockPos localPos, StructureBlockInfo newInfo) { public void setBlock(BlockPos localPos, StructureBlockInfo newInfo) {
contraption.blocks.put(localPos, newInfo); contraption.blocks.put(localPos, newInfo);
AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> this), AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
new ContraptionBlockChangedPacket(getId(), localPos, newInfo.state)); new ContraptionBlockChangedPacket(getId(), localPos, newInfo.state()));
} }
protected abstract void tickContraption(); protected abstract void tickContraption();
@ -430,22 +430,22 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
public void tickActors() { public void tickActors() {
boolean stalledPreviously = contraption.stalled; boolean stalledPreviously = contraption.stalled;
if (!level.isClientSide) if (!level().isClientSide)
contraption.stalled = false; contraption.stalled = false;
skipActorStop = true; skipActorStop = true;
for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) { for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) {
MovementContext context = pair.right; MovementContext context = pair.right;
StructureBlockInfo blockInfo = pair.left; StructureBlockInfo blockInfo = pair.left;
MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state); MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state());
if (actor == null) if (actor == null)
continue; continue;
Vec3 oldMotion = context.motion; Vec3 oldMotion = context.motion;
Vec3 actorPosition = toGlobalVector(VecHelper.getCenterOf(blockInfo.pos) Vec3 actorPosition = toGlobalVector(VecHelper.getCenterOf(blockInfo.pos())
.add(actor.getActiveAreaOffset(context)), 1); .add(actor.getActiveAreaOffset(context)), 1);
BlockPos gridPosition = new BlockPos(actorPosition); BlockPos gridPosition = BlockPos.containing(actorPosition);
boolean newPosVisited = boolean newPosVisited =
!context.stall && shouldActorTrigger(context, blockInfo, actor, actorPosition, gridPosition); !context.stall && shouldActorTrigger(context, blockInfo, actor, actorPosition, gridPosition);
@ -470,7 +470,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
contraption.stalled |= context.stall; contraption.stalled |= context.stall;
} }
if (!isAlive()) { if (!isAlive()) {
contraption.stop(level); contraption.stop(level());
return; return;
} }
skipActorStop = false; skipActorStop = false;
@ -487,7 +487,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
} }
} }
if (!level.isClientSide) { if (!level().isClientSide) {
if (!stalledPreviously && contraption.stalled) if (!stalledPreviously && contraption.stalled)
onContraptionStalled(); onContraptionStalled();
entityData.set(STALLED, contraption.stalled); entityData.set(STALLED, contraption.stalled);
@ -501,10 +501,10 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) { for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) {
MovementContext context = pair.right; MovementContext context = pair.right;
StructureBlockInfo blockInfo = pair.left; StructureBlockInfo blockInfo = pair.left;
MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state); MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state());
if (actor instanceof PortableStorageInterfaceMovement && isActorActive(context, actor)) if (actor instanceof PortableStorageInterfaceMovement && isActorActive(context, actor))
if (context.position != null) if (context.position != null)
actor.visitNewPosition(context, new BlockPos(context.position)); actor.visitNewPosition(context, BlockPos.containing(context.position));
} }
} }
@ -525,7 +525,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
context.motion = actorPosition.subtract(previousPosition); context.motion = actorPosition.subtract(previousPosition);
if (!level.isClientSide() && context.contraption.entity instanceof CarriageContraptionEntity cce if (!level().isClientSide() && context.contraption.entity instanceof CarriageContraptionEntity cce
&& cce.getCarriage() != null) { && cce.getCarriage() != null) {
Train train = cce.getCarriage().train; Train train = cce.getCarriage().train;
double actualSpeed = train.speedBeforeStall != null ? train.speedBeforeStall : train.speed; double actualSpeed = train.speedBeforeStall != null ? train.speedBeforeStall : train.speed;
@ -537,7 +537,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
relativeMotion = reverseRotation(relativeMotion, 1); relativeMotion = reverseRotation(relativeMotion, 1);
context.relativeMotion = relativeMotion; context.relativeMotion = relativeMotion;
return !new BlockPos(previousPosition).equals(gridPosition) return !BlockPos.containing(previousPosition).equals(gridPosition)
|| (context.relativeMotion.length() > 0 || context.contraption instanceof CarriageContraption) || (context.relativeMotion.length() > 0 || context.contraption instanceof CarriageContraption)
&& context.firstMovement; && context.firstMovement;
} }
@ -640,7 +640,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
return; return;
initialized = compound.getBoolean("Initialized"); initialized = compound.getBoolean("Initialized");
contraption = Contraption.fromNBT(level, compound.getCompound("Contraption"), spawnData); contraption = Contraption.fromNBT(level(), compound.getCompound("Contraption"), spawnData);
contraption.entity = this; contraption.entity = this;
entityData.set(STALLED, compound.getBoolean("Stalled")); entityData.set(STALLED, compound.getBoolean("Stalled"));
} }
@ -653,12 +653,12 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
StructureTransform transform = makeStructureTransform(); StructureTransform transform = makeStructureTransform();
contraption.stop(level); contraption.stop(level());
AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> this), AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
new ContraptionDisassemblyPacket(this.getId(), transform)); new ContraptionDisassemblyPacket(this.getId(), transform));
contraption.addBlocksToWorld(level, transform); contraption.addBlocksToWorld(level(), transform);
contraption.addPassengersToWorld(level, transform, getPassengers()); contraption.addPassengersToWorld(level(), transform, getPassengers());
for (Entity entity : getPassengers()) { for (Entity entity : getPassengers()) {
if (!(entity instanceof OrientedContraptionEntity)) if (!(entity instanceof OrientedContraptionEntity))
@ -677,14 +677,14 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
ejectPassengers(); ejectPassengers();
moveCollidedEntitiesOnDisassembly(transform); moveCollidedEntitiesOnDisassembly(transform);
AllSoundEvents.CONTRAPTION_DISASSEMBLE.playOnServer(level, blockPosition()); AllSoundEvents.CONTRAPTION_DISASSEMBLE.playOnServer(level(), blockPosition());
} }
private void moveCollidedEntitiesOnDisassembly(StructureTransform transform) { private void moveCollidedEntitiesOnDisassembly(StructureTransform transform) {
for (Entity entity : collidingEntities.keySet()) { for (Entity entity : collidingEntities.keySet()) {
Vec3 localVec = toLocalVector(entity.position(), 0); Vec3 localVec = toLocalVector(entity.position(), 0);
Vec3 transformed = transform.apply(localVec); Vec3 transformed = transform.apply(localVec);
if (level.isClientSide) if (level().isClientSide)
entity.setPos(transformed.x, transformed.y + 1 / 16f, transformed.z); entity.setPos(transformed.x, transformed.y + 1 / 16f, transformed.z);
else else
entity.teleportTo(transformed.x, transformed.y + 1 / 16f, transformed.z); entity.teleportTo(transformed.x, transformed.y + 1 / 16f, transformed.z);
@ -693,8 +693,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
@Override @Override
public void remove(RemovalReason p_146834_) { public void remove(RemovalReason p_146834_) {
if (!level.isClientSide && !isRemoved() && contraption != null && !skipActorStop) if (!level().isClientSide && !isRemoved() && contraption != null && !skipActorStop)
contraption.stop(level); contraption.stop(level());
if (contraption != null) if (contraption != null)
contraption.onEntityRemoved(this); contraption.onEntityRemoved(this);
super.remove(p_146834_); super.remove(p_146834_);
@ -757,8 +757,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
if (contraption == null || !contraption.blocks.containsKey(localPos)) if (contraption == null || !contraption.blocks.containsKey(localPos))
return; return;
StructureBlockInfo info = contraption.blocks.get(localPos); StructureBlockInfo info = contraption.blocks.get(localPos);
contraption.blocks.put(localPos, new StructureBlockInfo(info.pos, newState, info.nbt)); contraption.blocks.put(localPos, new StructureBlockInfo(info.pos(), newState, info.nbt()));
if (info.state != newState && !(newState.getBlock() instanceof SlidingDoorBlock)) if (info.state() != newState && !(newState.getBlock() instanceof SlidingDoorBlock))
contraption.deferInvalidate = true; contraption.deferInvalidate = true;
contraption.invalidateColliders(); contraption.invalidateColliders();
} }
@ -918,7 +918,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
} }
public boolean isAliveOrStale() { public boolean isAliveOrStale() {
return isAlive() || level.isClientSide() ? staleTicks > 0 : false; return isAlive() || level().isClientSide() ? staleTicks > 0 : false;
} }
} }

View file

@ -177,8 +177,7 @@ public class BlockMovementChecks {
if (state.getCollisionShape(world, pos) if (state.getCollisionShape(world, pos)
.isEmpty()) .isEmpty())
return false; return false;
if (state.getMaterial() if (state.canBeReplaced())
.isReplaceable())
return false; return false;
return true; return true;
} }

View file

@ -189,7 +189,7 @@ public abstract class Contraption {
public ContraptionWorld getContraptionWorld() { public ContraptionWorld getContraptionWorld() {
if (world == null) if (world == null)
world = new ContraptionWorld(entity.level, this); world = new ContraptionWorld(entity.level(), this);
return world; return world;
} }
@ -251,7 +251,7 @@ public abstract class Contraption {
for (BlockFace blockFace : pendingSubContraptions) { for (BlockFace blockFace : pendingSubContraptions) {
Direction face = blockFace.getFace(); Direction face = blockFace.getFace();
StabilizedContraption subContraption = new StabilizedContraption(face); StabilizedContraption subContraption = new StabilizedContraption(face);
Level world = entity.level; Level world = entity.level();
BlockPos pos = blockFace.getPos(); BlockPos pos = blockFace.getPos();
try { try {
if (!subContraption.assemble(world, pos)) if (!subContraption.assemble(world, pos))
@ -635,7 +635,7 @@ public abstract class Contraption {
protected void addBlock(BlockPos pos, Pair<StructureBlockInfo, BlockEntity> pair) { protected void addBlock(BlockPos pos, Pair<StructureBlockInfo, BlockEntity> pair) {
StructureBlockInfo captured = pair.getKey(); StructureBlockInfo captured = pair.getKey();
BlockPos localPos = pos.subtract(anchor); BlockPos localPos = pos.subtract(anchor);
StructureBlockInfo structureBlockInfo = new StructureBlockInfo(localPos, captured.state, captured.nbt); StructureBlockInfo structureBlockInfo = new StructureBlockInfo(localPos, captured.state(), captured.nbt());
if (blocks.put(localPos, structureBlockInfo) != null) if (blocks.put(localPos, structureBlockInfo) != null)
return; return;
@ -644,10 +644,10 @@ public abstract class Contraption {
BlockEntity be = pair.getValue(); BlockEntity be = pair.getValue();
storage.addBlock(localPos, be); storage.addBlock(localPos, be);
if (AllMovementBehaviours.getBehaviour(captured.state) != null) if (AllMovementBehaviours.getBehaviour(captured.state()) != null)
actors.add(MutablePair.of(structureBlockInfo, null)); actors.add(MutablePair.of(structureBlockInfo, null));
MovingInteractionBehaviour interactionBehaviour = AllInteractionBehaviours.getBehaviour(captured.state); MovingInteractionBehaviour interactionBehaviour = AllInteractionBehaviours.getBehaviour(captured.state());
if (interactionBehaviour != null) if (interactionBehaviour != null)
interactors.put(localPos, interactionBehaviour); interactors.put(localPos, interactionBehaviour);
@ -735,7 +735,7 @@ public abstract class Contraption {
StructureBlockInfo structureBlockInfo = getBlocks().get(pos); StructureBlockInfo structureBlockInfo = getBlocks().get(pos);
if (structureBlockInfo == null) if (structureBlockInfo == null)
return; return;
MovingInteractionBehaviour behaviour = AllInteractionBehaviours.getBehaviour(structureBlockInfo.state); MovingInteractionBehaviour behaviour = AllInteractionBehaviours.getBehaviour(structureBlockInfo.state());
if (behaviour != null) if (behaviour != null)
interactors.put(pos, behaviour); interactors.put(pos, behaviour);
}); });
@ -758,11 +758,11 @@ public abstract class Contraption {
ListTag actorsNBT = new ListTag(); ListTag actorsNBT = new ListTag();
for (MutablePair<StructureBlockInfo, MovementContext> actor : getActors()) { for (MutablePair<StructureBlockInfo, MovementContext> actor : getActors()) {
MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(actor.left.state); MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(actor.left.state());
if (behaviour == null) if (behaviour == null)
continue; continue;
CompoundTag compound = new CompoundTag(); CompoundTag compound = new CompoundTag();
compound.put("Pos", NbtUtils.writeBlockPos(actor.left.pos)); compound.put("Pos", NbtUtils.writeBlockPos(actor.left.pos()));
behaviour.writeExtraData(actor.right); behaviour.writeExtraData(actor.right);
actor.right.writeToNBT(compound); actor.right.writeToNBT(compound);
actorsNBT.add(compound); actorsNBT.add(compound);
@ -833,12 +833,12 @@ public abstract class Contraption {
ListTag blockList = new ListTag(); ListTag blockList = new ListTag();
for (StructureBlockInfo block : this.blocks.values()) { for (StructureBlockInfo block : this.blocks.values()) {
int id = palette.idFor(block.state); int id = palette.idFor(block.state());
CompoundTag c = new CompoundTag(); CompoundTag c = new CompoundTag();
c.putLong("Pos", block.pos.asLong()); c.putLong("Pos", block.pos().asLong());
c.putInt("State", id); c.putInt("State", id);
if (block.nbt != null) if (block.nbt() != null)
c.put("Data", block.nbt); c.put("Data", block.nbt());
blockList.add(c); blockList.add(c);
} }
@ -879,36 +879,36 @@ public abstract class Contraption {
StructureBlockInfo info = StructureBlockInfo info =
usePalettedDeserialization ? readStructureBlockInfo(c, finalPalette) : legacyReadStructureBlockInfo(c, holderGetter); usePalettedDeserialization ? readStructureBlockInfo(c, finalPalette) : legacyReadStructureBlockInfo(c, holderGetter);
this.blocks.put(info.pos, info); this.blocks.put(info.pos(), info);
if (!world.isClientSide) if (!world.isClientSide)
return; return;
CompoundTag tag = info.nbt; CompoundTag tag = info.nbt();
if (tag == null) if (tag == null)
return; return;
tag.putInt("x", info.pos.getX()); tag.putInt("x", info.pos().getX());
tag.putInt("y", info.pos.getY()); tag.putInt("y", info.pos().getY());
tag.putInt("z", info.pos.getZ()); tag.putInt("z", info.pos().getZ());
BlockEntity be = BlockEntity.loadStatic(info.pos, info.state, tag); BlockEntity be = BlockEntity.loadStatic(info.pos(), info.state(), tag);
if (be == null) if (be == null)
return; return;
be.setLevel(world); be.setLevel(world);
modelData.put(info.pos, be.getModelData()); modelData.put(info.pos(), be.getModelData());
if (be instanceof KineticBlockEntity kbe) if (be instanceof KineticBlockEntity kbe)
kbe.setSpeed(0); kbe.setSpeed(0);
be.getBlockState(); be.getBlockState();
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state); MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state());
if (movementBehaviour == null || !movementBehaviour.hasSpecialInstancedRendering()) if (movementBehaviour == null || !movementBehaviour.hasSpecialInstancedRendering())
maybeInstancedBlockEntities.add(be); maybeInstancedBlockEntities.add(be);
if (movementBehaviour != null && !movementBehaviour.renderAsNormalBlockEntity()) if (movementBehaviour != null && !movementBehaviour.renderAsNormalBlockEntity())
return; return;
presentBlockEntities.put(info.pos, be); presentBlockEntities.put(info.pos(), be);
specialRenderedBlockEntities.add(be); specialRenderedBlockEntities.add(be);
}); });
} }
@ -944,28 +944,28 @@ public abstract class Contraption {
for (Iterator<StructureBlockInfo> iterator = blocks.values() for (Iterator<StructureBlockInfo> iterator = blocks.values()
.iterator(); iterator.hasNext();) { .iterator(); iterator.hasNext();) {
StructureBlockInfo block = iterator.next(); StructureBlockInfo block = iterator.next();
if (brittles != BlockMovementChecks.isBrittle(block.state)) if (brittles != BlockMovementChecks.isBrittle(block.state()))
continue; continue;
for (int i = 0; i < superglue.size(); i++) { for (int i = 0; i < superglue.size(); i++) {
AABB aabb = superglue.get(i); AABB aabb = superglue.get(i);
if (aabb == null if (aabb == null
|| !aabb.contains(block.pos.getX() + .5, block.pos.getY() + .5, block.pos.getZ() + .5)) || !aabb.contains(block.pos().getX() + .5, block.pos().getY() + .5, block.pos().getZ() + .5))
continue; continue;
if (minimisedGlue.get(i) == null) if (minimisedGlue.get(i) == null)
minimisedGlue.set(i, new BoundingBox(block.pos)); minimisedGlue.set(i, new BoundingBox(block.pos()));
else else
minimisedGlue.set(i, BBHelper.encapsulate(minimisedGlue.get(i), block.pos)); minimisedGlue.set(i, BBHelper.encapsulate(minimisedGlue.get(i), block.pos()));
} }
BlockPos add = block.pos.offset(anchor) BlockPos add = block.pos().offset(anchor)
.offset(offset); .offset(offset);
if (customBlockRemoval(world, add, block.state)) if (customBlockRemoval(world, add, block.state()))
continue; continue;
BlockState oldState = world.getBlockState(add); BlockState oldState = world.getBlockState(add);
Block blockIn = oldState.getBlock(); Block blockIn = oldState.getBlock();
boolean blockMismatch = block.state.getBlock() != blockIn; boolean blockMismatch = block.state().getBlock() != blockIn;
blockMismatch &= !AllBlocks.POWERED_SHAFT.is(blockIn) || !AllBlocks.SHAFT.has(block.state); blockMismatch &= !AllBlocks.POWERED_SHAFT.is(blockIn) || !AllBlocks.SHAFT.has(block.state());
if (blockMismatch) if (blockMismatch)
iterator.remove(); iterator.remove();
world.removeBlockEntity(add); world.removeBlockEntity(add);
@ -990,13 +990,13 @@ public abstract class Contraption {
} }
for (StructureBlockInfo block : blocks.values()) { for (StructureBlockInfo block : blocks.values()) {
BlockPos add = block.pos.offset(anchor) BlockPos add = block.pos().offset(anchor)
.offset(offset); .offset(offset);
// if (!shouldUpdateAfterMovement(block)) // if (!shouldUpdateAfterMovement(block))
// continue; // continue;
int flags = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL; int flags = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL;
world.sendBlockUpdated(add, block.state, Blocks.AIR.defaultBlockState(), flags); world.sendBlockUpdated(add, block.state(), Blocks.AIR.defaultBlockState(), flags);
// when the blockstate is set to air, the block's POI data is removed, but // when the blockstate is set to air, the block's POI data is removed, but
// markAndNotifyBlock tries to // markAndNotifyBlock tries to
@ -1004,7 +1004,7 @@ public abstract class Contraption {
// we add the POI data back now // we add the POI data back now
// (code copied from ServerWorld.onBlockStateChange) // (code copied from ServerWorld.onBlockStateChange)
ServerLevel serverWorld = (ServerLevel) world; ServerLevel serverWorld = (ServerLevel) world;
PoiTypes.forState(block.state) PoiTypes.forState(block.state())
.ifPresent(poiType -> { .ifPresent(poiType -> {
world.getServer() world.getServer()
.execute(() -> { .execute(() -> {
@ -1014,9 +1014,9 @@ public abstract class Contraption {
}); });
}); });
world.markAndNotifyBlock(add, world.getChunkAt(add), block.state, Blocks.AIR.defaultBlockState(), flags, world.markAndNotifyBlock(add, world.getChunkAt(add), block.state(), Blocks.AIR.defaultBlockState(), flags,
512); 512);
block.state.updateIndirectNeighbourShapes(world, add, flags & -2); block.state().updateIndirectNeighbourShapes(world, add, flags & -2);
} }
} }
@ -1027,11 +1027,11 @@ public abstract class Contraption {
for (boolean nonBrittles : Iterate.trueAndFalse) { for (boolean nonBrittles : Iterate.trueAndFalse) {
for (StructureBlockInfo block : blocks.values()) { for (StructureBlockInfo block : blocks.values()) {
if (nonBrittles == BlockMovementChecks.isBrittle(block.state)) if (nonBrittles == BlockMovementChecks.isBrittle(block.state()))
continue; continue;
BlockPos targetPos = transform.apply(block.pos); BlockPos targetPos = transform.apply(block.pos());
BlockState state = transform.apply(block.state); BlockState state = transform.apply(block.state());
if (customBlockPlacement(world, targetPos, state)) if (customBlockPlacement(world, targetPos, state))
continue; continue;
@ -1082,7 +1082,7 @@ public abstract class Contraption {
BlockEntity blockEntity = world.getBlockEntity(targetPos); BlockEntity blockEntity = world.getBlockEntity(targetPos);
CompoundTag tag = block.nbt; CompoundTag tag = block.nbt();
// Temporary fix: Calling load(CompoundTag tag) on a Sculk sensor causes it to not react to vibrations. // Temporary fix: Calling load(CompoundTag tag) on a Sculk sensor causes it to not react to vibrations.
if(state.is(Blocks.SCULK_SENSOR) || state.is(Blocks.SCULK_SHRIEKER)) if(state.is(Blocks.SCULK_SENSOR) || state.is(Blocks.SCULK_SHRIEKER))
@ -1114,8 +1114,8 @@ public abstract class Contraption {
for (StructureBlockInfo block : blocks.values()) { for (StructureBlockInfo block : blocks.values()) {
if (!shouldUpdateAfterMovement(block)) if (!shouldUpdateAfterMovement(block))
continue; continue;
BlockPos targetPos = transform.apply(block.pos); BlockPos targetPos = transform.apply(block.pos());
world.markAndNotifyBlock(targetPos, world.getChunkAt(targetPos), block.state, block.state, world.markAndNotifyBlock(targetPos, world.getChunkAt(targetPos), block.state(), block.state(),
Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL, 512); Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL, 512);
} }
@ -1152,7 +1152,7 @@ public abstract class Contraption {
for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) { for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) {
MovementContext context = new MovementContext(world, pair.left, this); MovementContext context = new MovementContext(world, pair.left, this);
MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state); MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state());
if (behaviour != null) if (behaviour != null)
behaviour.startMoving(context); behaviour.startMoving(context);
pair.setRight(context); pair.setRight(context);
@ -1182,7 +1182,7 @@ public abstract class Contraption {
public void setActorsActive(ItemStack referenceStack, boolean enable) { public void setActorsActive(ItemStack referenceStack, boolean enable) {
for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) { for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) {
MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state); MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state());
if (behaviour == null) if (behaviour == null)
continue; continue;
ItemStack behaviourStack = behaviour.canBeDisabledVia(pair.right); ItemStack behaviourStack = behaviour.canBeDisabledVia(pair.right);
@ -1212,7 +1212,7 @@ public abstract class Contraption {
public void forEachActor(Level world, BiConsumer<MovementBehaviour, MovementContext> callBack) { public void forEachActor(Level world, BiConsumer<MovementBehaviour, MovementContext> callBack) {
for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) { for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) {
MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state); MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state());
if (behaviour == null) if (behaviour == null)
continue; continue;
callBack.accept(behaviour, pair.getRight()); callBack.accept(behaviour, pair.getRight());
@ -1220,10 +1220,10 @@ public abstract class Contraption {
} }
protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) { protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) {
if (PoiTypes.forState(info.state) if (PoiTypes.forState(info.state())
.isPresent()) .isPresent())
return false; return false;
if (info.state.getBlock() instanceof SlidingDoorBlock) if (info.state().getBlock() instanceof SlidingDoorBlock)
return false; return false;
return true; return true;
} }
@ -1293,7 +1293,7 @@ public abstract class Contraption {
@Nullable @Nullable
public MutablePair<StructureBlockInfo, MovementContext> getActorAt(BlockPos localPos) { public MutablePair<StructureBlockInfo, MovementContext> getActorAt(BlockPos localPos) {
for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) for (MutablePair<StructureBlockInfo, MovementContext> pair : actors)
if (localPos.equals(pair.left.pos)) if (localPos.equals(pair.left.pos()))
return pair; return pair;
return null; return null;
} }
@ -1320,7 +1320,7 @@ public abstract class Contraption {
for (Entry<BlockPos, StructureBlockInfo> entry : blocks.entrySet()) { for (Entry<BlockPos, StructureBlockInfo> entry : blocks.entrySet()) {
StructureBlockInfo info = entry.getValue(); StructureBlockInfo info = entry.getValue();
BlockPos localPos = entry.getKey(); BlockPos localPos = entry.getKey();
VoxelShape collisionShape = info.state.getCollisionShape(world, localPos, CollisionContext.empty()); VoxelShape collisionShape = info.state().getCollisionShape(world, localPos, CollisionContext.empty());
if (collisionShape.isEmpty()) if (collisionShape.isEmpty())
continue; continue;
combinedShape = Shapes.joinUnoptimized(combinedShape, combinedShape = Shapes.joinUnoptimized(combinedShape,
@ -1421,7 +1421,7 @@ public abstract class Contraption {
public boolean containsBlockBreakers() { public boolean containsBlockBreakers() {
for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) { for (MutablePair<StructureBlockInfo, MovementContext> pair : actors) {
MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state); MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state());
if (behaviour instanceof BlockBreakingMovementBehaviour || behaviour instanceof HarvesterMovementBehaviour) if (behaviour instanceof BlockBreakingMovementBehaviour || behaviour instanceof HarvesterMovementBehaviour)
return true; return true;
} }

View file

@ -272,22 +272,22 @@ public class ContraptionCollider {
if (temporalCollision) if (temporalCollision)
collisionLocation = collisionLocation.add(0, motionResponse.y, 0); collisionLocation = collisionLocation.add(0, motionResponse.y, 0);
BlockPos pos = new BlockPos(contraptionEntity.toLocalVector(entity.position(), 0)); BlockPos pos = BlockPos.containing(contraptionEntity.toLocalVector(entity.position(), 0));
if (contraption.getBlocks() if (contraption.getBlocks()
.containsKey(pos)) { .containsKey(pos)) {
BlockState blockState = contraption.getBlocks() BlockState blockState = contraption.getBlocks()
.get(pos).state; .get(pos).state();
if (blockState.is(BlockTags.CLIMBABLE)) { if (blockState.is(BlockTags.CLIMBABLE)) {
surfaceCollision.setTrue(); surfaceCollision.setTrue();
totalResponse = totalResponse.add(0, .1f, 0); totalResponse = totalResponse.add(0, .1f, 0);
} }
} }
pos = new BlockPos(contraptionEntity.toLocalVector(collisionLocation, 0)); pos = BlockPos.containing(contraptionEntity.toLocalVector(collisionLocation, 0));
if (contraption.getBlocks() if (contraption.getBlocks()
.containsKey(pos)) { .containsKey(pos)) {
BlockState blockState = contraption.getBlocks() BlockState blockState = contraption.getBlocks()
.get(pos).state; .get(pos).state();
MovingInteractionBehaviour movingInteractionBehaviour = contraption.interactors.get(pos); MovingInteractionBehaviour movingInteractionBehaviour = contraption.interactors.get(pos);
if (movingInteractionBehaviour != null) if (movingInteractionBehaviour != null)
@ -303,7 +303,7 @@ public class ContraptionCollider {
if (bounce > 0 && hasNormal && anyCollision if (bounce > 0 && hasNormal && anyCollision
&& bounceEntity(entity, collisionNormal, contraptionEntity, bounce)) { && bounceEntity(entity, collisionNormal, contraptionEntity, bounce)) {
entity.level.playSound(playerType == PlayerType.CLIENT ? (Player) entity : null, entity.getX(), entity.level().playSound(playerType == PlayerType.CLIENT ? (Player) entity : null, entity.getX(),
entity.getY(), entity.getZ(), SoundEvents.SLIME_BLOCK_FALL, SoundSource.BLOCKS, .5f, 1); entity.getY(), entity.getZ(), SoundEvents.SLIME_BLOCK_FALL, SoundSource.BLOCKS, .5f, 1);
continue; continue;
} }
@ -397,7 +397,7 @@ public class ContraptionCollider {
AllPackets.getChannel() AllPackets.getChannel()
.sendToServer(new ClientMotionPacket(entityMotion, true, limbSwing)); .sendToServer(new ClientMotionPacket(entityMotion, true, limbSwing));
if (entity.isOnGround() && contraption instanceof TranslatingContraption) { if (entity.onGround() && contraption instanceof TranslatingContraption) {
safetyLock.setLeft(new WeakReference<>(contraptionEntity)); safetyLock.setLeft(new WeakReference<>(contraptionEntity));
safetyLock.setRight(entity.getY() - contraptionEntity.getY()); safetyLock.setRight(entity.getY() - contraptionEntity.getY());
} }
@ -506,7 +506,7 @@ public class ContraptionCollider {
if (!(contraptionEntity instanceof CarriageContraptionEntity cce)) if (!(contraptionEntity instanceof CarriageContraptionEntity cce))
return entityMotion; return entityMotion;
if (!entity.isOnGround()) if (!entity.onGround())
return entityMotion; return entityMotion;
CompoundTag persistentData = entity.getPersistentData(); CompoundTag persistentData = entity.getPersistentData();
@ -612,20 +612,20 @@ public class ContraptionCollider {
/** From Entity#collide **/ /** From Entity#collide **/
static Vec3 collide(Vec3 p_20273_, Entity e) { static Vec3 collide(Vec3 p_20273_, Entity e) {
AABB aabb = e.getBoundingBox(); AABB aabb = e.getBoundingBox();
List<VoxelShape> list = e.level.getEntityCollisions(e, aabb.expandTowards(p_20273_)); List<VoxelShape> list = e.level().getEntityCollisions(e, aabb.expandTowards(p_20273_));
Vec3 vec3 = p_20273_.lengthSqr() == 0.0D ? p_20273_ : collideBoundingBox(e, p_20273_, aabb, e.level, list); Vec3 vec3 = p_20273_.lengthSqr() == 0.0D ? p_20273_ : collideBoundingBox(e, p_20273_, aabb, e.level(), list);
boolean flag = p_20273_.x != vec3.x; boolean flag = p_20273_.x != vec3.x;
boolean flag1 = p_20273_.y != vec3.y; boolean flag1 = p_20273_.y != vec3.y;
boolean flag2 = p_20273_.z != vec3.z; boolean flag2 = p_20273_.z != vec3.z;
boolean flag3 = flag1 && p_20273_.y < 0.0D; boolean flag3 = flag1 && p_20273_.y < 0.0D;
if (e.getStepHeight() > 0.0F && flag3 && (flag || flag2)) { if (e.getStepHeight() > 0.0F && flag3 && (flag || flag2)) {
Vec3 vec31 = collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.getStepHeight(), p_20273_.z), aabb, Vec3 vec31 = collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.getStepHeight(), p_20273_.z), aabb,
e.level, list); e.level(), list);
Vec3 vec32 = collideBoundingBox(e, new Vec3(0.0D, (double) e.getStepHeight(), 0.0D), Vec3 vec32 = collideBoundingBox(e, new Vec3(0.0D, (double) e.getStepHeight(), 0.0D),
aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level, list); aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level(), list);
if (vec32.y < (double) e.getStepHeight()) { if (vec32.y < (double) e.getStepHeight()) {
Vec3 vec33 = Vec3 vec33 =
collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level, list) collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level(), list)
.add(vec32); .add(vec32);
if (vec33.horizontalDistanceSqr() > vec31.horizontalDistanceSqr()) { if (vec33.horizontalDistanceSqr() > vec31.horizontalDistanceSqr()) {
vec31 = vec33; vec31 = vec33;
@ -634,7 +634,7 @@ public class ContraptionCollider {
if (vec31.horizontalDistanceSqr() > vec3.horizontalDistanceSqr()) { if (vec31.horizontalDistanceSqr() > vec3.horizontalDistanceSqr()) {
return vec31.add(collideBoundingBox(e, new Vec3(0.0D, -vec31.y + p_20273_.y, 0.0D), aabb.move(vec31), return vec31.add(collideBoundingBox(e, new Vec3(0.0D, -vec31.y + p_20273_.y, 0.0D), aabb.move(vec31),
e.level, list)); e.level(), list));
} }
} }
@ -644,7 +644,7 @@ public class ContraptionCollider {
private static PlayerType getPlayerType(Entity entity) { private static PlayerType getPlayerType(Entity entity) {
if (!(entity instanceof Player)) if (!(entity instanceof Player))
return PlayerType.NONE; return PlayerType.NONE;
if (!entity.level.isClientSide) if (!entity.level().isClientSide)
return PlayerType.SERVER; return PlayerType.SERVER;
MutableBoolean isClient = new MutableBoolean(false); MutableBoolean isClient = new MutableBoolean(false);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> isClient.setValue(isClientPlayerEntity(entity))); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> isClient.setValue(isClientPlayerEntity(entity)));
@ -665,17 +665,17 @@ public class ContraptionCollider {
AABB blockScanBB = localBB.inflate(0.5f); AABB blockScanBB = localBB.inflate(0.5f);
blockScanBB = blockScanBB.inflate(horizontalFactor, verticalFactor, horizontalFactor); blockScanBB = blockScanBB.inflate(horizontalFactor, verticalFactor, horizontalFactor);
BlockPos min = new BlockPos(blockScanBB.minX, blockScanBB.minY, blockScanBB.minZ); BlockPos min = BlockPos.containing(blockScanBB.minX, blockScanBB.minY, blockScanBB.minZ);
BlockPos max = new BlockPos(blockScanBB.maxX, blockScanBB.maxY, blockScanBB.maxZ); BlockPos max = BlockPos.containing(blockScanBB.maxX, blockScanBB.maxY, blockScanBB.maxZ);
List<VoxelShape> potentialHits = BlockPos.betweenClosedStream(min, max) List<VoxelShape> potentialHits = BlockPos.betweenClosedStream(min, max)
.filter(contraption.getBlocks()::containsKey) .filter(contraption.getBlocks()::containsKey)
.filter(Predicates.not(contraption::isHiddenInPortal)) .filter(Predicates.not(contraption::isHiddenInPortal))
.map(p -> { .map(p -> {
BlockState blockState = contraption.getBlocks() BlockState blockState = contraption.getBlocks()
.get(p).state; .get(p).state();
BlockPos pos = contraption.getBlocks() BlockPos pos = contraption.getBlocks()
.get(p).pos; .get(p).pos();
VoxelShape collisionShape = blockState.getCollisionShape(world, p); VoxelShape collisionShape = blockState.getCollisionShape(world, p);
return collisionShape.move(pos.getX(), pos.getY(), pos.getZ()); return collisionShape.move(pos.getX(), pos.getY(), pos.getZ());
}) })
@ -694,7 +694,7 @@ public class ContraptionCollider {
TranslatingContraption contraption = (TranslatingContraption) contraptionEntity.getContraption(); TranslatingContraption contraption = (TranslatingContraption) contraptionEntity.getContraption();
AABB bounds = contraptionEntity.getBoundingBox(); AABB bounds = contraptionEntity.getBoundingBox();
Vec3 position = contraptionEntity.position(); Vec3 position = contraptionEntity.position();
BlockPos gridPos = new BlockPos(position); BlockPos gridPos = BlockPos.containing(position);
if (contraption == null) if (contraption == null)
return false; return false;
@ -734,7 +734,7 @@ public class ContraptionCollider {
for (BlockPos colliderPos : contraption.getOrCreateColliders(world, movementDirection)) { for (BlockPos colliderPos : contraption.getOrCreateColliders(world, movementDirection)) {
colliderPos = colliderPos.offset(gridPos) colliderPos = colliderPos.offset(gridPos)
.subtract(new BlockPos(otherPosition)); .subtract(BlockPos.containing(otherPosition));
if (!otherContraption.getBlocks() if (!otherContraption.getBlocks()
.containsKey(colliderPos)) .containsKey(colliderPos))
continue; continue;
@ -762,7 +762,7 @@ public class ContraptionCollider {
if (collidedState.getBlock() instanceof CocoaBlock) if (collidedState.getBlock() instanceof CocoaBlock)
continue; continue;
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state); MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state());
if (movementBehaviour != null) { if (movementBehaviour != null) {
if (movementBehaviour instanceof BlockBreakingMovementBehaviour) { if (movementBehaviour instanceof BlockBreakingMovementBehaviour) {
BlockBreakingMovementBehaviour behaviour = (BlockBreakingMovementBehaviour) movementBehaviour; BlockBreakingMovementBehaviour behaviour = (BlockBreakingMovementBehaviour) movementBehaviour;
@ -784,8 +784,7 @@ public class ContraptionCollider {
if (AllBlocks.PULLEY_MAGNET.has(collidedState) && pos.equals(BlockPos.ZERO) if (AllBlocks.PULLEY_MAGNET.has(collidedState) && pos.equals(BlockPos.ZERO)
&& movementDirection == Direction.UP) && movementDirection == Direction.UP)
continue; continue;
if (!collidedState.getMaterial() if (!collidedState.canBeReplaced() && !emptyCollider) {
.isReplaceable() && !emptyCollider) {
return true; return true;
} }

View file

@ -156,7 +156,7 @@ public class ContraptionHandlerClient {
.get(pos); .get(pos);
if (blockInfo == null) if (blockInfo == null)
continue; continue;
BlockState state = blockInfo.state; BlockState state = blockInfo.state();
VoxelShape raytraceShape = state.getShape(contraption.getContraptionWorld(), BlockPos.ZERO.below()); VoxelShape raytraceShape = state.getShape(contraption.getContraptionWorld(), BlockPos.ZERO.below());
if (raytraceShape.isEmpty()) if (raytraceShape.isEmpty())
continue; continue;

View file

@ -39,7 +39,7 @@ public enum ContraptionMovementSetting {
} }
public static boolean allAre(Collection<StructureTemplate.StructureBlockInfo> blocks, ContraptionMovementSetting are) { public static boolean allAre(Collection<StructureTemplate.StructureBlockInfo> blocks, ContraptionMovementSetting are) {
return blocks.stream().anyMatch(b -> get(b.state.getBlock()) == are); return blocks.stream().anyMatch(b -> get(b.state().getBlock()) == are);
} }
public static boolean isNoPickup(Collection<StructureTemplate.StructureBlockInfo> blocks) { public static boolean isNoPickup(Collection<StructureTemplate.StructureBlockInfo> blocks) {

View file

@ -37,7 +37,7 @@ public class ContraptionWorld extends WrappedWorld {
StructureTemplate.StructureBlockInfo blockInfo = contraption.getBlocks().get(pos); StructureTemplate.StructureBlockInfo blockInfo = contraption.getBlocks().get(pos);
if (blockInfo != null) if (blockInfo != null)
return blockInfo.state; return blockInfo.state();
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();
} }

View file

@ -55,7 +55,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
@Override @Override
public void setPos(double x, double y, double z) { public void setPos(double x, double y, double z) {
super.setPos(x, y, z); super.setPos(x, y, z);
if (!level.isClientSide()) if (!level().isClientSide())
return; return;
for (Entity entity : getPassengers()) for (Entity entity : getPassengers())
positionRider(entity); positionRider(entity);
@ -125,7 +125,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
public void setAngle(float angle) { public void setAngle(float angle) {
this.angle = angle; this.angle = angle;
if (!level.isClientSide()) if (!level().isClientSide())
return; return;
for (Entity entity : getPassengers()) for (Entity entity : getPassengers())
positionRider(entity); positionRider(entity);
@ -157,7 +157,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
if (controllerPos == null) if (controllerPos == null)
return; return;
if (!level.isLoaded(controllerPos)) if (!level().isLoaded(controllerPos))
return; return;
IControlContraption controller = getController(); IControlContraption controller = getController();
if (controller == null) { if (controller == null) {
@ -166,7 +166,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
} }
if (!controller.isAttachedTo(this)) { if (!controller.isAttachedTo(this)) {
controller.attach(this); controller.attach(this);
if (level.isClientSide) if (level().isClientSide)
setPos(getX(), getY(), getZ()); setPos(getX(), getY(), getZ());
} }
} }
@ -186,7 +186,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
if (!activeAreaOffset.multiply(VecHelper.axisAlingedPlaneOf(Vec3.atLowerCornerOf(facing.getNormal()))) if (!activeAreaOffset.multiply(VecHelper.axisAlingedPlaneOf(Vec3.atLowerCornerOf(facing.getNormal())))
.equals(Vec3.ZERO)) .equals(Vec3.ZERO))
return false; return false;
if (!VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) if (!VecHelper.onSameAxis(blockInfo.pos(), BlockPos.ZERO, facing.getAxis()))
return false; return false;
context.motion = Vec3.atLowerCornerOf(facing.getNormal()) context.motion = Vec3.atLowerCornerOf(facing.getNormal())
.scale(angleDelta / 360.0); .scale(angleDelta / 360.0);
@ -204,9 +204,9 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
protected IControlContraption getController() { protected IControlContraption getController() {
if (controllerPos == null) if (controllerPos == null)
return null; return null;
if (!level.isLoaded(controllerPos)) if (!level().isLoaded(controllerPos))
return null; return null;
BlockEntity be = level.getBlockEntity(controllerPos); BlockEntity be = level().getBlockEntity(controllerPos);
if (!(be instanceof IControlContraption)) if (!(be instanceof IControlContraption))
return null; return null;
return (IControlContraption) be; return (IControlContraption) be;
@ -214,7 +214,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
@Override @Override
protected StructureTransform makeStructureTransform() { protected StructureTransform makeStructureTransform() {
BlockPos offset = new BlockPos(getAnchorVec().add(.5, .5, .5)); BlockPos offset = BlockPos.containing(getAnchorVec().add(.5, .5, .5));
float xRot = rotationAxis == Axis.X ? angle : 0; float xRot = rotationAxis == Axis.X ? angle : 0;
float yRot = rotationAxis == Axis.Y ? angle : 0; float yRot = rotationAxis == Axis.Y ? angle : 0;
float zRot = rotationAxis == Axis.Z ? angle : 0; float zRot = rotationAxis == Axis.Z ? angle : 0;

View file

@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.IFluidTank;
@ -98,7 +99,7 @@ public class MountedFluidStorage {
if (blockEntity == null) if (blockEntity == null)
return; return;
IFluidHandler teHandler = blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) IFluidHandler teHandler = blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER)
.orElse(null); .orElse(null);
if (!(teHandler instanceof SmartFluidTank)) if (!(teHandler instanceof SmartFluidTank))
return; return;
@ -116,7 +117,7 @@ public class MountedFluidStorage {
if (tank instanceof CreativeSmartFluidTank) if (tank instanceof CreativeSmartFluidTank)
return; return;
LazyOptional<IFluidHandler> capability = be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); LazyOptional<IFluidHandler> capability = be.getCapability(ForgeCapabilities.FLUID_HANDLER);
IFluidHandler teHandler = capability.orElse(null); IFluidHandler teHandler = capability.orElse(null);
if (!(teHandler instanceof SmartFluidTank)) if (!(teHandler instanceof SmartFluidTank))
return; return;

View file

@ -17,8 +17,8 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
@ -51,7 +51,7 @@ public class MountedStorage {
return true; return true;
try { try {
LazyOptional<IItemHandler> capability = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); LazyOptional<IItemHandler> capability = be.getCapability(ForgeCapabilities.ITEM_HANDLER);
IItemHandler handler = capability.orElse(null); IItemHandler handler = capability.orElse(null);
if (handler instanceof ItemStackHandler) if (handler instanceof ItemStackHandler)
return !(handler instanceof ProcessingInventory); return !(handler instanceof ProcessingInventory);
@ -102,7 +102,7 @@ public class MountedStorage {
return; return;
} }
IItemHandler beHandler = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) IItemHandler beHandler = blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER)
.orElse(dummyHandler); .orElse(dummyHandler);
if (beHandler == dummyHandler) if (beHandler == dummyHandler)
return; return;
@ -156,7 +156,7 @@ public class MountedStorage {
return; return;
} }
LazyOptional<IItemHandler> capability = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); LazyOptional<IItemHandler> capability = be.getCapability(ForgeCapabilities.ITEM_HANDLER);
IItemHandler teHandler = capability.orElse(null); IItemHandler teHandler = capability.orElse(null);
if (!(teHandler instanceof IItemHandlerModifiable)) if (!(teHandler instanceof IItemHandlerModifiable))
return; return;

View file

@ -53,7 +53,7 @@ public class MountedStorageManager {
} }
public void entityTick(AbstractContraptionEntity entity) { public void entityTick(AbstractContraptionEntity entity) {
fluidStorage.forEach((pos, mfs) -> mfs.tick(entity, pos, entity.level.isClientSide)); fluidStorage.forEach((pos, mfs) -> mfs.tick(entity, pos, entity.level().isClientSide));
} }
public void createHandlers() { public void createHandlers() {
@ -169,14 +169,14 @@ public class MountedStorageManager {
} }
public void addStorageToWorld(StructureBlockInfo block, BlockEntity blockEntity) { public void addStorageToWorld(StructureBlockInfo block, BlockEntity blockEntity) {
if (storage.containsKey(block.pos)) { if (storage.containsKey(block.pos())) {
MountedStorage mountedStorage = storage.get(block.pos); MountedStorage mountedStorage = storage.get(block.pos());
if (mountedStorage.isValid()) if (mountedStorage.isValid())
mountedStorage.addStorageToWorld(blockEntity); mountedStorage.addStorageToWorld(blockEntity);
} }
if (fluidStorage.containsKey(block.pos)) { if (fluidStorage.containsKey(block.pos())) {
MountedFluidStorage mountedStorage = fluidStorage.get(block.pos); MountedFluidStorage mountedStorage = fluidStorage.get(block.pos());
if (mountedStorage.isValid()) if (mountedStorage.isValid())
mountedStorage.addStorageToWorld(blockEntity); mountedStorage.addStorageToWorld(blockEntity);
} }
@ -214,7 +214,7 @@ public class MountedStorageManager {
} }
public boolean handlePlayerStorageInteraction(Contraption contraption, Player player, BlockPos localPos) { public boolean handlePlayerStorageInteraction(Contraption contraption, Player player, BlockPos localPos) {
if (player.level.isClientSide()) { if (player.level().isClientSide()) {
BlockEntity localBE = contraption.presentBlockEntities.get(localPos); BlockEntity localBE = contraption.presentBlockEntities.get(localPos);
return MountedStorage.canUseAsStorage(localBE); return MountedStorage.canUseAsStorage(localBE);
} }
@ -227,9 +227,9 @@ public class MountedStorageManager {
StructureBlockInfo info = contraption.getBlocks() StructureBlockInfo info = contraption.getBlocks()
.get(localPos); .get(localPos);
if (info != null && info.state.hasProperty(ChestBlock.TYPE)) { if (info != null && info.state().hasProperty(ChestBlock.TYPE)) {
ChestType chestType = info.state.getValue(ChestBlock.TYPE); ChestType chestType = info.state().getValue(ChestBlock.TYPE);
Direction facing = info.state.getOptionalValue(ChestBlock.FACING) Direction facing = info.state().getOptionalValue(ChestBlock.FACING)
.orElse(Direction.SOUTH); .orElse(Direction.SOUTH);
Direction connectedDirection = Direction connectedDirection =
chestType == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise(); chestType == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise();
@ -250,12 +250,12 @@ public class MountedStorageManager {
Supplier<Boolean> stillValid = () -> contraption.entity.isAlive() Supplier<Boolean> stillValid = () -> contraption.entity.isAlive()
&& player.distanceToSqr(contraption.entity.toGlobalVector(Vec3.atCenterOf(localPos), 0)) < 64; && player.distanceToSqr(contraption.entity.toGlobalVector(Vec3.atCenterOf(localPos), 0)) < 64;
Component name = info != null ? info.state.getBlock() Component name = info != null ? info.state().getBlock()
.getName() : Components.literal("Container"); .getName() : Components.literal("Container");
player.openMenu(MountedStorageInteraction.createMenuProvider(name, handler, slotCount, stillValid)); player.openMenu(MountedStorageInteraction.createMenuProvider(name, handler, slotCount, stillValid));
Vec3 soundPos = contraption.entity.toGlobalVector(Vec3.atCenterOf(localPos), 0); Vec3 soundPos = contraption.entity.toGlobalVector(Vec3.atCenterOf(localPos), 0);
player.level.playSound(null, new BlockPos(soundPos), SoundEvents.BARREL_OPEN, SoundSource.BLOCKS, 0.75f, 1f); player.level().playSound(null, BlockPos.containing(soundPos), SoundEvents.BARREL_OPEN, SoundSource.BLOCKS, 0.75f, 1f);
return true; return true;
} }

View file

@ -145,7 +145,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
@Override @Override
public void stopRiding() { public void stopRiding() {
if (!level.isClientSide && isAlive()) if (!level().isClientSide && isAlive())
disassemble(); disassemble();
super.stopRiding(); super.stopRiding();
} }
@ -283,7 +283,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
LazyOptional<MinecartController> capability = LazyOptional<MinecartController> capability =
riding.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); riding.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY);
if (capability.isPresent()) { if (capability.isPresent()) {
if (!level.isClientSide()) if (!level().isClientSide())
capability.orElse(null) capability.orElse(null)
.setStalledExternally(isStalled); .setStalledExternally(isStalled);
} else { } else {
@ -298,7 +298,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
} }
} }
if (level.isClientSide) if (level().isClientSide)
return; return;
if (!isStalled()) { if (!isStalled()) {
@ -373,11 +373,11 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
if (riding instanceof AbstractMinecart) { if (riding instanceof AbstractMinecart) {
AbstractMinecart minecartEntity = (AbstractMinecart) riding; AbstractMinecart minecartEntity = (AbstractMinecart) riding;
BlockPos railPosition = minecartEntity.getCurrentRailPosition(); BlockPos railPosition = minecartEntity.getCurrentRailPosition();
BlockState blockState = level.getBlockState(railPosition); BlockState blockState = level().getBlockState(railPosition);
if (blockState.getBlock() instanceof BaseRailBlock) { if (blockState.getBlock() instanceof BaseRailBlock) {
BaseRailBlock abstractRailBlock = (BaseRailBlock) blockState.getBlock(); BaseRailBlock abstractRailBlock = (BaseRailBlock) blockState.getBlock();
RailShape railDirection = RailShape railDirection =
abstractRailBlock.getRailDirection(blockState, level, railPosition, minecartEntity); abstractRailBlock.getRailDirection(blockState, level(), railPosition, minecartEntity);
motion = VecHelper.project(motion, MinecartSim2020.getRailVec(railDirection)); motion = VecHelper.project(motion, MinecartSim2020.getRailVec(railDirection));
} }
} }
@ -422,12 +422,12 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
int i = Mth.floor(furnaceCart.getX()); int i = Mth.floor(furnaceCart.getX());
int j = Mth.floor(furnaceCart.getY()); int j = Mth.floor(furnaceCart.getY());
int k = Mth.floor(furnaceCart.getZ()); int k = Mth.floor(furnaceCart.getZ());
if (furnaceCart.level.getBlockState(new BlockPos(i, j - 1, k)) if (furnaceCart.level().getBlockState(new BlockPos(i, j - 1, k))
.is(BlockTags.RAILS)) .is(BlockTags.RAILS))
--j; --j;
BlockPos blockpos = new BlockPos(i, j, k); BlockPos blockpos = new BlockPos(i, j, k);
BlockState blockstate = this.level.getBlockState(blockpos); BlockState blockstate = this.level().getBlockState(blockpos);
if (furnaceCart.canUseRail() && blockstate.is(BlockTags.RAILS)) if (furnaceCart.canUseRail() && blockstate.is(BlockTags.RAILS))
if (fuel > 1) if (fuel > 1)
riding.setDeltaMovement(riding.getDeltaMovement() riding.setDeltaMovement(riding.getDeltaMovement()
@ -452,11 +452,11 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
UUID couplingId = getCouplingId(); UUID couplingId = getCouplingId();
if (couplingId == null) if (couplingId == null)
return null; return null;
MinecartController controller = CapabilityMinecartController.getIfPresent(level, couplingId); MinecartController controller = CapabilityMinecartController.getIfPresent(level(), couplingId);
if (controller == null || !controller.isPresent()) if (controller == null || !controller.isPresent())
return null; return null;
UUID coupledCart = controller.getCoupledCart(true); UUID coupledCart = controller.getCoupledCart(true);
MinecartController coupledController = CapabilityMinecartController.getIfPresent(level, coupledCart); MinecartController coupledController = CapabilityMinecartController.getIfPresent(level(), coupledCart);
if (coupledController == null || !coupledController.isPresent()) if (coupledController == null || !coupledController.isPresent())
return null; return null;
return Couple.create(controller, coupledController); return Couple.create(controller, coupledController);
@ -505,7 +505,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
@Override @Override
protected StructureTransform makeStructureTransform() { protected StructureTransform makeStructureTransform() {
BlockPos offset = new BlockPos(getAnchorVec().add(.5, .5, .5)); BlockPos offset = BlockPos.containing(getAnchorVec().add(.5, .5, .5));
return new StructureTransform(offset, 0, -yaw + getInitialYaw(), 0); return new StructureTransform(offset, 0, -yaw + getInitialYaw(), 0);
} }

View file

@ -103,7 +103,7 @@ public class StructureTransform {
} }
public BlockPos applyWithoutOffset(BlockPos localPos) { public BlockPos applyWithoutOffset(BlockPos localPos) {
return new BlockPos(applyWithoutOffset(VecHelper.getCenterOf(localPos))); return BlockPos.containing(applyWithoutOffset(VecHelper.getCenterOf(localPos)));
} }
public BlockPos apply(BlockPos localPos) { public BlockPos apply(BlockPos localPos) {

View file

@ -37,14 +37,14 @@ public class TrainCollisionPacket extends SimplePacketBase {
public boolean handle(Context context) { public boolean handle(Context context) {
context.enqueueWork(() -> { context.enqueueWork(() -> {
ServerPlayer player = context.getSender(); ServerPlayer player = context.getSender();
Level level = player.level; Level level = player.level();
Entity entity = level.getEntity(contraptionEntityId); Entity entity = level.getEntity(contraptionEntityId);
if (!(entity instanceof CarriageContraptionEntity cce)) if (!(entity instanceof CarriageContraptionEntity cce))
return; return;
player.hurt(new EntityDamageSource("create.run_over", cce), (int) damage); player.hurt(new EntityDamageSource("create.run_over", cce), (int) damage);
player.level.playSound(player, entity.blockPosition(), SoundEvents.PLAYER_ATTACK_CRIT, SoundSource.NEUTRAL, player.level().playSound(player, entity.blockPosition(), SoundEvents.PLAYER_ATTACK_CRIT, SoundSource.NEUTRAL,
1, .75f); 1, .75f);
}); });
return true; return true;

View file

@ -27,15 +27,15 @@ public abstract class TranslatingContraption extends Contraption {
public Set<BlockPos> createColliders(Level world, Direction movementDirection) { public Set<BlockPos> createColliders(Level world, Direction movementDirection) {
Set<BlockPos> colliders = new HashSet<>(); Set<BlockPos> colliders = new HashSet<>();
for (StructureBlockInfo info : getBlocks().values()) { for (StructureBlockInfo info : getBlocks().values()) {
BlockPos offsetPos = info.pos.relative(movementDirection); BlockPos offsetPos = info.pos().relative(movementDirection);
if (info.state.getCollisionShape(world, offsetPos) if (info.state().getCollisionShape(world, offsetPos)
.isEmpty()) .isEmpty())
continue; continue;
if (getBlocks().containsKey(offsetPos) if (getBlocks().containsKey(offsetPos)
&& !getBlocks().get(offsetPos).state.getCollisionShape(world, offsetPos) && !getBlocks().get(offsetPos).state().getCollisionShape(world, offsetPos)
.isEmpty()) .isEmpty())
continue; continue;
colliders.add(info.pos); colliders.add(info.pos());
} }
return colliders; return colliders;
} }

View file

@ -21,6 +21,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PacketDistributor;
@ -40,7 +41,7 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
return false; return false;
if (contraption instanceof ElevatorContraption ec) if (contraption instanceof ElevatorContraption ec)
return elevatorInteraction(localPos, contraptionEntity, ec, ctx); return elevatorInteraction(localPos, contraptionEntity, ec, ctx);
if (contraptionEntity.level.isClientSide()) { if (contraptionEntity.level().isClientSide()) {
if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe) if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
cbe.pressButton(); cbe.pressButton();
return true; return true;
@ -70,7 +71,7 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
if (invert) { if (invert) {
for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) { for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) {
MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state); MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state());
if (behaviour == null) if (behaviour == null)
continue; continue;
ItemStack behaviourStack = behaviour.canBeDisabledVia(pair.right); ItemStack behaviourStack = behaviour.canBeDisabledVia(pair.right);
@ -94,8 +95,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
ContraptionControlsBlockEntity.sendStatus(player, filter, !disable); ContraptionControlsBlockEntity.sendStatus(player, filter, !disable);
send(contraptionEntity, filter, disable); send(contraptionEntity, filter, disable);
AllSoundEvents.CONTROLLER_CLICK.play(player.level, null, AllSoundEvents.CONTROLLER_CLICK.play(player.level(), null,
new BlockPos(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)), 1, disable ? 0.8f : 1.5f); BlockPos.containing(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)), 1, disable ? 0.8f : 1.5f);
return true; return true;
} }
@ -107,10 +108,11 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
private boolean elevatorInteraction(BlockPos localPos, AbstractContraptionEntity contraptionEntity, private boolean elevatorInteraction(BlockPos localPos, AbstractContraptionEntity contraptionEntity,
ElevatorContraption contraption, MovementContext ctx) { ElevatorContraption contraption, MovementContext ctx) {
if (!contraptionEntity.level.isClientSide()) { Level level = contraptionEntity.level();
BlockPos pos = new BlockPos(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)); if (!level.isClientSide()) {
AllSoundEvents.CONTROLLER_CLICK.play(contraptionEntity.level, null, pos, 1, 1.5f); BlockPos pos = BlockPos.containing(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1));
AllSoundEvents.CONTRAPTION_ASSEMBLE.play(contraptionEntity.level, null, pos, 0.75f, 0.8f); AllSoundEvents.CONTROLLER_CLICK.play(level, null, pos, 1, 1.5f);
AllSoundEvents.CONTRAPTION_ASSEMBLE.play(level, null, pos, 0.75f, 0.8f);
return true; return true;
} }
if (!(ctx.temporaryData instanceof ElevatorFloorSelection efs)) if (!(ctx.temporaryData instanceof ElevatorFloorSelection efs))

View file

@ -79,7 +79,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
if (entity.getDeltaMovement() if (entity.getDeltaMovement()
.length() < 0.25f) .length() < 0.25f)
return; return;
entity.level.getEntitiesOfClass(Player.class, new AABB(entity.blockPosition()).inflate(32)) entity.level().getEntitiesOfClass(Player.class, new AABB(entity.blockPosition()).inflate(32))
.forEach(AllAdvancements.ANVIL_PLOUGH::awardTo); .forEach(AllAdvancements.ANVIL_PLOUGH::awardTo);
} }

View file

@ -78,7 +78,7 @@ public class PortableStorageInterfaceMovement implements MovementBehaviour {
return; return;
if (context.world.isClientSide) { if (context.world.isClientSide) {
BlockPos pos = new BlockPos(context.position); BlockPos pos = BlockPos.containing(context.position);
if (!findInterface(context, pos)) if (!findInterface(context, pos))
reset(context); reset(context);
return; return;

View file

@ -200,7 +200,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
if (profileForTracks != null) { if (profileForTracks != null) {
for (Couple<Integer> coords : profileForTracks.keys()) { for (Couple<Integer> coords : profileForTracks.keys()) {
float height = profileForTracks.get(coords); float height = profileForTracks.get(coords);
BlockPos targetPosition = new BlockPos(coords.getFirst(), height, coords.getSecond()); BlockPos targetPosition = BlockPos.containing(coords.getFirst(), height, coords.getSecond());
boolean shouldPlaceSlab = height > Math.floor(height) + .45; boolean shouldPlaceSlab = height > Math.floor(height) + .45;
if (startingY == 1 && shouldPlaceSlab && context.world.getBlockState(targetPosition.above()) if (startingY == 1 && shouldPlaceSlab && context.world.getBlockState(targetPosition.above())
.getOptionalValue(SlabBlock.TYPE) .getOptionalValue(SlabBlock.TYPE)
@ -256,8 +256,8 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
Axis axis = Axis.X; Axis axis = Axis.X;
StructureBlockInfo info = context.contraption.getBlocks() StructureBlockInfo info = context.contraption.getBlocks()
.get(BlockPos.ZERO); .get(BlockPos.ZERO);
if (info != null && info.state.hasProperty(StandardBogeyBlock.AXIS)) if (info != null && info.state().hasProperty(StandardBogeyBlock.AXIS))
axis = info.state.getValue(StandardBogeyBlock.AXIS); axis = info.state().getValue(StandardBogeyBlock.AXIS);
Direction orientation = cce.getInitialOrientation(); Direction orientation = cce.getInitialOrientation();
Direction rollerFacing = context.state.getValue(RollerBlock.FACING); Direction rollerFacing = context.state.getValue(RollerBlock.FACING);
@ -308,7 +308,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
for (Couple<Integer> coords : profileForTracks.keys()) { for (Couple<Integer> coords : profileForTracks.keys()) {
float height = profileForTracks.get(coords); float height = profileForTracks.get(coords);
boolean shouldPlaceSlab = height > Math.floor(height) + .45; boolean shouldPlaceSlab = height > Math.floor(height) + .45;
BlockPos targetPosition = new BlockPos(coords.getFirst(), height, coords.getSecond()); BlockPos targetPosition = BlockPos.containing(coords.getFirst(), height, coords.getSecond());
paveSet.add(Pair.of(targetPosition, shouldPlaceSlab)); paveSet.add(Pair.of(targetPosition, shouldPlaceSlab));
} }
@ -451,8 +451,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
BlockState existing = level.getBlockState(targetPos); BlockState existing = level.getBlockState(targetPos);
if (existing.is(toPlace.getBlock())) if (existing.is(toPlace.getBlock()))
return PaveResult.PASS; return PaveResult.PASS;
if (!existing.is(BlockTags.LEAVES) && !existing.getMaterial() if (!existing.is(BlockTags.LEAVES) && !existing.canBeReplaced()
.isReplaceable()
&& !existing.getCollisionShape(level, targetPos) && !existing.getCollisionShape(level, targetPos)
.isEmpty()) .isEmpty())
return PaveResult.FAIL; return PaveResult.FAIL;

View file

@ -36,7 +36,7 @@ public class TrackPaverV2 {
int extent = (int) Math.round((to - from) / direction.length()); int extent = (int) Math.round((to - from) / direction.length());
double length = edge.getLength(); double length = edge.getLength();
BlockPos pos = new BlockPos(edge.getPosition(graph, Mth.clamp(from, 1 / 16f, length - 1 / 16f) / length) BlockPos pos = BlockPos.containing(edge.getPosition(graph, Mth.clamp(from, 1 / 16f, length - 1 / 16f) / length)
.subtract(0, diff.y != 0 ? 1 : 0.5, 0)); .subtract(0, diff.y != 0 ? 1 : 0.5, 0));
paveStraight(task, pos, direction, extent); paveStraight(task, pos, direction, extent);
@ -69,7 +69,7 @@ public class TrackPaverV2 {
Vec3 targetVec = mainPos.add(mainNormal.scale(flip * (int) (currentOffset / 2.0))); Vec3 targetVec = mainPos.add(mainNormal.scale(flip * (int) (currentOffset / 2.0)));
if (!isDiagonalTrack) { if (!isDiagonalTrack) {
toPlaceOn.add(new BlockPos(targetVec)); toPlaceOn.add(BlockPos.containing(targetVec));
continue; continue;
} }
@ -82,14 +82,14 @@ public class TrackPaverV2 {
.add(mainNormal.normalize() .add(mainNormal.normalize()
.scale(flip)) .scale(flip))
.scale(.5); .scale(.5);
toPlaceOn.add(new BlockPos(targetVec.add(sideOffset))); toPlaceOn.add(BlockPos.containing(targetVec.add(sideOffset)));
} }
} }
if (placeRow) { if (placeRow) {
if (Math.abs(currentOffset % 2) == 1) if (Math.abs(currentOffset % 2) == 1)
targetVec = mainPos.add(mainNormal.scale(flip * (int) ((currentOffset + 1) / 2.0))); targetVec = mainPos.add(mainNormal.scale(flip * (int) ((currentOffset + 1) / 2.0)));
toPlaceOn.add(new BlockPos(targetVec)); toPlaceOn.add(BlockPos.containing(targetVec));
} }
} }

View file

@ -84,7 +84,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock {
public void updateEntityAfterFallOn(BlockGetter reader, Entity entity) { public void updateEntityAfterFallOn(BlockGetter reader, Entity entity) {
BlockPos pos = entity.blockPosition(); BlockPos pos = entity.blockPosition();
if (entity instanceof Player || !(entity instanceof LivingEntity) || !canBePickedUp(entity) if (entity instanceof Player || !(entity instanceof LivingEntity) || !canBePickedUp(entity)
|| isSeatOccupied(entity.level, pos)) { || isSeatOccupied(entity.level(), pos)) {
if (entity.isSuppressingBounce()) { if (entity.isSuppressingBounce()) {
super.updateEntityAfterFallOn(reader, entity); super.updateEntityAfterFallOn(reader, entity);
return; return;
@ -101,7 +101,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock {
if (reader.getBlockState(pos) if (reader.getBlockState(pos)
.getBlock() != this) .getBlock() != this)
return; return;
sitDown(entity.level, pos, entity); sitDown(entity.level(), pos, entity);
} }
@Override @Override
@ -165,7 +165,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock {
} }
public static Optional<Entity> getLeashed(Level level, Player player) { public static Optional<Entity> getLeashed(Level level, Player player) {
List<Entity> entities = player.level.getEntities((Entity) null, player.getBoundingBox() List<Entity> entities = player.level().getEntities((Entity) null, player.getBoundingBox()
.inflate(10), e -> true); .inflate(10), e -> true);
for (Entity e : entities) for (Entity e : entities)
if (e instanceof Mob mob && mob.getLeashHolder() == player && SeatBlock.canBePickedUp(e)) if (e instanceof Mob mob && mob.getLeashHolder() == player && SeatBlock.canBePickedUp(e))

View file

@ -85,9 +85,9 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
@Override @Override
public void tick() { public void tick() {
if (level.isClientSide) if (level().isClientSide)
return; return;
boolean blockPresent = level.getBlockState(blockPosition()) boolean blockPresent = level().getBlockState(blockPosition())
.getBlock() instanceof SeatBlock; .getBlock() instanceof SeatBlock;
if (isVehicle() && blockPresent) if (isVehicle() && blockPresent)
return; return;

View file

@ -34,7 +34,7 @@ public class ControlsInteractionBehaviour extends MovingInteractionBehaviour {
return false; return false;
contraptionEntity.setControllingPlayer(player.getUUID()); contraptionEntity.setControllingPlayer(player.getUUID());
if (player.level.isClientSide) if (player.level().isClientSide)
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
() -> () -> ControlsHandler.startControlling(contraptionEntity, localPos)); () -> () -> ControlsHandler.startControlling(contraptionEntity, localPos));
return true; return true;

View file

@ -68,8 +68,8 @@ public class ControlsMovementBehaviour implements MovementBehaviour {
Direction initialOrientation = cce.getInitialOrientation() Direction initialOrientation = cce.getInitialOrientation()
.getCounterClockWise(); .getCounterClockWise();
boolean inverted = false; boolean inverted = false;
if (info != null && info.state.hasProperty(ControlsBlock.FACING)) if (info != null && info.state().hasProperty(ControlsBlock.FACING))
inverted = !info.state.getValue(ControlsBlock.FACING) inverted = !info.state().getValue(ControlsBlock.FACING)
.equals(initialOrientation); .equals(initialOrientation);
if (ControlsHandler.getContraption() == entity && ControlsHandler.getControlsPos() != null if (ControlsHandler.getContraption() == entity && ControlsHandler.getControlsPos() != null

View file

@ -68,7 +68,7 @@ public class BearingContraption extends Contraption {
} }
private BlockState getSailBlock(Pair<StructureBlockInfo, BlockEntity> capture) { private BlockState getSailBlock(Pair<StructureBlockInfo, BlockEntity> capture) {
BlockState state = capture.getKey().state; BlockState state = capture.getKey().state();
if (AllBlocks.COPYCAT_PANEL.has(state) && capture.getRight() instanceof CopycatBlockEntity cbe) if (AllBlocks.COPYCAT_PANEL.has(state) && capture.getRight() instanceof CopycatBlockEntity cbe)
return cbe.getMaterial(); return cbe.getMaterial();
return state; return state;

View file

@ -342,8 +342,7 @@ public class MechanicalBearingBlockEntity extends GeneratingKineticBlockEntity
return false; return false;
BlockState attachedState = level.getBlockState(worldPosition.relative(state.getValue(BearingBlock.FACING))); BlockState attachedState = level.getBlockState(worldPosition.relative(state.getValue(BearingBlock.FACING)));
if (attachedState.getMaterial() if (attachedState.canBeReplaced())
.isReplaceable())
return false; return false;
TooltipHelper.addHint(tooltip, "hint.empty_bearing"); TooltipHelper.addHint(tooltip, "hint.empty_bearing");
return true; return true;

View file

@ -247,8 +247,7 @@ public class SailBlock extends WrenchableDirectionalBlock {
state.getValue(SailBlock.FACING) state.getValue(SailBlock.FACING)
.getAxis(), .getAxis(),
dir -> world.getBlockState(pos.relative(dir)) dir -> world.getBlockState(pos.relative(dir))
.getMaterial() .canBeReplaced());
.isReplaceable());
if (directions.isEmpty()) if (directions.isEmpty())
return PlacementOffset.fail(); return PlacementOffset.fail();

View file

@ -38,7 +38,7 @@ public class BellMovementBehaviour implements MovementBehaviour {
public static void playSound(MovementContext context) { public static void playSound(MovementContext context) {
Level world = context.world; Level world = context.world;
BlockPos pos = new BlockPos(context.position); BlockPos pos = BlockPos.containing(context.position);
Block block = context.state.getBlock(); Block block = context.state.getBlock();
if (block instanceof AbstractBellBlock) { if (block instanceof AbstractBellBlock) {

View file

@ -29,9 +29,9 @@ public class DoorMovingInteraction extends SimpleBlockMovingInteraction {
BlockPos otherPos = currentState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below(); BlockPos otherPos = currentState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below();
StructureBlockInfo info = contraption.getBlocks() StructureBlockInfo info = contraption.getBlocks()
.get(otherPos); .get(otherPos);
if (info.state.hasProperty(DoorBlock.OPEN)) { if (info.state().hasProperty(DoorBlock.OPEN)) {
BlockState newState = info.state.cycle(DoorBlock.OPEN); BlockState newState = info.state().cycle(DoorBlock.OPEN);
setContraptionBlockData(contraption.entity, otherPos, new StructureBlockInfo(info.pos, newState, info.nbt)); setContraptionBlockData(contraption.entity, otherPos, new StructureBlockInfo(info.pos(), newState, info.nbt()));
} }
currentState = currentState.cycle(DoorBlock.OPEN); currentState = currentState.cycle(DoorBlock.OPEN);
@ -45,11 +45,11 @@ public class DoorMovingInteraction extends SimpleBlockMovingInteraction {
pos.relative(hinge == DoorHingeSide.LEFT ? facing.getClockWise() : facing.getCounterClockWise()); pos.relative(hinge == DoorHingeSide.LEFT ? facing.getClockWise() : facing.getCounterClockWise());
StructureBlockInfo doubleInfo = contraption.getBlocks() StructureBlockInfo doubleInfo = contraption.getBlocks()
.get(doublePos); .get(doublePos);
if (doubleInfo != null && SlidingDoorBlock.isDoubleDoor(currentState, hinge, facing, doubleInfo.state)) if (doubleInfo != null && SlidingDoorBlock.isDoubleDoor(currentState, hinge, facing, doubleInfo.state()))
handlePlayerInteraction(null, InteractionHand.MAIN_HAND, doublePos, contraption.entity); handlePlayerInteraction(null, InteractionHand.MAIN_HAND, doublePos, contraption.entity);
} }
float pitch = player.level.random.nextFloat() * 0.1F + 0.9F; float pitch = player.level().random.nextFloat() * 0.1F + 0.9F;
if (sound != null) if (sound != null)
playSound(player, sound, pitch); playSound(player, sound, pitch);
} }

View file

@ -34,10 +34,10 @@ public class MovementContext {
public MovementContext(Level world, StructureBlockInfo info, Contraption contraption) { public MovementContext(Level world, StructureBlockInfo info, Contraption contraption) {
this.world = world; this.world = world;
this.state = info.state; this.state = info.state();
this.blockEntityData = info.nbt; this.blockEntityData = info.nbt();
this.contraption = contraption; this.contraption = contraption;
localPos = info.pos; localPos = info.pos();
disabled = false; disabled = false;
firstMovement = true; firstMovement = true;

View file

@ -16,13 +16,13 @@ public abstract class MovingInteractionBehaviour {
StructureBlockInfo info, MovementContext ctx) { StructureBlockInfo info, MovementContext ctx) {
contraptionEntity.getContraption().getActors().remove(index); contraptionEntity.getContraption().getActors().remove(index);
contraptionEntity.getContraption().getActors().add(index, MutablePair.of(info, ctx)); contraptionEntity.getContraption().getActors().add(index, MutablePair.of(info, ctx));
if (contraptionEntity.level.isClientSide) if (contraptionEntity.level().isClientSide)
contraptionEntity.getContraption().deferInvalidate = true; contraptionEntity.getContraption().deferInvalidate = true;
} }
protected void setContraptionBlockData(AbstractContraptionEntity contraptionEntity, BlockPos pos, protected void setContraptionBlockData(AbstractContraptionEntity contraptionEntity, BlockPos pos,
StructureBlockInfo info) { StructureBlockInfo info) {
if (contraptionEntity.level.isClientSide()) if (contraptionEntity.level().isClientSide())
return; return;
contraptionEntity.setBlock(pos, info); contraptionEntity.setBlock(pos, info);
} }

View file

@ -20,11 +20,11 @@ public abstract class SimpleBlockMovingInteraction extends MovingInteractionBeha
StructureBlockInfo info = contraption.getBlocks() StructureBlockInfo info = contraption.getBlocks()
.get(localPos); .get(localPos);
BlockState newState = handle(player, contraption, localPos, info.state); BlockState newState = handle(player, contraption, localPos, info.state());
if (info.state == newState) if (info.state() == newState)
return false; return false;
setContraptionBlockData(contraptionEntity, localPos, new StructureBlockInfo(info.pos, newState, info.nbt)); setContraptionBlockData(contraptionEntity, localPos, new StructureBlockInfo(info.pos(), newState, info.nbt()));
if (updateColliders()) if (updateColliders())
contraption.invalidateColliders(); contraption.invalidateColliders();
return true; return true;
@ -35,7 +35,7 @@ public abstract class SimpleBlockMovingInteraction extends MovingInteractionBeha
} }
protected void playSound(Player player, SoundEvent sound, float pitch) { protected void playSound(Player player, SoundEvent sound, float pitch) {
player.level.playSound(player, player.blockPosition(), sound, SoundSource.BLOCKS, 0.3f, pitch); player.level().playSound(player, player.blockPosition(), sound, SoundSource.BLOCKS, 0.3f, pitch);
} }
protected abstract BlockState handle(Player player, Contraption contraption, BlockPos pos, protected abstract BlockState handle(Player player, Contraption contraption, BlockPos pos,

View file

@ -15,7 +15,7 @@ public class TrapdoorMovingInteraction extends SimpleBlockMovingInteraction {
protected BlockState handle(Player player, Contraption contraption, BlockPos pos, BlockState currentState) { protected BlockState handle(Player player, Contraption contraption, BlockPos pos, BlockState currentState) {
SoundEvent sound = currentState.getValue(TrapDoorBlock.OPEN) ? SoundEvents.WOODEN_TRAPDOOR_CLOSE SoundEvent sound = currentState.getValue(TrapDoorBlock.OPEN) ? SoundEvents.WOODEN_TRAPDOOR_CLOSE
: SoundEvents.WOODEN_TRAPDOOR_OPEN; : SoundEvents.WOODEN_TRAPDOOR_OPEN;
float pitch = player.level.random.nextFloat() * 0.1F + 0.9F; float pitch = player.level().random.nextFloat() * 0.1F + 0.9F;
playSound(player, sound, pitch); playSound(player, sound, pitch);
return currentState.cycle(TrapDoorBlock.OPEN); return currentState.cycle(TrapDoorBlock.OPEN);
} }

View file

@ -62,7 +62,7 @@ public class ElevatorContraption extends PulleyContraption {
return; return;
ColumnCoords coords = getGlobalColumn(); ColumnCoords coords = getGlobalColumn();
ElevatorColumn column = ElevatorColumn.get(entity.level, coords); ElevatorColumn column = ElevatorColumn.get(entity.level(), coords);
if (column == null) if (column == null)
return; return;

View file

@ -91,10 +91,10 @@ public class ElevatorControlsHandler {
if (info == null) if (info == null)
continue; continue;
if (!AllBlocks.CONTRAPTION_CONTROLS.has(info.state)) if (!AllBlocks.CONTRAPTION_CONTROLS.has(info.state()))
continue; continue;
if (!slot.testHit(info.state, rayTraceResult.getLocation() if (!slot.testHit(info.state(), rayTraceResult.getLocation()
.subtract(Vec3.atLowerCornerOf(pos)))) .subtract(Vec3.atLowerCornerOf(pos))))
continue; continue;
@ -117,8 +117,8 @@ public class ElevatorControlsHandler {
if (prev != efs.currentIndex && !ec.namesList.isEmpty()) { if (prev != efs.currentIndex && !ec.namesList.isEmpty()) {
float pitch = (efs.currentIndex) / (float) (ec.namesList.size()); float pitch = (efs.currentIndex) / (float) (ec.namesList.size());
pitch = Mth.lerp(pitch, 1f, 1.5f); pitch = Mth.lerp(pitch, 1f, 1.5f);
AllSoundEvents.SCROLL_VALUE.play(mc.player.level, mc.player, AllSoundEvents.SCROLL_VALUE.play(mc.player.level(), mc.player,
new BlockPos(contraptionEntity.toGlobalVector(rayTraceResult.getLocation(), 1)), 1, pitch); BlockPos.containing(contraptionEntity.toGlobalVector(rayTraceResult.getLocation(), 1)), 1, pitch);
} }
return true; return true;

View file

@ -81,7 +81,7 @@ public class ElevatorFloorListPacket extends SimplePacketBase {
public boolean handle(Context context) { public boolean handle(Context context) {
context.enqueueWork(() -> { context.enqueueWork(() -> {
ServerPlayer sender = context.getSender(); ServerPlayer sender = context.getSender();
Entity entityByID = sender.getLevel() Entity entityByID = sender.level()
.getEntity(entityId); .getEntity(entityId);
if (!(entityByID instanceof AbstractContraptionEntity ace)) if (!(entityByID instanceof AbstractContraptionEntity ace))
return; return;

View file

@ -246,8 +246,7 @@ public class ElevatorPulleyBlockEntity extends PulleyBlockEntity {
BlockState ropeState = level.getBlockState(ropePos); BlockState ropeState = level.getBlockState(ropePos);
if (!ropeState.getCollisionShape(level, ropePos) if (!ropeState.getCollisionShape(level, ropePos)
.isEmpty() .isEmpty()
&& !ropeState.getMaterial() && !ropeState.canBeReplaced()) {
.isReplaceable()) {
break; break;
} }
++i; ++i;

View file

@ -36,7 +36,7 @@ public class ElevatorTargetFloorPacket extends SimplePacketBase {
public boolean handle(Context context) { public boolean handle(Context context) {
context.enqueueWork(() -> { context.enqueueWork(() -> {
ServerPlayer sender = context.getSender(); ServerPlayer sender = context.getSender();
Entity entityByID = sender.getLevel() Entity entityByID = sender.serverLevel()
.getEntity(entityId); .getEntity(entityId);
if (!(entityByID instanceof AbstractContraptionEntity ace)) if (!(entityByID instanceof AbstractContraptionEntity ace))
return; return;
@ -45,7 +45,7 @@ public class ElevatorTargetFloorPacket extends SimplePacketBase {
if (ace.distanceToSqr(sender) > 50 * 50) if (ace.distanceToSqr(sender) > 50 * 50)
return; return;
Level level = sender.level; Level level = sender.level();
ElevatorColumn elevatorColumn = ElevatorColumn.get(level, ec.getGlobalColumn()); ElevatorColumn elevatorColumn = ElevatorColumn.get(level, ec.getGlobalColumn());
if (!elevatorColumn.contacts.contains(targetY)) if (!elevatorColumn.contacts.contains(targetY))
return; return;

View file

@ -62,7 +62,7 @@ public class GantryContraption extends TranslatingContraption {
@Override @Override
protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) { protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) {
return super.shouldUpdateAfterMovement(info) && !AllBlocks.GANTRY_CARRIAGE.has(info.state); return super.shouldUpdateAfterMovement(info) && !AllBlocks.GANTRY_CARRIAGE.has(info.state());
} }
@Override @Override

View file

@ -59,7 +59,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
return; return;
double prevAxisMotion = axisMotion; double prevAxisMotion = axisMotion;
if (level.isClientSide) { if (level().isClientSide) {
clientOffsetDiff *= .75f; clientOffsetDiff *= .75f;
updateClientMotion(); updateClientMotion();
} }
@ -69,7 +69,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
Vec3 movementVec = getDeltaMovement(); Vec3 movementVec = getDeltaMovement();
if (ContraptionCollider.collideBlocks(this)) { if (ContraptionCollider.collideBlocks(this)) {
if (!level.isClientSide) if (!level().isClientSide)
disassemble(); disassemble();
return; return;
} }
@ -83,8 +83,8 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
} }
if (Math.signum(prevAxisMotion) != Math.signum(axisMotion) && prevAxisMotion != 0) if (Math.signum(prevAxisMotion) != Math.signum(axisMotion) && prevAxisMotion != 0)
contraption.stop(level); contraption.stop(level());
if (!level.isClientSide && (prevAxisMotion != axisMotion || tickCount % 3 == 0)) if (!level().isClientSide && (prevAxisMotion != axisMotion || tickCount % 3 == 0))
sendPacket(); sendPacket();
} }
@ -98,11 +98,11 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
Vec3 movementVec; Vec3 movementVec;
Direction facing = ((GantryContraption) contraption).getFacing(); Direction facing = ((GantryContraption) contraption).getFacing();
Vec3 currentPosition = getAnchorVec().add(.5, .5, .5); Vec3 currentPosition = getAnchorVec().add(.5, .5, .5);
BlockPos gantryShaftPos = new BlockPos(currentPosition).relative(facing.getOpposite()); BlockPos gantryShaftPos = BlockPos.containing(currentPosition).relative(facing.getOpposite());
BlockEntity be = level.getBlockEntity(gantryShaftPos); BlockEntity be = level().getBlockEntity(gantryShaftPos);
if (!(be instanceof GantryShaftBlockEntity) || !AllBlocks.GANTRY_SHAFT.has(be.getBlockState())) { if (!(be instanceof GantryShaftBlockEntity) || !AllBlocks.GANTRY_SHAFT.has(be.getBlockState())) {
if (!level.isClientSide) { if (!level().isClientSide) {
setContraptionMotion(Vec3.ZERO); setContraptionMotion(Vec3.ZERO);
disassemble(); disassemble();
} }
@ -116,7 +116,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
float pinionMovementSpeed = gantryShaftBlockEntity.getPinionMovementSpeed(); float pinionMovementSpeed = gantryShaftBlockEntity.getPinionMovementSpeed();
if (blockState.getValue(GantryShaftBlock.POWERED) || pinionMovementSpeed == 0) { if (blockState.getValue(GantryShaftBlock.POWERED) || pinionMovementSpeed == 0) {
setContraptionMotion(Vec3.ZERO); setContraptionMotion(Vec3.ZERO);
if (!level.isClientSide) if (!level().isClientSide)
disassemble(); disassemble();
return; return;
} }
@ -136,12 +136,12 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
.getStep() < 0))) .getStep() < 0)))
if (!gantryShaftBlockEntity.canAssembleOn()) { if (!gantryShaftBlockEntity.canAssembleOn()) {
setContraptionMotion(Vec3.ZERO); setContraptionMotion(Vec3.ZERO);
if (!level.isClientSide) if (!level().isClientSide)
disassemble(); disassemble();
return; return;
} }
if (level.isClientSide) if (level().isClientSide)
return; return;
axisMotion = pinionMovementSpeed; axisMotion = pinionMovementSpeed;
@ -175,7 +175,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity {
@Override @Override
protected StructureTransform makeStructureTransform() { protected StructureTransform makeStructureTransform() {
return new StructureTransform(new BlockPos(getAnchorVec().add(.5, .5, .5)), 0, 0, 0); return new StructureTransform(BlockPos.containing(getAnchorVec().add(.5, .5, .5)), 0, 0, 0);
} }
@Override @Override

View file

@ -178,13 +178,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
@Override @Override
public void move(MoverType typeIn, Vec3 pos) { public void move(MoverType typeIn, Vec3 pos) {
if (!level.isClientSide && isAlive() && pos.lengthSqr() > 0.0D) if (!level().isClientSide && isAlive() && pos.lengthSqr() > 0.0D)
discard(); discard();
} }
@Override @Override
public void push(double x, double y, double z) { public void push(double x, double y, double z) {
if (!level.isClientSide && isAlive() && x * x + y * y + z * z > 0.0D) if (!level().isClientSide && isAlive() && x * x + y * y + z * z > 0.0D)
discard(); discard();
} }
@ -307,7 +307,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
Vec3 origin = new Vec3(bb.minX, bb.minY, bb.minZ); Vec3 origin = new Vec3(bb.minX, bb.minY, bb.minZ);
Vec3 extents = new Vec3(bb.getXsize(), bb.getYsize(), bb.getZsize()); Vec3 extents = new Vec3(bb.getXsize(), bb.getYsize(), bb.getZsize());
if (!(level instanceof ServerLevel slevel)) if (!(level() instanceof ServerLevel slevel))
return; return;
for (Axis axis : Iterate.axes) { for (Axis axis : Iterate.axes) {

View file

@ -49,7 +49,7 @@ public class SuperGlueHandler {
for (Direction direction : Iterate.directions) { for (Direction direction : Iterate.directions) {
BlockPos relative = pos.relative(direction); BlockPos relative = pos.relative(direction);
if (SuperGlueEntity.isGlued(world, pos, direction, cached) if (SuperGlueEntity.isGlued(world, pos, direction, cached)
&& BlockMovementChecks.isMovementNecessary(world.getBlockState(relative), entity.level, relative)) && BlockMovementChecks.isMovementNecessary(world.getBlockState(relative), entity.level(), relative))
AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(() -> entity), AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(() -> entity),
new GlueEffectPacket(pos, direction, true)); new GlueEffectPacket(pos, direction, true));
} }
@ -60,7 +60,7 @@ public class SuperGlueHandler {
public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, Player placer) { public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, Player placer) {
ItemStack itemstack = placer.getOffhandItem(); ItemStack itemstack = placer.getOffhandItem();
AttributeInstance reachAttribute = placer.getAttribute(ForgeMod.REACH_DISTANCE.get()); AttributeInstance reachAttribute = placer.getAttribute(ForgeMod.BLOCK_REACH.get());
if (!AllItems.SUPER_GLUE.isIn(itemstack) || reachAttribute == null) if (!AllItems.SUPER_GLUE.isIn(itemstack) || reachAttribute == null)
return; return;
if (AllItems.WRENCH.isIn(placer.getMainHandItem())) if (AllItems.WRENCH.isIn(placer.getMainHandItem()))
@ -72,7 +72,7 @@ public class SuperGlueHandler {
Vec3 start = placer.getEyePosition(1); Vec3 start = placer.getEyePosition(1);
Vec3 look = placer.getViewVector(1); Vec3 look = placer.getViewVector(1);
Vec3 end = start.add(look.x * distance, look.y * distance, look.z * distance); Vec3 end = start.add(look.x * distance, look.y * distance, look.z * distance);
Level world = placer.level; Level world = placer.level();
RayTraceWorld rayTraceWorld = RayTraceWorld rayTraceWorld =
new RayTraceWorld(world, (p, state) -> p.equals(pos) ? Blocks.AIR.defaultBlockState() : state); new RayTraceWorld(world, (p, state) -> p.equals(pos) ? Blocks.AIR.defaultBlockState() : state);

View file

@ -34,13 +34,13 @@ public class SuperGlueRemovalPacket extends SimplePacketBase {
public boolean handle(Context context) { public boolean handle(Context context) {
context.enqueueWork(() -> { context.enqueueWork(() -> {
ServerPlayer player = context.getSender(); ServerPlayer player = context.getSender();
Entity entity = player.level.getEntity(entityId); Entity entity = player.level().getEntity(entityId);
if (!(entity instanceof SuperGlueEntity superGlue)) if (!(entity instanceof SuperGlueEntity superGlue))
return; return;
double range = 32; double range = 32;
if (player.distanceToSqr(superGlue.position()) > range * range) if (player.distanceToSqr(superGlue.position()) > range * range)
return; return;
AllSoundEvents.SLIME_ADDED.play(player.level, null, soundSource, 0.5F, 0.5F); AllSoundEvents.SLIME_ADDED.play(player.level(), null, soundSource, 0.5F, 0.5F);
superGlue.spawnParticles(); superGlue.spawnParticles();
entity.discard(); entity.discard();
}); });

View file

@ -74,7 +74,7 @@ public class SuperGlueSelectionHandler {
selected = null; selected = null;
if (firstPos == null) { if (firstPos == null) {
double range = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) double range = player.getAttribute(ForgeMod.BLOCK_REACH.get())
.getValue() + 1; .getValue() + 1;
Vec3 traceOrigin = RaycastHelper.getTraceOrigin(player); Vec3 traceOrigin = RaycastHelper.getTraceOrigin(player);
Vec3 traceTarget = RaycastHelper.getTraceTarget(player, range, traceOrigin); Vec3 traceTarget = RaycastHelper.getTraceTarget(player, range, traceOrigin);
@ -90,7 +90,7 @@ public class SuperGlueSelectionHandler {
if (distanceToSqr > bestDistance) if (distanceToSqr > bestDistance)
continue; continue;
selected = glueEntity; selected = glueEntity;
soundSourceForRemoval = new BlockPos(vec3); soundSourceForRemoval = BlockPos.containing(vec3);
bestDistance = distanceToSqr; bestDistance = distanceToSqr;
} }
@ -252,8 +252,8 @@ public class SuperGlueSelectionHandler {
public void confirm() { public void confirm() {
LocalPlayer player = Minecraft.getInstance().player; LocalPlayer player = Minecraft.getInstance().player;
AllPackets.getChannel().sendToServer(new SuperGlueSelectionPacket(firstPos, hoveredPos)); AllPackets.getChannel().sendToServer(new SuperGlueSelectionPacket(firstPos, hoveredPos));
AllSoundEvents.SLIME_ADDED.playAt(player.level, hoveredPos, 0.5F, 0.95F, false); AllSoundEvents.SLIME_ADDED.playAt(player.level(), hoveredPos, 0.5F, 0.95F, false);
player.level.playSound(player, hoveredPos, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.75f, 1); player.level().playSound(player, hoveredPos, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.75f, 1);
if (currentCluster != null) if (currentCluster != null)
CreateClient.OUTLINER.showCluster(clusterOutlineSlot, currentCluster) CreateClient.OUTLINER.showCluster(clusterOutlineSlot, currentCluster)

View file

@ -39,14 +39,14 @@ public class SuperGlueSelectionPacket extends SimplePacketBase {
context.enqueueWork(() -> { context.enqueueWork(() -> {
ServerPlayer player = context.getSender(); ServerPlayer player = context.getSender();
double range = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) double range = player.getAttribute(ForgeMod.BLOCK_REACH.get())
.getValue() + 2; .getValue() + 2;
if (player.distanceToSqr(Vec3.atCenterOf(to)) > range * range) if (player.distanceToSqr(Vec3.atCenterOf(to)) > range * range)
return; return;
if (!to.closerThan(from, 25)) if (!to.closerThan(from, 25))
return; return;
Set<BlockPos> group = SuperGlueSelectionHelper.searchGlueGroup(player.level, from, to, false); Set<BlockPos> group = SuperGlueSelectionHelper.searchGlueGroup(player.level(), from, to, false);
if (group == null) if (group == null)
return; return;
if (!group.contains(to)) if (!group.contains(to))
@ -56,8 +56,8 @@ public class SuperGlueSelectionPacket extends SimplePacketBase {
AABB bb = SuperGlueEntity.span(from, to); AABB bb = SuperGlueEntity.span(from, to);
SuperGlueSelectionHelper.collectGlueFromInventory(player, 1, false); SuperGlueSelectionHelper.collectGlueFromInventory(player, 1, false);
SuperGlueEntity entity = new SuperGlueEntity(player.level, bb); SuperGlueEntity entity = new SuperGlueEntity(player.level(), bb);
player.level.addFreshEntity(entity); player.level().addFreshEntity(entity);
entity.spawnParticles(); entity.spawnParticles();
AllAdvancements.SUPER_GLUE.awardTo(player); AllAdvancements.SUPER_GLUE.awardTo(player);

View file

@ -32,7 +32,7 @@ public class CouplingCreationPacket extends SimplePacketBase {
context.enqueueWork(() -> { context.enqueueWork(() -> {
ServerPlayer sender = context.getSender(); ServerPlayer sender = context.getSender();
if (sender != null) if (sender != null)
CouplingHandler.tryToCoupleCarts(sender, sender.level, id1, id2); CouplingHandler.tryToCoupleCarts(sender, sender.level(), id1, id2);
}); });
return true; return true;
} }

View file

@ -105,7 +105,7 @@ public class CouplingPhysics {
int y = Mth.floor(vec.y()); int y = Mth.floor(vec.y());
int z = Mth.floor(vec.z()); int z = Mth.floor(vec.z());
BlockPos pos = new BlockPos(x, y - 1, z); BlockPos pos = new BlockPos(x, y - 1, z);
if (minecart.level.getBlockState(pos).is(BlockTags.RAILS)) pos = pos.below(); if (minecart.level().getBlockState(pos).is(BlockTags.RAILS)) pos = pos.below();
BlockPos railPosition = pos; BlockPos railPosition = pos;
BlockState railState = world.getBlockState(railPosition.above()); BlockState railState = world.getBlockState(railPosition.above());
if (!(railState.getBlock() instanceof BaseRailBlock)) if (!(railState.getBlock() instanceof BaseRailBlock))

View file

@ -51,8 +51,9 @@ public class CouplingRenderer {
if (carts.getFirst() == null || carts.getSecond() == null) if (carts.getFirst() == null || carts.getSecond() == null)
return; return;
Couple<Integer> lightValues = carts.map(c -> LevelRenderer.getLightColor(world, new BlockPos(c.getBoundingBox() Couple<Integer> lightValues =
.getCenter()))); carts.map(c -> LevelRenderer.getLightColor(world, BlockPos.containing(c.getBoundingBox()
.getCenter())));
Vec3 center = carts.getFirst() Vec3 center = carts.getFirst()
.position() .position()

View file

@ -83,7 +83,7 @@ public class MinecartSim2020 {
actualY = cartPos.getY() + 1; actualY = cartPos.getY() + 1;
BaseRailBlock abstractrailblock = (BaseRailBlock) trackState.getBlock(); BaseRailBlock abstractrailblock = (BaseRailBlock) trackState.getBlock();
RailShape railshape = abstractrailblock.getRailDirection(trackState, cart.level, cartPos, cart); RailShape railshape = abstractrailblock.getRailDirection(trackState, cart.level(), cartPos, cart);
switch (railshape) { switch (railshape) {
case ASCENDING_EAST: case ASCENDING_EAST:
forcedMovement = forcedMovement.add(-1 * cart.getSlopeAdjustment(), 0.0D, 0.0D); forcedMovement = forcedMovement.add(-1 * cart.getSlopeAdjustment(), 0.0D, 0.0D);

View file

@ -99,7 +99,7 @@ public class MinecartController implements INBTSerializable<CompoundTag> {
if (passengers.isEmpty() || !(passengers.get(0) instanceof AbstractContraptionEntity)) { if (passengers.isEmpty() || !(passengers.get(0) instanceof AbstractContraptionEntity)) {
return; return;
} }
Level world = cart.level; Level world = cart.level();
int i = Mth.floor(cart.getX()); int i = Mth.floor(cart.getX());
int j = Mth.floor(cart.getY()); int j = Mth.floor(cart.getY());
int k = Mth.floor(cart.getZ()); int k = Mth.floor(cart.getZ());

View file

@ -44,7 +44,6 @@ import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.RailShape; import net.minecraft.world.level.block.state.properties.RailShape;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -103,7 +102,7 @@ public class MinecartContraptionItem extends Item {
d3 = 0.1D; d3 = 0.1D;
} }
} else { } else {
if (blockstate.getMaterial() != Material.AIR || !world.getBlockState(blockpos.below()) if (!blockstate.isAir() || !world.getBlockState(blockpos.below())
.is(BlockTags.RAILS)) { .is(BlockTags.RAILS)) {
return this.behaviourDefaultDispenseItem.dispense(source, stack); return this.behaviourDefaultDispenseItem.dispense(source, stack);
} }
@ -244,7 +243,7 @@ public class MinecartContraptionItem extends Item {
contraption.stop(event.getLevel()); contraption.stop(event.getLevel());
for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors()) for (MutablePair<StructureBlockInfo, MovementContext> pair : contraption.getActors())
if (AllMovementBehaviours.getBehaviour(pair.left.state)instanceof PortableStorageInterfaceMovement psim) if (AllMovementBehaviours.getBehaviour(pair.left.state())instanceof PortableStorageInterfaceMovement psim)
psim.reset(pair.right); psim.reset(pair.right);
ItemStack generatedStack = create(type, oce).setHoverName(entity.getCustomName()); ItemStack generatedStack = create(type, oce).setHoverName(entity.getCustomName());

View file

@ -83,11 +83,11 @@ public class MountedContraption extends Contraption {
protected Pair<StructureBlockInfo, BlockEntity> capture(Level world, BlockPos pos) { protected Pair<StructureBlockInfo, BlockEntity> capture(Level world, BlockPos pos) {
Pair<StructureBlockInfo, BlockEntity> pair = super.capture(world, pos); Pair<StructureBlockInfo, BlockEntity> pair = super.capture(world, pos);
StructureBlockInfo capture = pair.getKey(); StructureBlockInfo capture = pair.getKey();
if (!AllBlocks.CART_ASSEMBLER.has(capture.state)) if (!AllBlocks.CART_ASSEMBLER.has(capture.state()))
return pair; return pair;
Pair<StructureBlockInfo, BlockEntity> anchorSwap = Pair<StructureBlockInfo, BlockEntity> anchorSwap =
Pair.of(new StructureBlockInfo(pos, CartAssemblerBlock.createAnchor(capture.state), null), pair.getValue()); Pair.of(new StructureBlockInfo(pos, CartAssemblerBlock.createAnchor(capture.state()), null), pair.getValue());
if (pos.equals(anchor) || connectedCart != null) if (pos.equals(anchor) || connectedCart != null)
return anchorSwap; return anchorSwap;

View file

@ -139,9 +139,9 @@ public class PistonContraption extends TranslatingContraption {
bounds = new AABB(0, 0, 0, 0, 0, 0); bounds = new AABB(0, 0, 0, 0, 0, 0);
for (StructureBlockInfo pole : poles) { for (StructureBlockInfo pole : poles) {
BlockPos relPos = pole.pos.relative(direction, -extensionsInFront); BlockPos relPos = pole.pos().relative(direction, -extensionsInFront);
BlockPos localPos = relPos.subtract(anchor); BlockPos localPos = relPos.subtract(anchor);
getBlocks().put(localPos, new StructureBlockInfo(localPos, pole.state, null)); getBlocks().put(localPos, new StructureBlockInfo(localPos, pole.state(), null));
//pistonExtensionCollisionBox = pistonExtensionCollisionBox.union(new AABB(localPos)); //pistonExtensionCollisionBox = pistonExtensionCollisionBox.union(new AABB(localPos));
} }

View file

@ -17,7 +17,7 @@ public class PulleyLighter extends ContraptionLighter<PulleyContraption> {
GridAlignedBB bounds = GridAlignedBB.from(contraption.bounds); GridAlignedBB bounds = GridAlignedBB.from(contraption.bounds);
Level world = contraption.entity.level; Level world = contraption.entity.level();
BlockPos.MutableBlockPos pos = contraption.anchor.mutable(); BlockPos.MutableBlockPos pos = contraption.anchor.mutable();
while (!AllBlocks.ROPE_PULLEY.has(world.getBlockState(pos)) && pos.getY() < world.getMaxBuildHeight()) while (!AllBlocks.ROPE_PULLEY.has(world.getBlockState(pos)) && pos.getY() < world.getMaxBuildHeight())

View file

@ -63,7 +63,7 @@ public class ContraptionInstanceManager extends BlockEntityInstanceManager {
if (contraption.isHiddenInPortal(context.localPos)) if (contraption.isHiddenInPortal(context.localPos))
return null; return null;
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state); MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state());
if (movementBehaviour != null && movementBehaviour.hasSpecialInstancedRendering()) { if (movementBehaviour != null && movementBehaviour.hasSpecialInstancedRendering()) {
ActorInstance instance = movementBehaviour.createInstance(materialManager, renderWorld, context); ActorInstance instance = movementBehaviour.createInstance(materialManager, renderWorld, context);

View file

@ -20,12 +20,12 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
protected ContraptionLighter(C contraption) { protected ContraptionLighter(C contraption) {
this.contraption = contraption; this.contraption = contraption;
lightUpdater = LightUpdater.get(contraption.entity.level); lightUpdater = LightUpdater.get(contraption.entity.level());
bounds = getContraptionBounds(); bounds = getContraptionBounds();
growBoundsForEdgeData(bounds); growBoundsForEdgeData(bounds);
lightVolume = new GPULightVolume(contraption.entity.level, bounds); lightVolume = new GPULightVolume(contraption.entity.level(), bounds);
lightVolume.initialize(); lightVolume.initialize();
scheduleRebuild = true; scheduleRebuild = true;

View file

@ -54,7 +54,7 @@ public class ContraptionRenderDispatcher {
* @return true if there was a renderer associated with the given contraption. * @return true if there was a renderer associated with the given contraption.
*/ */
public static boolean invalidate(Contraption contraption) { public static boolean invalidate(Contraption contraption) {
Level level = contraption.entity.level; Level level = contraption.entity.level();
return WORLDS.get(level) return WORLDS.get(level)
.invalidate(contraption); .invalidate(contraption);
@ -94,7 +94,7 @@ public class ContraptionRenderDispatcher {
public static void renderFromEntity(AbstractContraptionEntity entity, Contraption contraption, public static void renderFromEntity(AbstractContraptionEntity entity, Contraption contraption,
MultiBufferSource buffers) { MultiBufferSource buffers) {
Level world = entity.level; Level world = entity.level();
ContraptionRenderInfo renderInfo = WORLDS.get(world) ContraptionRenderInfo renderInfo = WORLDS.get(world)
.getRenderInfo(contraption); .getRenderInfo(contraption);
@ -131,7 +131,7 @@ public class ContraptionRenderDispatcher {
for (StructureTemplate.StructureBlockInfo info : c.getBlocks() for (StructureTemplate.StructureBlockInfo info : c.getBlocks()
.values()) .values())
// Skip individual lighting updates to prevent lag with large contraptions // Skip individual lighting updates to prevent lag with large contraptions
renderWorld.setBlock(info.pos, info.state, Block.UPDATE_SUPPRESS_LIGHT); renderWorld.setBlock(info.pos(), info.state(), Block.UPDATE_SUPPRESS_LIGHT);
renderWorld.runLightingEngine(); renderWorld.runLightingEngine();
return renderWorld; return renderWorld;
@ -155,13 +155,13 @@ public class ContraptionRenderDispatcher {
context.world = world; context.world = world;
StructureTemplate.StructureBlockInfo blockInfo = actor.getLeft(); StructureTemplate.StructureBlockInfo blockInfo = actor.getLeft();
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state); MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state());
if (movementBehaviour != null) { if (movementBehaviour != null) {
if (c.isHiddenInPortal(blockInfo.pos)) if (c.isHiddenInPortal(blockInfo.pos()))
continue; continue;
m.pushPose(); m.pushPose();
TransformStack.cast(m) TransformStack.cast(m)
.translate(blockInfo.pos); .translate(blockInfo.pos());
movementBehaviour.renderInContraption(context, renderWorld, matrices, buffer); movementBehaviour.renderInContraption(context, renderWorld, matrices, buffer);
m.popPose(); m.popPose();
} }

View file

@ -49,13 +49,13 @@ public class ContraptionInteractionPacket extends SimplePacketBase {
ServerPlayer sender = context.getSender(); ServerPlayer sender = context.getSender();
if (sender == null) if (sender == null)
return; return;
Entity entityByID = sender.getLevel().getEntity(target); Entity entityByID = sender.level().getEntity(target);
if (!(entityByID instanceof AbstractContraptionEntity)) if (!(entityByID instanceof AbstractContraptionEntity))
return; return;
AbstractContraptionEntity contraptionEntity = (AbstractContraptionEntity) entityByID; AbstractContraptionEntity contraptionEntity = (AbstractContraptionEntity) entityByID;
AABB bb = contraptionEntity.getBoundingBox(); AABB bb = contraptionEntity.getBoundingBox();
double boundsExtra = Math.max(bb.getXsize(), bb.getYsize()); double boundsExtra = Math.max(bb.getXsize(), bb.getYsize());
double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue() + 10 + boundsExtra; double d = sender.getAttribute(ForgeMod.BLOCK_REACH.get()).getValue() + 10 + boundsExtra;
if (!sender.hasLineOfSight(entityByID)) if (!sender.hasLineOfSight(entityByID))
d -= 3; d -= 3;
d *= d; d *= d;

View file

@ -92,7 +92,7 @@ public class MetalLadderBlock extends LadderBlock implements IWrenchable {
int range = AllConfigs.server().equipment.placementAssistRange.get(); int range = AllConfigs.server().equipment.placementAssistRange.get();
if (player != null) { if (player != null) {
AttributeInstance reach = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); AttributeInstance reach = player.getAttribute(ForgeMod.BLOCK_REACH.get());
if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier)) if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier))
range += 4; range += 4;
} }
@ -107,8 +107,7 @@ public class MetalLadderBlock extends LadderBlock implements IWrenchable {
if (!state.canSurvive(world, newPos)) if (!state.canSurvive(world, newPos))
return PlacementOffset.fail(); return PlacementOffset.fail();
if (newState.getMaterial() if (newState.canBeReplaced())
.isReplaceable())
return PlacementOffset.success(newPos, bState -> bState.setValue(FACING, state.getValue(FACING))); return PlacementOffset.success(newPos, bState -> bState.setValue(FACING, state.getValue(FACING)));
return PlacementOffset.fail(); return PlacementOffset.fail();
} }

View file

@ -225,8 +225,7 @@ public class CopycatPanelBlock extends WaterloggedCopycatBlock {
state.getValue(FACING) state.getValue(FACING)
.getAxis(), .getAxis(),
dir -> world.getBlockState(pos.relative(dir)) dir -> world.getBlockState(pos.relative(dir))
.getMaterial() .canBeReplaced());
.isReplaceable());
if (directions.isEmpty()) if (directions.isEmpty())
return PlacementOffset.fail(); return PlacementOffset.fail();

View file

@ -332,8 +332,7 @@ public class GirderBlock extends Block implements SimpleWaterloggedBlock, IWrenc
VoxelShape shape = blockState.getShape(world, relative); VoxelShape shape = blockState.getShape(world, relative);
if (shape.isEmpty()) if (shape.isEmpty())
return false; return false;
if (Block.isFaceFull(shape, side.getOpposite()) && blockState.getMaterial() if (Block.isFaceFull(shape, side.getOpposite()) && blockState.isSolid())
.isSolidBlocking())
return true; return true;
return AbstractChuteBlock.getChuteFacing(blockState) == Direction.DOWN; return AbstractChuteBlock.getChuteFacing(blockState) == Direction.DOWN;
} }

View file

@ -81,7 +81,7 @@ public class GirderPlacementHelper implements IPlacementHelper {
for (Direction dir : directions) { for (Direction dir : directions) {
int range = AllConfigs.server().equipment.placementAssistRange.get(); int range = AllConfigs.server().equipment.placementAssistRange.get();
if (player != null) { if (player != null) {
AttributeInstance reach = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); AttributeInstance reach = player.getAttribute(ForgeMod.BLOCK_REACH.get());
if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier)) if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier))
range += 4; range += 4;
} }
@ -92,8 +92,7 @@ public class GirderPlacementHelper implements IPlacementHelper {
BlockPos newPos = pos.relative(dir, poles + 1); BlockPos newPos = pos.relative(dir, poles + 1);
BlockState newState = world.getBlockState(newPos); BlockState newState = world.getBlockState(newPos);
if (!newState.getMaterial() if (!newState.canBeReplaced())
.isReplaceable())
continue; continue;
return PlacementOffset.success(newPos, return PlacementOffset.success(newPos,

View file

@ -25,7 +25,7 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.GlassBlock; import net.minecraft.world.level.block.GlassBlock;
import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
public class AllPaletteBlocks { public class AllPaletteBlocks {
@ -73,7 +73,7 @@ public class AllPaletteBlocks {
WARPED_WINDOW = woodenWindowBlock(WoodType.WARPED, Blocks.WARPED_PLANKS), WARPED_WINDOW = woodenWindowBlock(WoodType.WARPED, Blocks.WARPED_PLANKS),
ORNATE_IRON_WINDOW = ORNATE_IRON_WINDOW =
customWindowBlock("ornate_iron_window", () -> Items.IRON_NUGGET, () -> AllSpriteShifts.ORNATE_IRON_WINDOW, customWindowBlock("ornate_iron_window", () -> Items.IRON_NUGGET, () -> AllSpriteShifts.ORNATE_IRON_WINDOW,
() -> RenderType::cutout, false, () -> MaterialColor.TERRACOTTA_LIGHT_GRAY); () -> RenderType::cutout, false, () -> MapColor.TERRACOTTA_LIGHT_GRAY);
public static final BlockEntry<ConnectedGlassPaneBlock> OAK_WINDOW_PANE = public static final BlockEntry<ConnectedGlassPaneBlock> OAK_WINDOW_PANE =
woodenWindowPane(WoodType.OAK, OAK_WINDOW), woodenWindowPane(WoodType.OAK, OAK_WINDOW),

View file

@ -15,7 +15,7 @@ import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
public enum AllPaletteStoneTypes { public enum AllPaletteStoneTypes {
@ -30,35 +30,35 @@ public enum AllPaletteStoneTypes {
ASURINE(STANDARD_RANGE, r -> r.paletteStoneBlock("asurine", () -> Blocks.DEEPSLATE, true, true) ASURINE(STANDARD_RANGE, r -> r.paletteStoneBlock("asurine", () -> Blocks.DEEPSLATE, true, true)
.properties(p -> p.destroyTime(1.25f) .properties(p -> p.destroyTime(1.25f)
.color(MaterialColor.COLOR_BLUE)) .mapColor(MapColor.COLOR_BLUE))
.register()), .register()),
CRIMSITE(STANDARD_RANGE, r -> r.paletteStoneBlock("crimsite", () -> Blocks.DEEPSLATE, true, true) CRIMSITE(STANDARD_RANGE, r -> r.paletteStoneBlock("crimsite", () -> Blocks.DEEPSLATE, true, true)
.properties(p -> p.destroyTime(1.25f) .properties(p -> p.destroyTime(1.25f)
.color(MaterialColor.COLOR_RED)) .mapColor(MapColor.COLOR_RED))
.register()), .register()),
LIMESTONE(STANDARD_RANGE, r -> r.paletteStoneBlock("limestone", () -> Blocks.SANDSTONE, true, false) LIMESTONE(STANDARD_RANGE, r -> r.paletteStoneBlock("limestone", () -> Blocks.SANDSTONE, true, false)
.properties(p -> p.destroyTime(1.25f) .properties(p -> p.destroyTime(1.25f)
.color(MaterialColor.SAND)) .mapColor(MapColor.SAND))
.register()), .register()),
OCHRUM(STANDARD_RANGE, r -> r.paletteStoneBlock("ochrum", () -> Blocks.CALCITE, true, true) OCHRUM(STANDARD_RANGE, r -> r.paletteStoneBlock("ochrum", () -> Blocks.CALCITE, true, true)
.properties(p -> p.destroyTime(1.25f) .properties(p -> p.destroyTime(1.25f)
.color(MaterialColor.TERRACOTTA_YELLOW)) .mapColor(MapColor.TERRACOTTA_YELLOW))
.register()), .register()),
SCORIA(STANDARD_RANGE, r -> r.paletteStoneBlock("scoria", () -> Blocks.BLACKSTONE, true, false) SCORIA(STANDARD_RANGE, r -> r.paletteStoneBlock("scoria", () -> Blocks.BLACKSTONE, true, false)
.properties(p -> p.color(MaterialColor.COLOR_BROWN)) .properties(p -> p.mapColor(MapColor.COLOR_BROWN))
.register()), .register()),
SCORCHIA(STANDARD_RANGE, r -> r.paletteStoneBlock("scorchia", () -> Blocks.BLACKSTONE, true, false) SCORCHIA(STANDARD_RANGE, r -> r.paletteStoneBlock("scorchia", () -> Blocks.BLACKSTONE, true, false)
.properties(p -> p.color(MaterialColor.TERRACOTTA_GRAY)) .properties(p -> p.mapColor(MapColor.TERRACOTTA_GRAY))
.register()), .register()),
VERIDIUM(STANDARD_RANGE, r -> r.paletteStoneBlock("veridium", () -> Blocks.TUFF, true, true) VERIDIUM(STANDARD_RANGE, r -> r.paletteStoneBlock("veridium", () -> Blocks.TUFF, true, true)
.properties(p -> p.destroyTime(1.25f) .properties(p -> p.destroyTime(1.25f)
.color(MaterialColor.WARPED_NYLIUM)) .mapColor(MapColor.WARPED_NYLIUM))
.register()) .register())
; ;

View file

@ -7,11 +7,11 @@ import com.simibubi.create.foundation.utility.AngleHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.AttachFace; import net.minecraft.world.level.block.state.properties.AttachFace;
@ -46,7 +46,7 @@ public class PlacardRenderer extends SafeBlockEntityRenderer<PlacardBlockEntity>
.translate(0, 0, 4.5 / 16f) .translate(0, 0, 4.5 / 16f)
.scale(blockItem ? .5f : .375f); .scale(blockItem ? .5f : .375f);
itemRenderer.renderStatic(heldItem, TransformType.FIXED, light, overlay, ms, buffer, 0); itemRenderer.renderStatic(heldItem, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0);
ms.popPose(); ms.popPose();
} }

View file

@ -49,7 +49,7 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour {
.get(context.localPos); .get(context.localPos);
if (structureBlockInfo == null) if (structureBlockInfo == null)
return; return;
boolean open = SlidingDoorBlockEntity.isOpen(structureBlockInfo.state); boolean open = SlidingDoorBlockEntity.isOpen(structureBlockInfo.state());
if (!context.world.isClientSide()) if (!context.world.isClientSide())
tickOpen(context, open); tickOpen(context, open);
@ -78,26 +78,26 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour {
StructureBlockInfo info = contraption.getBlocks() StructureBlockInfo info = contraption.getBlocks()
.get(pos); .get(pos);
if (info == null || !info.state.hasProperty(DoorBlock.OPEN)) if (info == null || !info.state().hasProperty(DoorBlock.OPEN))
return; return;
toggleDoor(pos, contraption, info); toggleDoor(pos, contraption, info);
if (shouldOpen) if (shouldOpen)
context.world.playSound(null, new BlockPos(context.position), SoundEvents.IRON_DOOR_OPEN, context.world.playSound(null, BlockPos.containing(context.position), SoundEvents.IRON_DOOR_OPEN,
SoundSource.BLOCKS, .125f, 1); SoundSource.BLOCKS, .125f, 1);
} }
private void toggleDoor(BlockPos pos, Contraption contraption, StructureBlockInfo info) { private void toggleDoor(BlockPos pos, Contraption contraption, StructureBlockInfo info) {
BlockState newState = info.state.cycle(DoorBlock.OPEN); BlockState newState = info.state().cycle(DoorBlock.OPEN);
contraption.entity.setBlock(pos, new StructureBlockInfo(info.pos, newState, info.nbt)); contraption.entity.setBlock(pos, new StructureBlockInfo(info.pos(), newState, info.nbt()));
BlockPos otherPos = newState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below(); BlockPos otherPos = newState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below();
info = contraption.getBlocks() info = contraption.getBlocks()
.get(otherPos); .get(otherPos);
if (info != null && info.state.hasProperty(DoorBlock.OPEN)) { if (info != null && info.state().hasProperty(DoorBlock.OPEN)) {
newState = info.state.cycle(DoorBlock.OPEN); newState = info.state().cycle(DoorBlock.OPEN);
contraption.entity.setBlock(otherPos, new StructureBlockInfo(info.pos, newState, info.nbt)); contraption.entity.setBlock(otherPos, new StructureBlockInfo(info.pos(), newState, info.nbt()));
contraption.invalidateColliders(); contraption.invalidateColliders();
} }
} }

View file

@ -156,8 +156,7 @@ public class WhistleBlock extends Block implements IBE<WhistleBlockEntity>, IWre
continue; continue;
} }
if (!blockState.getMaterial() if (!blockState.canBeReplaced())
.isReplaceable())
return; return;
pLevel.setBlock(currentPos, AllBlocks.STEAM_WHISTLE_EXTENSION.getDefaultState() pLevel.setBlock(currentPos, AllBlocks.STEAM_WHISTLE_EXTENSION.getDefaultState()

View file

@ -63,7 +63,7 @@ public class BacktankArmorLayer<T extends LivingEntity, M extends EntityModel<T>
.rotateY(180) .rotateY(180)
.unCentre() .unCentre()
.translate(0, 6.5f / 16, 11f / 16) .translate(0, 6.5f / 16, 11f / 16)
.rotate(Direction.EAST, AngleHelper.rad(2 * AnimationTickHolder.getRenderTime(entity.level) % 360)) .rotate(Direction.EAST, AngleHelper.rad(2 * AnimationTickHolder.getRenderTime(entity.level()) % 360))
.translate(0, -6.5f / 16, -11f / 16); .translate(0, -6.5f / 16, -11f / 16);
cogs.forEntityRender() cogs.forEntityRender()

View file

@ -63,8 +63,8 @@ public class BacktankUtil {
boolean depleted = threshold == 1; boolean depleted = threshold == 1;
MutableComponent component = Lang.translateDirect(depleted ? "backtank.depleted" : "backtank.low"); MutableComponent component = Lang.translateDirect(depleted ? "backtank.depleted" : "backtank.low");
AllSoundEvents.DENY.play(player.level, null, player.blockPosition(), 1, 1.25f); AllSoundEvents.DENY.play(player.level(), null, player.blockPosition(), 1, 1.25f);
AllSoundEvents.STEAM.play(player.level, null, player.blockPosition(), .5f, .5f); AllSoundEvents.STEAM.play(player.level(), null, player.blockPosition(), .5f, .5f);
player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10)); player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10));
player.connection.send(new ClientboundSetSubtitleTextPacket( player.connection.send(new ClientboundSetSubtitleTextPacket(

View file

@ -50,9 +50,9 @@ public class DivingBootsItem extends BaseArmorItem {
Vec3 motion = entity.getDeltaMovement(); Vec3 motion = entity.getDeltaMovement();
boolean isJumping = entity.jumping; boolean isJumping = entity.jumping;
entity.setOnGround(entity.isOnGround() || entity.verticalCollision); entity.setOnGround(entity.onGround() || entity.verticalCollision);
if (isJumping && entity.isOnGround()) { if (isJumping && entity.onGround()) {
motion = motion.add(0, .5f, 0); motion = motion.add(0, .5f, 0);
entity.setOnGround(false); entity.setOnGround(false);
} else { } else {
@ -90,7 +90,7 @@ public class DivingBootsItem extends BaseArmorItem {
double yMotion = entity.getDeltaMovement().y; double yMotion = entity.getDeltaMovement().y;
double vMultiplier = yMotion < 0 ? Math.max(0, 2.5 - Math.abs(yMotion) * 2) : 1; double vMultiplier = yMotion < 0 ? Math.max(0, 2.5 - Math.abs(yMotion) * 2) : 1;
if (!entity.isOnGround()) { if (!entity.onGround()) {
if (entity.jumping && entity.getPersistentData() if (entity.jumping && entity.getPersistentData()
.contains("LavaGrounded")) { .contains("LavaGrounded")) {
boolean eyeInFluid = entity.isEyeInFluid(FluidTags.LAVA); boolean eyeInFluid = entity.isEyeInFluid(FluidTags.LAVA);

View file

@ -75,7 +75,7 @@ public class DivingHelmetItem extends BaseArmorItem {
@SubscribeEvent @SubscribeEvent
public static void breatheUnderwater(LivingTickEvent event) { public static void breatheUnderwater(LivingTickEvent event) {
LivingEntity entity = event.getEntity(); LivingEntity entity = event.getEntity();
Level world = entity.level; Level world = entity.level();
boolean second = world.getGameTime() % 20 == 0; boolean second = world.getGameTime() % 20 == 0;
boolean drowning = entity.getAirSupply() == 0; boolean drowning = entity.getAirSupply() == 0;

View file

@ -55,9 +55,9 @@ public class HauntedBellPulser {
} catch (ExecutionException e) { } catch (ExecutionException e) {
} }
long gameTime = player.level.getGameTime(); long gameTime = player.level().getGameTime();
if (firstPulse || gameTime % RECHARGE_TICKS != 0) if (firstPulse || gameTime % RECHARGE_TICKS != 0)
sendPulse(player.level, event.player.blockPosition(), DISTANCE, false); sendPulse(player.level(), event.player.blockPosition(), DISTANCE, false);
} }
public static void sendPulse(Level world, BlockPos pos, int distance, boolean canOverlap) { public static void sendPulse(Level world, BlockPos pos, int distance, boolean canOverlap) {

View file

@ -31,7 +31,7 @@ public class SoulBaseParticle extends CustomRotationParticle {
public void tick() { public void tick() {
selectSpriteLoopingWithAge(animatedSprite); selectSpriteLoopingWithAge(animatedSprite);
BlockPos pos = new BlockPos(x, y, z); BlockPos pos = BlockPos.containing(x, y, z);
if (age++ >= lifetime || !SoulPulseEffect.isDark(level, pos)) if (age++ >= lifetime || !SoulPulseEffect.isDark(level, pos))
remove(); remove();
} }

View file

@ -72,7 +72,7 @@ public class SoulParticle extends CustomRotationParticle {
animationStage.tick(); animationStage.tick();
animationStage = animationStage.getNext(); animationStage = animationStage.getNext();
BlockPos pos = new BlockPos(x, y, z); BlockPos pos = BlockPos.containing(x, y, z);
if (animationStage == null) if (animationStage == null)
remove(); remove();
if (!SoulPulseEffect.isDark(level, pos)) { if (!SoulPulseEffect.isDark(level, pos)) {

View file

@ -32,7 +32,7 @@ public class BlueprintAssignCompleteRecipePacket extends SimplePacketBase {
return; return;
if (player.containerMenu instanceof BlueprintMenu) { if (player.containerMenu instanceof BlueprintMenu) {
BlueprintMenu c = (BlueprintMenu) player.containerMenu; BlueprintMenu c = (BlueprintMenu) player.containerMenu;
player.getLevel() player.level()
.getRecipeManager() .getRecipeManager()
.byKey(recipeID) .byKey(recipeID)
.ifPresent(r -> BlueprintItem.assignCompleteRecipe(c.ghostInventory, r)); .ifPresent(r -> BlueprintItem.assignCompleteRecipe(c.ghostInventory, r));

View file

@ -209,7 +209,7 @@ public class BlueprintEntity extends HangingEntity
@Override @Override
public boolean survives() { public boolean survives() {
if (!level.noCollision(this)) if (!level().noCollision(this))
return false; return false;
int i = Math.max(1, this.getWidth() / 16); int i = Math.max(1, this.getWidth() / 16);
@ -229,17 +229,16 @@ public class BlueprintEntity extends HangingEntity
blockpos$mutable.set(blockpos) blockpos$mutable.set(blockpos)
.move(newDirection, k + i1) .move(newDirection, k + i1)
.move(upDirection, l + j1); .move(upDirection, l + j1);
BlockState blockstate = this.level.getBlockState(blockpos$mutable); BlockState blockstate = this.level().getBlockState(blockpos$mutable);
if (Block.canSupportCenter(this.level, blockpos$mutable, this.direction)) if (Block.canSupportCenter(this.level(), blockpos$mutable, this.direction))
continue; continue;
if (!blockstate.getMaterial() if (!blockstate.isSolid() && !DiodeBlock.isDiode(blockstate)) {
.isSolid() && !DiodeBlock.isDiode(blockstate)) {
return false; return false;
} }
} }
} }
return this.level.getEntities(this, this.getBoundingBox(), HANGING_ENTITY) return this.level().getEntities(this, this.getBoundingBox(), HANGING_ENTITY)
.isEmpty(); .isEmpty();
} }
@ -255,11 +254,11 @@ public class BlueprintEntity extends HangingEntity
@Override @Override
public boolean skipAttackInteraction(Entity source) { public boolean skipAttackInteraction(Entity source) {
if (!(source instanceof Player) || level.isClientSide) if (!(source instanceof Player) || level().isClientSide)
return super.skipAttackInteraction(source); return super.skipAttackInteraction(source);
Player player = (Player) source; Player player = (Player) source;
double attrib = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) double attrib = player.getAttribute(ForgeMod.BLOCK_REACH.get())
.getValue() + (player.isCreative() ? 0 : -0.5F); .getValue() + (player.isCreative() ? 0 : -0.5F);
Vec3 eyePos = source.getEyePosition(1); Vec3 eyePos = source.getEyePosition(1);
@ -285,7 +284,7 @@ public class BlueprintEntity extends HangingEntity
@Override @Override
public void dropItem(@Nullable Entity p_110128_1_) { public void dropItem(@Nullable Entity p_110128_1_) {
if (!level.getGameRules() if (!level().getGameRules()
.getBoolean(GameRules.RULE_DOENTITYDROPS)) .getBoolean(GameRules.RULE_DOENTITYDROPS))
return; return;
@ -324,7 +323,7 @@ public class BlueprintEntity extends HangingEntity
public void lerpTo(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, public void lerpTo(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_,
int p_180426_9_, boolean p_180426_10_) { int p_180426_9_, boolean p_180426_10_) {
BlockPos blockpos = BlockPos blockpos =
this.pos.offset(p_180426_1_ - this.getX(), p_180426_3_ - this.getY(), p_180426_5_ - this.getZ()); this.pos.offset(BlockPos.containing(p_180426_1_ - this.getX(), p_180426_3_ - this.getY(), p_180426_5_ - this.getZ()));
this.setPos((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ()); this.setPos((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ());
} }
@ -351,7 +350,7 @@ public class BlueprintEntity extends HangingEntity
BlueprintSection section = getSectionAt(vec); BlueprintSection section = getSectionAt(vec);
ItemStackHandler items = section.getItems(); ItemStackHandler items = section.getItems();
if (!holdingWrench && !level.isClientSide && !items.getStackInSlot(9) if (!holdingWrench && !level().isClientSide && !items.getStackInSlot(9)
.isEmpty()) { .isEmpty()) {
IItemHandlerModifiable playerInv = new InvWrapper(player.getInventory()); IItemHandlerModifiable playerInv = new InvWrapper(player.getInventory());
@ -373,7 +372,7 @@ public class BlueprintEntity extends HangingEntity
} }
for (int slot = 0; slot < playerInv.getSlots(); slot++) { for (int slot = 0; slot < playerInv.getSlots(); slot++) {
if (!FilterItem.test(level, playerInv.getStackInSlot(slot), requestedItem)) if (!FilterItem.test(level(), playerInv.getStackInSlot(slot), requestedItem))
continue; continue;
ItemStack currentItem = playerInv.extractItem(slot, 1, false); ItemStack currentItem = playerInv.extractItem(slot, 1, false);
if (stacksTaken.containsKey(slot)) if (stacksTaken.containsKey(slot))
@ -393,9 +392,9 @@ public class BlueprintEntity extends HangingEntity
CraftingContainer craftingInventory = new BlueprintCraftingInventory(craftingGrid); CraftingContainer craftingInventory = new BlueprintCraftingInventory(craftingGrid);
if (!recipe.isPresent()) if (!recipe.isPresent())
recipe = level.getRecipeManager() recipe = level().getRecipeManager()
.getRecipeFor(RecipeType.CRAFTING, craftingInventory, level); .getRecipeFor(RecipeType.CRAFTING, craftingInventory, level());
ItemStack result = recipe.filter(r -> r.matches(craftingInventory, level)) ItemStack result = recipe.filter(r -> r.matches(craftingInventory, level()))
.map(r -> r.assemble(craftingInventory)) .map(r -> r.assemble(craftingInventory))
.orElse(ItemStack.EMPTY); .orElse(ItemStack.EMPTY);
@ -405,13 +404,13 @@ public class BlueprintEntity extends HangingEntity
success = false; success = false;
} else { } else {
amountCrafted += result.getCount(); amountCrafted += result.getCount();
result.onCraftedBy(player.level, player, 1); result.onCraftedBy(player.level(), player, 1);
ForgeEventFactory.firePlayerCraftingEvent(player, result, craftingInventory); ForgeEventFactory.firePlayerCraftingEvent(player, result, craftingInventory);
NonNullList<ItemStack> nonnulllist = level.getRecipeManager() NonNullList<ItemStack> nonnulllist = level().getRecipeManager()
.getRemainingItemsFor(RecipeType.CRAFTING, craftingInventory, level); .getRemainingItemsFor(RecipeType.CRAFTING, craftingInventory, level());
if (firstPass) if (firstPass)
level.playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, level().playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS,
.2f, 1f + Create.RANDOM.nextFloat()); .2f, 1f + Create.RANDOM.nextFloat());
player.getInventory() player.getInventory()
.placeItemBackInInventory(result); .placeItemBackInInventory(result);
@ -434,7 +433,7 @@ public class BlueprintEntity extends HangingEntity
} }
int i = section.index; int i = section.index;
if (!level.isClientSide && player instanceof ServerPlayer) { if (!level().isClientSide && player instanceof ServerPlayer) {
NetworkHooks.openScreen((ServerPlayer) player, section, buf -> { NetworkHooks.openScreen((ServerPlayer) player, section, buf -> {
buf.writeVarInt(getId()); buf.writeVarInt(getId());
buf.writeVarInt(i); buf.writeVarInt(i);
@ -530,7 +529,7 @@ public class BlueprintEntity extends HangingEntity
list.put(index + "", inventory.serializeNBT()); list.put(index + "", inventory.serializeNBT());
list.putBoolean("InferredIcon", inferredIcon); list.putBoolean("InferredIcon", inferredIcon);
cachedDisplayItems = null; cachedDisplayItems = null;
if (!level.isClientSide) if (!level().isClientSide)
syncPersistentDataWithTracking(BlueprintEntity.this); syncPersistentDataWithTracking(BlueprintEntity.this);
} }
@ -539,7 +538,7 @@ public class BlueprintEntity extends HangingEntity
} }
public Level getBlueprintWorld() { public Level getBlueprintWorld() {
return level; return level();
} }
@Override @Override

View file

@ -14,12 +14,12 @@ import com.simibubi.create.foundation.utility.Couple;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
@ -106,7 +106,7 @@ public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
Minecraft.getInstance() Minecraft.getInstance()
.getItemRenderer() .getItemRenderer()
.renderStatic(stack, TransformType.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); .renderStatic(stack, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0);
squashedMS.popPose(); squashedMS.popPose();
}); });
squashedMS.popPose(); squashedMS.popPose();

View file

@ -80,8 +80,7 @@ public class ClipboardBlock extends FaceAttachedHorizontalDirectionalBlock
public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) { public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) {
return !pLevel.getBlockState(pPos.relative(getConnectedDirection(pState).getOpposite())) return !pLevel.getBlockState(pPos.relative(getConnectedDirection(pState).getOpposite()))
.getMaterial() .canBeReplaced();
.isReplaceable();
} }
@Override @Override

View file

@ -47,7 +47,7 @@ public class ClipboardEditPacket extends SimplePacketBase {
ServerPlayer sender = context.getSender(); ServerPlayer sender = context.getSender();
if (targetedBlock != null) { if (targetedBlock != null) {
Level world = sender.level; Level world = sender.level();
if (world == null || !world.isLoaded(targetedBlock)) if (world == null || !world.isLoaded(targetedBlock))
return; return;
if (!targetedBlock.closerThan(sender.blockPosition(), 20)) if (!targetedBlock.closerThan(sender.blockPosition(), 20))

View file

@ -34,7 +34,7 @@ import net.minecraft.SharedConstants;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.client.StringSplitter; import net.minecraft.client.StringSplitter;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.font.TextFieldHelper; import net.minecraft.client.gui.font.TextFieldHelper;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.PageButton; import net.minecraft.client.gui.screens.inventory.PageButton;
@ -524,7 +524,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
return; return;
pCursorPos = convertLocalToScreen(pCursorPos); pCursorPos = convertLocalToScreen(pCursorPos);
if (!pIsEndOfText) { if (!pIsEndOfText) {
GuiComponent.fill(pPoseStack, pCursorPos.x, pCursorPos.y - 1, pCursorPos.x + 1, pCursorPos.y + 9, GuiGraphics.fill(pPoseStack, pCursorPos.x, pCursorPos.y - 1, pCursorPos.x + 1, pCursorPos.y + 9,
-16777216); -16777216);
} else { } else {
font.draw(pPoseStack, "_", (float) pCursorPos.x, (float) pCursorPos.y, 0); font.draw(pPoseStack, "_", (float) pCursorPos.x, (float) pCursorPos.y, 0);

View file

@ -56,10 +56,10 @@ public class ExtendoGripInteractionPacket extends SimplePacketBase {
ServerPlayer sender = context.getSender(); ServerPlayer sender = context.getSender();
if (sender == null) if (sender == null)
return; return;
Entity entityByID = sender.getLevel() Entity entityByID = sender.level()
.getEntity(target); .getEntity(target);
if (entityByID != null && ExtendoGripItem.isHoldingExtendoGrip(sender)) { if (entityByID != null && ExtendoGripItem.isHoldingExtendoGrip(sender)) {
double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()) double d = sender.getAttribute(ForgeMod.BLOCK_REACH.get())
.getValue(); .getValue();
if (!sender.hasLineOfSight(entityByID)) if (!sender.hasLineOfSight(entityByID))
d -= 3; d -= 3;

View file

@ -64,10 +64,10 @@ public class ExtendoGripItem extends Item {
private static final Supplier<Multimap<Attribute, AttributeModifier>> rangeModifier = Suppliers.memoize(() -> private static final Supplier<Multimap<Attribute, AttributeModifier>> rangeModifier = Suppliers.memoize(() ->
// Holding an ExtendoGrip // Holding an ExtendoGrip
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier)); ImmutableMultimap.of(ForgeMod.BLOCK_REACH.get(), singleRangeAttributeModifier));
private static final Supplier<Multimap<Attribute, AttributeModifier>> doubleRangeModifier = Suppliers.memoize(() -> private static final Supplier<Multimap<Attribute, AttributeModifier>> doubleRangeModifier = Suppliers.memoize(() ->
// Holding two ExtendoGrips o.O // Holding two ExtendoGrips o.O
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier)); ImmutableMultimap.of(ForgeMod.BLOCK_REACH.get(), doubleRangeAttributeModifier));
private static DamageSource lastActiveDamageSource; private static DamageSource lastActiveDamageSource;
@ -148,7 +148,7 @@ public class ExtendoGripItem extends Item {
return; return;
// Modified version of GameRenderer#getMouseOver // Modified version of GameRenderer#getMouseOver
double d0 = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) double d0 = player.getAttribute(ForgeMod.BLOCK_REACH.get())
.getValue(); .getValue();
if (!player.isCreative()) if (!player.isCreative())
d0 -= 0.5f; d0 -= 0.5f;
@ -194,7 +194,7 @@ public class ExtendoGripItem extends Item {
private static void findAndDamageExtendoGrip(Player player) { private static void findAndDamageExtendoGrip(Player player) {
if (player == null) if (player == null)
return; return;
if (player.level.isClientSide) if (player.level().isClientSide)
return; return;
InteractionHand hand = InteractionHand.MAIN_HAND; InteractionHand hand = InteractionHand.MAIN_HAND;
ItemStack extendo = player.getMainHandItem(); ItemStack extendo = player.getMainHandItem();
@ -258,7 +258,7 @@ public class ExtendoGripItem extends Item {
// Server ignores entity interaction further than 6m // Server ignores entity interaction further than 6m
if (entity.distanceToSqr(target) < 36) if (entity.distanceToSqr(target) < 36)
return false; return false;
if (!entity.level.isClientSide) if (!entity.level().isClientSide)
return false; return false;
if (!(entity instanceof Player)) if (!(entity instanceof Player))
return false; return false;

View file

@ -11,8 +11,8 @@ import com.simibubi.create.foundation.item.render.PartialItemModelRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -28,12 +28,12 @@ public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer {
private static final Vec3 COG_ROTATION_OFFSET = new Vec3(0, 1 / 16f, 0); private static final Vec3 COG_ROTATION_OFFSET = new Vec3(0, 1 / 16f, 0);
@Override @Override
protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, TransformType transformType, protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType,
PoseStack ms, MultiBufferSource buffer, int light, int overlay) { PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
TransformStack stacker = TransformStack.cast(ms); TransformStack stacker = TransformStack.cast(ms);
float animation = 0.25f; float animation = 0.25f;
boolean leftHand = transformType == TransformType.FIRST_PERSON_LEFT_HAND; boolean leftHand = transformType == ItemDisplayContext.FIRST_PERSON_LEFT_HAND;
boolean rightHand = transformType == TransformType.FIRST_PERSON_RIGHT_HAND; boolean rightHand = transformType == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND;
if (leftHand || rightHand) if (leftHand || rightHand)
animation = Mth.lerp(AnimationTickHolder.getPartialTicks(), animation = Mth.lerp(AnimationTickHolder.getPartialTicks(),
ExtendoGripRenderHandler.lastMainHandAnimation, ExtendoGripRenderHandler.lastMainHandAnimation,

View file

@ -12,12 +12,12 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.ItemInHandRenderer;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.ForgeHooksClient;
@ -110,8 +110,8 @@ public class ExtendoGripRenderHandler {
ms.pushPose(); ms.pushPose();
ms.translate(flip * -0.1f, 0, -0.3f); ms.translate(flip * -0.1f, 0, -0.3f);
ItemInHandRenderer firstPersonRenderer = mc.getEntityRenderDispatcher().getItemInHandRenderer(); ItemInHandRenderer firstPersonRenderer = mc.getEntityRenderDispatcher().getItemInHandRenderer();
TransformType transform = ItemDisplayContext transform =
rightHand ? TransformType.FIRST_PERSON_RIGHT_HAND : TransformType.FIRST_PERSON_LEFT_HAND; rightHand ? ItemDisplayContext.FIRST_PERSON_RIGHT_HAND : ItemDisplayContext.FIRST_PERSON_LEFT_HAND;
firstPersonRenderer.renderItem(mc.player, notInOffhand ? heldItem : offhandItem, transform, !rightHand, firstPersonRenderer.renderItem(mc.player, notInOffhand ? heldItem : offhandItem, transform, !rightHand,
event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight()); event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight());

View file

@ -3,8 +3,8 @@ package com.simibubi.create.content.equipment.goggles;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllPartialModels; import com.simibubi.create.AllPartialModels;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraftforge.client.model.BakedModelWrapper; import net.minecraftforge.client.model.BakedModelWrapper;
public class GogglesModel extends BakedModelWrapper<BakedModel> { public class GogglesModel extends BakedModelWrapper<BakedModel> {
@ -14,11 +14,11 @@ public class GogglesModel extends BakedModelWrapper<BakedModel> {
} }
@Override @Override
public BakedModel applyTransform(TransformType cameraTransformType, PoseStack mat, boolean leftHanded) { public BakedModel applyTransform(ItemDisplayContext cameraItemDisplayContext, PoseStack mat, boolean leftHanded) {
if (cameraTransformType == TransformType.HEAD) if (cameraItemDisplayContext == ItemDisplayContext.HEAD)
return AllPartialModels.GOGGLES.get() return AllPartialModels.GOGGLES.get()
.applyTransform(cameraTransformType, mat, leftHanded); .applyTransform(cameraItemDisplayContext, mat, leftHanded);
return super.applyTransform(cameraTransformType, mat, leftHanded); return super.applyTransform(cameraItemDisplayContext, mat, leftHanded);
} }
} }

View file

@ -160,7 +160,7 @@ public class BuiltinPotatoProjectileTypes {
.soundPitch(1.1f) .soundPitch(1.1f)
.onEntityHit(ray -> { .onEntityHit(ray -> {
Entity entity = ray.getEntity(); Entity entity = ray.getEntity();
Level world = entity.level; Level world = entity.level();
if (!(entity instanceof ZombieVillager) || !((ZombieVillager) entity).hasEffect(MobEffects.WEAKNESS)) if (!(entity instanceof ZombieVillager) || !((ZombieVillager) entity).hasEffect(MobEffects.WEAKNESS))
return foodEffects(Foods.GOLDEN_APPLE, false).test(ray); return foodEffects(Foods.GOLDEN_APPLE, false).test(ray);
@ -271,7 +271,7 @@ public class BuiltinPotatoProjectileTypes {
private static Predicate<EntityHitResult> potion(MobEffect effect, int level, int ticks, boolean recoverable) { private static Predicate<EntityHitResult> potion(MobEffect effect, int level, int ticks, boolean recoverable) {
return ray -> { return ray -> {
Entity entity = ray.getEntity(); Entity entity = ray.getEntity();
if (entity.level.isClientSide) if (entity.level().isClientSide)
return true; return true;
if (entity instanceof LivingEntity) if (entity instanceof LivingEntity)
applyEffect((LivingEntity) entity, new MobEffectInstance(effect, ticks, level - 1)); applyEffect((LivingEntity) entity, new MobEffectInstance(effect, ticks, level - 1));
@ -282,7 +282,7 @@ public class BuiltinPotatoProjectileTypes {
private static Predicate<EntityHitResult> foodEffects(FoodProperties food, boolean recoverable) { private static Predicate<EntityHitResult> foodEffects(FoodProperties food, boolean recoverable) {
return ray -> { return ray -> {
Entity entity = ray.getEntity(); Entity entity = ray.getEntity();
if (entity.level.isClientSide) if (entity.level().isClientSide)
return true; return true;
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
@ -315,8 +315,7 @@ public class BuiltinPotatoProjectileTypes {
Direction face = ray.getDirection(); Direction face = ray.getDirection();
BlockPos placePos = hitPos.relative(face); BlockPos placePos = hitPos.relative(face);
if (!world.getBlockState(placePos) if (!world.getBlockState(placePos)
.getMaterial() .canBeReplaced())
.isReplaceable())
return false; return false;
if (!(cropBlock.get() instanceof IPlantable)) if (!(cropBlock.get() instanceof IPlantable))
return false; return false;
@ -345,8 +344,7 @@ public class BuiltinPotatoProjectileTypes {
Direction face = ray.getDirection(); Direction face = ray.getDirection();
BlockPos placePos = hitPos.relative(face); BlockPos placePos = hitPos.relative(face);
if (!world.getBlockState(placePos) if (!world.getBlockState(placePos)
.getMaterial() .canBeReplaced())
.isReplaceable())
return false; return false;
if (face == Direction.UP) { if (face == Direction.UP) {

View file

@ -14,11 +14,11 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer {
@ -27,7 +27,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer {
@Override @Override
protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer,
TransformType transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
ItemRenderer itemRenderer = Minecraft.getInstance() ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer(); .getItemRenderer();
renderer.render(model.getOriginalModel(), light); renderer.render(model.getOriginalModel(), light);
@ -53,7 +53,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer {
renderer.render(COG.get(), light); renderer.render(COG.get(), light);
ms.popPose(); ms.popPose();
if (transformType == TransformType.GUI) { if (transformType == ItemDisplayContext.GUI) {
PotatoCannonItem.getAmmoforPreview(stack) PotatoCannonItem.getAmmoforPreview(stack)
.ifPresent(ammo -> { .ifPresent(ammo -> {
PoseStack localMs = new PoseStack(); PoseStack localMs = new PoseStack();
@ -61,7 +61,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer {
localMs.scale(.5f, .5f, .5f); localMs.scale(.5f, .5f, .5f);
TransformStack.cast(localMs) TransformStack.cast(localMs)
.rotateY(-34); .rotateY(-34);
itemRenderer.renderStatic(ammo, TransformType.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer, 0); itemRenderer.renderStatic(ammo, ItemDisplayContext.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer, 0);
}); });
} }

View file

@ -208,7 +208,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
if (this.isOnFire() && !targetIsEnderman) if (this.isOnFire() && !targetIsEnderman)
target.setSecondsOnFire(5); target.setSecondsOnFire(5);
boolean onServer = !level.isClientSide; boolean onServer = !level().isClientSide;
if (onServer && !target.hurt(causePotatoDamage(), damage)) { if (onServer && !target.hurt(causePotatoDamage(), damage)) {
target.setRemainingFireTicks(k); target.setRemainingFireTicks(k);
kill(); kill();
@ -223,7 +223,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
recoverItem(); recoverItem();
if (!(target instanceof LivingEntity)) { if (!(target instanceof LivingEntity)) {
playHitSound(level, position()); playHitSound(level(), position());
kill(); kill();
return; return;
} }
@ -274,7 +274,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
} }
public static void playHitSound(Level world, Vec3 location) { public static void playHitSound(Level world, Vec3 location) {
AllSoundEvents.POTATO_HIT.playOnServer(world, new BlockPos(location)); AllSoundEvents.POTATO_HIT.playOnServer(world, BlockPos.containing(location));
} }
public static void playLaunchSound(Level world, Vec3 location, float pitch) { public static void playLaunchSound(Level world, Vec3 location, float pitch) {
@ -285,7 +285,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
protected void onHitBlock(BlockHitResult ray) { protected void onHitBlock(BlockHitResult ray) {
Vec3 hit = ray.getLocation(); Vec3 hit = ray.getLocation();
pop(hit); pop(hit);
if (!getProjectileType().onBlockHit(level, ray) && !level.isClientSide) if (!getProjectileType().onBlockHit(level(), ray) && !level().isClientSide)
if (random.nextDouble() <= recoveryChance) if (random.nextDouble() <= recoveryChance)
recoverItem(); recoverItem();
super.onHitBlock(ray); super.onHitBlock(ray);
@ -307,12 +307,12 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
Vec3 m = VecHelper.offsetRandomly(Vec3.ZERO, this.random, .25f); Vec3 m = VecHelper.offsetRandomly(Vec3.ZERO, this.random, .25f);
level.addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), hit.x, hit.y, hit.z, m.x, m.y, level().addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), hit.x, hit.y, hit.z, m.x, m.y,
m.z); m.z);
} }
} }
if (!level.isClientSide) if (!level().isClientSide)
playHitSound(level, position()); playHitSound(level(), position());
} }
private DamageSource causePotatoDamage() { private DamageSource causePotatoDamage() {

View file

@ -4,11 +4,11 @@ import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class PotatoProjectileRenderer extends EntityRenderer<PotatoProjectileEntity> { public class PotatoProjectileRenderer extends EntityRenderer<PotatoProjectileEntity> {
@ -31,7 +31,7 @@ public class PotatoProjectileRenderer extends EntityRenderer<PotatoProjectileEnt
Minecraft.getInstance() Minecraft.getInstance()
.getItemRenderer() .getItemRenderer()
.renderStatic(item, TransformType.GROUND, light, OverlayTexture.NO_OVERLAY, ms, buffer, 0); .renderStatic(item, ItemDisplayContext.GROUND, light, OverlayTexture.NO_OVERLAY, ms, buffer, 0);
ms.popPose(); ms.popPose();
} }

View file

@ -10,23 +10,23 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer { public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer {
@Override @Override
protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer,
TransformType transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
LocalPlayer player = Minecraft.getInstance().player; LocalPlayer player = Minecraft.getInstance().player;
float partialTicks = AnimationTickHolder.getPartialTicks(); float partialTicks = AnimationTickHolder.getPartialTicks();
boolean leftHand = transformType == TransformType.FIRST_PERSON_LEFT_HAND; boolean leftHand = transformType == ItemDisplayContext.FIRST_PERSON_LEFT_HAND;
boolean firstPerson = leftHand || transformType == TransformType.FIRST_PERSON_RIGHT_HAND; boolean firstPerson = leftHand || transformType == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND;
CompoundTag tag = stack.getOrCreateTag(); CompoundTag tag = stack.getOrCreateTag();
boolean jeiMode = tag.contains("JEI"); boolean jeiMode = tag.contains("JEI");
@ -36,7 +36,7 @@ public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer {
if (tag.contains("Polishing")) { if (tag.contains("Polishing")) {
ms.pushPose(); ms.pushPose();
if (transformType == TransformType.GUI) { if (transformType == ItemDisplayContext.GUI) {
ms.translate(0.0F, .2f, 1.0F); ms.translate(0.0F, .2f, 1.0F);
ms.scale(.75f, .75f, .75f); ms.scale(.75f, .75f, .75f);
} else { } else {
@ -50,14 +50,14 @@ public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer {
if (time / (float) stack.getUseDuration() < 0.8F) { if (time / (float) stack.getUseDuration() < 0.8F) {
float bobbing = -Mth.abs(Mth.cos(time / 4.0F * (float) Math.PI) * 0.1F); float bobbing = -Mth.abs(Mth.cos(time / 4.0F * (float) Math.PI) * 0.1F);
if (transformType == TransformType.GUI) if (transformType == ItemDisplayContext.GUI)
ms.translate(bobbing, bobbing, 0.0F); ms.translate(bobbing, bobbing, 0.0F);
else else
ms.translate(0.0f, bobbing, 0.0F); ms.translate(0.0f, bobbing, 0.0F);
} }
ItemStack toPolish = ItemStack.of(tag.getCompound("Polishing")); ItemStack toPolish = ItemStack.of(tag.getCompound("Polishing"));
itemRenderer.renderStatic(toPolish, TransformType.NONE, light, overlay, ms, buffer, 0); itemRenderer.renderStatic(toPolish, ItemDisplayContext.NONE, light, overlay, ms, buffer, 0);
ms.popPose(); ms.popPose();
} }
@ -73,7 +73,7 @@ public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer {
} }
} }
itemRenderer.render(stack, TransformType.NONE, false, ms, buffer, light, overlay, model.getOriginalModel()); itemRenderer.render(stack, ItemDisplayContext.NONE, false, ms, buffer, light, overlay, model.getOriginalModel());
ms.popPose(); ms.popPose();
} }

View file

@ -61,7 +61,7 @@ public class SymmetryHandler {
.isEmpty() .isEmpty()
&& inv.getItem(i) && inv.getItem(i)
.getItem() == AllItems.WAND_OF_SYMMETRY.get()) { .getItem() == AllItems.WAND_OF_SYMMETRY.get()) {
SymmetryWandItem.apply(player.level, inv.getItem(i), player, event.getPos(), event.getPlacedBlock()); SymmetryWandItem.apply(player.level(), inv.getItem(i), player, event.getPos(), event.getPlacedBlock());
} }
} }
} }
@ -77,7 +77,7 @@ public class SymmetryHandler {
for (int i = 0; i < Inventory.getSelectionSize(); i++) { for (int i = 0; i < Inventory.getSelectionSize(); i++) {
if (!inv.getItem(i) if (!inv.getItem(i)
.isEmpty() && AllItems.WAND_OF_SYMMETRY.isIn(inv.getItem(i))) { .isEmpty() && AllItems.WAND_OF_SYMMETRY.isIn(inv.getItem(i))) {
SymmetryWandItem.remove(player.level, inv.getItem(i), player, event.getPos()); SymmetryWandItem.remove(player.level(), inv.getItem(i), player, event.getPos());
} }
} }
} }
@ -100,7 +100,7 @@ public class SymmetryHandler {
if (mirror instanceof EmptyMirror) if (mirror instanceof EmptyMirror)
continue; continue;
BlockPos pos = new BlockPos(mirror.getPosition()); BlockPos pos = BlockPos.containing(mirror.getPosition());
float yShift = 0; float yShift = 0;
double speed = 1 / 16d; double speed = 1 / 16d;
@ -122,7 +122,7 @@ public class SymmetryHandler {
mc.getBlockRenderer() mc.getBlockRenderer()
.getModelRenderer() .getModelRenderer()
.tesselateBlock(player.level, model, Blocks.AIR.defaultBlockState(), pos, ms, builder, true, .tesselateBlock(player.level(), model, Blocks.AIR.defaultBlockState(), pos, ms, builder, true,
random, Mth.getSeed(pos), OverlayTexture.NO_OVERLAY, ModelData.EMPTY, RenderType.solid()); random, Mth.getSeed(pos), OverlayTexture.NO_OVERLAY, ModelData.EMPTY, RenderType.solid());
ms.popPose(); ms.popPose();

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