Java源码示例:erogenousbeef.core.multiblock.MultiblockValidationException
示例1
@Override
protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException {
// We only allow air and functional parts in turbines.
// Air is ok
if (world.isAirBlock(x, y, z)) {
return;
}
Block block = world.getBlock(x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
// Coil windings below here:
// Everything else, gtfo
throw new MultiblockValidationException(String.format("%d, %d, %d is invalid for a turbine interior. Only rotor parts, metal blocks and empty space are allowed.", x, y, z));
}
示例2
@Override
public void isGoodForInterior() throws MultiblockValidationException {
// Check above and below. Above must be fuel rod or control rod.
TileEntity entityAbove = this.worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if (!(entityAbove instanceof TileEntityReactorFuelRodSimulator || entityAbove instanceof TileEntityReactorControlRod)) {
throw new MultiblockValidationException(String.format("Fuel rod at %d, %d, %d must be part of a vertical column that reaches the entire height of the reactor, with a control rod on top.", xCoord, yCoord, zCoord));
}
// Below must be fuel rod or the base of the reactor.
TileEntity entityBelow = this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if (entityBelow instanceof TileEntityReactorFuelRodSimulator) {
return;
} else if (entityBelow instanceof RectangularMultiblockTileEntityBase) {
((RectangularMultiblockTileEntityBase)entityBelow).isGoodForBottom();
return;
}
throw new MultiblockValidationException(String.format("Fuel rod at %d, %d, %d must be part of a vertical column that reaches the entire height of the reactor, with a control rod on top.", xCoord, yCoord, zCoord));
}
示例3
@Override
protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException {
// We only allow air and functional parts in turbines.
// Air is ok
if (world.isAirBlock(x, y, z)) {
return;
}
Block block = world.getBlock(x, y, z);
int metadata = world.getBlockMetadata(x, y, z);
// Coil windings below here:
// Everything else, gtfo
throw new MultiblockValidationException(String.format("%d, %d, %d is invalid for a turbine interior. Only rotor parts, metal blocks and empty space are allowed.", x, y, z));
}
示例4
@Override
public void isGoodForInterior() throws MultiblockValidationException {
// Check above and below. Above must be fuel rod or control rod.
TileEntity entityAbove = this.worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if (!(entityAbove instanceof TileEntityReactorFuelRodSimulator || entityAbove instanceof TileEntityReactorControlRod)) {
throw new MultiblockValidationException(String.format("Fuel rod at %d, %d, %d must be part of a vertical column that reaches the entire height of the reactor, with a control rod on top.", xCoord, yCoord, zCoord));
}
// Below must be fuel rod or the base of the reactor.
TileEntity entityBelow = this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if (entityBelow instanceof TileEntityReactorFuelRodSimulator) {
return;
} else if (entityBelow instanceof RectangularMultiblockTileEntityBase) {
((RectangularMultiblockTileEntityBase)entityBelow).isGoodForBottom();
return;
}
throw new MultiblockValidationException(String.format("Fuel rod at %d, %d, %d must be part of a vertical column that reaches the entire height of the reactor, with a control rod on top.", xCoord, yCoord, zCoord));
}
示例5
@Override
public void isGoodForInterior() throws MultiblockValidationException {
// Check above and below. Above must be fuel rod or control rod.
TileEntity entityAbove = this.worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if(!(entityAbove instanceof TileEntityReactorFuelRod || entityAbove instanceof TileEntityReactorControlRod)) {
throw new MultiblockValidationException(String.format("Fuel rod at %d, %d, %d must be part of a vertical column that reaches the entire height of the reactor, with a control rod on top.", xCoord, yCoord, zCoord));
}
// Below must be fuel rod or the base of the reactor.
TileEntity entityBelow = this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if(entityBelow instanceof TileEntityReactorFuelRod) {
return;
}
else if(entityBelow instanceof RectangularMultiblockTileEntityBase) {
((RectangularMultiblockTileEntityBase)entityBelow).isGoodForBottom();
return;
}
throw new MultiblockValidationException(String.format("Fuel rod at %d, %d, %d must be part of a vertical column that reaches the entire height of the reactor, with a control rod on top.", xCoord, yCoord, zCoord));
}
示例6
@Override
protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException {
// We only allow air and functional parts in turbines.
// Air is ok
if(world.isAirBlock(x, y, z)) { return; }
Block block = world.getBlock(x, y, z);
int metadata = world.getBlockMetadata(x,y,z);
// Coil windings below here:
if(getCoilPartData(x, y, z, block, metadata) != null) {
foundCoils.add(new CoordTriplet(x,y,z));
return;
}
// Everything else, gtfo
throw new MultiblockValidationException(String.format("%d, %d, %d is invalid for a turbine interior. Only rotor parts, metal blocks and empty space are allowed.", x, y, z));
}
示例7
@Override
protected void isMachineWhole() throws MultiblockValidationException {
// Ensure that there is at least one controller and control rod attached.
if(attachedControlRods.size() < 1) {
throw new MultiblockValidationException("Not enough control rods. Reactors require at least 1.");
}
if(attachedControllers.size() < 1) {
throw new MultiblockValidationException("Not enough controllers. Reactors require at least 1.");
}
super.isMachineWhole();
}
示例8
@Override
public void isGoodForFrame() throws MultiblockValidationException {
int metadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
if(BlockReactorPart.isCasing(metadata)) { return; }
throw new MultiblockValidationException(String.format("%d, %d, %d - Only casing may be used as part of a reactor's frame", xCoord, yCoord, zCoord));
}
示例9
@Override
public void isGoodForTop() throws MultiblockValidationException {
// Check that the space below us is a fuel rod
TileEntity teBelow = this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if(!(teBelow instanceof TileEntityReactorFuelRod)) {
throw new MultiblockValidationException(String.format("%d, %d, %d - Control rods may only be placed on the top face, atop a column of fuel rods", xCoord, yCoord, zCoord));
}
}
示例10
@Override
public void isGoodForFrame() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例11
@Override
public void isGoodForSides() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例12
@Override
public void isGoodForTop() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例13
@Override
public void isGoodForBottom() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例14
@Override
public void isGoodForFrame() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例15
@Override
public void isGoodForSides() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例16
@Override
public void isGoodForTop() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例17
@Override
public void isGoodForBottom() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - fuel rods may only be placed in the reactor interior", xCoord, yCoord, zCoord));
}
示例18
@Override
public void isGoodForFrame() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - Reactor glass may only be used on the exterior faces, not as part of a reactor's frame or interior", xCoord, yCoord, zCoord));
}
示例19
@Override
public void isGoodForSides() throws MultiblockValidationException {
}
示例20
@Override
public void isGoodForTop() throws MultiblockValidationException {
}
示例21
@Override
public void isGoodForBottom() throws MultiblockValidationException {
}
示例22
@Override
public void isGoodForInterior() throws MultiblockValidationException {
throw new MultiblockValidationException(String.format("%d, %d, %d - Reactor glass may only be used on the exterior faces, not as part of a reactor's frame or interior", xCoord, yCoord, zCoord));
}
示例23
@Override
public void isGoodForFrame() throws MultiblockValidationException {
throw new MultiblockValidationException("Rotor parts may only be placed in the turbine interior");
}
示例24
@Override
public void isGoodForSides() throws MultiblockValidationException {
throw new MultiblockValidationException("Rotor parts may only be placed in the turbine interior");
}
示例25
@Override
public void isGoodForTop() throws MultiblockValidationException {
throw new MultiblockValidationException("Rotor parts may only be placed in the turbine interior");
}
示例26
@Override
public void isGoodForBottom() throws MultiblockValidationException {
throw new MultiblockValidationException("Rotor parts may only be placed in the turbine interior");
}
示例27
@Override
public void isGoodForInterior() throws MultiblockValidationException {
}
示例28
@Override
public void isGoodForSides() throws MultiblockValidationException {
// All parts are valid for sides, by default
}
示例29
@Override
public void isGoodForTop() throws MultiblockValidationException {
// All parts are valid for the top, by default
}
示例30
@Override
public void isGoodForBottom() throws MultiblockValidationException {
// All parts are valid for the bottom, by default
}