Class SignDemand
java.lang.Object
purplecreate.tramways.content.signs.demands.SignDemand
- Direct Known Subclasses:
AuxSignDemand
,SpeedSignDemand
,TemporaryEndSignDemand
,WhistleSignDemand
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 pointabstract net.minecraft.world.item.ItemStack
getIcon()
dev.engine_room.flywheel.lib.model.baked.PartialModel
getSignFace
(TramSignBlock.SignType signType) void
initSettingsGUI
(com.simibubi.create.foundation.gui.ModularGuiLineBuilder builder) Set up the settings menu for your demandboolean
static boolean
isManual
(com.simibubi.create.content.trains.entity.Train train) Check if a train is being driven manuallystatic 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 signstatic 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 signvoid
setDefaultSettings
(net.minecraft.nbt.CompoundTag tag) Set up the default settings for your demandvoid
validateSettings
(net.minecraft.nbt.CompoundTag received, net.minecraft.nbt.CompoundTag disk) Validate settings sent over the network
-
Constructor Details
-
SignDemand
public SignDemand()
-
-
Method Details
-
register
Use this to register a demand. You should probably use this at the common setup event.- Parameters:
location
- A unique id for your demanddemand
- 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 renderedcolor
- The color of the text as an intscale
- The scale of the text (something like .4f/16f is good)ms
- The PoseStack given by SignDemand#renderbuffer
- The MultiBufferSource given by SignDemand#renderlight
- 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 networkdisk
- 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 demandtrain
- 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
-