Remove more tiles

This commit is contained in:
PepperCode1 2023-05-24 07:59:45 -07:00
parent 55af801433
commit 761f109520
50 changed files with 221 additions and 221 deletions

View file

@ -25,8 +25,8 @@ import com.simibubi.create.content.kinetics.press.PressingRecipe;
import com.simibubi.create.content.kinetics.saw.CuttingRecipe; import com.simibubi.create.content.kinetics.saw.CuttingRecipe;
import com.simibubi.create.content.processing.basin.BasinRecipe; import com.simibubi.create.content.processing.basin.BasinRecipe;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory; import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory;
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipeSerializer;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer; import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipeSerializer;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo; import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.RegisteredObjects; import com.simibubi.create.foundation.utility.RegisteredObjects;

View file

@ -11,8 +11,8 @@ public class AttachedComputerPacket extends BlockEntityDataPacket<SyncedBlockEnt
private final boolean hasAttachedComputer; private final boolean hasAttachedComputer;
public AttachedComputerPacket(BlockPos tilePos, boolean hasAttachedComputer) { public AttachedComputerPacket(BlockPos blockEntityPos, boolean hasAttachedComputer) {
super(tilePos); super(blockEntityPos);
this.hasAttachedComputer = hasAttachedComputer; this.hasAttachedComputer = hasAttachedComputer;
} }
@ -27,9 +27,9 @@ public class AttachedComputerPacket extends BlockEntityDataPacket<SyncedBlockEnt
} }
@Override @Override
protected void handlePacket(SyncedBlockEntity tile) { protected void handlePacket(SyncedBlockEntity blockEntity) {
if (tile instanceof SmartBlockEntity smartTile) { if (blockEntity instanceof SmartBlockEntity sbe) {
smartTile.getBehaviour(AbstractComputerBehaviour.TYPE) sbe.getBehaviour(AbstractComputerBehaviour.TYPE)
.setHasAttachedComputer(hasAttachedComputer); .setHasAttachedComputer(hasAttachedComputer);
} }
} }

View file

@ -36,18 +36,18 @@ public class ComputerBehaviour extends AbstractComputerBehaviour {
} }
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) { public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) {
if (te instanceof SpeedControllerBlockEntity scte) if (te instanceof SpeedControllerBlockEntity scbe)
return () -> new SpeedControllerPeripheral(scte, scte.targetSpeed); return () -> new SpeedControllerPeripheral(scbe, scbe.targetSpeed);
if (te instanceof DisplayLinkBlockEntity dlte) if (te instanceof DisplayLinkBlockEntity dlbe)
return () -> new DisplayLinkPeripheral(dlte); return () -> new DisplayLinkPeripheral(dlbe);
if (te instanceof SequencedGearshiftBlockEntity sgte) if (te instanceof SequencedGearshiftBlockEntity sgbe)
return () -> new SequencedGearshiftPeripheral(sgte); return () -> new SequencedGearshiftPeripheral(sgbe);
if (te instanceof SpeedGaugeBlockEntity sgte) if (te instanceof SpeedGaugeBlockEntity sgbe)
return () -> new SpeedGaugePeripheral(sgte); return () -> new SpeedGaugePeripheral(sgbe);
if (te instanceof StressGaugeBlockEntity sgte) if (te instanceof StressGaugeBlockEntity sgbe)
return () -> new StressGaugePeripheral(sgte); return () -> new StressGaugePeripheral(sgbe);
if (te instanceof StationBlockEntity ste) if (te instanceof StationBlockEntity sbe)
return () -> new StationPeripheral(ste); return () -> new StationPeripheral(sbe);
throw new IllegalArgumentException("No peripheral available for " + te.getType() throw new IllegalArgumentException("No peripheral available for " + te.getType()
.getRegistryName()); .getRegistryName());

View file

@ -19,8 +19,8 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
private final AtomicInteger cursorX = new AtomicInteger(); private final AtomicInteger cursorX = new AtomicInteger();
private final AtomicInteger cursorY = new AtomicInteger(); private final AtomicInteger cursorY = new AtomicInteger();
public DisplayLinkPeripheral(DisplayLinkBlockEntity tile) { public DisplayLinkPeripheral(DisplayLinkBlockEntity blockEntity) {
super(tile); super(blockEntity);
} }
@LuaFunction @LuaFunction
@ -36,7 +36,7 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final Object[] getSize() { public final Object[] getSize() {
DisplayTargetStats stats = tile.activeTarget.provideStats(new DisplayLinkContext(tile.getLevel(), tile)); DisplayTargetStats stats = blockEntity.activeTarget.provideStats(new DisplayLinkContext(blockEntity.getLevel(), blockEntity));
return new Object[]{stats.maxRows(), stats.maxColumns()}; return new Object[]{stats.maxRows(), stats.maxColumns()};
} }
@ -52,7 +52,7 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
@LuaFunction @LuaFunction
public final void write(String text) { public final void write(String text) {
ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING); ListTag tag = blockEntity.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
int x = cursorX.get(); int x = cursorX.get();
int y = cursorY.get(); int y = cursorY.get();
@ -68,8 +68,8 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
tag.set(y, StringTag.valueOf(builder.toString())); tag.set(y, StringTag.valueOf(builder.toString()));
synchronized (tile) { synchronized (blockEntity) {
tile.getSourceConfig().put(TAG_KEY, tag); blockEntity.getSourceConfig().put(TAG_KEY, tag);
} }
cursorX.set(x + text.length()); cursorX.set(x + text.length());
@ -77,26 +77,26 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
@LuaFunction @LuaFunction
public final void clearLine() { public final void clearLine() {
ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING); ListTag tag = blockEntity.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
if (tag.size() > cursorY.get()) if (tag.size() > cursorY.get())
tag.set(cursorY.get(), StringTag.valueOf("")); tag.set(cursorY.get(), StringTag.valueOf(""));
synchronized (tile) { synchronized (blockEntity) {
tile.getSourceConfig().put(TAG_KEY, tag); blockEntity.getSourceConfig().put(TAG_KEY, tag);
} }
} }
@LuaFunction @LuaFunction
public final void clear() { public final void clear() {
synchronized (tile) { synchronized (blockEntity) {
tile.getSourceConfig().put(TAG_KEY, new ListTag()); blockEntity.getSourceConfig().put(TAG_KEY, new ListTag());
} }
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final void update() { public final void update() {
tile.tickSource(); blockEntity.tickSource();
} }
@NotNull @NotNull

View file

@ -13,8 +13,8 @@ import dan200.computercraft.api.lua.LuaFunction;
public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftBlockEntity> { public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftBlockEntity> {
public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity tile) { public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity blockEntity) {
super(tile); super(blockEntity);
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
@ -29,20 +29,20 @@ public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGear
@LuaFunction @LuaFunction
public final boolean isRunning() { public final boolean isRunning() {
return !this.tile.isIdle(); return !this.blockEntity.isIdle();
} }
private void runInstruction(IArguments arguments, SequencerInstructions instructionType) throws LuaException { private void runInstruction(IArguments arguments, SequencerInstructions instructionType) throws LuaException {
int speedModifier = arguments.count() > 1 ? arguments.getInt(1) : 1; int speedModifier = arguments.count() > 1 ? arguments.getInt(1) : 1;
this.tile.getInstructions().clear(); this.blockEntity.getInstructions().clear();
this.tile.getInstructions().add(new Instruction( this.blockEntity.getInstructions().add(new Instruction(
instructionType, instructionType,
InstructionSpeedModifiers.getByModifier(speedModifier), InstructionSpeedModifiers.getByModifier(speedModifier),
Math.abs(arguments.getInt(0)))); Math.abs(arguments.getInt(0))));
this.tile.getInstructions().add(new Instruction(SequencerInstructions.END)); this.blockEntity.getInstructions().add(new Instruction(SequencerInstructions.END));
this.tile.run(0); this.blockEntity.run(0);
} }
@NotNull @NotNull

View file

@ -11,8 +11,8 @@ public class SpeedControllerPeripheral extends SyncedPeripheral<SpeedControllerB
private final ScrollValueBehaviour targetSpeed; private final ScrollValueBehaviour targetSpeed;
public SpeedControllerPeripheral(SpeedControllerBlockEntity tile, ScrollValueBehaviour targetSpeed) { public SpeedControllerPeripheral(SpeedControllerBlockEntity blockEntity, ScrollValueBehaviour targetSpeed) {
super(tile); super(blockEntity);
this.targetSpeed = targetSpeed; this.targetSpeed = targetSpeed;
} }

View file

@ -8,13 +8,13 @@ import dan200.computercraft.api.lua.LuaFunction;
public class SpeedGaugePeripheral extends SyncedPeripheral<SpeedGaugeBlockEntity> { public class SpeedGaugePeripheral extends SyncedPeripheral<SpeedGaugeBlockEntity> {
public SpeedGaugePeripheral(SpeedGaugeBlockEntity tile) { public SpeedGaugePeripheral(SpeedGaugeBlockEntity blockEntity) {
super(tile); super(blockEntity);
} }
@LuaFunction @LuaFunction
public final float getSpeed() { public final float getSpeed() {
return this.tile.getSpeed(); return this.blockEntity.getSpeed();
} }
@NotNull @NotNull

View file

@ -32,54 +32,54 @@ import net.minecraftforge.network.PacketDistributor;
public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> { public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
public StationPeripheral(StationBlockEntity tile) { public StationPeripheral(StationBlockEntity blockEntity) {
super(tile); super(blockEntity);
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final void assemble() throws LuaException { public final void assemble() throws LuaException {
if (!tile.isAssembling()) if (!blockEntity.isAssembling())
throw new LuaException("station must be in assembly mode"); throw new LuaException("station must be in assembly mode");
tile.assemble(null); blockEntity.assemble(null);
if (tile.getStation() == null || tile.getStation().getPresentTrain() == null) if (blockEntity.getStation() == null || blockEntity.getStation().getPresentTrain() == null)
throw new LuaException("failed to assemble train"); throw new LuaException("failed to assemble train");
if (!tile.exitAssemblyMode()) if (!blockEntity.exitAssemblyMode())
throw new LuaException("failed to exit assembly mode"); throw new LuaException("failed to exit assembly mode");
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final void disassemble() throws LuaException { public final void disassemble() throws LuaException {
if (tile.isAssembling()) if (blockEntity.isAssembling())
throw new LuaException("station must not be in assembly mode"); throw new LuaException("station must not be in assembly mode");
getTrainOrThrow(); getTrainOrThrow();
if (!tile.enterAssemblyMode(null)) if (!blockEntity.enterAssemblyMode(null))
throw new LuaException("could not disassemble train"); throw new LuaException("could not disassemble train");
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final void setAssemblyMode(boolean assemblyMode) throws LuaException { public final void setAssemblyMode(boolean assemblyMode) throws LuaException {
if (assemblyMode) { if (assemblyMode) {
if (!tile.enterAssemblyMode(null)) if (!blockEntity.enterAssemblyMode(null))
throw new LuaException("failed to enter assembly mode"); throw new LuaException("failed to enter assembly mode");
} else { } else {
if (!tile.exitAssemblyMode()) if (!blockEntity.exitAssemblyMode())
throw new LuaException("failed to exit assembly mode"); throw new LuaException("failed to exit assembly mode");
} }
} }
@LuaFunction @LuaFunction
public final boolean isInAssemblyMode() { public final boolean isInAssemblyMode() {
return tile.isAssembling(); return blockEntity.isAssembling();
} }
@LuaFunction @LuaFunction
public final String getStationName() throws LuaException { public final String getStationName() throws LuaException {
GlobalStation station = tile.getStation(); GlobalStation station = blockEntity.getStation();
if (station == null) if (station == null)
throw new LuaException("station is not connected to a track"); throw new LuaException("station is not connected to a track");
@ -88,13 +88,13 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final void setStationName(String name) throws LuaException { public final void setStationName(String name) throws LuaException {
if (!tile.updateName(name)) if (!blockEntity.updateName(name))
throw new LuaException("could not set station name"); throw new LuaException("could not set station name");
} }
@LuaFunction @LuaFunction
public final boolean isTrainPresent() throws LuaException { public final boolean isTrainPresent() throws LuaException {
GlobalStation station = tile.getStation(); GlobalStation station = blockEntity.getStation();
if (station == null) if (station == null)
throw new LuaException("station is not connected to a track"); throw new LuaException("station is not connected to a track");
@ -103,7 +103,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
@LuaFunction @LuaFunction
public final boolean isTrainImminent() throws LuaException { public final boolean isTrainImminent() throws LuaException {
GlobalStation station = tile.getStation(); GlobalStation station = blockEntity.getStation();
if (station == null) if (station == null)
throw new LuaException("station is not connected to a track"); throw new LuaException("station is not connected to a track");
@ -112,7 +112,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
@LuaFunction @LuaFunction
public final boolean isTrainEnroute() throws LuaException { public final boolean isTrainEnroute() throws LuaException {
GlobalStation station = tile.getStation(); GlobalStation station = blockEntity.getStation();
if (station == null) if (station == null)
throw new LuaException("station is not connected to a track"); throw new LuaException("station is not connected to a track");
@ -158,7 +158,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
} }
private @NotNull Train getTrainOrThrow() throws LuaException { private @NotNull Train getTrainOrThrow() throws LuaException {
GlobalStation station = tile.getStation(); GlobalStation station = blockEntity.getStation();
if (station == null) if (station == null)
throw new LuaException("station is not connected to a track"); throw new LuaException("station is not connected to a track");

View file

@ -8,18 +8,18 @@ import dan200.computercraft.api.lua.LuaFunction;
public class StressGaugePeripheral extends SyncedPeripheral<StressGaugeBlockEntity> { public class StressGaugePeripheral extends SyncedPeripheral<StressGaugeBlockEntity> {
public StressGaugePeripheral(StressGaugeBlockEntity tile) { public StressGaugePeripheral(StressGaugeBlockEntity blockEntity) {
super(tile); super(blockEntity);
} }
@LuaFunction @LuaFunction
public final float getStress() { public final float getStress() {
return this.tile.getNetworkStress(); return this.blockEntity.getNetworkStress();
} }
@LuaFunction @LuaFunction
public final float getStressCapacity() { public final float getStressCapacity() {
return this.tile.getNetworkCapacity(); return this.blockEntity.getNetworkCapacity();
} }
@NotNull @NotNull

View file

@ -16,30 +16,30 @@ import net.minecraftforge.network.PacketDistributor;
public abstract class SyncedPeripheral<T extends SmartBlockEntity> implements IPeripheral { public abstract class SyncedPeripheral<T extends SmartBlockEntity> implements IPeripheral {
protected final T tile; protected final T blockEntity;
private final AtomicInteger computers = new AtomicInteger(); private final AtomicInteger computers = new AtomicInteger();
public SyncedPeripheral(T tile) { public SyncedPeripheral(T blockEntity) {
this.tile = tile; this.blockEntity = blockEntity;
} }
@Override @Override
public void attach(@NotNull IComputerAccess computer) { public void attach(@NotNull IComputerAccess computer) {
computers.incrementAndGet(); computers.incrementAndGet();
updateTile(); updateBlockEntity();
} }
@Override @Override
public void detach(@NotNull IComputerAccess computer) { public void detach(@NotNull IComputerAccess computer) {
computers.decrementAndGet(); computers.decrementAndGet();
updateTile(); updateBlockEntity();
} }
private void updateTile() { private void updateBlockEntity() {
boolean hasAttachedComputer = computers.get() > 0; boolean hasAttachedComputer = computers.get() > 0;
tile.getBehaviour(ComputerBehaviour.TYPE).setHasAttachedComputer(hasAttachedComputer); blockEntity.getBehaviour(ComputerBehaviour.TYPE).setHasAttachedComputer(hasAttachedComputer);
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new AttachedComputerPacket(tile.getBlockPos(), hasAttachedComputer)); AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new AttachedComputerPacket(blockEntity.getBlockPos(), hasAttachedComputer));
} }
@Override @Override

View file

@ -323,8 +323,8 @@ public abstract class Contraption {
if (AllBlocks.BELT.has(state)) if (AllBlocks.BELT.has(state))
moveBelt(pos, frontier, visited, state); moveBelt(pos, frontier, visited, state);
if (AllBlocks.WINDMILL_BEARING.has(state) && world.getBlockEntity(pos)instanceof WindmillBearingBlockEntity wbte) if (AllBlocks.WINDMILL_BEARING.has(state) && world.getBlockEntity(pos)instanceof WindmillBearingBlockEntity wbbe)
wbte.disassembleForMovement(); wbbe.disassembleForMovement();
if (AllBlocks.GANTRY_CARRIAGE.has(state)) if (AllBlocks.GANTRY_CARRIAGE.has(state))
moveGantryPinion(world, pos, frontier, visited, state); moveGantryPinion(world, pos, frontier, visited, state);
@ -894,8 +894,8 @@ public abstract class Contraption {
return; return;
be.setLevel(world); be.setLevel(world);
modelData.put(info.pos, be.getModelData()); modelData.put(info.pos, be.getModelData());
if (be instanceof KineticBlockEntity kte) if (be instanceof KineticBlockEntity kbe)
kte.setSpeed(0); kbe.setSpeed(0);
be.getBlockState(); be.getBlockState();
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state); MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state);

View file

@ -41,8 +41,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
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 cte) if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
cte.pressButton(); cbe.pressButton();
return true; return true;
} }
@ -119,8 +119,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
return true; return true;
AllPackets.getChannel().sendToServer(new ElevatorTargetFloorPacket(contraptionEntity, efs.currentTargetY)); AllPackets.getChannel().sendToServer(new ElevatorTargetFloorPacket(contraptionEntity, efs.currentTargetY));
if (contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte) if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
cte.pressButton(); cbe.pressButton();
return true; return true;
} }

View file

@ -103,8 +103,8 @@ public class ContraptionControlsRenderer extends SmartBlockEntityRenderer<Contra
msr.rotate(Direction.WEST, AngleHelper.rad(67.5f)); msr.rotate(Direction.WEST, AngleHelper.rad(67.5f));
float buttondepth = -.25f; float buttondepth = -.25f;
if (ctx.contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte) if (ctx.contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
buttondepth += -1 / 24f * cte.button.getValue(AnimationTickHolder.getPartialTicks(renderWorld)); buttondepth += -1 / 24f * cbe.button.getValue(AnimationTickHolder.getPartialTicks(renderWorld));
if (!text.isBlank() && playerDistance < 100) { if (!text.isBlank() && playerDistance < 100) {
int actualWidth = fontRenderer.width(text); int actualWidth = fontRenderer.width(text);

View file

@ -69,8 +69,8 @@ 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 cte) if (AllBlocks.COPYCAT_PANEL.has(state) && capture.getRight() instanceof CopycatBlockEntity cbe)
return cte.getMaterial(); return cbe.getMaterial();
return state; return state;
} }

View file

@ -54,16 +54,16 @@ public class ElevatorColumn {
public void markDirty() { public void markDirty() {
for (BlockPos pos : getContacts()) { for (BlockPos pos : getContacts()) {
BlockEntity blockEntity = level.getBlockEntity(pos); BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity instanceof ElevatorContactBlockEntity ecte) if (blockEntity instanceof ElevatorContactBlockEntity ecbe)
ecte.setChanged(); ecbe.setChanged();
} }
} }
public void floorReached(LevelAccessor level, String name) { public void floorReached(LevelAccessor level, String name) {
getContacts().stream() getContacts().stream()
.forEach(p -> { .forEach(p -> {
if (level.getBlockEntity(p)instanceof ElevatorContactBlockEntity ecte) if (level.getBlockEntity(p) instanceof ElevatorContactBlockEntity ecbe)
ecte.updateDisplayedFloor(name); ecbe.updateDisplayedFloor(name);
}); });
} }
@ -72,8 +72,8 @@ public class ElevatorColumn {
public List<IntAttached<Couple<String>>> compileNamesList() { public List<IntAttached<Couple<String>>> compileNamesList() {
return getContacts().stream() return getContacts().stream()
.map(p -> { .map(p -> {
if (level.getBlockEntity(p)instanceof ElevatorContactBlockEntity ecte) if (level.getBlockEntity(p) instanceof ElevatorContactBlockEntity ecbe)
return IntAttached.with(p.getY(), ecte.getNames()); return IntAttached.with(p.getY(), ecbe.getNames());
return null; return null;
}) })
.filter(Objects::nonNull) .filter(Objects::nonNull)
@ -126,13 +126,13 @@ public class ElevatorColumn {
Integer y = contacts.get(i); Integer y = contacts.get(i);
BlockPos pos = contactAt(y); BlockPos pos = contactAt(y);
if (!(level.getBlockEntity(pos)instanceof ElevatorContactBlockEntity ecte)) if (!(level.getBlockEntity(pos) instanceof ElevatorContactBlockEntity ecbe))
continue; continue;
Integer currentLevel = null; Integer currentLevel = null;
if (!ecte.shortName.isBlank()) { if (!ecbe.shortName.isBlank()) {
Integer tryValueOf = tryValueOf(ecte.shortName); Integer tryValueOf = tryValueOf(ecbe.shortName);
if (tryValueOf != null) if (tryValueOf != null)
currentLevel = tryValueOf; currentLevel = tryValueOf;
if (currentLevel == null) if (currentLevel == null)
@ -146,13 +146,13 @@ public class ElevatorColumn {
for (int peekI = i + 1; peekI < contacts.size(); peekI++) { for (int peekI = i + 1; peekI < contacts.size(); peekI++) {
BlockPos peekPos = contactAt(contacts.get(peekI)); BlockPos peekPos = contactAt(contacts.get(peekI));
if (!(level.getBlockEntity(peekPos)instanceof ElevatorContactBlockEntity peekEcte)) if (!(level.getBlockEntity(peekPos) instanceof ElevatorContactBlockEntity peekEcbe))
continue; continue;
Integer tryValueOf = tryValueOf(peekEcte.shortName); Integer tryValueOf = tryValueOf(peekEcbe.shortName);
if (tryValueOf == null) if (tryValueOf == null)
continue; continue;
if (currentLevel != null && currentLevel >= tryValueOf) { if (currentLevel != null && currentLevel >= tryValueOf) {
peekEcte.shortName = ""; peekEcbe.shortName = "";
break; break;
} }
nextLevel = tryValueOf; nextLevel = tryValueOf;
@ -162,7 +162,7 @@ public class ElevatorColumn {
if (currentLevel == null) if (currentLevel == null)
currentLevel = nextLevel != null ? nextLevel - 1 : 0; currentLevel = nextLevel != null ? nextLevel - 1 : 0;
ecte.updateName(String.valueOf(currentLevel), ecte.longName); ecbe.updateName(String.valueOf(currentLevel), ecbe.longName);
prevLevel = currentLevel; prevLevel = currentLevel;
} }

View file

@ -141,10 +141,10 @@ public class ElevatorContraption extends PulleyContraption {
public void broadcastFloorData(Level level, BlockPos contactPos) { public void broadcastFloorData(Level level, BlockPos contactPos) {
ElevatorColumn column = ElevatorColumn.get(level, getGlobalColumn()); ElevatorColumn column = ElevatorColumn.get(level, getGlobalColumn());
if (!(world.getBlockEntity(contactPos)instanceof ElevatorContactBlockEntity ecte)) if (!(world.getBlockEntity(contactPos) instanceof ElevatorContactBlockEntity ecbe))
return; return;
if (column != null) if (column != null)
column.floorReached(level, ecte.shortName); column.floorReached(level, ecbe.shortName);
} }
@Override @Override

View file

@ -290,8 +290,8 @@ public class ElevatorPulleyBlockEntity extends PulleyBlockEntity {
continue; continue;
pos = pos.offset(anchor); pos = pos.offset(anchor);
if (level.getBlockEntity(new BlockPos(pos.getX(), worldPosition.getY(), if (level.getBlockEntity(new BlockPos(pos.getX(), worldPosition.getY(),
pos.getZ()))instanceof ElevatorPulleyBlockEntity pte) pos.getZ())) instanceof ElevatorPulleyBlockEntity pbe)
pte.startMirroringOther(worldPosition); pbe.startMirroringOther(worldPosition);
} }
ElevatorColumn column = ElevatorColumn.getOrCreate(level, contraption.getGlobalColumn()); ElevatorColumn column = ElevatorColumn.getOrCreate(level, contraption.getGlobalColumn());

View file

@ -158,8 +158,8 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
continue; continue;
pos = pos.offset(anchor); pos = pos.offset(anchor);
if (level.getBlockEntity( if (level.getBlockEntity(
new BlockPos(pos.getX(), worldPosition.getY(), pos.getZ()))instanceof PulleyBlockEntity pte) new BlockPos(pos.getX(), worldPosition.getY(), pos.getZ())) instanceof PulleyBlockEntity pbe)
pte.startMirroringOther(worldPosition); pbe.startMirroringOther(worldPosition);
} }
} }
} }
@ -307,14 +307,14 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
public void startMirroringOther(BlockPos parent) { public void startMirroringOther(BlockPos parent) {
if (parent.equals(worldPosition)) if (parent.equals(worldPosition))
return; return;
if (!(level.getBlockEntity(parent)instanceof PulleyBlockEntity pte)) if (!(level.getBlockEntity(parent) instanceof PulleyBlockEntity pbe))
return; return;
if (pte.getType() != getType()) if (pbe.getType() != getType())
return; return;
if (pte.mirrorChildren == null) if (pbe.mirrorChildren == null)
pte.mirrorChildren = new ArrayList<>(); pbe.mirrorChildren = new ArrayList<>();
pte.mirrorChildren.add(worldPosition); pbe.mirrorChildren.add(worldPosition);
pte.notifyUpdate(); pbe.notifyUpdate();
mirrorParent = parent; mirrorParent = parent;
try { try {
@ -328,12 +328,12 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
if (mirrorChildren == null) if (mirrorChildren == null)
return; return;
for (BlockPos blockPos : mirrorChildren) { for (BlockPos blockPos : mirrorChildren) {
if (!(level.getBlockEntity(blockPos)instanceof PulleyBlockEntity pte)) if (!(level.getBlockEntity(blockPos) instanceof PulleyBlockEntity pbe))
continue; continue;
pte.offset = offset; pbe.offset = offset;
pte.disassemble(); pbe.disassemble();
pte.mirrorParent = null; pbe.mirrorParent = null;
pte.notifyUpdate(); pbe.notifyUpdate();
} }
mirrorChildren.clear(); mirrorChildren.clear();
notifyUpdate(); notifyUpdate();

View file

@ -272,8 +272,8 @@ public abstract class CopycatBlock extends Block implements IBE<CopycatBlockEnti
} }
public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) { public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) {
if (reader.getBlockEntity(targetPos)instanceof CopycatBlockEntity ufte) if (reader.getBlockEntity(targetPos) instanceof CopycatBlockEntity cbe)
return ufte.getMaterial(); return cbe.getMaterial();
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();
} }

View file

@ -237,9 +237,9 @@ public class GirderBlock extends Block implements SimpleWaterloggedBlock, IWrenc
public static boolean isFacingBracket(BlockAndTintGetter level, BlockPos pos, Direction d) { public static boolean isFacingBracket(BlockAndTintGetter level, BlockPos pos, Direction d) {
BlockEntity blockEntity = level.getBlockEntity(pos.relative(d)); BlockEntity blockEntity = level.getBlockEntity(pos.relative(d));
if (!(blockEntity instanceof SmartBlockEntity ste)) if (!(blockEntity instanceof SmartBlockEntity sbe))
return false; return false;
BracketedBlockEntityBehaviour behaviour = ste.getBehaviour(BracketedBlockEntityBehaviour.TYPE); BracketedBlockEntityBehaviour behaviour = sbe.getBehaviour(BracketedBlockEntityBehaviour.TYPE);
if (behaviour == null) if (behaviour == null)
return false; return false;
BlockState bracket = behaviour.getBracket(); BlockState bracket = behaviour.getBracket();

View file

@ -55,13 +55,13 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour {
tickOpen(context, open); tickOpen(context, open);
Map<BlockPos, BlockEntity> tes = context.contraption.presentBlockEntities; Map<BlockPos, BlockEntity> tes = context.contraption.presentBlockEntities;
if (!(tes.get(context.localPos)instanceof SlidingDoorBlockEntity doorTE)) if (!(tes.get(context.localPos) instanceof SlidingDoorBlockEntity sdbe))
return; return;
boolean wasSettled = doorTE.animation.settled(); boolean wasSettled = sdbe.animation.settled();
doorTE.animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR); sdbe.animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR);
doorTE.animation.tickChaser(); sdbe.animation.tickChaser();
if (!wasSettled && doorTE.animation.settled() && !open) if (!wasSettled && sdbe.animation.settled() && !open)
context.world.playLocalSound(context.position.x, context.position.y, context.position.z, context.world.playLocalSound(context.position.x, context.position.y, context.position.z,
SoundEvents.IRON_DOOR_CLOSE, SoundSource.BLOCKS, .125f, 1, false); SoundEvents.IRON_DOOR_CLOSE, SoundSource.BLOCKS, .125f, 1, false);
} }

View file

@ -186,8 +186,8 @@ public class WhistleBlockEntity extends SmartBlockEntity implements IHaveGoggleI
source = new WeakReference<>(null); source = new WeakReference<>(null);
Direction facing = WhistleBlock.getAttachedDirection(getBlockState()); Direction facing = WhistleBlock.getAttachedDirection(getBlockState());
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing)); BlockEntity be = level.getBlockEntity(worldPosition.relative(facing));
if (be instanceof FluidTankBlockEntity tankTe) if (be instanceof FluidTankBlockEntity tankBe)
source = new WeakReference<>(tank = tankTe); source = new WeakReference<>(tank = tankBe);
} }
if (tank == null) if (tank == null)
return null; return null;

View file

@ -327,8 +327,8 @@ public class BoilerData {
if (AllBlocks.STEAM_WHISTLE.has(attachedState) if (AllBlocks.STEAM_WHISTLE.has(attachedState)
&& WhistleBlock.getAttachedDirection(attachedState) && WhistleBlock.getAttachedDirection(attachedState)
.getOpposite() == d) { .getOpposite() == d) {
if (level.getBlockEntity(attachedPos)instanceof WhistleBlockEntity wte) if (level.getBlockEntity(attachedPos) instanceof WhistleBlockEntity wbe)
whistlePitches.add(wte.getPitchId()); whistlePitches.add(wbe.getPitchId());
} }
} }
} }

View file

@ -315,8 +315,8 @@ public class FluidTankBlockEntity extends SmartBlockEntity implements IHaveGoggl
for (int xOffset = 0; xOffset < width; xOffset++) for (int xOffset = 0; xOffset < width; xOffset++)
for (int zOffset = 0; zOffset < width; zOffset++) for (int zOffset = 0; zOffset < width; zOffset++)
if (level.getBlockEntity( if (level.getBlockEntity(
worldPosition.offset(xOffset, yOffset, zOffset))instanceof FluidTankBlockEntity fte) worldPosition.offset(xOffset, yOffset, zOffset)) instanceof FluidTankBlockEntity fbe)
fte.refreshCapability(); fbe.refreshCapability();
} }
if (changed) { if (changed) {

View file

@ -146,14 +146,14 @@ public class CrushingWheelControllerBlock extends DirectionalBlock implements IB
if (neighbour.getValue(BlockStateProperties.AXIS) == d.getAxis()) if (neighbour.getValue(BlockStateProperties.AXIS) == d.getAxis())
continue; continue;
BlockEntity adjBE = world.getBlockEntity(pos.relative(d)); BlockEntity adjBE = world.getBlockEntity(pos.relative(d));
if (!(adjBE instanceof CrushingWheelBlockEntity cwte)) if (!(adjBE instanceof CrushingWheelBlockEntity cwbe))
continue; continue;
be.crushingspeed = Math.abs(cwte.getSpeed() / 50f); be.crushingspeed = Math.abs(cwbe.getSpeed() / 50f);
be.sendData(); be.sendData();
cwte.award(AllAdvancements.CRUSHING_WHEEL); cwbe.award(AllAdvancements.CRUSHING_WHEEL);
if (cwte.getSpeed() > 255) if (cwbe.getSpeed() > 255)
cwte.award(AllAdvancements.CRUSHER_MAXED); cwbe.award(AllAdvancements.CRUSHER_MAXED);
break; break;
} }

View file

@ -166,8 +166,8 @@ public class SteamEngineBlockEntity extends SmartBlockEntity implements IHaveGog
source = new WeakReference<>(null); source = new WeakReference<>(null);
Direction facing = SteamEngineBlock.getFacing(getBlockState()); Direction facing = SteamEngineBlock.getFacing(getBlockState());
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing.getOpposite())); BlockEntity be = level.getBlockEntity(worldPosition.relative(facing.getOpposite()));
if (be instanceof FluidTankBlockEntity tankTe) if (be instanceof FluidTankBlockEntity tankBe)
source = new WeakReference<>(tank = tankTe); source = new WeakReference<>(tank = tankBe);
} }
if (tank == null) if (tank == null)
return null; return null;

View file

@ -782,7 +782,7 @@ public class ChuteBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
// //
// @Override // @Override
// public Direction getAirflowOriginSide() { // public Direction getAirflowOriginSide() {
// return world != null && !(world.getTileEntity(pos.down()) instanceof // return world != null && !(world.getBlockEntity(pos.down()) instanceof
// IAirCurrentSource) // IAirCurrentSource)
// && getBlockState().get(ChuteBlock.FACING) == Direction.DOWN ? Direction.DOWN // && getBlockState().get(ChuteBlock.FACING) == Direction.DOWN ? Direction.DOWN
// : Direction.UP; // : Direction.UP;

View file

@ -86,14 +86,14 @@ public class DisplayLinkBlock extends WrenchableDirectionalBlock implements IBE<
continue; continue;
BlockEntity blockEntity = level.getBlockEntity(offsetPos); BlockEntity blockEntity = level.getBlockEntity(offsetPos);
if (!(blockEntity instanceof DisplayLinkBlockEntity dgte)) if (!(blockEntity instanceof DisplayLinkBlockEntity dlbe))
continue; continue;
if (dgte.activeSource == null) if (dlbe.activeSource == null)
continue; continue;
if (dgte.getDirection() != d.getOpposite()) if (dlbe.getDirection() != d.getOpposite())
continue; continue;
callback.accept(dgte); callback.accept(dlbe);
} }
} }

View file

@ -11,9 +11,9 @@ public class CurrentFloorDisplaySource extends SingleLineDisplaySource {
@Override @Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.getSourceBlockEntity() instanceof ElevatorContactBlockEntity ecte)) if (!(context.getSourceBlockEntity() instanceof ElevatorContactBlockEntity ecbe))
return EMPTY_LINE; return EMPTY_LINE;
return Components.literal(ecte.lastReportedCurrentFloor); return Components.literal(ecbe.lastReportedCurrentFloor);
} }
@Override @Override

View file

@ -14,9 +14,9 @@ public class FillLevelDisplaySource extends PercentOrProgressBarDisplaySource {
@Override @Override
protected Float getProgress(DisplayLinkContext context) { protected Float getProgress(DisplayLinkContext context) {
BlockEntity be = context.getSourceBlockEntity(); BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof ThresholdSwitchBlockEntity sste)) if (!(be instanceof ThresholdSwitchBlockEntity tsbe))
return null; return null;
return sste.currentLevel; return tsbe.currentLevel;
} }
@Override @Override

View file

@ -15,9 +15,9 @@ public class ObservedTrainNameSource extends SingleLineDisplaySource {
@Override @Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.getSourceBlockEntity() instanceof TrackObserverBlockEntity observerTE)) if (!(context.getSourceBlockEntity() instanceof TrackObserverBlockEntity observerBE))
return EMPTY_LINE; return EMPTY_LINE;
TrackObserver observer = observerTE.getObserver(); TrackObserver observer = observerBE.getObserver();
if (observer == null) if (observer == null)
return EMPTY_LINE; return EMPTY_LINE;
UUID currentTrain = observer.getCurrentTrain(); UUID currentTrain = observer.getCurrentTrain();

View file

@ -172,9 +172,9 @@ public class StationSummaryDisplaySource extends DisplaySource {
if (conf.contains("Filter")) if (conf.contains("Filter"))
return; return;
if (!(context.getSourceBlockEntity() instanceof StationBlockEntity stationTe)) if (!(context.getSourceBlockEntity() instanceof StationBlockEntity stationBe))
return; return;
GlobalStation station = stationTe.getStation(); GlobalStation station = stationBe.getStation();
if (station == null) if (station == null)
return; return;
conf.putString("Filter", station.name); conf.putString("Filter", station.name);

View file

@ -12,9 +12,9 @@ public class StopWatchDisplaySource extends SingleLineDisplaySource {
@Override @Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.getSourceBlockEntity()instanceof CuckooClockBlockEntity ccte)) if (!(context.getSourceBlockEntity() instanceof CuckooClockBlockEntity ccbe))
return TimeOfDayDisplaySource.EMPTY_TIME; return TimeOfDayDisplaySource.EMPTY_TIME;
if (ccte.getSpeed() == 0) if (ccbe.getSpeed() == 0)
return TimeOfDayDisplaySource.EMPTY_TIME; return TimeOfDayDisplaySource.EMPTY_TIME;
if (!context.sourceConfig() if (!context.sourceConfig()

View file

@ -22,9 +22,9 @@ public class TimeOfDayDisplaySource extends SingleLineDisplaySource {
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.level()instanceof ServerLevel sLevel)) if (!(context.level()instanceof ServerLevel sLevel))
return EMPTY_TIME; return EMPTY_TIME;
if (!(context.getSourceBlockEntity() instanceof CuckooClockBlockEntity ccte)) if (!(context.getSourceBlockEntity() instanceof CuckooClockBlockEntity ccbe))
return EMPTY_TIME; return EMPTY_TIME;
if (ccte.getSpeed() == 0) if (ccbe.getSpeed() == 0)
return EMPTY_TIME; return EMPTY_TIME;
boolean c12 = context.sourceConfig() boolean c12 = context.sourceConfig()

View file

@ -15,9 +15,9 @@ public class TrainStatusDisplaySource extends SingleLineDisplaySource {
@Override @Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.getSourceBlockEntity() instanceof StationBlockEntity observerTE)) if (!(context.getSourceBlockEntity() instanceof StationBlockEntity observerBE))
return EMPTY_LINE; return EMPTY_LINE;
GlobalStation observer = observerTE.getStation(); GlobalStation observer = observerBE.getStation();
if (observer == null) if (observer == null)
return EMPTY_LINE; return EMPTY_LINE;
Train currentTrain = observer.getPresentTrain(); Train currentTrain = observer.getPresentTrain();

View file

@ -90,10 +90,10 @@ public class DisplayBoardTarget extends DisplayTarget {
AABB baseShape = super.getMultiblockBounds(level, pos); AABB baseShape = super.getMultiblockBounds(level, pos);
BlockEntity be = level.getBlockEntity(pos); BlockEntity be = level.getBlockEntity(pos);
if (!(be instanceof FlapDisplayBlockEntity fdte)) if (!(be instanceof FlapDisplayBlockEntity fdbe))
return baseShape; return baseShape;
FlapDisplayBlockEntity controller = fdte.getController(); FlapDisplayBlockEntity controller = fdbe.getController();
if (controller == null) if (controller == null)
return baseShape; return baseShape;

View file

@ -137,9 +137,9 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
public abstract BogeyStyle getDefaultStyle(); public abstract BogeyStyle getDefaultStyle();
/** /**
* Legacy system doesn't capture bogey tile entities when constructing a train * Legacy system doesn't capture bogey block entities when constructing a train
*/ */
public boolean captureTileEntityForTrain() { public boolean captureBlockEntityForTrain() {
return false; return false;
} }
@ -198,11 +198,11 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
BlockEntity be = level.getBlockEntity(pos); BlockEntity be = level.getBlockEntity(pos);
if (!(be instanceof AbstractBogeyBlockEntity sbte)) if (!(be instanceof AbstractBogeyBlockEntity sbbe))
return InteractionResult.FAIL; return InteractionResult.FAIL;
player.getCooldowns().addCooldown(stack.getItem(), 20); player.getCooldowns().addCooldown(stack.getItem(), 20);
BogeyStyle currentStyle = sbte.getStyle(); BogeyStyle currentStyle = sbbe.getStyle();
BogeySizes.BogeySize size = getSize(); BogeySizes.BogeySize size = getSize();
@ -217,21 +217,21 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
size = size.increment(); size = size.increment();
} }
sbte.setBogeyStyle(style); sbbe.setBogeyStyle(style);
CompoundTag defaultData = style.defaultData; CompoundTag defaultData = style.defaultData;
sbte.setBogeyData(sbte.getBogeyData().merge(defaultData)); sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData));
if (size == getSize()) { if (size == getSize()) {
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style") player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style")
.append(": ").append(style.displayName), true); .append(": ").append(style.displayName), true);
} else { } else {
CompoundTag oldData = sbte.getBogeyData(); CompoundTag oldData = sbbe.getBogeyData();
level.setBlock(pos, this.getStateOfSize(sbte, size), 3); level.setBlock(pos, this.getStateOfSize(sbbe, size), 3);
BlockEntity newBlockEntity = level.getBlockEntity(pos); BlockEntity newBlockEntity = level.getBlockEntity(pos);
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newTileEntity)) if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newBlockEntity1))
return InteractionResult.FAIL; return InteractionResult.FAIL;
newTileEntity.setBogeyData(oldData); newBlockEntity1.setBogeyData(oldData);
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size") player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
.append(": ").append(style.displayName), true); .append(": ").append(style.displayName), true);
} }
@ -276,9 +276,9 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
} }
public BlockState getNextSize(Level level, BlockPos pos) { public BlockState getNextSize(Level level, BlockPos pos) {
BlockEntity te = level.getBlockEntity(pos); BlockEntity be = level.getBlockEntity(pos);
if (te instanceof AbstractBogeyBlockEntity sbte) if (be instanceof AbstractBogeyBlockEntity sbbe)
return this.getNextSize(sbte); return this.getNextSize(sbbe);
return level.getBlockState(pos); return level.getBlockState(pos);
} }
@ -319,8 +319,8 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
public BogeyStyle getNextStyle(Level level, BlockPos pos) { public BogeyStyle getNextStyle(Level level, BlockPos pos) {
BlockEntity te = level.getBlockEntity(pos); BlockEntity te = level.getBlockEntity(pos);
if (te instanceof AbstractBogeyBlockEntity sbte) if (te instanceof AbstractBogeyBlockEntity sbbe)
return this.getNextStyle(sbte.getStyle()); return this.getNextStyle(sbbe.getStyle());
return getDefaultStyle(); return getDefaultStyle();
} }

View file

@ -16,10 +16,10 @@ public class BogeyBlockEntityRenderer<T extends BlockEntity> extends SafeBlockEn
protected void renderSafe(T be, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, protected void renderSafe(T be, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light,
int overlay) { int overlay) {
BlockState blockState = be.getBlockState(); BlockState blockState = be.getBlockState();
if (be instanceof AbstractBogeyBlockEntity sbte) { if (be instanceof AbstractBogeyBlockEntity sbbe) {
float angle = sbte.getVirtualAngle(partialTicks); float angle = sbbe.getVirtualAngle(partialTicks);
if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey) if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey)
bogey.render(blockState, angle, ms, partialTicks, buffer, light, overlay, sbte.getStyle(), sbte.getBogeyData()); bogey.render(blockState, angle, ms, partialTicks, buffer, light, overlay, sbbe.getStyle(), sbbe.getBogeyData());
} }
} }

View file

@ -163,12 +163,12 @@ public class CarriageContraption extends Contraption {
} }
if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey) { if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey) {
boolean captureTE = bogey.captureTileEntityForTrain(); boolean captureBE = bogey.captureBlockEntityForTrain();
bogeys++; bogeys++;
if (bogeys == 2) if (bogeys == 2)
secondBogeyPos = pos; secondBogeyPos = pos;
return Pair.of(new StructureBlockInfo(pos, blockState, captureTE ? getBlockEntityNBT(world, pos) : null), return Pair.of(new StructureBlockInfo(pos, blockState, captureBE ? getBlockEntityNBT(world, pos) : null),
captureTE ? world.getBlockEntity(pos) : null); captureBE ? world.getBlockEntity(pos) : null);
} }
if (AllBlocks.BLAZE_BURNER.has(blockState) if (AllBlocks.BLAZE_BURNER.has(blockState)

View file

@ -29,12 +29,12 @@ import com.simibubi.create.content.trains.bogey.AbstractBogeyBlockEntity;
import com.simibubi.create.content.trains.entity.Carriage.DimensionalCarriageEntity; import com.simibubi.create.content.trains.entity.Carriage.DimensionalCarriageEntity;
import com.simibubi.create.content.trains.entity.TravellingPoint.IEdgePointListener; import com.simibubi.create.content.trains.entity.TravellingPoint.IEdgePointListener;
import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection; import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.DimensionPalette; import com.simibubi.create.content.trains.graph.DimensionPalette;
import com.simibubi.create.content.trains.graph.EdgeData; import com.simibubi.create.content.trains.graph.EdgeData;
import com.simibubi.create.content.trains.graph.EdgePointType; import com.simibubi.create.content.trains.graph.EdgePointType;
import com.simibubi.create.content.trains.graph.TrackEdge; import com.simibubi.create.content.trains.graph.TrackEdge;
import com.simibubi.create.content.trains.graph.TrackGraph; import com.simibubi.create.content.trains.graph.TrackGraph;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.TrackNode; import com.simibubi.create.content.trains.graph.TrackNode;
import com.simibubi.create.content.trains.observer.TrackObserver; import com.simibubi.create.content.trains.observer.TrackObserver;
import com.simibubi.create.content.trains.schedule.ScheduleRuntime; import com.simibubi.create.content.trains.schedule.ScheduleRuntime;
@ -740,9 +740,9 @@ public class Train {
Vec3 bogeyPosition = bogey.getAnchorPosition(); Vec3 bogeyPosition = bogey.getAnchorPosition();
if (bogeyPosition == null) continue; if (bogeyPosition == null) continue;
BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition)); BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition));
if (!(be instanceof AbstractBogeyBlockEntity sbte)) if (!(be instanceof AbstractBogeyBlockEntity sbbe))
continue; continue;
sbte.setBogeyData(bogey.bogeyData); sbbe.setBogeyData(bogey.bogeyData);
} }
offset += carriage.bogeySpacing; offset += carriage.bogeySpacing;
@ -755,8 +755,8 @@ public class Train {
if (currentStation != null) { if (currentStation != null) {
currentStation.cancelReservation(this); currentStation.cancelReservation(this);
BlockPos blockEntityPos = currentStation.getBlockEntityPos(); BlockPos blockEntityPos = currentStation.getBlockEntityPos();
if (level.getBlockEntity(blockEntityPos) instanceof StationBlockEntity ste) if (level.getBlockEntity(blockEntityPos) instanceof StationBlockEntity sbe)
ste.lastDisassembledTrainName = name.copy(); sbe.lastDisassembledTrainName = name.copy();
} }
Create.RAILWAYS.removeTrain(id); Create.RAILWAYS.removeTrain(id);

View file

@ -2,10 +2,10 @@ package com.simibubi.create.content.trains.entity;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.DimensionPalette; import com.simibubi.create.content.trains.graph.DimensionPalette;
import com.simibubi.create.content.trains.graph.TrackEdge; import com.simibubi.create.content.trains.graph.TrackEdge;
import com.simibubi.create.content.trains.graph.TrackGraph; import com.simibubi.create.content.trains.graph.TrackGraph;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.TrackNode; import com.simibubi.create.content.trains.graph.TrackNode;
import com.simibubi.create.content.trains.graph.TrackNodeLocation; import com.simibubi.create.content.trains.graph.TrackNodeLocation;
import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Couple;

View file

@ -22,10 +22,10 @@ import com.simibubi.create.content.trains.entity.TravellingPoint.IEdgePointListe
import com.simibubi.create.content.trains.entity.TravellingPoint.ITrackSelector; import com.simibubi.create.content.trains.entity.TravellingPoint.ITrackSelector;
import com.simibubi.create.content.trains.entity.TravellingPoint.ITurnListener; import com.simibubi.create.content.trains.entity.TravellingPoint.ITurnListener;
import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection; import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.TrackEdge; import com.simibubi.create.content.trains.graph.TrackEdge;
import com.simibubi.create.content.trains.graph.TrackGraph; import com.simibubi.create.content.trains.graph.TrackGraph;
import com.simibubi.create.content.trains.graph.TrackGraphHelper; import com.simibubi.create.content.trains.graph.TrackGraphHelper;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.TrackNode; import com.simibubi.create.content.trains.graph.TrackNode;
import com.simibubi.create.content.trains.track.BezierTrackPointLocation; import com.simibubi.create.content.trains.track.BezierTrackPointLocation;
import com.simibubi.create.content.trains.track.ITrackBlock; import com.simibubi.create.content.trains.track.ITrackBlock;

View file

@ -16,11 +16,11 @@ import java.util.function.Predicate;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.DimensionPalette; import com.simibubi.create.content.trains.graph.DimensionPalette;
import com.simibubi.create.content.trains.graph.EdgeData; import com.simibubi.create.content.trains.graph.EdgeData;
import com.simibubi.create.content.trains.graph.TrackEdge; import com.simibubi.create.content.trains.graph.TrackEdge;
import com.simibubi.create.content.trains.graph.TrackGraph; import com.simibubi.create.content.trains.graph.TrackGraph;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.TrackNode; import com.simibubi.create.content.trains.graph.TrackNode;
import com.simibubi.create.content.trains.graph.TrackNodeLocation; import com.simibubi.create.content.trains.graph.TrackNodeLocation;
import com.simibubi.create.content.trains.signal.TrackEdgePoint; import com.simibubi.create.content.trains.signal.TrackEdgePoint;

View file

@ -149,11 +149,11 @@ public class TrackGraphHelper {
BezierTrackPointLocation targetBezier) { BezierTrackPointLocation targetBezier) {
BlockState state = level.getBlockState(pos); BlockState state = level.getBlockState(pos);
if (!(state.getBlock()instanceof ITrackBlock track)) if (!(state.getBlock() instanceof ITrackBlock track))
return null; return null;
if (!(level.getBlockEntity(pos)instanceof TrackBlockEntity trackTE)) if (!(level.getBlockEntity(pos) instanceof TrackBlockEntity trackBE))
return null; return null;
BezierConnection bc = trackTE.getConnections() BezierConnection bc = trackBE.getConnections()
.get(targetBezier.curveTarget()); .get(targetBezier.curveTarget());
if (bc == null || !bc.isPrimary()) if (bc == null || !bc.isPrimary())
return null; return null;

View file

@ -36,10 +36,10 @@ import com.simibubi.create.content.trains.entity.CarriageContraption;
import com.simibubi.create.content.trains.entity.Train; import com.simibubi.create.content.trains.entity.Train;
import com.simibubi.create.content.trains.entity.TrainPacket; import com.simibubi.create.content.trains.entity.TrainPacket;
import com.simibubi.create.content.trains.entity.TravellingPoint; import com.simibubi.create.content.trains.entity.TravellingPoint;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.EdgePointType; import com.simibubi.create.content.trains.graph.EdgePointType;
import com.simibubi.create.content.trains.graph.TrackEdge; import com.simibubi.create.content.trains.graph.TrackEdge;
import com.simibubi.create.content.trains.graph.TrackGraph; import com.simibubi.create.content.trains.graph.TrackGraph;
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
import com.simibubi.create.content.trains.graph.TrackNode; import com.simibubi.create.content.trains.graph.TrackNode;
import com.simibubi.create.content.trains.graph.TrackNodeLocation; import com.simibubi.create.content.trains.graph.TrackNodeLocation;
import com.simibubi.create.content.trains.graph.TrackNodeLocation.DiscoveredLocation; import com.simibubi.create.content.trains.graph.TrackNodeLocation.DiscoveredLocation;
@ -296,18 +296,18 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
if (!(blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey)) if (!(blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey))
continue; continue;
BlockEntity be = level.getBlockEntity(bogeyPos); BlockEntity be = level.getBlockEntity(bogeyPos);
if (!(be instanceof AbstractBogeyBlockEntity oldTE)) if (!(be instanceof AbstractBogeyBlockEntity oldBE))
continue; continue;
CompoundTag oldData = oldTE.getBogeyData(); CompoundTag oldData = oldBE.getBogeyData();
BlockState newBlock = bogey.getNextSize(oldTE); BlockState newBlock = bogey.getNextSize(oldBE);
if (newBlock.getBlock() == bogey) if (newBlock.getBlock() == bogey)
player.displayClientMessage(Lang.translateDirect("bogey.style.no_other_sizes") player.displayClientMessage(Lang.translateDirect("bogey.style.no_other_sizes")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
level.setBlock(bogeyPos, newBlock, 3); level.setBlock(bogeyPos, newBlock, 3);
BlockEntity newEntity = level.getBlockEntity(bogeyPos); BlockEntity newEntity = level.getBlockEntity(bogeyPos);
if (!(newEntity instanceof AbstractBogeyBlockEntity newTE)) if (!(newEntity instanceof AbstractBogeyBlockEntity newBE))
continue; continue;
newTE.setBogeyData(oldData); newBE.setBogeyData(oldData);
bogey.playRotateSound(level, bogeyPos); bogey.playRotateSound(level, bogeyPos);
return true; return true;
} }
@ -748,9 +748,9 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
AbstractBogeyBlock<?> typeOfFirstBogey = bogeyTypes[bogeyIndex]; AbstractBogeyBlock<?> typeOfFirstBogey = bogeyTypes[bogeyIndex];
boolean firstBogeyIsUpsideDown = upsideDownBogeys[bogeyIndex]; boolean firstBogeyIsUpsideDown = upsideDownBogeys[bogeyIndex];
BlockPos firstBogeyPos = contraption.anchor; BlockPos firstBogeyPos = contraption.anchor;
AbstractBogeyBlockEntity firstBogeyTileEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos); AbstractBogeyBlockEntity firstBogeyBlockEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos);
CarriageBogey firstBogey = CarriageBogey firstBogey =
new CarriageBogey(typeOfFirstBogey, firstBogeyIsUpsideDown, firstBogeyTileEntity.getBogeyData(), points.get(pointIndex), points.get(pointIndex + 1)); new CarriageBogey(typeOfFirstBogey, firstBogeyIsUpsideDown, firstBogeyBlockEntity.getBogeyData(), points.get(pointIndex), points.get(pointIndex + 1));
CarriageBogey secondBogey = null; CarriageBogey secondBogey = null;
BlockPos secondBogeyPos = contraption.getSecondBogeyPos(); BlockPos secondBogeyPos = contraption.getSecondBogeyPos();
int bogeySpacing = 0; int bogeySpacing = 0;
@ -762,10 +762,10 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
contraptions.size() + 1); contraptions.size() + 1);
return; return;
} }
AbstractBogeyBlockEntity secondBogeyTileEntity = AbstractBogeyBlockEntity secondBogeyBlockEntity =
(AbstractBogeyBlockEntity) level.getBlockEntity(secondBogeyPos); (AbstractBogeyBlockEntity) level.getBlockEntity(secondBogeyPos);
bogeySpacing = bogeyLocations[bogeyIndex + 1] - bogeyLocations[bogeyIndex]; bogeySpacing = bogeyLocations[bogeyIndex + 1] - bogeyLocations[bogeyIndex];
secondBogey = new CarriageBogey(bogeyTypes[bogeyIndex + 1], upsideDownBogeys[bogeyIndex + 1], secondBogeyTileEntity.getBogeyData(), secondBogey = new CarriageBogey(bogeyTypes[bogeyIndex + 1], upsideDownBogeys[bogeyIndex + 1], secondBogeyBlockEntity.getBogeyData(),
points.get(pointIndex + 2), points.get(pointIndex + 3)); points.get(pointIndex + 2), points.get(pointIndex + 3));
bogeyIndex++; bogeyIndex++;

View file

@ -279,8 +279,8 @@ public class TrackBlock extends Block
level.setBlock(pos, state.setValue(SHAPE, TrackShape.asPortal(d)) level.setBlock(pos, state.setValue(SHAPE, TrackShape.asPortal(d))
.setValue(HAS_BE, true), 3); .setValue(HAS_BE, true), 3);
BlockEntity be = level.getBlockEntity(pos); BlockEntity be = level.getBlockEntity(pos);
if (be instanceof TrackBlockEntity tte) if (be instanceof TrackBlockEntity tbe)
tte.bind(otherLevel.dimension(), otherTrackPos); tbe.bind(otherLevel.dimension(), otherTrackPos);
otherLevel.setBlock(otherTrackPos, state.setValue(SHAPE, TrackShape.asPortal(otherTrack.getFace())) otherLevel.setBlock(otherTrackPos, state.setValue(SHAPE, TrackShape.asPortal(otherTrack.getFace()))
.setValue(HAS_BE, true), 3); .setValue(HAS_BE, true), 3);
@ -401,24 +401,24 @@ public class TrackBlock extends Block
return list; return list;
BlockEntity blockEntity = world.getBlockEntity(pos); BlockEntity blockEntity = world.getBlockEntity(pos);
if (!(blockEntity instanceof TrackBlockEntity trackTE)) if (!(blockEntity instanceof TrackBlockEntity trackBE))
return list; return list;
Map<BlockPos, BezierConnection> connections = trackTE.getConnections(); Map<BlockPos, BezierConnection> connections = trackBE.getConnections();
connections.forEach((connectedPos, bc) -> ITrackBlock.addToListIfConnected(connectedTo, list, connections.forEach((connectedPos, bc) -> ITrackBlock.addToListIfConnected(connectedTo, list,
(d, b) -> d == 1 ? Vec3.atLowerCornerOf(bc.tePositions.get(b)) : bc.starts.get(b), bc.normals::get, (d, b) -> d == 1 ? Vec3.atLowerCornerOf(bc.tePositions.get(b)) : bc.starts.get(b), bc.normals::get,
b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, bc::yOffsetAt, null, bc, b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, bc::yOffsetAt, null, bc,
(b, v) -> ITrackBlock.getMaterialSimple(world, v, bc.getMaterial()))); (b, v) -> ITrackBlock.getMaterialSimple(world, v, bc.getMaterial())));
if (trackTE.boundLocation == null || !(world instanceof ServerLevel level)) if (trackBE.boundLocation == null || !(world instanceof ServerLevel level))
return list; return list;
ResourceKey<Level> otherDim = trackTE.boundLocation.getFirst(); ResourceKey<Level> otherDim = trackBE.boundLocation.getFirst();
ServerLevel otherLevel = level.getServer() ServerLevel otherLevel = level.getServer()
.getLevel(otherDim); .getLevel(otherDim);
if (otherLevel == null) if (otherLevel == null)
return list; return list;
BlockPos boundPos = trackTE.boundLocation.getSecond(); BlockPos boundPos = trackBE.boundLocation.getSecond();
BlockState boundState = otherLevel.getBlockState(boundPos); BlockState boundState = otherLevel.getBlockState(boundPos);
if (!AllTags.AllBlockTags.TRACKS.matches(boundState)) if (!AllTags.AllBlockTags.TRACKS.matches(boundState))
return list; return list;
@ -626,9 +626,9 @@ public class TrackBlock extends Block
Level level = context.getLevel(); Level level = context.getLevel();
if (!level.isClientSide && !player.isCreative() && state.getValue(HAS_BE)) { if (!level.isClientSide && !player.isCreative() && state.getValue(HAS_BE)) {
BlockEntity blockEntity = level.getBlockEntity(context.getClickedPos()); BlockEntity blockEntity = level.getBlockEntity(context.getClickedPos());
if (blockEntity instanceof TrackBlockEntity trackTE) { if (blockEntity instanceof TrackBlockEntity trackBE) {
trackTE.cancelDrops = true; trackBE.cancelDrops = true;
trackTE.connections.values() trackBE.connections.values()
.forEach(bc -> bc.addItemsToPlayer(player)); .forEach(bc -> bc.addItemsToPlayer(player));
} }
} }
@ -705,8 +705,8 @@ public class TrackBlock extends Block
Vec3 normal = null; Vec3 normal = null;
Vec3 offset = null; Vec3 offset = null;
if (bezierPoint != null && world.getBlockEntity(pos) instanceof TrackBlockEntity trackTE) { if (bezierPoint != null && world.getBlockEntity(pos) instanceof TrackBlockEntity trackBE) {
BezierConnection bc = trackTE.connections.get(bezierPoint.curveTarget()); BezierConnection bc = trackBE.connections.get(bezierPoint.curveTarget());
if (bc != null) { if (bc != null) {
double length = Mth.floor(bc.getLength() * 2); double length = Mth.floor(bc.getLength() * 2);
int seg = bezierPoint.segment() + 1; int seg = bezierPoint.segment() + 1;

View file

@ -108,14 +108,14 @@ public class TrackBlockEntity extends SmartBlockEntity implements ITransformable
} }
BlockEntity blockEntity = level.getBlockEntity(key); BlockEntity blockEntity = level.getBlockEntity(key);
if (!(blockEntity instanceof TrackBlockEntity trackTE) || blockEntity.isRemoved()) { if (!(blockEntity instanceof TrackBlockEntity trackBE) || blockEntity.isRemoved()) {
invalid.add(key); invalid.add(key);
continue; continue;
} }
if (!trackTE.connections.containsKey(worldPosition)) { if (!trackBE.connections.containsKey(worldPosition)) {
trackTE.addConnection(bc.secondary()); trackBE.addConnection(bc.secondary());
trackTE.tilt.tryApplySmoothing(); trackBE.tilt.tryApplySmoothing();
} }
} }

View file

@ -59,7 +59,7 @@ public class TrackBlockItem extends BlockItem {
Vec3 lookAngle = player.getLookAngle(); Vec3 lookAngle = player.getLookAngle();
if (!isFoil(stack)) { if (!isFoil(stack)) {
if (state.getBlock()instanceof TrackBlock track && track.getTrackAxes(level, pos, state) if (state.getBlock() instanceof TrackBlock track && track.getTrackAxes(level, pos, state)
.size() > 1) { .size() > 1) {
if (!level.isClientSide) if (!level.isClientSide)
player.displayClientMessage(Lang.translateDirect("track.junction_start") player.displayClientMessage(Lang.translateDirect("track.junction_start")

View file

@ -269,8 +269,8 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends BlockEnti
public BlockPos getPositionForMapMarker() { public BlockPos getPositionForMapMarker() {
BlockPos target = targetTrack.offset(blockEntity.getBlockPos()); BlockPos target = targetTrack.offset(blockEntity.getBlockPos());
if (targetBezier != null && getWorld().getBlockEntity(target) instanceof TrackBlockEntity tte) { if (targetBezier != null && getWorld().getBlockEntity(target) instanceof TrackBlockEntity tbe) {
BezierConnection bc = tte.getConnections() BezierConnection bc = tbe.getConnections()
.get(targetBezier.curveTarget()); .get(targetBezier.curveTarget());
if (bc == null) if (bc == null)
return target; return target;

View file

@ -44,8 +44,8 @@ public interface IBE<T extends BlockEntity> extends EntityBlock {
if (blockState.is(newBlockState.getBlock()) && newBlockState.hasBlockEntity()) if (blockState.is(newBlockState.getBlock()) && newBlockState.hasBlockEntity())
return; return;
BlockEntity blockEntity = level.getBlockEntity(pos); BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity instanceof SmartBlockEntity ste) if (blockEntity instanceof SmartBlockEntity sbe)
ste.destroy(); sbe.destroy();
level.removeBlockEntity(pos); level.removeBlockEntity(pos);
} }