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.processing.basin.BasinRecipe;
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.sequenced.SequencedAssemblyRecipeSerializer;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.RegisteredObjects;

View file

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

View file

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

View file

@ -19,8 +19,8 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
private final AtomicInteger cursorX = new AtomicInteger();
private final AtomicInteger cursorY = new AtomicInteger();
public DisplayLinkPeripheral(DisplayLinkBlockEntity tile) {
super(tile);
public DisplayLinkPeripheral(DisplayLinkBlockEntity blockEntity) {
super(blockEntity);
}
@LuaFunction
@ -36,7 +36,7 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
@LuaFunction(mainThread = true)
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()};
}
@ -52,7 +52,7 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
@LuaFunction
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 y = cursorY.get();
@ -68,8 +68,8 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
tag.set(y, StringTag.valueOf(builder.toString()));
synchronized (tile) {
tile.getSourceConfig().put(TAG_KEY, tag);
synchronized (blockEntity) {
blockEntity.getSourceConfig().put(TAG_KEY, tag);
}
cursorX.set(x + text.length());
@ -77,26 +77,26 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
@LuaFunction
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())
tag.set(cursorY.get(), StringTag.valueOf(""));
synchronized (tile) {
tile.getSourceConfig().put(TAG_KEY, tag);
synchronized (blockEntity) {
blockEntity.getSourceConfig().put(TAG_KEY, tag);
}
}
@LuaFunction
public final void clear() {
synchronized (tile) {
tile.getSourceConfig().put(TAG_KEY, new ListTag());
synchronized (blockEntity) {
blockEntity.getSourceConfig().put(TAG_KEY, new ListTag());
}
}
@LuaFunction(mainThread = true)
public final void update() {
tile.tickSource();
blockEntity.tickSource();
}
@NotNull

View file

@ -13,8 +13,8 @@ import dan200.computercraft.api.lua.LuaFunction;
public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftBlockEntity> {
public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity tile) {
super(tile);
public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity blockEntity) {
super(blockEntity);
}
@LuaFunction(mainThread = true)
@ -29,20 +29,20 @@ public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGear
@LuaFunction
public final boolean isRunning() {
return !this.tile.isIdle();
return !this.blockEntity.isIdle();
}
private void runInstruction(IArguments arguments, SequencerInstructions instructionType) throws LuaException {
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,
InstructionSpeedModifiers.getByModifier(speedModifier),
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -41,8 +41,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
if (contraption instanceof ElevatorContraption ec)
return elevatorInteraction(localPos, contraptionEntity, ec, ctx);
if (contraptionEntity.level.isClientSide()) {
if (contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte)
cte.pressButton();
if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
cbe.pressButton();
return true;
}
@ -119,8 +119,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
return true;
AllPackets.getChannel().sendToServer(new ElevatorTargetFloorPacket(contraptionEntity, efs.currentTargetY));
if (contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte)
cte.pressButton();
if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
cbe.pressButton();
return true;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -272,8 +272,8 @@ public abstract class CopycatBlock extends Block implements IBE<CopycatBlockEnti
}
public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) {
if (reader.getBlockEntity(targetPos)instanceof CopycatBlockEntity ufte)
return ufte.getMaterial();
if (reader.getBlockEntity(targetPos) instanceof CopycatBlockEntity cbe)
return cbe.getMaterial();
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) {
BlockEntity blockEntity = level.getBlockEntity(pos.relative(d));
if (!(blockEntity instanceof SmartBlockEntity ste))
if (!(blockEntity instanceof SmartBlockEntity sbe))
return false;
BracketedBlockEntityBehaviour behaviour = ste.getBehaviour(BracketedBlockEntityBehaviour.TYPE);
BracketedBlockEntityBehaviour behaviour = sbe.getBehaviour(BracketedBlockEntityBehaviour.TYPE);
if (behaviour == null)
return false;
BlockState bracket = behaviour.getBracket();

View file

@ -55,13 +55,13 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour {
tickOpen(context, open);
Map<BlockPos, BlockEntity> tes = context.contraption.presentBlockEntities;
if (!(tes.get(context.localPos)instanceof SlidingDoorBlockEntity doorTE))
if (!(tes.get(context.localPos) instanceof SlidingDoorBlockEntity sdbe))
return;
boolean wasSettled = doorTE.animation.settled();
doorTE.animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR);
doorTE.animation.tickChaser();
boolean wasSettled = sdbe.animation.settled();
sdbe.animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR);
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,
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);
Direction facing = WhistleBlock.getAttachedDirection(getBlockState());
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing));
if (be instanceof FluidTankBlockEntity tankTe)
source = new WeakReference<>(tank = tankTe);
if (be instanceof FluidTankBlockEntity tankBe)
source = new WeakReference<>(tank = tankBe);
}
if (tank == null)
return null;

View file

@ -327,8 +327,8 @@ public class BoilerData {
if (AllBlocks.STEAM_WHISTLE.has(attachedState)
&& WhistleBlock.getAttachedDirection(attachedState)
.getOpposite() == d) {
if (level.getBlockEntity(attachedPos)instanceof WhistleBlockEntity wte)
whistlePitches.add(wte.getPitchId());
if (level.getBlockEntity(attachedPos) instanceof WhistleBlockEntity wbe)
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 zOffset = 0; zOffset < width; zOffset++)
if (level.getBlockEntity(
worldPosition.offset(xOffset, yOffset, zOffset))instanceof FluidTankBlockEntity fte)
fte.refreshCapability();
worldPosition.offset(xOffset, yOffset, zOffset)) instanceof FluidTankBlockEntity fbe)
fbe.refreshCapability();
}
if (changed) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -137,9 +137,9 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
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;
}
@ -198,11 +198,11 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
BlockEntity be = level.getBlockEntity(pos);
if (!(be instanceof AbstractBogeyBlockEntity sbte))
if (!(be instanceof AbstractBogeyBlockEntity sbbe))
return InteractionResult.FAIL;
player.getCooldowns().addCooldown(stack.getItem(), 20);
BogeyStyle currentStyle = sbte.getStyle();
BogeyStyle currentStyle = sbbe.getStyle();
BogeySizes.BogeySize size = getSize();
@ -217,21 +217,21 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
size = size.increment();
}
sbte.setBogeyStyle(style);
sbbe.setBogeyStyle(style);
CompoundTag defaultData = style.defaultData;
sbte.setBogeyData(sbte.getBogeyData().merge(defaultData));
sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData));
if (size == getSize()) {
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style")
.append(": ").append(style.displayName), true);
} else {
CompoundTag oldData = sbte.getBogeyData();
level.setBlock(pos, this.getStateOfSize(sbte, size), 3);
CompoundTag oldData = sbbe.getBogeyData();
level.setBlock(pos, this.getStateOfSize(sbbe, size), 3);
BlockEntity newBlockEntity = level.getBlockEntity(pos);
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newTileEntity))
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newBlockEntity1))
return InteractionResult.FAIL;
newTileEntity.setBogeyData(oldData);
newBlockEntity1.setBogeyData(oldData);
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
.append(": ").append(style.displayName), true);
}
@ -276,9 +276,9 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
}
public BlockState getNextSize(Level level, BlockPos pos) {
BlockEntity te = level.getBlockEntity(pos);
if (te instanceof AbstractBogeyBlockEntity sbte)
return this.getNextSize(sbte);
BlockEntity be = level.getBlockEntity(pos);
if (be instanceof AbstractBogeyBlockEntity sbbe)
return this.getNextSize(sbbe);
return level.getBlockState(pos);
}
@ -319,8 +319,8 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
public BogeyStyle getNextStyle(Level level, BlockPos pos) {
BlockEntity te = level.getBlockEntity(pos);
if (te instanceof AbstractBogeyBlockEntity sbte)
return this.getNextStyle(sbte.getStyle());
if (te instanceof AbstractBogeyBlockEntity sbbe)
return this.getNextStyle(sbbe.getStyle());
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,
int overlay) {
BlockState blockState = be.getBlockState();
if (be instanceof AbstractBogeyBlockEntity sbte) {
float angle = sbte.getVirtualAngle(partialTicks);
if (be instanceof AbstractBogeyBlockEntity sbbe) {
float angle = sbbe.getVirtualAngle(partialTicks);
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) {
boolean captureTE = bogey.captureTileEntityForTrain();
boolean captureBE = bogey.captureBlockEntityForTrain();
bogeys++;
if (bogeys == 2)
secondBogeyPos = pos;
return Pair.of(new StructureBlockInfo(pos, blockState, captureTE ? getBlockEntityNBT(world, pos) : null),
captureTE ? world.getBlockEntity(pos) : null);
return Pair.of(new StructureBlockInfo(pos, blockState, captureBE ? getBlockEntityNBT(world, pos) : null),
captureBE ? world.getBlockEntity(pos) : null);
}
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.TravellingPoint.IEdgePointListener;
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.EdgeData;
import com.simibubi.create.content.trains.graph.EdgePointType;
import com.simibubi.create.content.trains.graph.TrackEdge;
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.observer.TrackObserver;
import com.simibubi.create.content.trains.schedule.ScheduleRuntime;
@ -740,9 +740,9 @@ public class Train {
Vec3 bogeyPosition = bogey.getAnchorPosition();
if (bogeyPosition == null) continue;
BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition));
if (!(be instanceof AbstractBogeyBlockEntity sbte))
if (!(be instanceof AbstractBogeyBlockEntity sbbe))
continue;
sbte.setBogeyData(bogey.bogeyData);
sbbe.setBogeyData(bogey.bogeyData);
}
offset += carriage.bogeySpacing;
@ -755,8 +755,8 @@ public class Train {
if (currentStation != null) {
currentStation.cancelReservation(this);
BlockPos blockEntityPos = currentStation.getBlockEntityPos();
if (level.getBlockEntity(blockEntityPos) instanceof StationBlockEntity ste)
ste.lastDisassembledTrainName = name.copy();
if (level.getBlockEntity(blockEntityPos) instanceof StationBlockEntity sbe)
sbe.lastDisassembledTrainName = name.copy();
}
Create.RAILWAYS.removeTrain(id);

View file

@ -2,10 +2,10 @@ package com.simibubi.create.content.trains.entity;
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.TrackEdge;
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.TrackNodeLocation;
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.ITurnListener;
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.TrackGraph;
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.track.BezierTrackPointLocation;
import com.simibubi.create.content.trains.track.ITrackBlock;

View file

@ -16,11 +16,11 @@ import java.util.function.Predicate;
import javax.annotation.Nullable;
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.EdgeData;
import com.simibubi.create.content.trains.graph.TrackEdge;
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.TrackNodeLocation;
import com.simibubi.create.content.trains.signal.TrackEdgePoint;

View file

@ -149,11 +149,11 @@ public class TrackGraphHelper {
BezierTrackPointLocation targetBezier) {
BlockState state = level.getBlockState(pos);
if (!(state.getBlock()instanceof ITrackBlock track))
if (!(state.getBlock() instanceof ITrackBlock track))
return null;
if (!(level.getBlockEntity(pos)instanceof TrackBlockEntity trackTE))
if (!(level.getBlockEntity(pos) instanceof TrackBlockEntity trackBE))
return null;
BezierConnection bc = trackTE.getConnections()
BezierConnection bc = trackBE.getConnections()
.get(targetBezier.curveTarget());
if (bc == null || !bc.isPrimary())
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.TrainPacket;
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.TrackEdge;
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.TrackNodeLocation;
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))
continue;
BlockEntity be = level.getBlockEntity(bogeyPos);
if (!(be instanceof AbstractBogeyBlockEntity oldTE))
if (!(be instanceof AbstractBogeyBlockEntity oldBE))
continue;
CompoundTag oldData = oldTE.getBogeyData();
BlockState newBlock = bogey.getNextSize(oldTE);
CompoundTag oldData = oldBE.getBogeyData();
BlockState newBlock = bogey.getNextSize(oldBE);
if (newBlock.getBlock() == bogey)
player.displayClientMessage(Lang.translateDirect("bogey.style.no_other_sizes")
.withStyle(ChatFormatting.RED), true);
level.setBlock(bogeyPos, newBlock, 3);
BlockEntity newEntity = level.getBlockEntity(bogeyPos);
if (!(newEntity instanceof AbstractBogeyBlockEntity newTE))
if (!(newEntity instanceof AbstractBogeyBlockEntity newBE))
continue;
newTE.setBogeyData(oldData);
newBE.setBogeyData(oldData);
bogey.playRotateSound(level, bogeyPos);
return true;
}
@ -748,9 +748,9 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
AbstractBogeyBlock<?> typeOfFirstBogey = bogeyTypes[bogeyIndex];
boolean firstBogeyIsUpsideDown = upsideDownBogeys[bogeyIndex];
BlockPos firstBogeyPos = contraption.anchor;
AbstractBogeyBlockEntity firstBogeyTileEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos);
AbstractBogeyBlockEntity firstBogeyBlockEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos);
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;
BlockPos secondBogeyPos = contraption.getSecondBogeyPos();
int bogeySpacing = 0;
@ -762,10 +762,10 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
contraptions.size() + 1);
return;
}
AbstractBogeyBlockEntity secondBogeyTileEntity =
AbstractBogeyBlockEntity secondBogeyBlockEntity =
(AbstractBogeyBlockEntity) level.getBlockEntity(secondBogeyPos);
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));
bogeyIndex++;

View file

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

View file

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

View file

@ -59,7 +59,7 @@ public class TrackBlockItem extends BlockItem {
Vec3 lookAngle = player.getLookAngle();
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) {
if (!level.isClientSide)
player.displayClientMessage(Lang.translateDirect("track.junction_start")

View file

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

View file

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