use of crazypants.enderio.base.machine.modes.IoMode in project EnderIO by SleepyTrousers.
the class ImpulseRenderMapper method renderIO.
@SideOnly(Side.CLIENT)
protected EnumMap<EnumFacing, EnumIOMode> renderIO(@Nonnull TileImpulseHopper tileEntity, @Nonnull BlockImpulseHopper block) {
EnumMap<EnumFacing, EnumIOMode> result = new EnumMap<EnumFacing, EnumIOMode>(EnumFacing.class);
for (EnumFacing face : EnumFacing.values()) {
IoMode ioMode = tileEntity.getIoMode(face);
if (ioMode != IoMode.NONE) {
EnumIOMode iOMode = mapIOMode(ioMode);
result.put(face, iOMode);
}
}
return result.isEmpty() ? null : result;
}
use of crazypants.enderio.base.machine.modes.IoMode in project EnderIO by SleepyTrousers.
the class AbstractMachineEntity method toggleIoModeForFace.
@Override
@Nonnull
public IoMode toggleIoModeForFace(@Nullable EnumFacing faceHit) {
IoMode curMode = getIoMode(faceHit);
IoMode mode = curMode.next();
while (!supportsMode(faceHit, mode)) {
mode = mode.next();
}
setIoMode(faceHit, mode);
return mode;
}
use of crazypants.enderio.base.machine.modes.IoMode in project EnderIO by SleepyTrousers.
the class GuiOverlayIoConfig method init.
@Override
public void init(@Nonnull IGuiScreen screenIn) {
this.screen = screenIn;
renderer = new IoConfigRenderer<E>(coords) {
@Override
@Nonnull
protected String getLabelForMode(@Nonnull IoMode mode) {
return GuiOverlayIoConfig.this.getLabelForMode(mode);
}
};
renderer.init();
bounds = new Rectangle(screenIn.getOverlayOffsetXLeft() + 5, screenIn.getGuiYSize() - height - 5, screenIn.getGuiXSize() - screenIn.getOverlayOffsetXRight() - 10, height);
}
use of crazypants.enderio.base.machine.modes.IoMode in project EnderIO by SleepyTrousers.
the class TileCapBank method toggleIoModeForFace.
// ---------- IO
@Override
@Nonnull
public IoMode toggleIoModeForFace(@Nullable EnumFacing faceHit) {
if (faceHit == null) {
return IoMode.NONE;
}
IPowerInterface rec = getReceptorForFace(faceHit);
IoMode curMode = getIoMode(faceHit);
if (curMode == IoMode.PULL) {
setIoMode(faceHit, IoMode.PUSH, true);
return IoMode.PUSH;
}
if (curMode == IoMode.PUSH) {
setIoMode(faceHit, IoMode.DISABLED, true);
return IoMode.DISABLED;
}
if (curMode == IoMode.DISABLED) {
if (rec == null || rec.getProvider() instanceof IConduitBundle) {
setIoMode(faceHit, IoMode.NONE, true);
return IoMode.NONE;
}
}
setIoMode(faceHit, IoMode.PULL, true);
return IoMode.PULL;
}
use of crazypants.enderio.base.machine.modes.IoMode in project EnderIO by SleepyTrousers.
the class TileCapBank method setIoMode.
public void setIoMode(@Nonnull EnumFacing faceHit, @Nonnull IoMode mode, boolean updateReceptors) {
if (mode == IoMode.NONE) {
if (faceModes == null) {
return;
}
faceModes.remove(faceHit);
if (faceModes.isEmpty()) {
faceModes = null;
}
} else {
if (faceModes == null) {
faceModes = new EnumMap<EnumFacing, IoMode>(EnumFacing.class);
}
faceModes.put(faceHit, mode);
}
markDirty();
if (updateReceptors) {
validateModeForReceptor(faceHit);
receptorsDirty = true;
}
if (hasWorld()) {
IBlockState bs = world.getBlockState(pos);
world.notifyBlockUpdate(pos, bs, bs, 3);
// TODO what is this? world.notifyBlockOfStateChange(getPos(), getBlockType());
world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
Aggregations