Class RedstoneModule
java.lang.Object
me.desht.pneumaticcraft.common.tubemodules.AbstractTubeModule
me.desht.pneumaticcraft.common.tubemodules.AbstractNetworkedRedstoneModule
me.desht.pneumaticcraft.common.tubemodules.RedstoneModule
- All Implemented Interfaces:
INetworkedModule
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
FieldsFields inherited from class me.desht.pneumaticcraft.common.tubemodules.AbstractTubeModule
advancedConfig, dir, higherBound, lowerBound, MAX_VALUE, pressureTube, upgraded -
Constructor Summary
ConstructorsConstructorDescriptionRedstoneModule(net.minecraft.core.Direction dir, PressureTubeBlockEntity pressureTube) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected intintintprotected doubleGet the module's height (in range 0..16 as passed toBlock.box(double, double, double, double, double, double)protected intnet.minecraft.world.item.ItemgetItem()intintdoublegetWidth()Get the module's width (in range 0..16 as passed toBlock.box(double, double, double, double, double, double)booleanhasGui()Does this module have a gui? Server also needs to know about this, since module GUI's are opened in response to a packet from the server.booleanbooleanprotected booleanisWatchingChannel(int channel) booleanonActivated(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) protected voidonInputLevelChange(int level) Called when this module's input level is changed.voidvoidvoidreadFromNBT(net.minecraft.nbt.CompoundTag tag) voidsetColorChannel(int channel) voidsetComparatorInput(boolean comparatorInput) voidsetInverted(boolean inverted) voidsetOperation(RedstoneModule.Operation operation, int otherColor, int constantVal) booleansetOutputLevel(int level) voidsetRedstoneDirection(RedstoneModule.EnumRedstoneDirection redstoneDirection) voidvoidprotected voidupdateOutput(byte[] levels) This gets called byAbstractNetworkedRedstoneModule.notifyInputLevelsChanged(int)when the input levels of the channels that this module is watching changes.net.minecraft.nbt.CompoundTagwriteToNBT(net.minecraft.nbt.CompoundTag tag) Methods inherited from class me.desht.pneumaticcraft.common.tubemodules.AbstractNetworkedRedstoneModule
canConnectTo, fetchNetworkInputLevels, getInputLevel, notifyInputLevelsChanged, onNetworkReform, onPlaced, setInputLevel, updateInputLevelMethods inherited from class me.desht.pneumaticcraft.common.tubemodules.AbstractTubeModule
canUpgrade, equals, getDirection, getDrops, getRenderBoundingBox, getShape, getThreshold, getTube, getType, hashCode, isFake, isInline, isInlineAndFocused, isUpgraded, isValid, markFake, onRemoved, sendDescriptionPacket, setChanged, tickCommon, updateNeighbors, upgrade
-
Field Details
-
extension
public float extension -
lastExtension
public float lastExtension
-
-
Constructor Details
-
RedstoneModule
-
-
Method Details
-
hasGui
public boolean hasGui()Description copied from class:AbstractTubeModuleDoes this module have a gui? Server also needs to know about this, since module GUI's are opened in response to a packet from the server.- Overrides:
hasGuiin classAbstractTubeModule- Returns:
- true if the module has a gui
-
onNeighborBlockUpdate
public void onNeighborBlockUpdate()- Overrides:
onNeighborBlockUpdatein classAbstractTubeModule
-
onNeighborTileUpdate
public void onNeighborTileUpdate()- Overrides:
onNeighborTileUpdatein classAbstractTubeModule
-
getWidth
public double getWidth()Description copied from class:AbstractTubeModuleGet the module's width (in range 0..16 as passed toBlock.box(double, double, double, double, double, double)- Overrides:
getWidthin classAbstractTubeModule- Returns:
- the width
-
getHeight
protected double getHeight()Description copied from class:AbstractTubeModuleGet the module's height (in range 0..16 as passed toBlock.box(double, double, double, double, double, double)- Overrides:
getHeightin classAbstractTubeModule- Returns:
- the height
-
getItem
public net.minecraft.world.item.Item getItem()- Specified by:
getItemin classAbstractTubeModule
-
tickServer
public void tickServer()- Overrides:
tickServerin classAbstractNetworkedRedstoneModule
-
updateOutput
protected void updateOutput(@Nullable byte[] levels) Description copied from class:AbstractNetworkedRedstoneModuleThis gets called byAbstractNetworkedRedstoneModule.notifyInputLevelsChanged(int)when the input levels of the channels that this module is watching changes.- Overrides:
updateOutputin classAbstractNetworkedRedstoneModule- Parameters:
levels- the input levels of all channels
-
isWatchingChannel
protected boolean isWatchingChannel(int channel) - Overrides:
isWatchingChannelin classAbstractNetworkedRedstoneModule- Returns:
- if this module is "watching"
channel(ifAbstractNetworkedRedstoneModule.updateOutput(byte[])should be called when the respective channels updates)
-
tickClient
public void tickClient()- Overrides:
tickClientin classAbstractTubeModule
-
writeToNBT
public net.minecraft.nbt.CompoundTag writeToNBT(net.minecraft.nbt.CompoundTag tag) - Overrides:
writeToNBTin classAbstractTubeModule
-
readFromNBT
public void readFromNBT(net.minecraft.nbt.CompoundTag tag) - Overrides:
readFromNBTin classAbstractTubeModule
-
getRedstoneDirection
-
setRedstoneDirection
-
getRedstoneLevel
public int getRedstoneLevel()- Overrides:
getRedstoneLevelin classAbstractTubeModule
-
setOutputLevel
public boolean setOutputLevel(int level) -
getColorChannel
public int getColorChannel()- Specified by:
getColorChannelin interfaceINetworkedModule
-
getInputChannel
protected int getInputChannel()- Overrides:
getInputChannelin classAbstractNetworkedRedstoneModule- Returns:
- the input channel of this module, or -1 if not inputting
-
setColorChannel
public void setColorChannel(int channel) - Specified by:
setColorChannelin interfaceINetworkedModule
-
isInverted
public boolean isInverted() -
setInverted
public void setInverted(boolean inverted) -
isComparatorInput
public boolean isComparatorInput() -
setComparatorInput
public void setComparatorInput(boolean comparatorInput) -
addInfo
- Overrides:
addInfoin classAbstractTubeModule
-
onActivated
public boolean onActivated(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) - Overrides:
onActivatedin classAbstractTubeModule
-
calculateInputLevel
protected int calculateInputLevel()- Overrides:
calculateInputLevelin classAbstractNetworkedRedstoneModule- Returns:
- the current input signal level
-
onInputLevelChange
protected void onInputLevelChange(int level) Description copied from class:AbstractNetworkedRedstoneModuleCalled when this module's input level is changed.- Overrides:
onInputLevelChangein classAbstractNetworkedRedstoneModule- Parameters:
level- the new input level
-
getOperation
-
getOtherColor
public int getOtherColor() -
getConstantVal
public int getConstantVal() -
setOperation
-