Class RedstoneProgram
java.lang.Object
com.petrolpark.compat.create.common.redstone.programmer.RedstoneProgram
- Direct Known Subclasses:
RedstoneProgrammerBehaviour.BehaviourRedstoneProgram,RedstoneProgrammerBlockItem.ItemStackRedstoneProgram,RedstoneProgrammerMenu.DummyRedstoneProgram
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic final recordstatic interfacestatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionintPurely visual, informs where lines should be drawn in the GUI.protected List<RedstoneProgram.Channel> Each pair of Frequencies, and the list of strengths associated with it.static final net.minecraft.network.codec.StreamEncoder<net.minecraft.network.RegistryFriendlyByteBuf, RedstoneProgram> protected intLength of the program in beats.intPurely visual, informs which lines drawn in the GUI should be thicker.SeePlayMode.protected booleanWhether a the Redstone Link network was notified of a change in the last tick and it needn't be notified again.booleanIf we are paused.protected booleanWhether we were paused last tick.protected intHow far through the program we are, in beats.protected booleanWhether we were powered last tick.protected intChannel sequences may not change strength more often than this if edited in the GUI.protected intHow many ticks until the beat gets incremented. -
Constructor Summary
ConstructorsConstructorDescriptionRedstoneProgram(RedstoneProgram.PlayMode mode, int length, int playtime, int ticksToNextBeat, boolean paused, boolean pausedLastTick, boolean poweredLastTick, List<RedstoneProgram.ChannelData> channels, int ticksPerBeat, int beatsPerLine, int linesPerBar) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddBlankChannel(net.createmod.catnip.data.Couple<com.simibubi.create.content.redstone.link.RedstoneLinkNetworkHandler.Frequency> frequencies, boolean simulate) static final <PROGRAM extends RedstoneProgram>
com.mojang.serialization.Codec<PROGRAM> codec(RedstoneProgram.Factory<PROGRAM> factory) copyFrom(RedstoneProgram otherProgram) copyFrom(RedstoneProgram.PlayMode mode, int length, int playtime, int ticksToNextBeat, boolean paused, boolean pausedLastTick, boolean poweredLastTick, List<RedstoneProgram.ChannelData> channels, int ticksPerBeat, int beatsPerLine, int linesPerBar) booleanintThe number of ticks this program has been playing for.intabstract net.minecraft.core.BlockPoscom.google.common.collect.ImmutableList<RedstoneProgram.Channel> protected static com.simibubi.create.content.redstone.link.RedstoneLinkNetworkHandlerintintgetMode()intintintabstract net.minecraft.world.level.LevelAccessorgetWorld()inthashCode()abstract booleanhasPower()booleanbooleanisPaused()protected static booleanisValidWorld(net.minecraft.world.level.LevelAccessor level) voidload()booleanremove(RedstoneProgram.Channel channel) voidrestart()voidsetDuration(int duration) voidsetTicksPerBeat(int value) abstract booleanstatic final <PROGRAM extends RedstoneProgram>
net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, PROGRAM> streamCodec(RedstoneProgram.Factory<PROGRAM> factory) voidswap(RedstoneProgram.Channel channel1, RedstoneProgram.Channel channel2) voidtick()voidunload()booleanbooleanvoidConsumer<net.minecraft.network.RegistryFriendlyByteBuf>
-
Field Details
-
ENCODER
public static final net.minecraft.network.codec.StreamEncoder<net.minecraft.network.RegistryFriendlyByteBuf,RedstoneProgram> ENCODER -
mode
SeePlayMode. -
length
protected int lengthLength of the program in beats. -
playtime
protected int playtimeHow far through the program we are, in beats. -
ticksToNextBeat
protected int ticksToNextBeatHow many ticks until the beat gets incremented. -
paused
public boolean pausedIf we are paused. -
pausedLastTick
protected boolean pausedLastTickWhether we were paused last tick. -
poweredLastTick
protected boolean poweredLastTickWhether we were powered last tick. -
channels
Each pair of Frequencies, and the list of strengths associated with it. -
ticksPerBeat
protected int ticksPerBeatChannel sequences may not change strength more often than this if edited in the GUI. -
beatsPerLine
public int beatsPerLinePurely visual, informs where lines should be drawn in the GUI. -
linesPerBar
public int linesPerBarPurely visual, informs which lines drawn in the GUI should be thicker. -
notifiedChange
protected boolean notifiedChangeWhether a the Redstone Link network was notified of a change in the last tick and it needn't be notified again.
-
-
Constructor Details
-
RedstoneProgram
public RedstoneProgram(RedstoneProgram.PlayMode mode, int length, int playtime, int ticksToNextBeat, boolean paused, boolean pausedLastTick, boolean poweredLastTick, List<RedstoneProgram.ChannelData> channels, int ticksPerBeat, int beatsPerLine, int linesPerBar) -
RedstoneProgram
public RedstoneProgram()
-
-
Method Details
-
codec
public static final <PROGRAM extends RedstoneProgram> com.mojang.serialization.Codec<PROGRAM> codec(RedstoneProgram.Factory<PROGRAM> factory) -
streamCodec
public static final <PROGRAM extends RedstoneProgram> net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,PROGRAM> streamCodec(RedstoneProgram.Factory<PROGRAM> factory) -
getMode
-
getLength
public int getLength() -
getPlaytime
public int getPlaytime() -
getTicksToNextBeat
public int getTicksToNextBeat() -
isPaused
public boolean isPaused() -
wasPausedLastTick
public boolean wasPausedLastTick() -
wasPoweredLastTick
public boolean wasPoweredLastTick() -
getChannelData
-
getTicksPerBeat
public int getTicksPerBeat() -
getBeatsPerLine
public int getBeatsPerLine() -
getLinesPerBar
public int getLinesPerBar() -
getAbsolutePlaytime
public int getAbsolutePlaytime()The number of ticks this program has been playing for. -
setTicksPerBeat
public void setTicksPerBeat(int value) -
tick
public void tick() -
restart
public void restart() -
hasPower
public abstract boolean hasPower() -
getBlockPos
public abstract net.minecraft.core.BlockPos getBlockPos() -
shouldTransmit
public abstract boolean shouldTransmit() -
getWorld
public abstract net.minecraft.world.level.LevelAccessor getWorld() -
whenChanged
public void whenChanged() -
getHashSalt
-
getChannels
-
addBlankChannel
public boolean addBlankChannel(net.createmod.catnip.data.Couple<com.simibubi.create.content.redstone.link.RedstoneLinkNetworkHandler.Frequency> frequencies, boolean simulate) - Parameters:
frequencies-- Returns:
trueif the Channel could be added (that frequency did not already exist)
-
remove
-
swap
-
load
public void load() -
unload
public void unload() -
setDuration
public void setDuration(int duration) -
copyFrom
public RedstoneProgram copyFrom(RedstoneProgram.PlayMode mode, int length, int playtime, int ticksToNextBeat, boolean paused, boolean pausedLastTick, boolean poweredLastTick, List<RedstoneProgram.ChannelData> channels, int ticksPerBeat, int beatsPerLine, int linesPerBar) -
copyFrom
-
hasPowerChanged
public boolean hasPowerChanged() -
getHandler
protected static com.simibubi.create.content.redstone.link.RedstoneLinkNetworkHandler getHandler() -
isValidWorld
protected static boolean isValidWorld(net.minecraft.world.level.LevelAccessor level) -
writeToMenu
-
equals
-
hashCode
public int hashCode()
-