Class BaseCommandBlock
java.lang.Object
net.minecraft.world.level.BaseCommandBlock
- Direct Known Subclasses:
MinecartCommandBlock.MinecartCommandBase
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe command stored in the command block.private @Nullable Componentprivate static final Componentprivate longprivate @Nullable ComponentThe previously run command.private static final intprivate intThe number of successful commands run.private booleanprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CommandSourceStackcreateCommandSourceStack(ServerLevel level, CommandSource source) private @Nullable BaseCommandBlock.CloseableCommandBlockSourcecreateSource(ServerLevel level) @Nullable ComponentgetName()intbooleanabstract booleanisValid()voidload(ValueInput input) abstract voidonUpdated(ServerLevel level) booleanperformCommand(ServerLevel level) voidsave(ValueOutput output) voidsetCommand(String command) Sets the command.voidsetCustomName(@Nullable Component name) voidsetLastOutput(@Nullable Component lastOutput) voidsetSuccessCount(int successCount) voidsetTrackOutput(boolean trackOutput)
-
Field Details
-
DEFAULT_NAME
-
NO_LAST_EXECUTION
private static final int NO_LAST_EXECUTION- See Also:
-
lastExecution
private long lastExecution -
updateLastExecution
private boolean updateLastExecution -
successCount
private int successCountThe number of successful commands run. (used for redstone output) -
trackOutput
private boolean trackOutput -
lastOutput
The previously run command. -
command
The command stored in the command block. -
customName
-
-
Constructor Details
-
BaseCommandBlock
public BaseCommandBlock()
-
-
Method Details
-
getSuccessCount
public int getSuccessCount() -
setSuccessCount
public void setSuccessCount(int successCount) -
getLastOutput
-
save
-
load
-
setCommand
Sets the command. -
getCommand
-
performCommand
-
createSource
-
getName
-
getCustomName
-
setCustomName
-
onUpdated
-
setLastOutput
-
setTrackOutput
public void setTrackOutput(boolean trackOutput) -
isTrackOutput
public boolean isTrackOutput() -
createCommandSourceStack
public abstract CommandSourceStack createCommandSourceStack(ServerLevel level, CommandSource source) -
isValid
public abstract boolean isValid()
-