mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 01:13:41 +01:00
Fivepointone-ify Again
This commit is contained in:
parent
ab221b9d5b
commit
d4152728e6
21 changed files with 125 additions and 127 deletions
|
@ -1809,6 +1809,7 @@
|
|||
"create.display_source.redstone_power.progress_bar": "Progress Bar",
|
||||
"create.display_source.boiler.not_enough_space": "Not enough space ",
|
||||
"create.display_source.boiler.for_boiler_status": "for Boiler Status",
|
||||
"create.display_source.computer_display_source": "From Computer",
|
||||
|
||||
"create.display_target.line": "Line %1$s",
|
||||
"create.display_target.page": "Page %1$s",
|
||||
|
@ -1831,6 +1832,8 @@
|
|||
"create.super_glue.not_enough": "Not enough glue in inventory",
|
||||
"create.super_glue.success": "Applying Glue...",
|
||||
|
||||
"create.gui.attached_computer.controlled": "This device is being controlled by a computer",
|
||||
"create.gui.attached_computer.hint": "To use device manually, disconnect all computers and modems",
|
||||
"create.gui.config.overlay1": "Hi :)",
|
||||
"create.gui.config.overlay2": "This is a sample overlay",
|
||||
"create.gui.config.overlay3": "Click or drag with your mouse",
|
||||
|
|
|
@ -19,10 +19,8 @@
|
|||
"create:andesite_belt_funnel",
|
||||
"create:brass_funnel",
|
||||
"create:brass_belt_funnel",
|
||||
"create:creative_crate",
|
||||
"create:redstone_link",
|
||||
"create:analog_lever",
|
||||
"create:placard",
|
||||
"create:pulse_repeater",
|
||||
"create:pulse_extender",
|
||||
"create:clipboard",
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
package com.simibubi.create.compat.computercraft;
|
||||
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BehaviourType;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
public class AbstractComputerBehaviour extends TileEntityBehaviour {
|
||||
public class AbstractComputerBehaviour extends BlockEntityBehaviour {
|
||||
|
||||
public static final BehaviourType<AbstractComputerBehaviour> TYPE = new BehaviourType<>();
|
||||
|
||||
boolean hasAttachedComputer;
|
||||
|
||||
public AbstractComputerBehaviour(SmartTileEntity te) {
|
||||
public AbstractComputerBehaviour(SmartBlockEntity te) {
|
||||
super(te);
|
||||
this.hasAttachedComputer = false;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.simibubi.create.compat.computercraft;
|
||||
|
||||
import com.simibubi.create.foundation.networking.TileEntityDataPacket;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.SyncedBlockEntity;
|
||||
import com.simibubi.create.foundation.networking.BlockEntityDataPacket;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
||||
public class AttachedComputerPacket extends TileEntityDataPacket<SyncedTileEntity> {
|
||||
public class AttachedComputerPacket extends BlockEntityDataPacket<SyncedBlockEntity> {
|
||||
|
||||
private final boolean hasAttachedComputer;
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class AttachedComputerPacket extends TileEntityDataPacket<SyncedTileEntit
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void handlePacket(SyncedTileEntity tile) {
|
||||
if (tile instanceof SmartTileEntity smartTile) {
|
||||
protected void handlePacket(SyncedBlockEntity tile) {
|
||||
if (tile instanceof SmartBlockEntity smartTile) {
|
||||
smartTile.getBehaviour(AbstractComputerBehaviour.TYPE)
|
||||
.setHasAttachedComputer(hasAttachedComputer);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.function.Function;
|
|||
|
||||
import com.simibubi.create.compat.Mods;
|
||||
import com.simibubi.create.compat.computercraft.implementation.ComputerBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
|
||||
public class ComputerCraftProxy {
|
||||
|
||||
|
@ -18,13 +18,13 @@ public class ComputerCraftProxy {
|
|||
computerFactory = ComputerBehaviour::new;
|
||||
}
|
||||
|
||||
private static Function<SmartTileEntity, ? extends AbstractComputerBehaviour> fallbackFactory;
|
||||
private static Function<SmartTileEntity, ? extends AbstractComputerBehaviour> computerFactory;
|
||||
private static Function<SmartBlockEntity, ? extends AbstractComputerBehaviour> fallbackFactory;
|
||||
private static Function<SmartBlockEntity, ? extends AbstractComputerBehaviour> computerFactory;
|
||||
|
||||
public static AbstractComputerBehaviour behaviour(SmartTileEntity ste) {
|
||||
public static AbstractComputerBehaviour behaviour(SmartBlockEntity sbe) {
|
||||
if (computerFactory == null)
|
||||
return fallbackFactory.apply(ste);
|
||||
return computerFactory.apply(ste);
|
||||
return fallbackFactory.apply(sbe);
|
||||
return computerFactory.apply(sbe);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.simibubi.create.compat.computercraft;
|
||||
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
|
||||
public class FallbackComputerBehaviour extends AbstractComputerBehaviour {
|
||||
|
||||
public FallbackComputerBehaviour(SmartTileEntity te) {
|
||||
public FallbackComputerBehaviour(SmartBlockEntity te) {
|
||||
super(te);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ import com.simibubi.create.compat.computercraft.implementation.peripherals.Speed
|
|||
import com.simibubi.create.compat.computercraft.implementation.peripherals.SpeedGaugePeripheral;
|
||||
import com.simibubi.create.compat.computercraft.implementation.peripherals.StationPeripheral;
|
||||
import com.simibubi.create.compat.computercraft.implementation.peripherals.StressGaugePeripheral;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.display.DisplayLinkTileEntity;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.StationTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeBlockEntity;
|
||||
import com.simibubi.create.content.logistics.block.display.DisplayLinkBlockEntity;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.StationBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
@ -30,23 +30,23 @@ public class ComputerBehaviour extends AbstractComputerBehaviour {
|
|||
LazyOptional<IPeripheral> peripheral;
|
||||
NonNullSupplier<IPeripheral> peripheralSupplier;
|
||||
|
||||
public ComputerBehaviour(SmartTileEntity te) {
|
||||
public ComputerBehaviour(SmartBlockEntity te) {
|
||||
super(te);
|
||||
this.peripheralSupplier = getPeripheralFor(te);
|
||||
}
|
||||
|
||||
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartTileEntity te) {
|
||||
if (te instanceof SpeedControllerTileEntity scte)
|
||||
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) {
|
||||
if (te instanceof SpeedControllerBlockEntity scte)
|
||||
return () -> new SpeedControllerPeripheral(scte, scte.targetSpeed);
|
||||
if (te instanceof DisplayLinkTileEntity dlte)
|
||||
if (te instanceof DisplayLinkBlockEntity dlte)
|
||||
return () -> new DisplayLinkPeripheral(dlte);
|
||||
if (te instanceof SequencedGearshiftTileEntity sgte)
|
||||
if (te instanceof SequencedGearshiftBlockEntity sgte)
|
||||
return () -> new SequencedGearshiftPeripheral(sgte);
|
||||
if (te instanceof SpeedGaugeTileEntity sgte)
|
||||
if (te instanceof SpeedGaugeBlockEntity sgte)
|
||||
return () -> new SpeedGaugePeripheral(sgte);
|
||||
if (te instanceof StressGaugeTileEntity sgte)
|
||||
if (te instanceof StressGaugeBlockEntity sgte)
|
||||
return () -> new StressGaugePeripheral(sgte);
|
||||
if (te instanceof StationTileEntity ste)
|
||||
if (te instanceof StationBlockEntity ste)
|
||||
return () -> new StationPeripheral(ste);
|
||||
|
||||
throw new IllegalArgumentException("No peripheral available for " + te.getType()
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.content.logistics.block.display.DisplayLinkBlockEntity;
|
||||
import com.simibubi.create.content.logistics.block.display.DisplayLinkContext;
|
||||
import com.simibubi.create.content.logistics.block.display.DisplayLinkTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.display.target.DisplayTargetStats;
|
||||
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
|
@ -13,13 +13,13 @@ import net.minecraft.nbt.ListTag;
|
|||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
||||
public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkTileEntity> {
|
||||
public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEntity> {
|
||||
|
||||
public static final String TAG_KEY = "ComputerSourceList";
|
||||
private final AtomicInteger cursorX = new AtomicInteger();
|
||||
private final AtomicInteger cursorY = new AtomicInteger();
|
||||
|
||||
public DisplayLinkPeripheral(DisplayLinkTileEntity tile) {
|
||||
public DisplayLinkPeripheral(DisplayLinkBlockEntity tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.Instruction;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.InstructionSpeedModifiers;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencerInstructions;
|
||||
|
||||
import dan200.computercraft.api.lua.IArguments;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
|
||||
public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftTileEntity> {
|
||||
public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftBlockEntity> {
|
||||
|
||||
public SequencedGearshiftPeripheral(SequencedGearshiftTileEntity tile) {
|
||||
public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@ package com.simibubi.create.compat.computercraft.implementation.peripherals;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
|
||||
public class SpeedControllerPeripheral extends SyncedPeripheral<SpeedControllerTileEntity> {
|
||||
public class SpeedControllerPeripheral extends SyncedPeripheral<SpeedControllerBlockEntity> {
|
||||
|
||||
private final ScrollValueBehaviour targetSpeed;
|
||||
|
||||
public SpeedControllerPeripheral(SpeedControllerTileEntity tile, ScrollValueBehaviour targetSpeed) {
|
||||
public SpeedControllerPeripheral(SpeedControllerBlockEntity tile, ScrollValueBehaviour targetSpeed) {
|
||||
super(tile);
|
||||
this.targetSpeed = targetSpeed;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.simibubi.create.compat.computercraft.implementation.peripherals;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeBlockEntity;
|
||||
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
|
||||
public class SpeedGaugePeripheral extends SyncedPeripheral<SpeedGaugeTileEntity> {
|
||||
public class SpeedGaugePeripheral extends SyncedPeripheral<SpeedGaugeBlockEntity> {
|
||||
|
||||
public SpeedGaugePeripheral(SpeedGaugeTileEntity tile) {
|
||||
public SpeedGaugePeripheral(SpeedGaugeBlockEntity tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
import com.simibubi.create.compat.computercraft.implementation.CreateLuaTable;
|
||||
import com.simibubi.create.content.logistics.trains.entity.Train;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.GlobalStation;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.StationTileEntity;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.StationBlockEntity;
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.TrainEditPacket;
|
||||
import com.simibubi.create.content.logistics.trains.management.schedule.Schedule;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
@ -30,9 +30,9 @@ import net.minecraft.nbt.StringTag;
|
|||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
||||
public class StationPeripheral extends SyncedPeripheral<StationTileEntity> {
|
||||
public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
||||
|
||||
public StationPeripheral(StationTileEntity tile) {
|
||||
public StationPeripheral(StationBlockEntity tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class StationPeripheral extends SyncedPeripheral<StationTileEntity> {
|
|||
public final void setTrainName(String name) throws LuaException {
|
||||
Train train = getTrainOrThrow();
|
||||
train.name = Components.literal(name);
|
||||
AllPackets.channel.send(PacketDistributor.ALL.noArg(), new TrainEditPacket.TrainEditReturnPacket(train.id, name, train.icon.getId()));
|
||||
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new TrainEditPacket.TrainEditReturnPacket(train.id, name, train.icon.getId()));
|
||||
}
|
||||
|
||||
@LuaFunction
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.simibubi.create.compat.computercraft.implementation.peripherals;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeBlockEntity;
|
||||
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
|
||||
public class StressGaugePeripheral extends SyncedPeripheral<StressGaugeTileEntity> {
|
||||
public class StressGaugePeripheral extends SyncedPeripheral<StressGaugeBlockEntity> {
|
||||
|
||||
public StressGaugePeripheral(StressGaugeTileEntity tile) {
|
||||
public StressGaugePeripheral(StressGaugeBlockEntity tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import com.simibubi.create.compat.computercraft.AttachedComputerPacket;
|
||||
import com.simibubi.create.compat.computercraft.implementation.ComputerBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
||||
public abstract class SyncedPeripheral<T extends SmartTileEntity> implements IPeripheral {
|
||||
public abstract class SyncedPeripheral<T extends SmartBlockEntity> implements IPeripheral {
|
||||
|
||||
protected final T tile;
|
||||
private final AtomicInteger computers = new AtomicInteger();
|
||||
|
@ -39,7 +39,7 @@ public abstract class SyncedPeripheral<T extends SmartTileEntity> implements IPe
|
|||
boolean hasAttachedComputer = computers.get() > 0;
|
||||
|
||||
tile.getBehaviour(ComputerBehaviour.TYPE).setHasAttachedComputer(hasAttachedComputer);
|
||||
AllPackets.channel.send(PacketDistributor.ALL.noArg(), new AttachedComputerPacket(tile.getBlockPos(), hasAttachedComputer));
|
||||
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new AttachedComputerPacket(tile.getBlockPos(), hasAttachedComputer));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,9 +41,9 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
if (te.computerBehaviour.hasAttachedComputer())
|
||||
if (blockEntity.computerBehaviour.hasAttachedComputer())
|
||||
minecraft.setScreen(new ComputerScreen(title, () -> Components.literal(station.name),
|
||||
this::renderAdditional, this, te.computerBehaviour::hasAttachedComputer));
|
||||
this::renderAdditional, this, blockEntity.computerBehaviour::hasAttachedComputer));
|
||||
|
||||
setWindowSize(background.width, background.height);
|
||||
super.init();
|
||||
|
@ -81,9 +81,9 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen {
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (te.computerBehaviour.hasAttachedComputer())
|
||||
if (blockEntity.computerBehaviour.hasAttachedComputer())
|
||||
minecraft.setScreen(new ComputerScreen(title, () -> Components.literal(station.name),
|
||||
this::renderAdditional, this, te.computerBehaviour::hasAttachedComputer));
|
||||
this::renderAdditional, this, blockEntity.computerBehaviour::hasAttachedComputer));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -295,14 +295,14 @@ public class ClientEvents {
|
|||
|
||||
if (AllFluids.CHOCOLATE.get()
|
||||
.isSame(fluid)) {
|
||||
event.scaleFarPlaneDistance(1f / 32f * AllConfigs.CLIENT.chocolateTransparencyMultiplier.getF());
|
||||
event.scaleFarPlaneDistance(1f / 32f * AllConfigs.client().chocolateTransparencyMultiplier.getF());
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (AllFluids.HONEY.get()
|
||||
.isSame(fluid)) {
|
||||
event.scaleFarPlaneDistance(1f / 8f * AllConfigs.CLIENT.honeyTransparencyMultiplier.getF());
|
||||
event.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4,34 +4,23 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelBlockEntity.SelectionMode;
|
||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.IMultiBlockEntityContainer;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BehaviourType;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.mixin.accessor.GameTestHelperAccessor;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongArrayMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeverBlock;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelTileEntity.SelectionMode;
|
||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeTileEntity;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.tileEntity.IMultiTileContainer;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
|
@ -44,14 +33,21 @@ import net.minecraft.world.entity.item.ItemEntity;
|
|||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeverBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
/**
|
||||
* A helper class expanding the functionality of {@link GameTestHelper}.
|
||||
|
@ -91,7 +87,7 @@ public class CreateGameTestHelper extends GameTestHelper {
|
|||
}
|
||||
|
||||
public void assertNixiePower(BlockPos pos, int strength) {
|
||||
NixieTubeTileEntity nixie = getBlockEntity(AllTileEntities.NIXIE_TUBE.get(), pos);
|
||||
NixieTubeBlockEntity nixie = getBlockEntity(AllBlockEntityTypes.NIXIE_TUBE.get(), pos);
|
||||
int actualStrength = nixie.getRedstoneStrength();
|
||||
if (actualStrength != strength)
|
||||
fail("Expected nixie tube at %s to have power of %s, got %s".formatted(pos, strength, actualStrength));
|
||||
|
@ -146,20 +142,20 @@ public class CreateGameTestHelper extends GameTestHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Given any segment of an {@link IMultiTileContainer}, get the controller for it.
|
||||
* Given any segment of an {@link IMultiBlockEntityContainer}, get the controller for it.
|
||||
*/
|
||||
public <T extends BlockEntity & IMultiTileContainer> T getControllerBlockEntity(BlockEntityType<T> type, BlockPos anySegment) {
|
||||
T be = getBlockEntity(type, anySegment).getControllerTE();
|
||||
public <T extends BlockEntity & IMultiBlockEntityContainer> T getControllerBlockEntity(BlockEntityType<T> type, BlockPos anySegment) {
|
||||
T be = getBlockEntity(type, anySegment).getControllerBE();
|
||||
if (be == null)
|
||||
fail("Could not get block entity controller with type [%s] from pos [%s]".formatted(RegisteredObjects.getKeyOrThrow(type), anySegment));
|
||||
return be;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the expected {@link TileEntityBehaviour} from the given position, failing if not present.
|
||||
* Get the expected {@link BlockEntityBehaviour} from the given position, failing if not present.
|
||||
*/
|
||||
public <T extends TileEntityBehaviour> T getBehavior(BlockPos pos, BehaviourType<T> type) {
|
||||
T behavior = TileEntityBehaviour.get(getLevel(), absolutePos(pos), type);
|
||||
public <T extends BlockEntityBehaviour> T getBehavior(BlockPos pos, BehaviourType<T> type) {
|
||||
T behavior = BlockEntityBehaviour.get(getLevel(), absolutePos(pos), type);
|
||||
if (behavior == null)
|
||||
fail("Behavior at " + pos + " missing, expected " + type.getName());
|
||||
return behavior;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.simibubi.create.gametest.tests;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.content.contraptions.fluids.actors.HosePulleyFluidHandler;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
|
||||
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeBlockEntity;
|
||||
import com.simibubi.create.gametest.infrastructure.CreateGameTestHelper;
|
||||
|
||||
import com.simibubi.create.gametest.infrastructure.GameTestGroup;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -95,8 +93,8 @@ public class TestFluids {
|
|||
BlockPos stressometer = new BlockPos(5, 2, 5);
|
||||
BlockPos speedometer = new BlockPos(4, 2, 5);
|
||||
helper.succeedWhen(() -> {
|
||||
StressGaugeTileEntity stress = helper.getBlockEntity(AllTileEntities.STRESSOMETER.get(), stressometer);
|
||||
SpeedGaugeTileEntity speed = helper.getBlockEntity(AllTileEntities.SPEEDOMETER.get(), speedometer);
|
||||
StressGaugeBlockEntity stress = helper.getBlockEntity(AllBlockEntityTypes.STRESSOMETER.get(), stressometer);
|
||||
SpeedGaugeBlockEntity speed = helper.getBlockEntity(AllBlockEntityTypes.SPEEDOMETER.get(), speedometer);
|
||||
float capacity = stress.getNetworkCapacity();
|
||||
helper.assertCloseEnoughTo(capacity, 2048);
|
||||
float rotationSpeed = Mth.abs(speed.getSpeed());
|
||||
|
|
|
@ -5,18 +5,18 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelTileEntity.SelectionMode;
|
||||
import com.simibubi.create.content.logistics.block.depot.DepotTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelBlockEntity.SelectionMode;
|
||||
import com.simibubi.create.content.logistics.block.depot.DepotBlockEntity;
|
||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeBlockEntity;
|
||||
import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayBlockEntity;
|
||||
import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayLayout;
|
||||
import com.simibubi.create.content.logistics.trains.management.display.FlapDisplaySection;
|
||||
import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayTileEntity;
|
||||
import com.simibubi.create.foundation.utility.Components;
|
||||
import com.simibubi.create.gametest.infrastructure.CreateGameTestHelper;
|
||||
import com.simibubi.create.gametest.infrastructure.GameTestGroup;
|
||||
import com.simibubi.create.foundation.utility.Components;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
import net.minecraft.Util;
|
||||
|
@ -53,9 +53,9 @@ public class TestItems {
|
|||
public static void armPurgatory(CreateGameTestHelper helper) {
|
||||
BlockPos lever = new BlockPos(2, 3, 2);
|
||||
BlockPos depot1Pos = new BlockPos(3, 2, 1);
|
||||
DepotTileEntity depot1 = helper.getBlockEntity(AllTileEntities.DEPOT.get(), depot1Pos);
|
||||
DepotBlockEntity depot1 = helper.getBlockEntity(AllBlockEntityTypes.DEPOT.get(), depot1Pos);
|
||||
BlockPos depot2Pos = new BlockPos(1, 2, 1);
|
||||
DepotTileEntity depot2 = helper.getBlockEntity(AllTileEntities.DEPOT.get(), depot2Pos);
|
||||
DepotBlockEntity depot2 = helper.getBlockEntity(AllBlockEntityTypes.DEPOT.get(), depot2Pos);
|
||||
helper.pullLever(lever);
|
||||
helper.succeedWhen(() -> {
|
||||
helper.assertSecondsPassed(5);
|
||||
|
@ -234,12 +234,12 @@ public class TestItems {
|
|||
BlockPos chest = new BlockPos(3, 2, 1);
|
||||
long totalChestItems = helper.getTotalItems(chest);
|
||||
BlockPos chestNixiePos = new BlockPos(2, 3, 1);
|
||||
NixieTubeTileEntity chestNixie = helper.getBlockEntity(AllTileEntities.NIXIE_TUBE.get(), chestNixiePos);
|
||||
NixieTubeBlockEntity chestNixie = helper.getBlockEntity(AllBlockEntityTypes.NIXIE_TUBE.get(), chestNixiePos);
|
||||
|
||||
BlockPos doubleChest = new BlockPos(2, 2, 3);
|
||||
long totalDoubleChestItems = helper.getTotalItems(doubleChest);
|
||||
BlockPos doubleChestNixiePos = new BlockPos(1, 3, 3);
|
||||
NixieTubeTileEntity doubleChestNixie = helper.getBlockEntity(AllTileEntities.NIXIE_TUBE.get(), doubleChestNixiePos);
|
||||
NixieTubeBlockEntity doubleChestNixie = helper.getBlockEntity(AllBlockEntityTypes.NIXIE_TUBE.get(), doubleChestNixiePos);
|
||||
|
||||
helper.succeedWhen(() -> {
|
||||
String chestNixieText = chestNixie.getFullText().getString();
|
||||
|
@ -256,16 +256,16 @@ public class TestItems {
|
|||
@GameTest(template = "depot_display", timeoutTicks = CreateGameTestHelper.TEN_SECONDS)
|
||||
public static void depotDisplay(CreateGameTestHelper helper) {
|
||||
BlockPos displayPos = new BlockPos(5, 3, 1);
|
||||
List<DepotTileEntity> depots = Stream.of(
|
||||
List<DepotBlockEntity> depots = Stream.of(
|
||||
new BlockPos(2, 2, 1),
|
||||
new BlockPos(1, 2, 1)
|
||||
).map(pos -> helper.getBlockEntity(AllTileEntities.DEPOT.get(), pos)).toList();
|
||||
).map(pos -> helper.getBlockEntity(AllBlockEntityTypes.DEPOT.get(), pos)).toList();
|
||||
List<BlockPos> levers = List.of(
|
||||
new BlockPos(2, 5, 0),
|
||||
new BlockPos(1, 5, 0)
|
||||
);
|
||||
levers.forEach(helper::pullLever);
|
||||
FlapDisplayTileEntity display = helper.getBlockEntity(AllTileEntities.FLAP_DISPLAY.get(), displayPos).getController();
|
||||
FlapDisplayBlockEntity display = helper.getBlockEntity(AllBlockEntityTypes.FLAP_DISPLAY.get(), displayPos).getController();
|
||||
helper.succeedWhen(() -> {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
FlapDisplayLayout line = display.getLines().get(i);
|
||||
|
@ -273,7 +273,7 @@ public class TestItems {
|
|||
line.getSections().stream().map(FlapDisplaySection::getText).forEach(textComponent::append);
|
||||
String text = textComponent.getString().toLowerCase(Locale.ROOT).trim();
|
||||
|
||||
DepotTileEntity depot = depots.get(i);
|
||||
DepotBlockEntity depot = depots.get(i);
|
||||
ItemStack item = depot.getHeldItem();
|
||||
String name = Registry.ITEM.getKey(item.getItem()).getPath();
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.simibubi.create.gametest.tests;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.schematics.SchematicExport;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity.State;
|
||||
import com.simibubi.create.content.schematics.item.SchematicItem;
|
||||
import static com.simibubi.create.gametest.infrastructure.CreateGameTestHelper.FIFTEEN_SECONDS;
|
||||
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.content.schematics.SchematicExport;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonBlockEntity;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonBlockEntity.State;
|
||||
import com.simibubi.create.content.schematics.item.SchematicItem;
|
||||
import com.simibubi.create.gametest.infrastructure.CreateGameTestHelper;
|
||||
import com.simibubi.create.gametest.infrastructure.GameTestGroup;
|
||||
|
||||
|
@ -20,8 +21,6 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import static com.simibubi.create.gametest.infrastructure.CreateGameTestHelper.FIFTEEN_SECONDS;
|
||||
|
||||
@GameTestGroup(path = "misc")
|
||||
public class TestMisc {
|
||||
@GameTest(template = "schematicannon", timeoutTicks = FIFTEEN_SECONDS)
|
||||
|
@ -41,7 +40,7 @@ public class TestMisc {
|
|||
schematic.getOrCreateTag().put("Anchor", NbtUtils.writeBlockPos(anchor));
|
||||
// setup cannon
|
||||
BlockPos cannonPos = new BlockPos(3, 2, 6);
|
||||
SchematicannonTileEntity cannon = helper.getBlockEntity(AllTileEntities.SCHEMATICANNON.get(), cannonPos);
|
||||
SchematicannonBlockEntity cannon = helper.getBlockEntity(AllBlockEntityTypes.SCHEMATICANNON.get(), cannonPos);
|
||||
cannon.inventory.setStackInSlot(0, schematic);
|
||||
// run
|
||||
cannon.state = State.RUNNING;
|
||||
|
|
|
@ -963,6 +963,7 @@
|
|||
"create.display_source.redstone_power.progress_bar": "Progress Bar",
|
||||
"create.display_source.boiler.not_enough_space": "Not enough space ",
|
||||
"create.display_source.boiler.for_boiler_status": "for Boiler Status",
|
||||
"create.display_source.computer_display_source": "From Computer",
|
||||
|
||||
"create.display_target.line": "Line %1$s",
|
||||
"create.display_target.page": "Page %1$s",
|
||||
|
@ -985,6 +986,9 @@
|
|||
"create.super_glue.not_enough": "Not enough glue in inventory",
|
||||
"create.super_glue.success": "Applying Glue...",
|
||||
|
||||
"create.gui.attached_computer.controlled": "This device is being controlled by a computer",
|
||||
"create.gui.attached_computer.hint": "To use device manually, disconnect all computers and modems",
|
||||
|
||||
"create.gui.config.overlay1": "Hi :)",
|
||||
"create.gui.config.overlay2": "This is a sample overlay",
|
||||
"create.gui.config.overlay3": "Click or drag with your mouse",
|
||||
|
|
Loading…
Reference in a new issue