java.lang.Object
com.petrolpark.compat.create.common.redstone.programmer.RedstoneProgram
Direct Known Subclasses:
RedstoneProgrammerBehaviour.BehaviourRedstoneProgram, RedstoneProgrammerBlockItem.ItemStackRedstoneProgram, RedstoneProgrammerMenu.DummyRedstoneProgram

public abstract class RedstoneProgram extends Object
  • Field Details

    • ENCODER

      public static final net.minecraft.network.codec.StreamEncoder<net.minecraft.network.RegistryFriendlyByteBuf,RedstoneProgram> ENCODER
    • mode

    • length

      protected int length
      Length of the program in beats.
    • playtime

      protected int playtime
      How far through the program we are, in beats.
    • ticksToNextBeat

      protected int ticksToNextBeat
      How many ticks until the beat gets incremented.
    • paused

      public boolean paused
      If we are paused.
    • pausedLastTick

      protected boolean pausedLastTick
      Whether we were paused last tick.
    • poweredLastTick

      protected boolean poweredLastTick
      Whether we were powered last tick.
    • channels

      protected List<RedstoneProgram.Channel> channels
      Each pair of Frequencies, and the list of strengths associated with it.
    • ticksPerBeat

      protected int ticksPerBeat
      Channel sequences may not change strength more often than this if edited in the GUI.
    • beatsPerLine

      public int beatsPerLine
      Purely visual, informs where lines should be drawn in the GUI.
    • linesPerBar

      public int linesPerBar
      Purely visual, informs which lines drawn in the GUI should be thicker.
    • notifiedChange

      protected boolean notifiedChange
      Whether 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

      public RedstoneProgram.PlayMode 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

      public List<RedstoneProgram.ChannelData> 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

      public Object getHashSalt()
    • getChannels

      public com.google.common.collect.ImmutableList<RedstoneProgram.Channel> getChannels()
    • tryAddNewChannel

      public boolean tryAddNewChannel(net.createmod.catnip.data.Couple<com.simibubi.create.content.redstone.link.RedstoneLinkNetworkHandler.Frequency> frequency, net.minecraft.world.entity.player.Player player, boolean simulate)
    • addBlankChannel

      public void addBlankChannel(net.createmod.catnip.data.Couple<com.simibubi.create.content.redstone.link.RedstoneLinkNetworkHandler.Frequency> frequencies)
    • remove

      public boolean remove(RedstoneProgram.Channel channel)
    • swap

      public void swap(RedstoneProgram.Channel channel1, RedstoneProgram.Channel channel2)
    • 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

      public RedstoneProgram copyFrom(@Nonnull RedstoneProgram otherProgram)
    • 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

      public Consumer<net.minecraft.network.RegistryFriendlyByteBuf> writeToMenu()
    • translate

      public static final net.minecraft.network.chat.MutableComponent translate(String suffix, Object... args)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object