Chicago Pile fix ClassCastException.

This commit is contained in:
BallOfEnergy 2024-12-31 17:18:04 -06:00
parent 86de688469
commit 9a22c343c9
2 changed files with 30 additions and 31 deletions

View File

@ -56,22 +56,22 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
public Item getItemDropped(int i, Random rand, int j) {
return null;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
TileEntityBobble entity = (TileEntityBobble) world.getTileEntity(x, y, z);
if(entity != null) {
return new ItemStack(this, 1, entity.type.ordinal());
}
return super.getPickBlock(target, world, x, y, z, player);
}
@Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
if(!player.capabilities.isCreativeMode) {
harvesters.set(player);
if(!world.isRemote) {
@ -87,7 +87,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
harvesters.set(null);
}
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
@ -96,11 +96,11 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
} else {
return true;
}
@ -109,7 +109,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for(int i = 1; i < BobbleType.values().length; i++)
list.add(new ItemStack(item, 1, i));
}
@ -118,12 +118,12 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
int meta = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(x, y, z);
bobble.type = BobbleType.values()[Math.abs(stack.getItemDamage()) % BobbleType.values().length];
bobble.markDirty();
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float f = 0.0625F;
@ -142,7 +142,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
}
public static class TileEntityBobble extends TileEntity {
public BobbleType type = BobbleType.NONE;
@Override
@ -156,7 +156,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
this.writeToNBT(nbt);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
@ -174,9 +174,9 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
nbt.setByte("type", (byte) type.ordinal());
}
}
public static enum BobbleType {
NONE( "null", "null", null, null, false, ScrapType.BOARD_BLANK),
STRENGTH( "Strength", "Strength", null, "It's essential to give your arguments impact.", false, ScrapType.BRIDGE_BIOS),
PERCEPTION( "Perception", "Perception", null, "Only through observation will you perceive weakness.", false, ScrapType.BRIDGE_NORTH),
@ -198,7 +198,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR),
DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC),
CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK),
MICROWAVE( "Microwave", "Microwave", "OC Compatibility", "they call me the food heater", true, ScrapType.BOARD_CONVERTER),
MICROWAVE( "Microwave", "Microwave", "OC Compatibility and massive RBMK/packet optimizations", "they call me the food heater$john optimization", true, ScrapType.BOARD_CONVERTER),
PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CARD_BOARD),
MELLOW( "MELLOWARPEGGIATION", "Mellow", "Industrial lighting, animation tools", "Make something cool now, ask for permission later.", true, ScrapType.CARD_PROCESSOR);
@ -208,7 +208,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
public String inscription; //the flavor text
public boolean skinLayers;
public ScrapType scrap;
private BobbleType(String name, String label, String contribution, String inscription, boolean layers, ScrapType scrap) {
this.name = name;
this.label = label;

View File

@ -74,29 +74,28 @@ public class PileNeutronHandler {
NeutronNodeWorld.addNode(new PileNeutronNode((TileEntityPileBase) tile));
}
TileEntityPileBase te = (TileEntityPileBase) tile;
Block block = te.getBlockType();
Block block = tile.getBlockType();
int meta = tile.getBlockMetadata();
if(!(tile instanceof TileEntityPileBase)) {
// Return when a boron block is hit
if (block == ModBlocks.block_boron)
return;
// Return when a boron block is hit
if(block == ModBlocks.block_boron)
return;
else if(block == ModBlocks.concrete ||
else if (block == ModBlocks.concrete ||
block == ModBlocks.concrete_smooth ||
block == ModBlocks.concrete_asbestos ||
block == ModBlocks.concrete_colored ||
block == ModBlocks.brick_concrete)
fluxQuantity *= 0.25;
fluxQuantity *= 0.25;
int meta = te.getBlockMetadata();
if (block == ModBlocks.block_graphite_rod && (meta & 8) == 0)
return;
}
if(block == ModBlocks.block_graphite_rod && (meta & 8) == 0)
return;
if(tile instanceof IPileNeutronReceiver) {
if(te instanceof IPileNeutronReceiver) {
IPileNeutronReceiver rec = (IPileNeutronReceiver) te;
IPileNeutronReceiver rec = (IPileNeutronReceiver) tile;
rec.receiveNeutrons((int) Math.floor(fluxQuantity));
if(block != ModBlocks.block_graphite_detector || (meta & 8) == 0)