java.lang.Object
purplecreate.tramways.content.signs.demands.SignDemand
Direct Known Subclasses:
AuxSignDemand, SpeedSignDemand, TemporaryEndSignDemand, WhistleSignDemand

public abstract class SignDemand extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(net.minecraft.nbt.CompoundTag tag, com.simibubi.create.content.trains.entity.Train train, double distance)
    This function is ran every tick on the run-up to and whilst the train runs over the track point
    abstract net.minecraft.world.item.ItemStack
     
    dev.engine_room.flywheel.lib.model.baked.PartialModel
     
    void
    initSettingsGUI(com.simibubi.create.foundation.gui.ModularGuiLineBuilder builder)
    Set up the settings menu for your demand
    boolean
     
    static boolean
    isManual(com.simibubi.create.content.trains.entity.Train train)
    Check if a train is being driven manually
    static void
    register(net.minecraft.resources.ResourceLocation location, SignDemand demand)
    Use this to register a demand.
    void
    render(TramSignBlock.SignType signType, net.minecraft.nbt.CompoundTag tag, com.mojang.blaze3d.vertex.PoseStack ms, net.minecraft.client.renderer.MultiBufferSource buffer, int light, int overlay)
    Use this to render text or symbols on the sign
    static void
    renderTextInCenter(String text, int color, float scale, com.mojang.blaze3d.vertex.PoseStack ms, net.minecraft.client.renderer.MultiBufferSource buffer, int light)
    Render text in the center of the sign
    void
    setDefaultSettings(net.minecraft.nbt.CompoundTag tag)
    Set up the default settings for your demand
    void
    validateSettings(net.minecraft.nbt.CompoundTag received, net.minecraft.nbt.CompoundTag disk)
    Validate settings sent over the network

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SignDemand

      public SignDemand()
  • Method Details

    • register

      public static void register(net.minecraft.resources.ResourceLocation location, SignDemand demand)
      Use this to register a demand. You should probably use this at the common setup event.
      Parameters:
      location - A unique id for your demand
      demand - A new instance of your demand
    • isManual

      public static boolean isManual(com.simibubi.create.content.trains.entity.Train train)
      Check if a train is being driven manually
      Parameters:
      train - The train to check
      Returns:
      True if the train is manually driven
    • renderTextInCenter

      public static void renderTextInCenter(String text, int color, float scale, com.mojang.blaze3d.vertex.PoseStack ms, net.minecraft.client.renderer.MultiBufferSource buffer, int light)
      Render text in the center of the sign
      Parameters:
      text - The text to be rendered
      color - The color of the text as an int
      scale - The scale of the text (something like .4f/16f is good)
      ms - The PoseStack given by SignDemand#render
      buffer - The MultiBufferSource given by SignDemand#render
      light - The int light given by SignDemand#render
    • isAuxiliary

      public boolean isAuxiliary()
      Returns:
      true if the sign demand should be for auxiliary blocks
    • getIcon

      @Environment(CLIENT) public abstract net.minecraft.world.item.ItemStack getIcon()
      Returns:
      an icon to be shown in the settings menu
    • getSignFace

      @Environment(CLIENT) public dev.engine_room.flywheel.lib.model.baked.PartialModel getSignFace(TramSignBlock.SignType signType)
    • initSettingsGUI

      @Environment(CLIENT) public void initSettingsGUI(com.simibubi.create.foundation.gui.ModularGuiLineBuilder builder)
      Set up the settings menu for your demand
      Parameters:
      builder - Add elements using the builder
    • validateSettings

      public void validateSettings(net.minecraft.nbt.CompoundTag received, net.minecraft.nbt.CompoundTag disk)
      Validate settings sent over the network
      Parameters:
      received - For reading settings from network
      disk - For writing validated settings
    • setDefaultSettings

      public void setDefaultSettings(net.minecraft.nbt.CompoundTag tag)
      Set up the default settings for your demand
      Parameters:
      tag - Write the defaults to tag
    • execute

      public void execute(net.minecraft.nbt.CompoundTag tag, com.simibubi.create.content.trains.entity.Train train, double distance)
      This function is ran every tick on the run-up to and whilst the train runs over the track point
      Parameters:
      tag - The settings for your demand
      train - The train running past the sign
    • render

      @Environment(CLIENT) public void render(TramSignBlock.SignType signType, net.minecraft.nbt.CompoundTag tag, com.mojang.blaze3d.vertex.PoseStack ms, net.minecraft.client.renderer.MultiBufferSource buffer, int light, int overlay)

      Use this to render text or symbols on the sign

      Tip: You can use SignDemand.renderTextInCenter if you just need something simple

      Parameters:
      tag - The settings for your demand