Package net.minecraft.world.level
Class BaseCommandBlock
java.lang.Object
net.minecraft.world.level.BaseCommandBlock
- All Implemented Interfaces:
CommandSource
- Direct Known Subclasses:
MinecartCommandBlock.MinecartCommandBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
The command stored in the command block.private Component
private static final Component
private long
private Component
The previously run command.private int
The number of successful commands run.private static final SimpleDateFormat
The formatting for the timestamp on commands run.private boolean
private boolean
Fields inherited from interface net.minecraft.commands.CommandSource
NULL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
abstract CommandSourceStack
abstract ServerLevel
getLevel()
getName()
abstract Vec3
int
boolean
abstract boolean
isValid()
void
load
(CompoundTag pTag, HolderLookup.Provider pLevelRegistry) abstract void
boolean
performCommand
(Level pLevel) save
(CompoundTag pTag, HolderLookup.Provider pLevelRegistry) void
sendSystemMessage
(Component pComponent) void
setCommand
(String pCommand) Sets the command.void
setCustomName
(Component pCustomName) void
setLastOutput
(Component pLastOutputMessage) void
setSuccessCount
(int pSuccessCount) void
setTrackOutput
(boolean pShouldTrackOutput) boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.commands.CommandSource
alwaysAccepts
-
Field Details
-
TIME_FORMAT
The formatting for the timestamp on commands run. -
DEFAULT_NAME
-
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 pSuccessCount) -
getLastOutput
-
save
-
load
-
setCommand
Sets the command. -
getCommand
-
performCommand
-
getName
-
getCustomName
-
setCustomName
-
sendSystemMessage
- Specified by:
sendSystemMessage
in interfaceCommandSource
-
getLevel
-
onUpdated
public abstract void onUpdated() -
setLastOutput
-
setTrackOutput
public void setTrackOutput(boolean pShouldTrackOutput) -
isTrackOutput
public boolean isTrackOutput() -
usedBy
-
getPosition
-
createCommandSourceStack
-
acceptsSuccess
public boolean acceptsSuccess()- Specified by:
acceptsSuccess
in interfaceCommandSource
-
acceptsFailure
public boolean acceptsFailure()- Specified by:
acceptsFailure
in interfaceCommandSource
-
shouldInformAdmins
public boolean shouldInformAdmins()- Specified by:
shouldInformAdmins
in interfaceCommandSource
-
isValid
public abstract boolean isValid()
-