diff --git a/changelog b/changelog index 29e0ddd73..404c55913 100644 --- a/changelog +++ b/changelog @@ -1,33 +1,27 @@ ## Added -* Analysis tool - * A more universal version of the power net analyzer - * Currently only works on fluid networks though - * In addition to seeing links and subscribers, the analysis tool also displays subscriber positions as well as a log (up to 50 entries) of what block received how much fluid - * This should finally give more insight in the bug that rarely causes fluids to disappear -* Leadburster - * A 40mm launcher grenade that doesn't explode, instead it attaches itself to a block and starts firing bullets - * Fires in circles for 2 seconds before it self-destructs -* Congo lake - * A 40mm pump-action grenade launcher with a capacity of 4 rounds -* Lantern - * Cheap and fancy illumination - * Will blind glyphids in a small radius - * Glyphids don't actually have eyes, just don't think about it too much -* Ashpit - * An optional part that can be placed under fireboxes and heating ovens - * Collects ashes, producing one ash pile for every 10 furnace operations worth of fuel - * Ash comes in different types like wood (from planks, logs and saplings), coal (coal, lignite and coke) and generic (everything else) - * Ashes can be used as dyes, for making industrial fertilizer, as low-efficiency furnace fuel or for carbon in the crucible - * Coal ashes can also be centrifuged, returning the flammable content as unburned coal dust as well as a small amount of boron +* PWR + * The successor to the old large nuclear reactor + * Has some design similarities with the RBMK, but in 3D + * Relatively easy to build and safe to operate + * Does not use any tile entity rendering and all math is pre-calculated when the reactor is assembled, making this one even more performant than the old large reactor +* Sodalite + * A gem that can be extracted from fluorite ore + * Can be heated in the combination oven to make sodium dust and chlorine ## Changed -* Updated polish and chinese localization -* Flechettes now get stuck in blocks for a few seconds -* NBT kits now display the amount of items in a stack -* Removed the special nuclear meteorite +* Bedrock fluorite ore now yields actual ore instead of fluorite directly +* Blocks that fall from fallout effects no longer drop items when falling on small blocks, preventing issues like gas blocks being dropped +* Bullets no longer need primers to be crafted, primers no longer exist at all +* The automatic buzzsaw can now use wood oil, ethanol, fish oil and heavy oil to run +* Fluorite ore is now centrifugable +* Fluorite crystals now centrifuge into slightly less fluorite but also yield sodalite ## Fixed -* Fixed thermos craching config hitting before the config is saved, resulting in an empty config the first time the server is launched -* Fixed heating oven not visually connecting to exhaust pipes -* Fixed loot blocks not correctly rendering items that require multiple render passes -* Fixed special meteorites spawning in worldgen +* Fixed FEnSU's IO limit not working properly +* Fixed overflow caused by uncapped Spk values of DFC beams, they are now capped at 9,200,000 Spk +* Fixed smooth lighting not working on connected textures +* Fixed the Thermos preventer not working on Crucible type servers +* Fixed pollution save files not working correctly on certain Thermos forks +* Fixed blast furnace output overstacking +* Fixed potential crash caused by centrifuges trying to create a recipe using non-registered items +* Fixed chemplant GUI crashing when too many upgrades are applied to a short duration recipe diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index fe480dde1..371268c24 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -875,6 +875,17 @@ public class ModBlocks { public static Block cm_circuit; public static Block cm_port; public static Block custom_machine; + + public static Block pwr_fuel; + public static Block pwr_control; + public static Block pwr_channel; + public static Block pwr_heatex; + public static Block pwr_neutron_source; + public static Block pwr_reflector; + public static Block pwr_casing; + public static Block pwr_port; + public static Block pwr_controller; + public static Block pwr_block; public static Block reactor_element; public static Block reactor_control; @@ -2036,6 +2047,17 @@ public class ModBlocks { cm_port = new BlockCMPort(Material.iron, EnumCMMaterials.class, true, true).setBlockName("cm_port").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_port"); custom_machine = new BlockCustomMachine().setBlockName("custom_machine").setCreativeTab(MainRegistry.machineTab).setLightLevel(1F).setHardness(5.0F).setResistance(10.0F); + pwr_fuel = new BlockPillar(Material.iron, RefStrings.MODID + ":pwr_fuel_top").setBlockName("pwr_fuel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_fuel_side"); + pwr_control = new BlockPillar(Material.iron, RefStrings.MODID + ":pwr_control_top").setBlockName("pwr_control").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_control_side"); + pwr_channel = new BlockPillar(Material.iron, RefStrings.MODID + ":pwr_channel_top").setBlockName("pwr_channel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_channel_side"); + pwr_heatex = new BlockGeneric(Material.iron).setBlockName("pwr_heatex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_heatex"); + pwr_neutron_source = new BlockGeneric(Material.iron).setBlockName("pwr_neutron_source").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_neutron_source"); + pwr_reflector = new BlockGeneric(Material.iron).setBlockName("pwr_reflector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_reflector"); + pwr_casing = new BlockGeneric(Material.iron).setBlockName("pwr_casing").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_casing"); + pwr_port = new BlockGeneric(Material.iron).setBlockName("pwr_port").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_port"); + pwr_controller = new MachinePWRController(Material.iron).setBlockName("pwr_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_casing_blank"); + pwr_block = new BlockPWR(Material.iron).setBlockName("pwr_block").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_block"); + reactor_element = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_element_top", RefStrings.MODID + ":reactor_element_base").setBlockName("reactor_element").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_element_side"); reactor_control = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_control_top").setBlockName("reactor_control").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_control_side"); reactor_hatch = new ReactorHatch(Material.iron).setBlockName("reactor_hatch").setHardness(5.0F).setResistance(1000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_concrete"); @@ -3366,6 +3388,18 @@ public class ModBlocks { register(cm_circuit); register(cm_port); + //PWR + GameRegistry.registerBlock(pwr_fuel, pwr_fuel.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_control, pwr_control.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_channel, pwr_channel.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_heatex, pwr_heatex.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_neutron_source, pwr_neutron_source.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_reflector, pwr_reflector.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_casing, pwr_casing.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_port, pwr_port.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_controller, pwr_controller.getUnlocalizedName()); + GameRegistry.registerBlock(pwr_block, pwr_block.getUnlocalizedName()); + //Multiblock Generators GameRegistry.registerBlock(reactor_element, reactor_element.getUnlocalizedName()); GameRegistry.registerBlock(reactor_control, reactor_control.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/bomb/NukeBoy.java b/src/main/java/com/hbm/blocks/bomb/NukeBoy.java index 01673e12d..d25f59ace 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeBoy.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeBoy.java @@ -5,10 +5,12 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.config.BombConfig; import com.hbm.entity.effect.EntityNukeCloudSmall; +import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.entity.logic.EntityNukeExplosionMK5; import com.hbm.interfaces.IBomb; import com.hbm.main.MainRegistry; import com.hbm.tileentity.bomb.TileEntityNukeBoy; +import com.hbm.util.TrackerUtil; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.Block; @@ -124,7 +126,13 @@ public class NukeBoy extends BlockContainer implements IBomb { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.boyRadius, x + 0.5, y + 0.5, z + 0.5)); - world.spawnEntityInWorld(EntityNukeCloudSmall.statFac(world, x, y, z, BombConfig.boyRadius)); + //world.spawnEntityInWorld(EntityNukeCloudSmall.statFac(world, x, y, z, BombConfig.boyRadius)); + + EntityNukeTorex torex = new EntityNukeTorex(world); + torex.setPositionAndRotation(x + 0.5, y + 1, z + 0.5, 0, 0); + torex.getDataWatcher().updateObject(10, 1.5F); + world.spawnEntityInWorld(torex); + TrackerUtil.setTrackingRange(world, torex, 1000); } return false; } diff --git a/src/main/java/com/hbm/blocks/machine/BlockHadronCoil.java b/src/main/java/com/hbm/blocks/machine/BlockHadronCoil.java index 20bd9f35a..ae323e1bf 100644 --- a/src/main/java/com/hbm/blocks/machine/BlockHadronCoil.java +++ b/src/main/java/com/hbm/blocks/machine/BlockHadronCoil.java @@ -47,7 +47,7 @@ public class BlockHadronCoil extends Block implements IBlockCT, ITooltipProvider } @Override - public boolean canConnect(IBlockAccess world, int x, int y, int z, IBlockCT block) { + public boolean canConnect(IBlockAccess world, int x, int y, int z, Block block) { return block instanceof BlockHadronCoil; } diff --git a/src/main/java/com/hbm/blocks/machine/BlockPWR.java b/src/main/java/com/hbm/blocks/machine/BlockPWR.java new file mode 100644 index 000000000..d30541e60 --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/BlockPWR.java @@ -0,0 +1,202 @@ +package com.hbm.blocks.machine; + +import java.util.Random; + +import com.hbm.blocks.ModBlocks; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.lib.RefStrings; +import com.hbm.render.block.ct.CT; +import com.hbm.render.block.ct.CTStitchReceiver; +import com.hbm.render.block.ct.IBlockCT; +import com.hbm.tileentity.machine.TileEntityPWRController; + +import api.hbm.fluid.IFluidConnector; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockPWR extends BlockContainer implements IBlockCT { + + @SideOnly(Side.CLIENT) protected IIcon iconPort; + + public BlockPWR(Material mat) { + super(mat); + } + + @Override + public int getRenderType() { + return CT.renderID; + } + + @Override + public Item getItemDropped(int i, Random rand, int j) { + return null; + } + + @SideOnly(Side.CLIENT) public CTStitchReceiver rec; + @SideOnly(Side.CLIENT) public CTStitchReceiver recPort; + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + super.registerBlockIcons(reg); + this.iconPort = reg.registerIcon(RefStrings.MODID + ":pwr_casing_port"); + this.rec = IBlockCT.primeReceiver(reg, this.blockIcon.getIconName(), this.blockIcon); + this.recPort = IBlockCT.primeReceiver(reg, this.iconPort.getIconName(), this.iconPort); + } + + @Override + public IIcon[] getFragments(IBlockAccess world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + if(meta == 1) return recPort.fragCache; + return rec.fragCache; + } + + @Override + public boolean canConnect(IBlockAccess world, int x, int y, int z, Block block) { + return block == ModBlocks.pwr_block || block == ModBlocks.pwr_controller; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBlockPWR(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + + TileEntity tile = world.getTileEntity(x, y, z); + + if(tile instanceof TileEntityBlockPWR) { + TileEntityBlockPWR pwr = (TileEntityBlockPWR) tile; + world.removeTileEntity(x, y, z); + if(pwr.block != null) { + world.setBlock(x, y, z, pwr.block); + TileEntity controller = world.getTileEntity(pwr.coreX, pwr.coreY, pwr.coreZ); + + if(controller instanceof TileEntityPWRController) { + ((TileEntityPWRController) controller).assembled = false; + } + } + } else { + world.removeTileEntity(x, y, z); + } + super.breakBlock(world, x, y, z, block, meta); + } + + public static class TileEntityBlockPWR extends TileEntity implements IFluidConnector { + + public Block block; + public int coreX; + public int coreY; + public int coreZ; + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + if(worldObj.getTotalWorldTime() % 20 == 0 && block != null) { + + if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) { + + TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ); + + if(tile instanceof TileEntityPWRController) { + TileEntityPWRController controller = (TileEntityPWRController) tile; + if(!controller.assembled) { + this.getBlockType().breakBlock(worldObj, xCoord, yCoord, zCoord, this.getBlockType(), this.getBlockMetadata()); + } + } else { + this.getBlockType().breakBlock(worldObj, xCoord, yCoord, zCoord, this.getBlockType(), this.getBlockMetadata()); + } + } + } + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + block = Block.getBlockById(nbt.getInteger("block")); + if(block != Blocks.air) { + coreX = nbt.getInteger("cX"); + coreY = nbt.getInteger("cY"); + coreZ = nbt.getInteger("cZ"); + } else { + block = null; + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + if(block != null) { + nbt.setInteger("block", Block.getIdFromBlock(block)); + nbt.setInteger("cX", coreX); + nbt.setInteger("cY", coreY); + nbt.setInteger("cZ", coreZ); + } + } + + @Override + public void markDirty() { + if(this.worldObj != null) { + this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); + } + } + + @Override + public long transferFluid(FluidType type, int pressure, long fluid) { + + if(this.getBlockMetadata() != 1) return fluid; + if(block == null) return fluid; + + if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) { + + TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ); + if(tile instanceof TileEntityPWRController) { + TileEntityPWRController controller = (TileEntityPWRController) tile; + return controller.transferFluid(type, pressure, fluid); + } + } + + return fluid; + } + + @Override + public long getDemand(FluidType type, int pressure) { + + if(this.getBlockMetadata() != 1) return 0; + if(block == null) return 0; + + if(worldObj.getChunkProvider().chunkExists(coreX >> 4, coreZ >> 4)) { + + TileEntity tile = worldObj.getTileEntity(coreX, coreY, coreZ); + if(tile instanceof TileEntityPWRController) { + TileEntityPWRController controller = (TileEntityPWRController) tile; + return controller.getDemand(type, pressure); + } + } + + return 0; + } + + @Override + public boolean canConnect(FluidType type, ForgeDirection dir) { + return this.getBlockMetadata() == 1; + } + } +} diff --git a/src/main/java/com/hbm/blocks/machine/MachineAutosaw.java b/src/main/java/com/hbm/blocks/machine/MachineAutosaw.java index fe568c409..0aeca216d 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineAutosaw.java +++ b/src/main/java/com/hbm/blocks/machine/MachineAutosaw.java @@ -5,16 +5,25 @@ import java.util.List; import java.util.Locale; import com.hbm.blocks.ILookOverlay; +import com.hbm.blocks.ITooltipProvider; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.tileentity.machine.TileEntityMachineAutosaw; import com.hbm.util.I18nUtil; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; -public class MachineAutosaw extends BlockContainer implements ILookOverlay { +public class MachineAutosaw extends BlockContainer implements ILookOverlay, ITooltipProvider { public MachineAutosaw() { super(Material.iron); @@ -39,6 +48,30 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay { public boolean renderAsNormalBlock() { return false; } + + @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 && !player.isSneaking()) { + + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) { + + TileEntityMachineAutosaw saw = (TileEntityMachineAutosaw) world.getTileEntity(x, y, z); + + FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, x, y, z, player.getHeldItem()); + if(saw.acceptedFuels.contains(type)) { + saw.tank.setTankType(type); + saw.markDirty(); + player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation("hbmfluid." + type.getName().toLowerCase(Locale.US))).appendSibling(new ChatComponentText("!"))); + return true; + } + } + + return false; + } + + return true; + } @Override public void printHook(Pre event, World world, int x, int y, int z) { @@ -55,4 +88,9 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay { ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { + this.addStandardInfo(stack, player, list, ext); + } } diff --git a/src/main/java/com/hbm/blocks/machine/MachinePWRController.java b/src/main/java/com/hbm/blocks/machine/MachinePWRController.java new file mode 100644 index 000000000..045822100 --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/MachinePWRController.java @@ -0,0 +1,201 @@ +package com.hbm.blocks.machine; + +import java.util.HashMap; +import java.util.Map.Entry; + +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.machine.BlockPWR.TileEntityBlockPWR; +import com.hbm.lib.RefStrings; +import com.hbm.main.MainRegistry; +import com.hbm.packet.AuxParticlePacketNT; +import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.machine.TileEntityPWRController; +import com.hbm.util.fauxpointtwelve.BlockPos; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class MachinePWRController extends BlockContainer { + + @SideOnly(Side.CLIENT) + private IIcon iconFront; + + public MachinePWRController(Material mat) { + super(mat); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityPWRController(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":pwr_controller"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + + if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); + if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); + if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); + if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); + } + + @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) { + return true; + } else if(!player.isSneaking()) { + + TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z); + + if(!controller.assembled) { + assemble(world, x, y, z, player); + } else { + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); + } + + return true; + } else { + return false; + } + } + + private static HashMap assembly = new HashMap(); + private static HashMap fuelRods = new HashMap(); + private static HashMap sources = new HashMap(); + private static boolean errored; + private static final int maxSize = 1024; + + public void assemble(World world, int x, int y, int z, EntityPlayer player) { + assembly.clear(); + fuelRods.clear(); + sources.clear(); + assembly.put(new BlockPos(x, y, z), this); + + ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite(); + + errored = false; + floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player); + + if(fuelRods.size() == 0 || sources.size() == 0) errored = true; + + TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z); + + if(!errored) { + for(Entry entry : assembly.entrySet()) { + + BlockPos pos = entry.getKey(); + Block block = entry.getValue(); + + if(block != ModBlocks.pwr_controller) { + + if(block == ModBlocks.pwr_port) { + world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 1, 3); + } else { + world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 0, 3); + } + + TileEntityBlockPWR pwr = (TileEntityBlockPWR) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); + pwr.block = block; + pwr.coreX = x; + pwr.coreY = y; + pwr.coreZ = z; + pwr.markDirty(); + } + } + + controller.setup(assembly, fuelRods); + } + controller.assembled = !errored; + + assembly.clear(); + fuelRods.clear(); + sources.clear(); + } + + private void floodFill(World world, int x, int y, int z, EntityPlayer player) { + + BlockPos pos = new BlockPos(x, y, z); + + if(assembly.containsKey(pos)) return; + if(assembly.size() >= maxSize) { + errored = true; + sendError(world, x, y, z, "Max size exceeded", player); + return; + } + + Block block = world.getBlock(x, y, z); + + if(isValidCasing(block)) { + assembly.put(pos, block); + return; + } + + if(isValidCore(block)) { + assembly.put(pos, block); + if(block == ModBlocks.pwr_fuel) fuelRods.put(pos, block); + if(block == ModBlocks.pwr_neutron_source) sources.put(pos, block); + floodFill(world, x + 1, y, z, player); + floodFill(world, x - 1, y, z, player); + floodFill(world, x, y + 1, z, player); + floodFill(world, x, y - 1, z, player); + floodFill(world, x, y, z + 1, player); + floodFill(world, x, y, z - 1, player); + return; + } + + sendError(world, x, y, z, "Non-reactor block", player); + errored = true; + } + + private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) { + + if(player instanceof EntityPlayerMP) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "marker"); + data.setInteger("color", 0xff0000); + data.setInteger("expires", 5_000); + data.setDouble("dist", 128D); + if(message != null) data.setString("label", message); + PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player); + } + } + + private boolean isValidCore(Block block) { + if(block == ModBlocks.pwr_fuel || block == ModBlocks.pwr_control || block == ModBlocks.pwr_channel || block == ModBlocks.pwr_heatex || block == ModBlocks.pwr_neutron_source) return true; + return false; + } + + private boolean isValidCasing(Block block) { + if(block == ModBlocks.pwr_casing || block == ModBlocks.pwr_reflector || block == ModBlocks.pwr_port) return true; + return false; + } +} diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index f8f149b7f..b9bb2aba5 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -168,65 +168,65 @@ public class WeaponRecipes { //Ammo assemblies CraftingManager.addRecipeAuto(new ItemStack(ModItems.pellet_flechette, 1), new Object[] { " L ", " L ", "LLL", 'L', PB.nugget() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.pellet_claws, 1), new Object[] { " X ", "X X", " XX", 'X', STEEL.plate() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', U235.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', PU239.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', ModItems.trinitite, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', ModItems.nuclear_waste_tiny, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_gold, 24), new Object[] { " I", "GC", " P", 'I', GOLD.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_schrabidium, 6), new Object[] { " I ", "GCN", " P ", 'I', SA326.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357, 'N', ModItems.billet_yharonite }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nightmare, 24), new Object[] { " I", "GC", " P", 'I', W.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_desh, 24), new Object[] { " I", "GC", " P", 'I', DESH.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_556, 32), new Object[] { " I", "GC", " P", 'I', STEEL.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(ModItems.ammo_556.stackFromEnum(30, Ammo556mm.K), new Object[] { "G", "C", "P", 'G', ANY_GUNPOWDER.dust(), 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lacunae, 32), new Object[] { " I", "GC", " P", 'I', CU.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_44, 'P', ModItems.primer_44 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_44, 'P', ModItems.primer_44 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_12gauge.stackFromEnum(12, Ammo12Gauge.PERCUSSION), new Object[] { "G", "C", "P", 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.FLECHETTE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_flechette, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.tnt, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(6, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.MINING), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.det_miner, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', U235.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', PU239.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', ModItems.trinitite, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', ModItems.nuclear_waste_tiny, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_gold, 24), new Object[] { " I", "GC", 'I', GOLD.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_schrabidium, 6), new Object[] { " I ", "GCN", 'I', SA326.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'N', ModItems.billet_yharonite }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nightmare, 24), new Object[] { " I", "GC", 'I', W.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_desh, 24), new Object[] { " I", "GC", 'I', DESH.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_556, 32), new Object[] { " I", "GC", 'I', STEEL.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(ModItems.ammo_556.stackFromEnum(30, Ammo556mm.K), new Object[] { "G", "C", 'G', ANY_GUNPOWDER.dust(), 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lacunae, 32), new Object[] { " I", "GC", 'I', CU.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_44 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_44 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_buckshot, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_12gauge.stackFromEnum(12, Ammo12Gauge.PERCUSSION), new Object[] { "G", "C", 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.FLECHETTE), new Object[] { " I ", "GCL", 'I', ModItems.pellet_flechette, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", 'I', ModBlocks.tnt, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(6, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", 'I', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.MINING), new Object[] { " I ", "GCL", 'I', ModBlocks.det_miner, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); CraftingManager.addShapelessAuto(ModItems.ammo_4gauge.stackFromEnum(Ammo4Gauge.QUACK), new Object[] { ModItems.ammo_4gauge, ModItems.nugget_bismuth, ModItems.nugget_tantalium, ModItems.ball_dynamite }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.STOCK), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_cluster, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(20, Ammo20Gauge.FLECHETTE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_flechette, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_357.stackFromEnum(6, Ammo357Magnum.NIGHTMARE2), new Object[] { "I", "C", "P", 'I', ModItems.powder_power, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_calamity, 12), new Object[] { " I ", "GCG", " P ", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_actionexpress, 12), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50 }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.STOCK), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.SLUG), new Object[] { " I ", "GCL", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", 'I', ModItems.pellet_cluster, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(20, Ammo20Gauge.FLECHETTE), new Object[] { " I ", "GCL", 'I', ModItems.pellet_flechette, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_357.stackFromEnum(6, Ammo357Magnum.NIGHTMARE2), new Object[] { "I", "C", 'I', ModItems.powder_power, 'C', ModItems.casing_buckshot }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_calamity, 12), new Object[] { " I ", "GCG", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_actionexpress, 12), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50 }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nuke, 1), new Object[] { " WP", "SEP", " WP", 'W', ModItems.wire_aluminium, 'P', STEEL.plate(), 'S', ModItems.hull_small_steel, 'E', ANY_HIGHEXPLOSIVE.ingot() }); CraftingManager.addRecipeAuto(ModItems.ammo_dart.stackFromEnum(16, AmmoDart.GPS), new Object[] { "IPI", "ICI", "IPI", 'I', ModItems.plate_polymer, 'P', IRON.plate(), 'C', new ItemStack(ModItems.fluid_tank_lead_full, 1, Fluids.WATZ.getID()) }); CraftingManager.addRecipeAuto(ModItems.ammo_dart.stackFromEnum(16, AmmoDart.NERF), new Object[] { "I", "I", 'I', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_45, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_44, 'P', ModItems.primer_44); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_762, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_9); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_45, 32), " I", "GC", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_44); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_762, 32), " I", "GC", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50); CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_luna, 4), new Object[] { " B ", "GCG", "GPG", 'B', FERRO.ingot(), 'G', ModItems.powder_nitan_mix, 'C', ModItems.casing_50, 'P', ModItems.powder_power}); //Folly shells CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_bullet, 1), new Object[] { " S ", "STS", "SMS", 'S', STAR.ingot(), 'T', ModItems.powder_magic, 'M', ModBlocks.block_meteor }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_bullet_nuclear, 1), new Object[] { " N ", "UTU", "UTU", 'N', ModItems.ammo_nuke, 'U', IRON.ingot(), 'T', W.block() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_bullet_du, 1), new Object[] { " U ", "UDU", "UTU", 'U', U238.block(), 'D', DESH.block(), 'T', W.block() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_shell, 1), new Object[] { "IPI", "IPI", "IMI", 'I', IRON.ingot(), 'P', IRON.plate(), 'M', ModItems.primer_50 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_shell, 1), new Object[] { "IPI", "IPI", "IMI", 'I', IRON.ingot(), 'P', IRON.plate(), 'M', ANY_SMOKELESS.dust() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_folly, 1), new Object[] { " B ", "MEM", " S ", 'B', ModItems.folly_bullet, 'M', ModItems.powder_magic, 'E', ModItems.powder_power, 'S', ModItems.folly_shell }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_folly_nuclear, 1), new Object[] { " B ", "EEE", " S ", 'B', ModItems.folly_bullet_nuclear, 'E', ModBlocks.det_charge, 'S', ModItems.folly_shell }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_folly_du, 1), new Object[] { " B ", "EEE", " S ", 'B', ModItems.folly_bullet_du, 'E', ModBlocks.det_charge, 'S', ModItems.folly_shell }); //Rockets - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 1), new Object[] { " T ", "GCG", " P ", 'T', ModItems.ball_dynamite, 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium, 'P', ModItems.primer_50 });// I got tired of changing *all* of them, the stock one is always the first one anyway - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 2), new Object[] { " T ", "GCG", " P ", 'T', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium, 'P', ModItems.primer_50 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 1), new Object[] { "T", "C", "G", 'T', ModItems.ball_dynamite, 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium, });// I got tired of changing *all* of them, the stock one is always the first one anyway + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 2), new Object[] { "T", "C", "G", 'T', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium }); CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(AmmoRocket.HE), new Object[] { "G", "R", 'G', ANY_PLASTICEXPLOSIVE.ingot(), 'R', ModItems.ammo_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(AmmoRocket.INCENDIARY), new Object[] { "G", "R", 'G', P_RED.dust(), 'R', ModItems.ammo_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(AmmoRocket.PHOSPHORUS), new Object[] { "G", "R", 'G', P_WHITE.ingot(), 'R', ModItems.ammo_rocket }); @@ -245,15 +245,15 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(2, AmmoRocket.RPC), new Object[] { "BP ", "CBH", " DR", 'B', ModItems.blades_steel, 'P', STEEL.plate(), 'C', Fluids.BIOFUEL.getDict(1000), 'H', ModItems.hull_small_steel, 'D', ModItems.piston_selenium, 'R', ModItems.ammo_rocket }); //Stinger Rockets - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_stinger_rocket, 2), "CE ", "FSF", " P ", 'C', ModItems.circuit_aluminium, 'E', ANY_PLASTICEXPLOSIVE.ingot(), 'F', ModItems.rocket_fuel, 'S', ModItems.hull_small_aluminium, 'P', ModItems.primer_50); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_stinger_rocket, 2), "CE ", " S ", " F ", 'C', ModItems.circuit_aluminium, 'E', ANY_PLASTICEXPLOSIVE.ingot(), 'F', ModItems.rocket_fuel, 'S', ModItems.hull_small_aluminium); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.HE), new Object[] { "S", "R", 'S', ANY_PLASTICEXPLOSIVE.ingot(), 'R', ModItems.ammo_stinger_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.INCENDIARY), new Object[] { "S", "R", 'S', P_RED.dust(), 'R', ModItems.ammo_stinger_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.NUCLEAR), new Object[] { "RPR", "PSP", "RPR", 'R', ModItems.neutron_reflector, 'P', PU239.nugget(), 'S', ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.HE) }); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.BONES), new Object[] { " C ", "SKR", " P ", 'C', ModItems.fallout, 'S', SR90.dust(), 'K', ModItems.ammo_stinger_rocket, 'R', RA226.dust(), 'P', PU.dust() }); //40mm grenades - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_grenade, 2), new Object[] { " T ", "GCI", " P ", 'T', ANY_HIGHEXPLOSIVE.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'I', IRON.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.TRACER), new Object[] { " T ", "GCI", " P ", 'T', LAPIS.dust(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'I', IRON.plate() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_grenade, 2), new Object[] { " T ", "GCI", 'T', ANY_HIGHEXPLOSIVE.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'I', IRON.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.TRACER), new Object[] { " T ", "GCI", 'T', LAPIS.dust(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'I', IRON.plate() }); CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.HE), new Object[] { "GIG", 'G', ModItems.ammo_grenade, 'I', ANY_PLASTICEXPLOSIVE.ingot() }); CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.INCENDIARY), new Object[] { "GIG", 'G', ModItems.ammo_grenade, 'I', P_RED.dust() }); CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.PHOSPHORUS), new Object[] { "GIG", 'G', ModItems.ammo_grenade, 'I', P_WHITE.ingot() }); diff --git a/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java b/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java index 079e2ab2c..51ee981cb 100644 --- a/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java +++ b/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java @@ -179,6 +179,7 @@ public class EntityFalloutRain extends Entity { hardness = worldObj.getBlock(x, y + i, z).getBlockHardness(worldObj, x, y + i, z); if(hardness <= Blocks.stonebrick.getExplosionResistance(null) && hardness >= 0) { EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldObj, x + 0.5D, y + 0.5D + i, z + 0.5D, worldObj.getBlock(x, y + i, z), worldObj.getBlockMetadata(x, y + i, z)); + entityfallingblock.field_145813_c = false; //turn off block drops because block dropping was coded by a mule with dementia worldObj.spawnEntityInWorld(entityfallingblock); } } diff --git a/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java b/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java index b93311496..8e0ef45f1 100644 --- a/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java +++ b/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java @@ -36,6 +36,17 @@ public class EntityNukeTorex extends Entity { this.dataWatcher.addObject(10, new Float(1)); } + @Override + @SideOnly(Side.CLIENT) + public int getBrightnessForRender(float p_70070_1_) { + return 15728880; + } + + @Override + public float getBrightness(float p_70013_1_) { + return 1.0F; + } + @Override public void onUpdate() { @@ -151,7 +162,7 @@ public class EntityNukeTorex extends Entity { if(life > fadeOut) { float fac = (float)(life - fadeOut) / (float)(lifetime - fadeOut); - return 1F - fac * fac; + return 1F - fac; } return 1.0F; diff --git a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java index 0ba128f52..6ddf72eec 100644 --- a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java +++ b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java @@ -153,8 +153,10 @@ public class PollutionHandler { public String getDataDir(WorldServer world) { String dir = world.getSaveHandler().getWorldDirectory().getAbsolutePath(); - if(world.provider.dimensionId != 0) { - dir += File.separator + "DIM" + world.provider.dimensionId; + // Crucible and probably Thermos provide dimId by themselves + String dimId = File.separator + "DIM" + world.provider.dimensionId; + if(world.provider.dimensionId != 0 && !dir.endsWith(dimId)) { + dir += dimId; } dir += File.separator + "data"; return dir; diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index 36a75a648..02afded30 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -212,6 +212,7 @@ public class OreDictManager { public static final DictFrame CINNABAR = new DictFrame("Cinnabar"); public static final DictFrame BORAX = new DictFrame("Borax"); public static final DictFrame CHLOROCALCITE = new DictFrame("Chlorocalcite"); + public static final DictFrame SODALITE = new DictFrame("Sodalite"); public static final DictFrame VOLCANIC = new DictFrame("Volcanic"); public static final DictFrame HEMATITE = new DictFrame("Hematite"); public static final DictFrame MALACHITE = new DictFrame("Malachite"); @@ -221,6 +222,8 @@ public class OreDictManager { */ /** LITHIUM */ public static final DictFrame LI = new DictFrame("Lithium"); + /** SODIUM */ + public static final DictFrame NA = new DictFrame("Sodium"); /* * PHOSPHORUS */ @@ -395,6 +398,7 @@ public class OreDictManager { CINNABAR .crystal(cinnebar) .gem(cinnebar) .ore(ore_cinnebar, ore_depth_cinnebar); BORAX .dust(powder_borax) .ore(ore_depth_borax); CHLOROCALCITE .dust(powder_chlorocalcite); + SODALITE .gem(gem_sodalite); VOLCANIC .gem(gem_volcanic) .ore(basalt_gem); HEMATITE .ore(fromOne(stone_resource, EnumStoneType.HEMATITE)); MALACHITE .ore(fromOne(stone_resource, EnumStoneType.MALACHITE)); @@ -404,6 +408,7 @@ public class OreDictManager { * HAZARDS, MISC */ LI .hydro(1F) .ingot(lithium) .dustSmall(powder_lithium_tiny) .dust(powder_lithium) .block(block_lithium) .ore(ore_gneiss_lithium, ore_meteor_lithium); + NA .hydro(1F) .dust(powder_sodium); /* * PHOSPHORUS diff --git a/src/main/java/com/hbm/inventory/container/ContainerPWR.java b/src/main/java/com/hbm/inventory/container/ContainerPWR.java new file mode 100644 index 000000000..ff6cc84fa --- /dev/null +++ b/src/main/java/com/hbm/inventory/container/ContainerPWR.java @@ -0,0 +1,76 @@ +package com.hbm.inventory.container; + +import com.hbm.inventory.SlotCraftingOutput; +import com.hbm.items.machine.IItemFluidIdentifier; +import com.hbm.tileentity.machine.TileEntityPWRController; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerPWR extends Container { + + TileEntityPWRController controller; + + public ContainerPWR(InventoryPlayer invPlayer, TileEntityPWRController controller) { + this.controller = controller; + + this.addSlotToContainer(new Slot(controller, 0, 53, 5)); + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, controller, 1, 89, 32)); + this.addSlotToContainer(new Slot(controller, 2, 8, 59)); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 106 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 164)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { + ItemStack var3 = null; + Slot var4 = (Slot) this.inventorySlots.get(par2); + + if(var4 != null && var4.getHasStack()) { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if(par2 <= 2) { + if(!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) { + return null; + } + } else { + + if(var3.getItem() instanceof IItemFluidIdentifier) { + if(!this.mergeItemStack(var5, 2, 3, false)) { + return null; + } + } else { + if(!this.mergeItemStack(var5, 0, 1, false)) { + return null; + } + } + } + + if(var5.stackSize == 0) { + var4.putStack((ItemStack) null); + } else { + var4.onSlotChanged(); + } + } + + return var3; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return controller.isUseableByPlayer(player); + } + +} diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 0c1d523d7..2ad14ed42 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -156,6 +156,7 @@ public class Fluids { public static FluidType SMOKE_LEADED; public static FluidType SMOKE_POISON; public static FluidType HELIUM4; + public static FluidType HEAVYWATER_HOT; private static final HashMap idMapping = new HashMap(); private static final HashMap nameMapping = new HashMap(); @@ -311,7 +312,8 @@ public class Fluids { SMOKE = new FluidType("SMOKE", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); SMOKE_LEADED = new FluidType("SMOKE_LEADED", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); SMOKE_POISON = new FluidType("SMOKE_POISON", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); - HELIUM4 = new FluidType(123,"HELIUM4", 0xE54B0A, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS); + HELIUM4 = new FluidType("HELIUM4", 0xE54B0A, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS); + HEAVYWATER_HOT = new FluidType(124, "HEAVYWATER_HOT",0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID); // ^ ^ ^ ^ ^ ^ ^ ^ //ADD NEW FLUIDS HERE @@ -323,6 +325,7 @@ public class Fluids { //vanilla metaOrder.add(WATER); metaOrder.add(HEAVYWATER); + metaOrder.add(HEAVYWATER_HOT); metaOrder.add(LAVA); //steams metaOrder.add(STEAM); @@ -489,8 +492,8 @@ public class Fluids { HOTOIL.addTraits(new FT_Coolable(OIL, 1, 1, 10).setEff(CoolingType.HEATEXCHANGER, 1.0D)); HOTCRACKOIL.addTraits(new FT_Coolable(CRACKOIL, 1, 1, 10).setEff(CoolingType.HEATEXCHANGER, 1.0D)); - - COOLANT.addTraits(new FT_Heatable().setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(300, 1, COOLANT_HOT, 1)); + + COOLANT.addTraits(new FT_Heatable().setEff(HeatingType.HEATEXCHANGER, 1.0D).setEff(HeatingType.PWR, 1.0D).addStep(300, 1, COOLANT_HOT, 1)); COOLANT_HOT.addTraits(new FT_Coolable(COOLANT, 1, 1, 300).setEff(CoolingType.HEATEXCHANGER, 1.0D)); MUG.addTraits(new FT_Heatable().setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(400, 1, MUG_HOT, 1)); @@ -499,6 +502,9 @@ public class Fluids { BLOOD.addTraits(new FT_Heatable().setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(500, 1, BLOOD_HOT, 1)); BLOOD_HOT.addTraits(new FT_Coolable(BLOOD, 1, 1, 500).setEff(CoolingType.HEATEXCHANGER, 1.0D)); + HEAVYWATER.addTraits(new FT_Heatable().setEff(HeatingType.PWR, 1.0D).addStep(300, 1, HEAVYWATER_HOT, 1), new FT_PWRModerator(1.25D)); + HEAVYWATER_HOT.addTraits(new FT_Coolable(HEAVYWATER, 1, 1, 300).setEff(CoolingType.HEATEXCHANGER, 1.0D)); + if(idMapping.size() != metaOrder.size()) { throw new IllegalStateException("A severe error has occoured during NTM's fluid registering process! The MetaOrder and Mappings are inconsistent! Mapping size: " + idMapping.size()+ " / MetaOrder size: " + metaOrder.size()); } diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FT_Heatable.java b/src/main/java/com/hbm/inventory/fluid/trait/FT_Heatable.java index 310083cf3..a10192c29 100644 --- a/src/main/java/com/hbm/inventory/fluid/trait/FT_Heatable.java +++ b/src/main/java/com/hbm/inventory/fluid/trait/FT_Heatable.java @@ -69,7 +69,8 @@ public class FT_Heatable extends FluidTrait { public static enum HeatingType { BOILER("Boilable"), - HEATEXCHANGER("Heatable"); + HEATEXCHANGER("Heatable"), + PWR("PWR Coolant"); public String name; diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FT_PWRModerator.java b/src/main/java/com/hbm/inventory/fluid/trait/FT_PWRModerator.java new file mode 100644 index 000000000..65386405a --- /dev/null +++ b/src/main/java/com/hbm/inventory/fluid/trait/FT_PWRModerator.java @@ -0,0 +1,43 @@ +package com.hbm.inventory.fluid.trait; + +import java.io.IOException; +import java.util.List; + +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; + +import net.minecraft.util.EnumChatFormatting; + +public class FT_PWRModerator extends FluidTrait { + + private double multiplier; + + public FT_PWRModerator(double mulitplier) { + this.multiplier = mulitplier; + } + + public double getMultiplier() { + return multiplier; + } + + @Override + public void addInfo(List info) { + info.add(EnumChatFormatting.BLUE + "[PWR Flux Multiplier]"); + } + + @Override + public void addInfoHidden(List info) { + int mult = (int) (multiplier * 100 - 100); + info.add(EnumChatFormatting.BLUE + "Core flux " + (mult >= 0 ? "+" : "") + mult + "%"); + } + + @Override + public void serializeJSON(JsonWriter writer) throws IOException { + writer.name("multiplier").value(multiplier); + } + + @Override + public void deserializeJSON(JsonObject obj) { + this.multiplier = obj.get("multiplier").getAsDouble(); + } +} diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java b/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java index ba385ad54..ff2522d09 100644 --- a/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java +++ b/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java @@ -24,6 +24,7 @@ public abstract class FluidTrait { traitNameMap.put("poison", FT_Poison.class); // x traitNameMap.put("toxin", FT_Toxin.class); // x traitNameMap.put("ventradiation", FT_VentRadiation.class); // x + traitNameMap.put("pwrmoderator", FT_PWRModerator.class); // x traitNameMap.put("gaseous", FT_Gaseous.class); traitNameMap.put("gaseous_art", FT_Gaseous_ART.class); diff --git a/src/main/java/com/hbm/inventory/gui/GUIPWR.java b/src/main/java/com/hbm/inventory/gui/GUIPWR.java new file mode 100644 index 000000000..b8888ec02 --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUIPWR.java @@ -0,0 +1,164 @@ +package com.hbm.inventory.gui; + +import org.apache.commons.lang3.math.NumberUtils; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerPWR; +import com.hbm.items.ModItems; +import com.hbm.lib.RefStrings; +import com.hbm.packet.NBTControlPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.render.util.GaugeUtil; +import com.hbm.render.util.GaugeUtil.Gauge; +import com.hbm.tileentity.machine.TileEntityPWRController; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class GUIPWR extends GuiInfoContainer { + + protected TileEntityPWRController controller; + private final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_pwr.png"); + + private GuiTextField field; + + public GUIPWR(InventoryPlayer inventory, TileEntityPWRController controller) { + super(new ContainerPWR(inventory, controller)); + this.controller = controller; + + this.xSize = 176; + this.ySize = 188; + } + + @Override + public void initGui() { + super.initGui(); + + Keyboard.enableRepeatEvents(true); + + this.field = new GuiTextField(this.fontRendererObj, guiLeft + 57, guiTop + 63, 30, 8); + this.field.setTextColor(0x00ff00); + this.field.setDisabledTextColour(0x008000); + this.field.setEnableBackgroundDrawing(false); + this.field.setMaxStringLength(3); + + this.field.setText((100 - controller.rodTarget) + ""); + } + + @Override + public void drawScreen(int x, int y, float interp) { + super.drawScreen(x, y, interp); + + this.drawCustomInfoStat(x, y, guiLeft + 115, guiTop + 31, 18, 18, x, y, new String[] { "Core: " + String.format("%,d", controller.coreHeat) + " / " + String.format("%,d", controller.coreHeatCapacity) + " TU" }); + this.drawCustomInfoStat(x, y, guiLeft + 151, guiTop + 31, 18, 18, x, y, new String[] { "Hull: " + String.format("%,d", controller.hullHeat) + " / " + String.format("%,d", controller.hullHeatCapacity) + " TU" }); + + this.drawCustomInfoStat(x, y, guiLeft + 52, guiTop + 31, 36, 18, x, y, new String[] { ((int) (controller.progress * 100 / controller.processTime)) + "%" }); + this.drawCustomInfoStat(x, y, guiLeft + 52, guiTop + 53, 54, 4, x, y, "Control rod level: " + (100 - controller.rodLevel) + "%"); + + if(controller.typeLoaded != -1 && controller.amountLoaded > 0) { + ItemStack display = new ItemStack(ModItems.pwr_fuel, 1, controller.typeLoaded); + if(guiLeft + 88 <= x && guiLeft + 88 + 18 > x && guiTop + 4 < y && guiTop + 4 + 18 >= y) this.renderToolTip(display, x, y); + } + + controller.tanks[0].renderTankInfo(this, x, y, guiLeft + 8, guiTop + 5, 16, 52); + controller.tanks[1].renderTankInfo(this, x, y, guiLeft + 26, guiTop + 5, 16, 52); + } + + @Override + protected void drawItemStack(ItemStack stack, int x, int y, String label) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRender.zLevel = 200.0F; + FontRenderer font = null; + if(stack != null) font = stack.getItem().getFontRenderer(stack); + if(font == null) font = fontRendererObj; + itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, x, y); + GL11.glScaled(0.5, 0.5, 0.5); + itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), stack, (x + font.getStringWidth(label) / 4) * 2, (y + 15) * 2, label); + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + GL11.glPopMatrix(); + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + + double scale = 1.25; + String flux = String.format("%,.1f", controller.flux); + GL11.glScaled(1 / scale, 1 / scale, 1); + this.fontRendererObj.drawString(flux, (int) (165 * scale - this.fontRendererObj.getStringWidth(flux)), (int)(64 * scale), 0x00ff00); + GL11.glScaled(scale, scale, 1); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + if(controller.hullHeat > controller.hullHeatCapacity * 0.8 || controller.coreHeat > controller.coreHeatCapacity * 0.8) + drawTexturedModalRect(guiLeft + 147, guiTop, 176, 14, 26, 26); + + int p = (int) (controller.progress * 33 / controller.processTime); + drawTexturedModalRect(guiLeft + 54, guiTop + 33, 176, 0, p, 14); + + int c = (int) (controller.rodLevel * 52 / 100); + drawTexturedModalRect(guiLeft + 53, guiTop + 54, 176, 40, c, 2); + + GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 115, guiTop + 31, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity); + GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 151, guiTop + 31, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacity); + + if(controller.typeLoaded != -1 && controller.amountLoaded > 0) { + ItemStack display = new ItemStack(ModItems.pwr_fuel, 1, controller.typeLoaded); + this.drawItemStack(display, guiLeft + 89, guiTop + 5, EnumChatFormatting.YELLOW + "" + controller.amountLoaded + "/" + controller.rodCount); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + GL11.glDisable(GL11.GL_LIGHTING); + + controller.tanks[0].renderTank(guiLeft + 8, guiTop + 57, this.zLevel, 16, 52); + controller.tanks[1].renderTank(guiLeft + 26, guiTop + 57, this.zLevel, 16, 52); + + this.field.drawTextBox(); + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int i) { + super.mouseClicked(mouseX, mouseY, i); + this.field.mouseClicked(mouseX, mouseY, i); + + if(guiLeft + 88 <= mouseX && guiLeft + 88 + 18 > mouseX && guiTop + 58 < mouseY && guiTop + 58 + 18 >= mouseY) { + + if(NumberUtils.isNumber(field.getText())) { + int level = (int)MathHelper.clamp_double(Double.parseDouble(field.getText()), 0, 100); + field.setText(level + ""); + + NBTTagCompound control = new NBTTagCompound(); + control.setInteger("control", 100 - level); + PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(control, controller.xCoord, controller.yCoord, controller.zCoord)); + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1F)); + + } + } + } + + @Override + protected void keyTyped(char c, int i) { + if(this.field.textboxKeyTyped(c, i)) return; + super.keyTyped(c, i); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java index 4c041eaea..e5b244fc5 100644 --- a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java +++ b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java @@ -100,6 +100,19 @@ public abstract class GuiInfoContainer extends GuiContainer { return this.fontRendererObj; } + protected void drawItemStack(ItemStack stack, int x, int y, String label) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRender.zLevel = 200.0F; + FontRenderer font = null; + if(stack != null) font = stack.getItem().getFontRenderer(stack); + if(font == null) font = fontRendererObj; + itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, x, y); + itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), stack, x, y, label); + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + } + protected void drawStackText(List lines, int x, int y, FontRenderer font) { if(!lines.isEmpty()) { diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 2c37aaa5d..88cbdd9a7 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -626,7 +626,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.ammo_75bolt, 2, ItemAmmoEnums.Ammo75Bolt.STOCK.ordinal()), new AStack[] { new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 1), - new ComparableStack(ModItems.primer_50, 5), new ComparableStack(ModItems.casing_50, 5), new OreDictStack(ANY_PLASTICEXPLOSIVE.ingot(), 2), new ComparableStack(ModItems.cordite, 3), @@ -636,7 +635,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.ammo_75bolt, 2, ItemAmmoEnums.Ammo75Bolt.INCENDIARY.ordinal()), new AStack[] { new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 1), - new ComparableStack(ModItems.primer_50, 5), new ComparableStack(ModItems.casing_50, 5), new OreDictStack(ANY_PLASTICEXPLOSIVE.ingot(), 3), new ComparableStack(ModItems.cordite, 3), @@ -646,7 +644,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.ammo_75bolt, 2, ItemAmmoEnums.Ammo75Bolt.HE.ordinal()), new AStack[] { new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 1), - new ComparableStack(ModItems.primer_50, 5), new ComparableStack(ModItems.casing_50, 5), new OreDictStack(ANY_HIGHEXPLOSIVE.ingot(), 5), new ComparableStack(ModItems.cordite, 5), diff --git a/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java b/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java index a3735f8bb..1f1aa97ea 100644 --- a/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java @@ -1,6 +1,7 @@ package com.hbm.inventory.recipes; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; @@ -188,8 +189,9 @@ public class CentrifugeRecipes extends SerializableRecipe { new ItemStack(ModItems.nugget_pu238, 6), new ItemStack(ModItems.nuclear_waste, 2) }); - if(OreDictionary.doesOreNameExist("nuggetNaquadria")) { - ItemStack nuggetNQR = OreDictionary.getOres("nuggetNaquadria").get(0); + ArrayList naquadriaNuggets = OreDictionary.getOres("nuggetNaquadria"); + if(naquadriaNuggets.size() != 0) { + ItemStack nuggetNQR = naquadriaNuggets.get(0); ItemStack copy = nuggetNQR.copy(); copy.stackSize = 12; recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.watz_pellet_depleted, EnumWatzType.NQD)), new ItemStack[] { @@ -318,6 +320,12 @@ public class CentrifugeRecipes extends SerializableRecipe { new ItemStack(ModItems.powder_emerald, 1), new ItemStack(Blocks.gravel, 1) }); + recipes.put(new OreDictStack(F.ore()), new ItemStack[] { + new ItemStack(ModItems.fluorite, 3), + new ItemStack(ModItems.fluorite, 3), + new ItemStack(ModItems.gem_sodalite, 1), + new ItemStack(Blocks.gravel, 1) }); + recipes.put(new OreDictStack(REDSTONE.ore()), new ItemStack[] { new ItemStack(Items.redstone, 3), new ItemStack(Items.redstone, 3), @@ -455,7 +463,7 @@ public class CentrifugeRecipes extends SerializableRecipe { recipes.put(new ComparableStack(ModItems.crystal_copper), new ItemStack[] { new ItemStack(ModItems.powder_copper, 2), new ItemStack(ModItems.powder_copper, 2), new ItemStack(ModItems.sulfur, 1), new ItemStack(ModItems.powder_cobalt_tiny, 1) }); recipes.put(new ComparableStack(ModItems.crystal_tungsten), new ItemStack[] { new ItemStack(ModItems.powder_tungsten, 2), new ItemStack(ModItems.powder_tungsten, 2), new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lithium_tiny, 1) }); recipes.put(new ComparableStack(ModItems.crystal_aluminium), new ItemStack[] { new ItemStack(ModItems.powder_aluminium, 2), new ItemStack(ModItems.powder_aluminium, 2), new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lithium_tiny, 1) }); - recipes.put(new ComparableStack(ModItems.crystal_fluorite), new ItemStack[] { new ItemStack(ModItems.fluorite, 3), new ItemStack(ModItems.fluorite, 3), new ItemStack(ModItems.fluorite, 3), new ItemStack(ModItems.powder_lithium_tiny, 1) }); + recipes.put(new ComparableStack(ModItems.crystal_fluorite), new ItemStack[] { new ItemStack(ModItems.fluorite, 4), new ItemStack(ModItems.fluorite, 4), new ItemStack(ModItems.gem_sodalite, 2), new ItemStack(ModItems.powder_lithium_tiny, 1) }); recipes.put(new ComparableStack(ModItems.crystal_beryllium), new ItemStack[] { new ItemStack(ModItems.powder_beryllium, 2), new ItemStack(ModItems.powder_beryllium, 2), new ItemStack(ModItems.powder_quartz, 1), new ItemStack(ModItems.powder_lithium_tiny, 1) }); recipes.put(new ComparableStack(ModItems.crystal_lead), new ItemStack[] { new ItemStack(ModItems.powder_lead, 2), new ItemStack(ModItems.powder_lead, 2), new ItemStack(ModItems.powder_gold, 1), new ItemStack(ModItems.powder_lithium_tiny, 1) }); recipes.put(new ComparableStack(ModItems.crystal_schraranium), new ItemStack[] { new ItemStack(ModItems.nugget_schrabidium, 2), new ItemStack(ModItems.nugget_schrabidium, 2), new ItemStack(ModItems.nugget_uranium, 2), new ItemStack(ModItems.nugget_plutonium, 2) }); diff --git a/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java b/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java index d1c218639..efcd14b13 100644 --- a/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java @@ -43,9 +43,10 @@ public class CombinationRecipes extends SerializableRecipe { recipes.put(LIGNITE.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALCREOSOTE, 50))); recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.briquette, EnumBriquetteType.LIGNITE)), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALCREOSOTE, 100))); - recipes.put(CINNABAR.crystal(), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.MERCURY, 100))); //recipes.put(CHLOROCALCITE.dust(), new Pair(new ItemStack(ModItems.powder_calcium), new FluidStack(Fluids.CHLORINE, 250))); - recipes.put(new ComparableStack(Items.glowstone_dust), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.CHLORINE, 100))); + recipes.put(CINNABAR.crystal(), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.MERCURY, 100))); + recipes.put(new ComparableStack(Items.glowstone_dust), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.CHLORINE, 100))); + recipes.put(SODALITE.gem(), new Pair(new ItemStack(ModItems.powder_sodium), new FluidStack(Fluids.CHLORINE, 100))); recipes.put(new ComparableStack(DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.BAUXITE)), new Pair(new ItemStack(ModItems.ingot_aluminium, 2), new FluidStack(Fluids.REDMUD, 250))); recipes.put(KEY_LOG, new Pair(new ItemStack(Items.coal, 1 ,1), new FluidStack(Fluids.WOODOIL, 250))); diff --git a/src/main/java/com/hbm/inventory/recipes/FuelPoolRecipes.java b/src/main/java/com/hbm/inventory/recipes/FuelPoolRecipes.java index 2e80c2bb4..9f01c9d80 100644 --- a/src/main/java/com/hbm/inventory/recipes/FuelPoolRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/FuelPoolRecipes.java @@ -11,6 +11,7 @@ import com.google.gson.stream.JsonWriter; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel; import net.minecraft.item.ItemStack; @@ -37,6 +38,8 @@ public class FuelPoolRecipes extends SerializableRecipe { recipes.put(new ComparableStack(ModItems.waste_plate_sa326, 1, 1), new ItemStack(ModItems.waste_plate_sa326)); recipes.put(new ComparableStack(ModItems.waste_plate_ra226be, 1, 1), new ItemStack(ModItems.waste_plate_ra226be)); recipes.put(new ComparableStack(ModItems.waste_plate_pu238be, 1, 1), new ItemStack(ModItems.waste_plate_pu238be)); + + for(EnumPWRFuel pwr : EnumPWRFuel.values()) recipes.put(new ComparableStack(ModItems.pwr_fuel_hot, 1, pwr.ordinal()), new ItemStack(ModItems.pwr_fuel_depleted, 1, pwr.ordinal())); } @Override diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index 1a488b9cb..fea2e23b0 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -524,11 +524,6 @@ public class AnvilRecipes { constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_9))).setTier(1)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_50))).setTier(1)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_buckshot))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_357))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_44))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_9))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_50))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_buckshot))).setTier(1)); Object[][] recs = new Object[][] { {ModItems.ammo_12gauge.stackFromEnum(20, Ammo12Gauge.STOCK), P_RED.dust(), ModItems.ammo_12gauge.stackFromEnum(20, Ammo12Gauge.INCENDIARY), 2}, diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 0ea177e3b..119a33d3b 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -21,6 +21,7 @@ import com.hbm.items.machine.*; import com.hbm.items.machine.ItemFELCrystal.EnumWavelengths; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.items.machine.ItemPlateFuel.FunctionEnum; +import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel; import com.hbm.items.machine.ItemRBMKRod.EnumBurnFunc; import com.hbm.items.machine.ItemRBMKRod.EnumDepleteFunc; import com.hbm.items.machine.ItemRTGPelletDepleted.DepletedRTGMaterial; @@ -414,7 +415,8 @@ public class ModItems { public static Item crystal_cinnebar; public static Item crystal_trixite; public static Item crystal_osmiridium; - + + public static Item gem_sodalite; public static Item gem_tantalium; public static Item gem_volcanic; public static Item gem_alexandrite; @@ -480,6 +482,7 @@ public class ModItems { public static Item powder_steel; public static Item powder_lithium; public static Item powder_zirconium; + public static Item powder_sodium; public static Item redstone_depleted; public static Item powder_australium; @@ -608,11 +611,6 @@ public class ModItems { public static Item mechanism_launcher_2; public static Item mechanism_special; - public static Item primer_357; - public static Item primer_44; - public static Item primer_9; - public static Item primer_50; - public static Item primer_buckshot; public static Item casing_357; public static Item casing_44; public static Item casing_9; @@ -1103,6 +1101,10 @@ public class ModItems { public static Item plate_fuel_sa326; public static Item plate_fuel_ra226be; public static Item plate_fuel_pu238be; + + public static Item pwr_fuel; + public static Item pwr_fuel_hot; + public static Item pwr_fuel_depleted; public static Item rbmk_lid; public static Item rbmk_lid_glass; @@ -2828,6 +2830,7 @@ public class ModItems { crystal_cinnebar = new Item().setUnlocalizedName("crystal_cinnebar").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_cinnebar"); crystal_trixite = new Item().setUnlocalizedName("crystal_trixite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_trixite"); crystal_osmiridium = new Item().setUnlocalizedName("crystal_osmiridium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_osmiridium"); + gem_sodalite = new ItemCustomLore().setUnlocalizedName("gem_sodalite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gem_sodalite"); gem_tantalium = new ItemCustomLore().setUnlocalizedName("gem_tantalium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gem_tantalium"); gem_volcanic = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("gem_volcanic").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gem_volcanic"); gem_alexandrite = new ItemAlexandrite().setUnlocalizedName("gem_alexandrite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gem_alexandrite"); @@ -2877,6 +2880,7 @@ public class ModItems { powder_steel = new Item().setUnlocalizedName("powder_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_steel"); powder_lithium = new Item().setUnlocalizedName("powder_lithium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_lithium"); powder_zirconium = new Item().setUnlocalizedName("powder_zirconium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_zirconium"); + powder_sodium = new Item().setUnlocalizedName("powder_sodium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_sodium"); redstone_depleted = new Item().setUnlocalizedName("redstone_depleted").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":redstone_depleted"); powder_power = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("powder_power").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_energy_alt"); powder_iodine = new ItemCustomLore().setRarity(EnumRarity.epic).setUnlocalizedName("powder_iodine").setCreativeTab(null).setTextureName(RefStrings.MODID + ":powder_iodine"); @@ -3095,11 +3099,6 @@ public class ModItems { mechanism_launcher_1 = new Item().setUnlocalizedName("mechanism_launcher_1").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":mechanism_5"); mechanism_launcher_2 = new Item().setUnlocalizedName("mechanism_launcher_2").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":mechanism_6"); mechanism_special = new Item().setUnlocalizedName("mechanism_special").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":mechanism_7"); - primer_357 = new Item().setUnlocalizedName("primer_357").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_357"); - primer_44 = new Item().setUnlocalizedName("primer_44").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_44"); - primer_9 = new Item().setUnlocalizedName("primer_9").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_9"); - primer_50 = new Item().setUnlocalizedName("primer_50").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_50"); - primer_buckshot = new Item().setUnlocalizedName("primer_buckshot").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_buckshot"); casing_357 = new Item().setUnlocalizedName("casing_357").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing_357"); casing_44 = new Item().setUnlocalizedName("casing_44").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing_44"); casing_9 = new Item().setUnlocalizedName("casing_9").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing_9"); @@ -3547,6 +3546,10 @@ public class ModItems { plate_fuel_sa326 = new ItemPlateFuel(2000000).setFunction(FunctionEnum.LINEAR, 80).setUnlocalizedName("plate_fuel_sa326").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":plate_fuel_sa326"); plate_fuel_ra226be = new ItemPlateFuel(1300000).setFunction(FunctionEnum.PASSIVE, 30).setUnlocalizedName("plate_fuel_ra226be").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":plate_fuel_ra226be"); plate_fuel_pu238be = new ItemPlateFuel(1000000).setFunction(FunctionEnum.PASSIVE, 50).setUnlocalizedName("plate_fuel_pu238be").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":plate_fuel_pu238be"); + + pwr_fuel = new ItemPWRFuel().setUnlocalizedName("pwr_fuel").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pwr_fuel"); + pwr_fuel_hot = new ItemEnumMulti(EnumPWRFuel.class, true, false).setUnlocalizedName("pwr_fuel_hot").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pwr_fuel_hot"); + pwr_fuel_depleted = new ItemEnumMulti(EnumPWRFuel.class, true, false).setUnlocalizedName("pwr_fuel_depleted").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pwr_fuel_depleted"); rbmk_lid = new ItemRBMKLid().setUnlocalizedName("rbmk_lid").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":rbmk_lid"); rbmk_lid_glass = new ItemRBMKLid().setUnlocalizedName("rbmk_lid_glass").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":rbmk_lid_glass"); @@ -5765,6 +5768,7 @@ public class ModItems { GameRegistry.registerItem(powder_lithium, powder_lithium.getUnlocalizedName()); GameRegistry.registerItem(powder_lithium_tiny, powder_lithium_tiny.getUnlocalizedName()); GameRegistry.registerItem(powder_zirconium, powder_zirconium.getUnlocalizedName()); + GameRegistry.registerItem(powder_sodium, powder_sodium.getUnlocalizedName()); GameRegistry.registerItem(powder_lignite, powder_lignite.getUnlocalizedName()); GameRegistry.registerItem(powder_iodine, powder_iodine.getUnlocalizedName()); GameRegistry.registerItem(powder_thorium, powder_thorium.getUnlocalizedName()); @@ -5872,6 +5876,7 @@ public class ModItems { GameRegistry.registerItem(crystal_cinnebar, crystal_cinnebar.getUnlocalizedName()); GameRegistry.registerItem(crystal_trixite, crystal_trixite.getUnlocalizedName()); GameRegistry.registerItem(crystal_osmiridium, crystal_osmiridium.getUnlocalizedName()); + GameRegistry.registerItem(gem_sodalite, gem_sodalite.getUnlocalizedName()); GameRegistry.registerItem(gem_tantalium, gem_tantalium.getUnlocalizedName()); GameRegistry.registerItem(gem_volcanic, gem_volcanic.getUnlocalizedName()); GameRegistry.registerItem(gem_alexandrite, gem_alexandrite.getUnlocalizedName()); @@ -6170,13 +6175,6 @@ public class ModItems { GameRegistry.registerItem(mechanism_launcher_2, mechanism_launcher_2.getUnlocalizedName()); GameRegistry.registerItem(mechanism_special, mechanism_special.getUnlocalizedName()); - //Primers - GameRegistry.registerItem(primer_357, primer_357.getUnlocalizedName()); - GameRegistry.registerItem(primer_44, primer_44.getUnlocalizedName()); - GameRegistry.registerItem(primer_9, primer_9.getUnlocalizedName()); - GameRegistry.registerItem(primer_50, primer_50.getUnlocalizedName()); - GameRegistry.registerItem(primer_buckshot, primer_buckshot.getUnlocalizedName()); - //Casings GameRegistry.registerItem(casing_357, casing_357.getUnlocalizedName()); GameRegistry.registerItem(casing_44, casing_44.getUnlocalizedName()); @@ -6640,6 +6638,11 @@ public class ModItems { GameRegistry.registerItem(plate_fuel_ra226be, plate_fuel_ra226be.getUnlocalizedName()); GameRegistry.registerItem(plate_fuel_pu238be, plate_fuel_pu238be.getUnlocalizedName()); + //PWR Parts + GameRegistry.registerItem(pwr_fuel, pwr_fuel.getUnlocalizedName()); + GameRegistry.registerItem(pwr_fuel_hot, pwr_fuel_hot.getUnlocalizedName()); + GameRegistry.registerItem(pwr_fuel_depleted, pwr_fuel_depleted.getUnlocalizedName()); + //RBMK parts GameRegistry.registerItem(rbmk_lid, rbmk_lid.getUnlocalizedName()); GameRegistry.registerItem(rbmk_lid_glass, rbmk_lid_glass.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/machine/ItemPWRFuel.java b/src/main/java/com/hbm/items/machine/ItemPWRFuel.java new file mode 100644 index 000000000..d60aca579 --- /dev/null +++ b/src/main/java/com/hbm/items/machine/ItemPWRFuel.java @@ -0,0 +1,58 @@ +package com.hbm.items.machine; + +import java.util.List; + +import com.hbm.items.ItemEnumMulti; +import com.hbm.util.EnumUtil; +import com.hbm.util.function.Function; +import com.hbm.util.function.Function.FunctionLogarithmic; +import com.hbm.util.function.Function.FunctionSqrt; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +public class ItemPWRFuel extends ItemEnumMulti { + + public ItemPWRFuel() { + super(EnumPWRFuel.class, true, true); + } + + public static enum EnumPWRFuel { + MEU( 05.0D, new FunctionLogarithmic(25)), + HEU233( 07.5D, new FunctionSqrt(25)), + HEU235( 07.5D, new FunctionSqrt(25)), + MEN( 07.5D, new FunctionLogarithmic(25)), + HEN237( 07.5D, new FunctionSqrt(25)), + MOX( 07.5D, new FunctionLogarithmic(25)), + MEP( 07.5D, new FunctionLogarithmic(25)), + HEP239( 10.0D, new FunctionSqrt(25)), + HEP241( 10.0D, new FunctionSqrt(25)), + MEA( 07.5D, new FunctionLogarithmic(25)), + HEA242( 10.0D, new FunctionSqrt(25)), + HES326( 15.0D, new FunctionSqrt(25)), + HES327( 15.0D, new FunctionSqrt(25)); + + public double yield = 1_000_000_000; + public double heatEmission; + public Function function; + + private EnumPWRFuel(double heatEmission, Function function) { + this.heatEmission = heatEmission; + this.function = function; + } + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + + EnumPWRFuel num = EnumUtil.grabEnumSafely(EnumPWRFuel.class, stack.getItemDamage()); + + String color = EnumChatFormatting.GOLD + ""; + String reset = EnumChatFormatting.RESET + ""; + + list.add(color + "Heat per flux: " + reset + num.heatEmission + " TU"); + list.add(color + "Reacton function: " + reset + num.function.getLabelForFuel()); + list.add(color + "Fuel type: " + reset + num.function.getDangerFromFuel()); + } +} diff --git a/src/main/java/com/hbm/items/special/ItemBedrockOre.java b/src/main/java/com/hbm/items/special/ItemBedrockOre.java index 9d12bade0..f4362a93f 100644 --- a/src/main/java/com/hbm/items/special/ItemBedrockOre.java +++ b/src/main/java/com/hbm/items/special/ItemBedrockOre.java @@ -95,7 +95,8 @@ public class ItemBedrockOre extends ItemEnumMulti { GOLD("Gold", 0xF9D738, B_LEAD, B_COPPER, B_BISMUTH), //occurs with copper, lead and rare bismuthide URANIUM("Uranium", 0x868D82, B_LEAD, B_RADIUM, B_POLONIUM), //uranium and its decay products THORIUM("Thorium", 0x7D401D, B_SILICON, B_URANIUM, B_TECHNETIUM), //thorium occours with uraninite and decay products - CHLOROCALCITE("Chlorocalcite", 0xCDE036, B_LITHIUM, B_SILICON, B_SILICON); //i guess? + CHLOROCALCITE("Chlorocalcite", 0xCDE036, B_LITHIUM, B_SILICON, B_SILICON), //i guess? + FLUORITE("Fluorite", 0xF6F3E7, B_SILICON, B_LITHIUM, B_ALUMINIUM); //different silicon-bearing gemstones, generic lithium, aluminium from sodium compound trailings public String oreName; public int color; diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 4c80ccab4..1e8e427dc 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -2,15 +2,22 @@ package com.hbm.items.tool; import java.util.List; +import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.lib.Library; +import com.hbm.util.TrackerUtil; +import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraft.entity.EntityTracker; +import net.minecraft.entity.EntityTrackerEntry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.IntHashMap; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; public class ItemWandD extends Item { @@ -32,7 +39,7 @@ public class ItemWandD extends Item { vnt.setSFX(new ExplosionEffectStandard()); vnt.explode();*/ - PollutionHandler.incrementPollution(world, pos.blockX, pos.blockY, pos.blockZ, PollutionType.SOOT, 15); + //PollutionHandler.incrementPollution(world, pos.blockX, pos.blockY, pos.blockZ, PollutionType.SOOT, 15); /*TimeAnalyzer.startCount("setBlock"); world.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.dirt); @@ -54,15 +61,16 @@ public class ItemWandD extends Item { tom.destructionRange = 600; world.spawnEntityInWorld(tom);*/ - /*EntityNukeTorex torex = new EntityNukeTorex(world); + EntityNukeTorex torex = new EntityNukeTorex(world); torex.setPositionAndRotation(pos.blockX, pos.blockY + 1, pos.blockZ, 0, 0); torex.getDataWatcher().updateObject(10, 1.5F); world.spawnEntityInWorld(torex); - EntityTracker entitytracker = ((WorldServer) world).getEntityTracker(); + /*EntityTracker entitytracker = ((WorldServer) world).getEntityTracker(); IntHashMap map = ReflectionHelper.getPrivateValue(EntityTracker.class, entitytracker, "trackedEntityIDs", "field_72794_c"); EntityTrackerEntry entry = (EntityTrackerEntry) map.lookup(torex.getEntityId()); - entry.blocksDistanceThreshold = 1000; - world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, 150, pos.blockX, pos.blockY + 1, pos.blockZ));*/ + entry.blocksDistanceThreshold = 1000;*/ + TrackerUtil.setTrackingRange(world, torex, 1000); + //world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, 150, pos.blockX, pos.blockY + 1, pos.blockZ)); //DungeonToolbox.generateBedrockOreWithChance(world, world.rand, pos.blockX, pos.blockZ, EnumBedrockOre.TITANIUM, new FluidStack(Fluids.SULFURIC_ACID, 500), 2, 1); diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index cdd0a61cd..852e84b61 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -34,8 +34,6 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.ammo_20gauge, 0, 2, 6, 3), new WeightedRandomChestContent(ModItems.casing_9, 0, 4, 10, 3), new WeightedRandomChestContent(ModItems.casing_50, 0, 4, 10, 3), - new WeightedRandomChestContent(ModItems.primer_9, 0, 4, 10, 3), - new WeightedRandomChestContent(ModItems.primer_50, 0, 4, 10, 3), new WeightedRandomChestContent(ModItems.cordite, 0, 4, 6, 5), new WeightedRandomChestContent(ModItems.battery_generic, 0, 1, 1, 4), new WeightedRandomChestContent(ModItems.battery_advanced, 0, 1, 1, 2), diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 438847446..d17a16610 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -959,8 +959,8 @@ public class MainRegistry { config.save(); try { - if(GeneralConfig.enableThermosPreventer && Class.forName("thermos.Thermos") != null) { - throw new IllegalStateException("The mod tried to start on a Thermos server and therefore stopped. To allow the server to start on Thermos, change the appropriate " + if(GeneralConfig.enableThermosPreventer && Class.forName("thermos.ThermosClassTransformer") != null) { + throw new IllegalStateException("The mod tried to start on a Thermos or it's fork server and therefore stopped. To allow the server to start on Thermos, change the appropriate " + "config entry (0.00 in hbm.cfg). This was done because, by default, Thermos " + "uses a so-called \"optimization\" feature that reduces tile ticking a lot, which will inevitably break a lot of machines. Most people aren't even aware " + "of this, and start blaming random mods for all their stuff breaking. In order to adjust or even disable this feature, edit \"tileentities.yml\" in your " @@ -1161,6 +1161,11 @@ public class MainRegistry { ignoreMappings.add("hbm:item.canned_kerosene"); ignoreMappings.add("hbm:item.canned_recursion"); ignoreMappings.add("hbm:item.canned_bark"); + ignoreMappings.add("hbm:item.primer_357"); + ignoreMappings.add("hbm:item.primer_44"); + ignoreMappings.add("hbm:item.primer_9"); + ignoreMappings.add("hbm:item.primer_50"); + ignoreMappings.add("hbm:item.primer_buckshot"); /// REMAP /// remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses); diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index 17a4e9682..a1bc1b705 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -1,7 +1,6 @@ package com.hbm.main; import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Random; @@ -18,7 +17,6 @@ import com.hbm.blocks.rail.IRailNTM.MoveContext; import com.hbm.blocks.rail.IRailNTM.RailCheckType; import com.hbm.blocks.rail.IRailNTM.RailContext; import com.hbm.config.GeneralConfig; -import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.entity.mob.EntityHunterChopper; import com.hbm.entity.projectile.EntityChopperMine; import com.hbm.entity.train.EntityRailCarRidable; @@ -147,11 +145,38 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class ModEventHandlerClient { + public static int flashTimer; + @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent.Pre event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; + /// NUKE FLASH /// + if(event.type == ElementType.CROSSHAIRS && flashTimer > 0) { + int width = event.resolution.getScaledWidth(); + int height = event.resolution.getScaledHeight(); + Tessellator tess = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.0F); + GL11.glDepthMask(false); + tess.startDrawingQuads(); + float brightness = (flashTimer - event.partialTicks) / 200F; + tess.setColorRGBA_F(1F, 1F, 1F, brightness * 0.8F); + tess.addVertex(width, 0, 0); + tess.addVertex(0, 0, 0); + tess.addVertex(0, height, 0); + tess.addVertex(width, height, 0); + tess.draw(); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glDepthMask(true); + return; + } + /// HANDLE GUN OVERLAYS /// if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemHUD) { ((IItemHUD)player.getHeldItem().getItem()).renderHUD(event, event.type, player, player.getHeldItem()); @@ -196,18 +221,6 @@ public class ModEventHandlerClient { } } - List torex = world.getEntitiesWithinAABB(EntityNukeTorex.class, player.boundingBox.expand(100, 100, 100)); - - if(!torex.isEmpty()) { - EntityNukeTorex t = torex.get(0); - List text = new ArrayList(); - text.add("Speed: " + t.getSimulationSpeed()); - text.add("Alpha: " + t.getAlpha()); - text.add("Age: " + t.ticksExisted + " / " + t.getMaxAge()); - text.add("Clouds: " + t.cloudlets.size()); - ILookOverlay.printGeneric(event, "DEBUG", 0xff0000, 0x4040000, text); - } - /*List text = new ArrayList(); text.add("IMPACT: " + ImpactWorldHandler.getImpactForClient(world)); text.add("DUST: " + ImpactWorldHandler.getDustForClient(world)); @@ -1250,6 +1263,8 @@ public class ModEventHandlerClient { client.sendQueue.addToSendQueue(new C0CPacketInput(client.moveStrafing, client.moveForward, client.movementInput.jump, client.movementInput.sneak)); } } + + if(event.phase == Phase.START) if(flashTimer > 0) flashTimer--; } @SubscribeEvent diff --git a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java index 7dd68dd4c..eee0c1d97 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java +++ b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java @@ -28,8 +28,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.EntityViewRenderEvent.FogColors; import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderPlayerEvent; public class ModEventHandlerRenderer { @@ -377,4 +379,15 @@ public class ModEventHandlerRenderer { event.blue = event.blue * (1 - interp) + sootColor * interp; } } + + @SubscribeEvent + public void onRenderHUD(RenderGameOverlayEvent.Pre event) { + + if(event.type == ElementType.HOTBAR && ModEventHandlerClient.flashTimer > 0) { + double mult = (ModEventHandlerClient.flashTimer + event.partialTicks) * 0.01D; + double horizontal = MathHelper.clamp_double(Math.sin(System.currentTimeMillis() * 0.02), -0.7, 0.7) * 5; + double vertical = MathHelper.clamp_double(Math.sin(System.currentTimeMillis() * 0.01 + 2), -0.7, 0.7) * 1; + GL11.glTranslated(horizontal * mult, vertical * mult, 0); + } + } } diff --git a/src/main/java/com/hbm/render/block/ct/CTContext.java b/src/main/java/com/hbm/render/block/ct/CTContext.java index 30e1e9126..d028d2933 100644 --- a/src/main/java/com/hbm/render/block/ct/CTContext.java +++ b/src/main/java/com/hbm/render/block/ct/CTContext.java @@ -80,7 +80,7 @@ public class CTContext { int[] coord = dirs[j]; Block neighbor = world.getBlock(x + coord[0], y + coord[1], z + coord[2]); - if(neighbor instanceof IBlockCT && ((IBlockCT) neighbor).canConnect(world, x + coord[0], y + coord[1], z + coord[2], (IBlockCT)block)) { + if(((IBlockCT) block).canConnect(world, x + coord[0], y + coord[1], z + coord[2], neighbor)) { cons[j] = true; } } diff --git a/src/main/java/com/hbm/render/block/ct/IBlockCT.java b/src/main/java/com/hbm/render/block/ct/IBlockCT.java index 66bd967c0..c672784c0 100644 --- a/src/main/java/com/hbm/render/block/ct/IBlockCT.java +++ b/src/main/java/com/hbm/render/block/ct/IBlockCT.java @@ -1,5 +1,6 @@ package com.hbm.render.block.ct; +import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; @@ -8,7 +9,7 @@ public interface IBlockCT { public IIcon[] getFragments(IBlockAccess world, int x, int y, int z); - public default boolean canConnect(IBlockAccess world, int x, int y, int z, IBlockCT block) { + public default boolean canConnect(IBlockAccess world, int x, int y, int z, Block block) { return this == block; } diff --git a/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java b/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java index e59c4a6b5..bbd2655ee 100644 --- a/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java +++ b/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java @@ -37,7 +37,7 @@ public class RenderBlocksCT extends RenderBlocks { this.blockAccess = acc; } - private void initSideInfo() { + private void initSideInfo(int side) { if(!this.enableAO) return; @@ -49,15 +49,42 @@ public class RenderBlocksCT extends RenderBlocks { * it's only the color in ONE PARTICULAR SIDE. well thanks for that i think that's rather poggers, lex. */ - float red = (colorRedTopLeft + colorRedTopRight + colorRedBottomLeft + colorRedBottomRight) / 4F; + /*float red = (colorRedTopLeft + colorRedTopRight + colorRedBottomLeft + colorRedBottomRight) / 4F; float green = (colorGreenTopLeft + colorGreenTopRight + colorGreenBottomLeft + colorGreenBottomRight) / 4F; float blue = (colorBlueTopLeft + colorBlueTopRight + colorBlueBottomLeft + colorBlueBottomRight) / 4F; - int light = (brightnessTopLeft + brightnessTopRight + brightnessBottomLeft + brightnessBottomRight) / 4; + int light = (brightnessTopLeft + brightnessTopRight + brightnessBottomLeft + brightnessBottomRight) / 4;*/ - this.tl = new VertInfo(red, green, blue, light); - this.tr = new VertInfo(red, green, blue, light); - this.bl = new VertInfo(red, green, blue, light); - this.br = new VertInfo(red, green, blue, light); + if(side == ForgeDirection.SOUTH.ordinal()) { + this.tl = new VertInfo(colorRedTopLeft, colorGreenTopLeft, colorBlueTopLeft, brightnessTopLeft); + this.tr = new VertInfo(colorRedTopRight, colorGreenTopRight, colorBlueTopRight, brightnessTopRight); + this.bl = new VertInfo(colorRedBottomLeft, colorGreenBottomLeft, colorBlueBottomLeft, brightnessBottomLeft); + this.br = new VertInfo(colorRedBottomRight, colorGreenBottomRight, colorBlueBottomRight, brightnessBottomRight); + } else if(side == ForgeDirection.NORTH.ordinal()) { + this.tr = new VertInfo(colorRedTopLeft, colorGreenTopLeft, colorBlueTopLeft, brightnessTopLeft); + this.br = new VertInfo(colorRedTopRight, colorGreenTopRight, colorBlueTopRight, brightnessTopRight); + this.tl = new VertInfo(colorRedBottomLeft, colorGreenBottomLeft, colorBlueBottomLeft, brightnessBottomLeft); + this.bl = new VertInfo(colorRedBottomRight, colorGreenBottomRight, colorBlueBottomRight, brightnessBottomRight); + } else if(side == ForgeDirection.EAST.ordinal()) { + this.bl = new VertInfo(colorRedTopLeft, colorGreenTopLeft, colorBlueTopLeft, brightnessTopLeft); + this.tl = new VertInfo(colorRedTopRight, colorGreenTopRight, colorBlueTopRight, brightnessTopRight); + this.br = new VertInfo(colorRedBottomLeft, colorGreenBottomLeft, colorBlueBottomLeft, brightnessBottomLeft); + this.tr = new VertInfo(colorRedBottomRight, colorGreenBottomRight, colorBlueBottomRight, brightnessBottomRight); + } else if(side == ForgeDirection.WEST.ordinal()) { + this.tr = new VertInfo(colorRedTopLeft, colorGreenTopLeft, colorBlueTopLeft, brightnessTopLeft); + this.br = new VertInfo(colorRedTopRight, colorGreenTopRight, colorBlueTopRight, brightnessTopRight); + this.tl = new VertInfo(colorRedBottomLeft, colorGreenBottomLeft, colorBlueBottomLeft, brightnessBottomLeft); + this.bl = new VertInfo(colorRedBottomRight, colorGreenBottomRight, colorBlueBottomRight, brightnessBottomRight); + } else if(side == ForgeDirection.UP.ordinal()) { + this.br = new VertInfo(colorRedTopLeft, colorGreenTopLeft, colorBlueTopLeft, brightnessTopLeft); + this.bl = new VertInfo(colorRedTopRight, colorGreenTopRight, colorBlueTopRight, brightnessTopRight); + this.tr = new VertInfo(colorRedBottomLeft, colorGreenBottomLeft, colorBlueBottomLeft, brightnessBottomLeft); + this.tl = new VertInfo(colorRedBottomRight, colorGreenBottomRight, colorBlueBottomRight, brightnessBottomRight); + } else { + this.tl = new VertInfo(colorRedTopLeft, colorGreenTopLeft, colorBlueTopLeft, brightnessTopLeft); + this.tr = new VertInfo(colorRedTopRight, colorGreenTopRight, colorBlueTopRight, brightnessTopRight); + this.bl = new VertInfo(colorRedBottomLeft, colorGreenBottomLeft, colorBlueBottomLeft, brightnessBottomLeft); + this.br = new VertInfo(colorRedBottomRight, colorGreenBottomRight, colorBlueBottomRight, brightnessBottomRight); + } this.tc = VertInfo.avg(tl, tr); this.bc = VertInfo.avg(bl, br); @@ -82,7 +109,7 @@ public class RenderBlocksCT extends RenderBlocks { @Override public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { - initSideInfo(); + initSideInfo(ForgeDirection.EAST.ordinal()); CTFace face = CTContext.faces[ForgeDirection.EAST.ordinal()]; /// ORDER: LEXICAL /// @@ -99,7 +126,7 @@ public class RenderBlocksCT extends RenderBlocks { @Override public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { - initSideInfo(); + initSideInfo(ForgeDirection.WEST.ordinal()); CTFace face = CTContext.faces[ForgeDirection.WEST.ordinal()]; /// ORDER: LEXICAL /// @@ -116,7 +143,7 @@ public class RenderBlocksCT extends RenderBlocks { @Override public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { - initSideInfo(); + initSideInfo(ForgeDirection.UP.ordinal()); CTFace face = CTContext.faces[ForgeDirection.UP.ordinal()]; /// ORDER: LEXICAL /// @@ -133,7 +160,7 @@ public class RenderBlocksCT extends RenderBlocks { @Override public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { - initSideInfo(); + initSideInfo(ForgeDirection.DOWN.ordinal()); CTFace face = CTContext.faces[ForgeDirection.DOWN.ordinal()]; /// ORDER: LEXICAL /// @@ -150,7 +177,7 @@ public class RenderBlocksCT extends RenderBlocks { @Override public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { - initSideInfo(); + initSideInfo(ForgeDirection.SOUTH.ordinal()); CTFace face = CTContext.faces[ForgeDirection.SOUTH.ordinal()]; /// ORDER: LEXICAL /// @@ -167,7 +194,7 @@ public class RenderBlocksCT extends RenderBlocks { @Override public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { - initSideInfo(); + initSideInfo(ForgeDirection.NORTH.ordinal()); CTFace face = CTContext.faces[ForgeDirection.NORTH.ordinal()]; /// ORDER: LEXICAL /// diff --git a/src/main/java/com/hbm/render/entity/effect/RenderTorex.java b/src/main/java/com/hbm/render/entity/effect/RenderTorex.java index 661b57773..dfa21028c 100644 --- a/src/main/java/com/hbm/render/entity/effect/RenderTorex.java +++ b/src/main/java/com/hbm/render/entity/effect/RenderTorex.java @@ -2,6 +2,7 @@ package com.hbm.render.entity.effect; import java.util.ArrayList; import java.util.Comparator; +import java.util.Random; import org.lwjgl.opengl.GL11; @@ -9,6 +10,7 @@ import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.entity.effect.EntityNukeTorex.Cloudlet; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; +import com.hbm.main.ModEventHandlerClient; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.OpenGlHelper; @@ -23,6 +25,7 @@ import net.minecraft.util.Vec3; public class RenderTorex extends Render { private static final ResourceLocation cloudlet = new ResourceLocation(RefStrings.MODID + ":textures/particle/particle_base.png"); + private static final ResourceLocation flash = new ResourceLocation(RefStrings.MODID + ":textures/particle/flare.png"); @Override public void doRender(Entity entity, double x, double y, double z, float f0, float interp) { @@ -31,6 +34,8 @@ public class RenderTorex extends Render { GL11.glTranslated(x, y, z); EntityNukeTorex cloud = (EntityNukeTorex)entity; cloudletWrapper(cloud, interp); + if(cloud.ticksExisted < 101) flashWrapper(cloud, interp); + if(cloud.ticksExisted < 10 && ModEventHandlerClient.flashTimer < 100) ModEventHandlerClient.flashTimer = 200; GL11.glPopMatrix(); } @@ -81,6 +86,43 @@ public class RenderTorex extends Render { GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } + + private void flashWrapper(EntityNukeTorex cloud, float interp) { + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glAlphaFunc(GL11.GL_GREATER, 0); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDepthMask(false); + RenderHelper.disableStandardItemLighting(); + + bindTexture(flash); + + Tessellator tess = Tessellator.instance; + tess.startDrawingQuads(); + + double age = Math.min(cloud.ticksExisted + interp, 100); + float alpha = (float) ((100D - age) / 100F); + + Random rand = new Random(cloud.getEntityId()); + + for(int i = 0; i < 3; i++) { + float x = (float) (rand.nextGaussian() * 0.5F * cloud.rollerSize); + float y = (float) (rand.nextGaussian() * 0.5F * cloud.rollerSize); + float z = (float) (rand.nextGaussian() * 0.5F * cloud.rollerSize); + tessellateFlash(tess, x, y + cloud.coreHeight, z, (float) (10 * cloud.rollerSize), alpha, interp); + } + + tess.draw(); + + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_ALPHA_TEST); + RenderHelper.enableStandardItemLighting(); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } private void tessellateCloudlet(Tessellator tess, double posX, double posY, double posZ, Cloudlet cloud, float interp) { @@ -104,6 +146,23 @@ public class RenderTorex extends Render { } + private void tessellateFlash(Tessellator tess, double posX, double posY, double posZ, float scale, float alpha, float interp) { + + float f1 = ActiveRenderInfo.rotationX; + float f2 = ActiveRenderInfo.rotationZ; + float f3 = ActiveRenderInfo.rotationYZ; + float f4 = ActiveRenderInfo.rotationXY; + float f5 = ActiveRenderInfo.rotationXZ; + + tess.setColorRGBA_F(1F, 1F, 1F, alpha); + + tess.addVertexWithUV((double) (posX - f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ - f2 * scale - f4 * scale), 1, 1); + tess.addVertexWithUV((double) (posX - f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ - f2 * scale + f4 * scale), 1, 0); + tess.addVertexWithUV((double) (posX + f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ + f2 * scale + f4 * scale), 0, 0); + tess.addVertexWithUV((double) (posX + f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ + f2 * scale - f4 * scale), 0, 1); + + } + @Override protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return null; diff --git a/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java b/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java index 988d683b8..58c6d15e0 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java +++ b/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java @@ -102,17 +102,16 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme @Override public ItemStack decrStackSize(int slot, int amount) { - if(slots[slot] != null) - { - if(slots[slot].stackSize <= amount) - { + if(slots[slot] != null) { + + if(slots[slot].stackSize <= amount) { ItemStack itemStack = slots[slot]; slots[slot] = null; return itemStack; } + ItemStack itemStack1 = slots[slot].splitStack(amount); - if (slots[slot].stackSize == 0) - { + if(slots[slot].stackSize == 0) { slots[slot] = null; } diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index 74b76c50b..fd8d60aca 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -14,6 +14,7 @@ import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre; import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe; import com.hbm.blocks.generic.PartEmitter.TileEntityPartEmitter; +import com.hbm.blocks.machine.BlockPWR.TileEntityBlockPWR; import com.hbm.blocks.machine.MachineCapacitor.TileEntityCapacitor; import com.hbm.blocks.machine.MachineFan.TileEntityFan; import com.hbm.blocks.machine.PistonInserter.TileEntityPistonInserter; @@ -216,6 +217,9 @@ public class TileMappings { put(TileEntityRandomOre.class, "tileentity_mother_of_all_ores"); put(TileEntityBedrockOre.class, "tileentity_bedrock_ore"); + + put(TileEntityBlockPWR.class, "tileentity_block_pwr"); + put(TileEntityPWRController.class, "tileentity_pwr_controller"); putNetwork(); putBombs(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java index 95b972949..a3adb1bc1 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java @@ -43,6 +43,7 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne public boolean isOn; public FluidTank tank; public long prev; + public static long maxJoules = Long.MAX_VALUE / 100_000; public static final int range = 50; @@ -98,6 +99,8 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); for(int i = 1; i <= range; i++) { + if(out > maxJoules) out = maxJoules; + beam = i; int x = xCoord + dir.offsetX * i; @@ -126,7 +129,7 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne Block b = worldObj.getBlock(x, y, z); - if(b != Blocks.air) { + if(!b.isAir(worldObj, x, y, z)) { if(b.getMaterial().isLiquid()) { worldObj.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "random.fizz", 1.0F, 1.0F); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java index b4fffdb9c..bd2366acc 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java @@ -19,7 +19,6 @@ import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.SimpleComponent; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -97,7 +96,7 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl break; } - if(worldObj.getBlock(x, y, z) != Blocks.air) + if(!worldObj.getBlock(x, y, z).isAir(worldObj, x, y, z)) break; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java index 82ce38079..a60975ed3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java @@ -17,7 +17,6 @@ import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.SimpleComponent; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -86,7 +85,7 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I break; } - if(worldObj.getBlock(x, y, z) != Blocks.air) + if(!worldObj.getBlock(x, y, z).isAir(worldObj, x, y, z)) break; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java index 1a10e1a7e..4e5cf6c3b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java @@ -132,32 +132,19 @@ public class TileEntityDiFurnace extends TileEntityMachinePolluting implements I } public boolean canProcess() { - if(slots[0] == null || slots[1] == null) { - return false; - } + if(slots[0] == null || slots[1] == null) return false; + if(!this.hasPower()) return false; - if(!this.hasPower()) { - return false; - } - - ItemStack itemStack = BlastFurnaceRecipes.getOutput(slots[0], slots[1]); - if(itemStack == null) { - return false; - } + ItemStack output = BlastFurnaceRecipes.getOutput(slots[0], slots[1]); + if(output == null) return false; + if(slots[3] == null) return true; + if(!slots[3].isItemEqual(output)) return false; - if(slots[3] == null) { + if(slots[3].stackSize + output.stackSize <= slots[3].getMaxStackSize()) { return true; } - - if(!slots[3].isItemEqual(itemStack)) { - return false; - } - - if(slots[3].stackSize < getInventoryStackLimit() && slots[3].stackSize < slots[3].getMaxStackSize()) { - return true; - } else { - return slots[3].stackSize < itemStack.getMaxStackSize(); - } + + return false; } private void processItem() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java index 2ca86eb13..3ec39159b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java @@ -1,9 +1,11 @@ package com.hbm.tileentity.machine; +import java.util.HashSet; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockTallPlant.EnumTallFlower; +import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.ModDamageSource; @@ -29,6 +31,15 @@ import net.minecraft.util.Vec3; public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardReceiver { + public static final HashSet acceptedFuels = new HashSet(); + + static { + acceptedFuels.add(Fluids.WOODOIL); + acceptedFuels.add(Fluids.ETHANOL); + acceptedFuels.add(Fluids.FISHOIL); + acceptedFuels.add(Fluids.HEAVYOIL); + } + public FluidTank tank; public boolean isOn; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java index 379a95c1b..3da9f3833 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java @@ -304,6 +304,8 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements this.maxProgress = recipe.getDuration() * this.speed / 100; + if(maxProgress <= 0) maxProgress = 1; + if(this.progress >= this.maxProgress) { consumeFluids(recipe); produceFluids(recipe); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java index d91102d51..99e38f3e4 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java @@ -150,6 +150,8 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa this.maxProgress[index] = recipe.getDuration() * this.speed / 100; + if(maxProgress[index] <= 0) maxProgress[index] = 1; + if(this.progress[index] >= this.maxProgress[index]) { consumeFluids(recipe, index); produceFluids(recipe, index); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java new file mode 100644 index 000000000..e50143a6b --- /dev/null +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java @@ -0,0 +1,457 @@ +package com.hbm.tileentity.machine; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import com.hbm.blocks.ModBlocks; +import com.hbm.interfaces.IControlReceiver; +import com.hbm.inventory.container.ContainerPWR; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.fluid.tank.FluidTank; +import com.hbm.inventory.fluid.trait.FT_Heatable; +import com.hbm.inventory.fluid.trait.FT_PWRModerator; +import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep; +import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType; +import com.hbm.inventory.gui.GUIPWR; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel; +import com.hbm.main.MainRegistry; +import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IGUIProvider; +import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.EnumUtil; +import com.hbm.util.fauxpointtwelve.BlockPos; + +import api.hbm.fluid.IFluidStandardTransceiver; +import net.minecraft.block.Block; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, IFluidStandardTransceiver { + + public FluidTank[] tanks; + public int coreHeat; + public static final int coreHeatCapacity = 10_000_000; + public int hullHeat; + public static final int hullHeatCapacity = 10_000_000; + public double flux; + + public int rodLevel = 100; + public int rodTarget = 100; + + public int typeLoaded; + public int amountLoaded; + public double progress; + public double processTime; + + public int rodCount; + public int connections; + public int connectionsControlled; + public int heatexCount; + public int channelCount; + public int sourceCount; + + public boolean assembled; + + private AudioWrapper audio; + + protected List ports = new ArrayList(); + + public TileEntityPWRController() { + super(3); + + this.tanks = new FluidTank[2]; + this.tanks[0] = new FluidTank(Fluids.COOLANT, 128_000); + this.tanks[1] = new FluidTank(Fluids.COOLANT_HOT, 128_000); + } + + /** The initial creation of the reactor, does all the pre-calculation and whatnot */ + public void setup(HashMap partMap, HashMap rodMap) { + + rodCount = 0; + connections = 0; + connectionsControlled = 0; + heatexCount = 0; + channelCount = 0; + sourceCount = 0; + + int connectionsDouble = 0; + int connectionsControlledDouble = 0; + + for(Entry entry : partMap.entrySet()) { + Block block = entry.getValue(); + + if(block == ModBlocks.pwr_fuel) rodCount++; + if(block == ModBlocks.pwr_heatex) heatexCount++; + if(block == ModBlocks.pwr_channel) channelCount++; + if(block == ModBlocks.pwr_neutron_source) sourceCount++; + if(block == ModBlocks.pwr_port) ports.add(entry.getKey()); + } + + for(Entry entry : rodMap.entrySet()) { + BlockPos fuelPos = entry.getKey(); + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + + boolean controlled = false; + + for(int i = 1; i < 16; i++) { + BlockPos checkPos = fuelPos.offset(dir, i); + Block atPos = partMap.get(checkPos); + if(atPos == null || atPos == ModBlocks.pwr_casing) break; + if(atPos == ModBlocks.pwr_control) controlled = true; + if(atPos == ModBlocks.pwr_fuel) { + if(controlled) { + connectionsControlledDouble++; + } else { + connectionsDouble++; + } + break; + } + if(atPos == ModBlocks.pwr_reflector) { + if(controlled) { + connectionsControlledDouble += 2; + } else { + connectionsDouble += 2; + } + break; + } + } + } + } + + connections = connectionsDouble / 2; + connectionsControlled = connectionsControlledDouble / 2; + + System.out.println("Finalized nuclear reactor!"); + System.out.println("Rods: " + rodCount); + System.out.println("Connections: " + connections); + System.out.println("Controlled connections: " + connectionsControlled); + System.out.println("Heatex: " + heatexCount); + System.out.println("Channels: " + channelCount); + System.out.println("Sources: " + sourceCount); + } + + @Override + public String getName() { + return "container.pwrController"; + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + this.tanks[0].setType(2, slots); + setupTanks(); + + for(BlockPos pos : ports) { + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + BlockPos portPos = pos.offset(dir); + + if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); + if(worldObj.getTotalWorldTime() % 20 == 0) this.trySubscribe(tanks[0].getTankType(), worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); + } + } + + if((typeLoaded == -1 || amountLoaded <= 0) && slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel) { + typeLoaded = slots[0].getItemDamage(); + amountLoaded++; + this.decrStackSize(0, 1); + this.markChanged(); + } else if(slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel && slots[0].getItemDamage() == typeLoaded && amountLoaded < rodCount){ + amountLoaded++; + this.decrStackSize(0, 1); + this.markChanged(); + } + + if(this.rodTarget > this.rodLevel) this.rodLevel++; + if(this.rodTarget < this.rodLevel) this.rodLevel--; + + int newFlux = this.sourceCount * 20; + + if(typeLoaded != -1 && amountLoaded > 0) { + + EnumPWRFuel fuel = EnumUtil.grabEnumSafely(EnumPWRFuel.class, typeLoaded); + double usedRods = getTotalProcessMultiplier(); + double fluxPerRod = this.flux / this.rodCount; + double outputPerRod = fuel.function.effonix(fluxPerRod); + double totalOutput = outputPerRod * amountLoaded * usedRods; + double totalHeatOutput = totalOutput * fuel.heatEmission; + + this.coreHeat += totalHeatOutput; + newFlux += totalOutput; + + this.processTime = (int) fuel.yield; + this.progress += totalOutput; + + if(this.progress >= this.processTime) { + this.progress -= this.processTime; + + if(slots[1] == null) { + slots[1] = new ItemStack(ModItems.pwr_fuel_hot, 1, typeLoaded); + } else if(slots[1].getItem() == ModItems.pwr_fuel_hot && slots[1].getItemDamage() == typeLoaded && slots[1].stackSize < slots[1].getMaxStackSize()) { + slots[1].stackSize++; + } + + this.amountLoaded--; + this.markChanged(); + } + } + + if(this.amountLoaded <= 0) { + this.typeLoaded = -1; + } + + /* CORE COOLING */ + double coreCoolingApproachNum = getXOverE((double) this.heatexCount / (double) this.rodCount, 2) / 2D; + int averageCoreHeat = (this.coreHeat + this.hullHeat) / 2; + this.coreHeat -= (coreHeat - averageCoreHeat) * coreCoolingApproachNum; + this.hullHeat -= (hullHeat - averageCoreHeat) * coreCoolingApproachNum; + + updateCoolant(); + + this.hullHeat *= 0.999D; + + this.flux = newFlux; + + if(tanks[0].getTankType().hasTrait(FT_PWRModerator.class)) { + this.flux *= tanks[0].getTankType().getTrait(FT_PWRModerator.class).getMultiplier(); + } + + NBTTagCompound data = new NBTTagCompound(); + tanks[0].writeToNBT(data, "t0"); + tanks[1].writeToNBT(data, "t1"); + data.setInteger("rodCount", rodCount); + data.setInteger("coreHeat", coreHeat); + data.setInteger("hullHeat", hullHeat); + data.setDouble("flux", flux); + data.setDouble("processTime", processTime); + data.setDouble("progress", progress); + data.setInteger("typeLoaded", typeLoaded); + data.setInteger("amountLoaded", amountLoaded); + data.setInteger("rodLevel", rodLevel); + data.setInteger("rodTarget", rodTarget); + this.networkPack(data, 150); + } else { + + if(amountLoaded > 0) { + + if(audio == null) { + audio = createAudioLoop(); + audio.startSound(); + } else if(!audio.isPlaying()) { + audio = rebootAudio(audio); + } + + audio.keepAlive(); + + } else { + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + } + } + + @Override + public AudioWrapper createAudioLoop() { + return MainRegistry.proxy.getLoopedSound("hbm:block.reactorLoop", xCoord, yCoord, zCoord, 1F, 10F, 1.0F, 20); + } + + @Override + public void onChunkUnload() { + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + @Override + public void invalidate() { + + super.invalidate(); + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + protected void updateCoolant() { + + FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); + if(trait == null || trait.getEfficiency(HeatingType.PWR) <= 0) return; + + double coolingEff = (double) this.channelCount / (double) this.rodCount * 0.1D; //10% cooling if numbers match + if(coolingEff > 1D) coolingEff = 1D; + + int heatToUse = (int) (this.hullHeat * coolingEff * trait.getEfficiency(HeatingType.PWR)); + HeatingStep step = trait.getFirstStep(); + int coolCycles = tanks[0].getFill() / step.amountReq; + int hotCycles = (tanks[1].getMaxFill() - tanks[1].getFill()) / step.amountProduced; + int heatCycles = heatToUse / step.heatReq; + int cycles = Math.min(coolCycles, Math.min(hotCycles, heatCycles)); + + this.hullHeat -= step.heatReq * cycles; + this.tanks[0].setFill(tanks[0].getFill() - step.amountReq * cycles); + this.tanks[1].setFill(tanks[1].getFill() + step.amountProduced * cycles); + } + + public void networkUnpack(NBTTagCompound nbt) { + tanks[0].readFromNBT(nbt, "t0"); + tanks[1].readFromNBT(nbt, "t1"); + rodCount = nbt.getInteger("rodCount"); + coreHeat = nbt.getInteger("coreHeat"); + hullHeat = nbt.getInteger("hullHeat"); + flux = nbt.getDouble("flux"); + processTime = nbt.getDouble("processTime"); + progress = nbt.getDouble("progress"); + typeLoaded = nbt.getInteger("typeLoaded"); + amountLoaded = nbt.getInteger("amountLoaded"); + rodLevel = nbt.getInteger("rodLevel"); + rodTarget = nbt.getInteger("rodTarget"); + } + + protected void setupTanks() { + + FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); + + if(trait == null || trait.getEfficiency(HeatingType.PWR) <= 0) { + tanks[0].setTankType(Fluids.NONE); + tanks[1].setTankType(Fluids.NONE); + return; + } + + tanks[1].setTankType(trait.getFirstStep().typeProduced); + } + + public double getTotalProcessMultiplier() { + double totalConnections = this.connections + this.connectionsControlled * (1D - (this.rodLevel / 100D)); + double connectionsEff = connectinFunc(totalConnections); + return connectionsEff; + } + + public double connectinFunc(double connections) { + return connections / 10D * (1D - getXOverE(connections, 300D)) + connections / 150D * getXOverE(connections, 300D); + } + + public double getXOverE(double x, double d) { + return 1 - Math.pow(Math.E, -x / d); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + tanks[0].readFromNBT(nbt, "t0"); + tanks[1].readFromNBT(nbt, "t1"); + + this.assembled = nbt.getBoolean("assembled"); + this.coreHeat = nbt.getInteger("coreHeat"); + this.hullHeat = nbt.getInteger("hullHeat"); + this.flux = nbt.getDouble("flux"); + this.rodLevel = nbt.getInteger("rodLevel"); + this.rodTarget = nbt.getInteger("rodTarget"); + this.typeLoaded = nbt.getInteger("typeLoaded"); + this.amountLoaded = nbt.getInteger("amountLoaded"); + this.progress = nbt.getDouble("progress"); + this.processTime = nbt.getDouble("processTime"); + + this.rodCount = nbt.getInteger("rodCount"); + this.connections = nbt.getInteger("connections"); + this.connectionsControlled = nbt.getInteger("connectionsControlled"); + this.heatexCount = nbt.getInteger("heatexCount"); + this.channelCount = nbt.getInteger("channelCount"); + this.sourceCount = nbt.getInteger("sourceCount"); + + ports.clear(); + int portCount = nbt.getInteger("portCount"); + for(int i = 0; i < portCount; i++) { + int[] port = nbt.getIntArray("p" + i); + ports.add(new BlockPos(port[0], port[1], port[2])); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + tanks[0].writeToNBT(nbt, "t0"); + tanks[1].writeToNBT(nbt, "t1"); + + nbt.setBoolean("assembled", assembled); + nbt.setInteger("coreHeat", coreHeat); + nbt.setInteger("hullHeat", hullHeat); + nbt.setDouble("flux", flux); + nbt.setInteger("rodLevel", rodLevel); + nbt.setInteger("rodTarget", rodTarget); + nbt.setInteger("typeLoaded", typeLoaded); + nbt.setInteger("amountLoaded", amountLoaded); + nbt.setDouble("progress", progress); + nbt.setDouble("processTime", processTime); + + nbt.setInteger("rodCount", rodCount); + nbt.setInteger("connections", connections); + nbt.setInteger("connectionsControlled", connectionsControlled); + nbt.setInteger("heatexCount", heatexCount); + nbt.setInteger("channelCount", channelCount); + nbt.setInteger("sourceCount", sourceCount); + + nbt.setInteger("portCount", ports.size()); + for(int i = 0; i < ports.size(); i++) { + BlockPos pos = ports.get(i); + nbt.setIntArray("p" + i, new int[] { pos.getX(), pos.getY(), pos.getZ() }); + } + } + + @Override + public boolean hasPermission(EntityPlayer player) { + return this.isUseableByPlayer(player); + } + + @Override + public void receiveControl(NBTTagCompound data) { + + if(data.hasKey("control")) { + this.rodTarget = MathHelper.clamp_int(data.getInteger("control"), 0, 100); + this.markChanged(); + } + } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new ContainerPWR(player.inventory, this); + } + + @Override + public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new GUIPWR(player.inventory, this); + } + + @Override + public FluidTank[] getAllTanks() { + return tanks; + } + + @Override + public FluidTank[] getSendingTanks() { + return new FluidTank[] { tanks[1] }; + } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] { tanks[0] }; + } +} diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java index ddd96c7de..be66e767d 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java @@ -2,8 +2,6 @@ package com.hbm.tileentity.machine.rbmk; import api.hbm.fluid.IFluidStandardReceiver; import com.hbm.blocks.machine.rbmk.RBMKBase; -import com.hbm.interfaces.IFluidAcceptor; -import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.tileentity.TileEntityLoadedBase; @@ -13,12 +11,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidAcceptor, IFluidStandardReceiver { +public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidStandardReceiver { public FluidTank water; public TileEntityRBMKInlet() { - water = new FluidTank(Fluids.WATER, 32000, 0); + water = new FluidTank(Fluids.WATER, 32000); } @Override @@ -63,33 +61,6 @@ public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidA this.water.writeToNBT(nbt, "tank"); } - @Override - public void setFillForSync(int fill, int index) { - if(index == 0) water.setFill(fill); - } - - @Override - public void setFluidFill(int fill, FluidType type) { - if(type == Fluids.WATER) water.setFill(fill); - } - - @Override - public void setTypeForSync(FluidType type, int index) { - if(index == 0) water.setTankType(type); - } - - @Override - public int getFluidFill(FluidType type) { - if(type == Fluids.WATER) return water.getFill(); - return 0; - } - - @Override - public int getMaxFluidFill(FluidType type) { - if(type == Fluids.WATER) return water.getMaxFill(); - return 0; - } - @Override public FluidTank[] getAllTanks() { return new FluidTank[] {water}; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java index 2c047cfd1..259ac0b4c 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java @@ -1,16 +1,9 @@ package com.hbm.tileentity.machine.rbmk; -import java.util.ArrayList; -import java.util.List; - import api.hbm.fluid.IFluidStandardSender; import com.hbm.blocks.machine.rbmk.RBMKBase; -import com.hbm.interfaces.IFluidAcceptor; -import com.hbm.interfaces.IFluidSource; -import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; -import com.hbm.lib.Library; import com.hbm.tileentity.TileEntityLoadedBase; import net.minecraft.block.Block; @@ -18,13 +11,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluidSource, IFluidStandardSender { +public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluidStandardSender { - public List list = new ArrayList(); public FluidTank steam; public TileEntityRBMKOutlet() { - steam = new FluidTank(Fluids.SUPERHOTSTEAM, 32000, 0); + steam = new FluidTank(Fluids.SUPERHOTSTEAM, 32000); } @Override @@ -53,8 +45,7 @@ public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluid } } - fillFluidInit(this.steam.getTankType()); - this.sendFluidToAll(steam, this); + fillFluidInit(); } } @@ -70,49 +61,9 @@ public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluid this.steam.writeToNBT(nbt, "tank"); } - @Override - public void setFillForSync(int fill, int index) { - steam.setFill(fill); - } - - @Override - public void setFluidFill(int fill, FluidType type) { - steam.setFill(fill); - } - - @Override - public void setTypeForSync(FluidType type, int index) { - steam.setTankType(type); - } - - @Override - public int getFluidFill(FluidType type) { - return steam.getFill(); - } - - @Override - public void fillFluidInit(FluidType type) { + public void fillFluidInit() { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) - fillFluid(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY, this.zCoord + dir.offsetZ, getTact(), type); - } - - @Override - public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) { - Library.transmitFluid(x, y, z, newTact, this, worldObj, type); - } - - @Override - @Deprecated - public boolean getTact() { return worldObj.getTotalWorldTime() % 2 == 0; } - - @Override - public List getFluidList(FluidType type) { - return this.list; - } - - @Override - public void clearFluidList(FluidType type) { - this.list.clear(); + this.sendFluid(steam, worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFENSU.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFENSU.java index b936d41b8..eea2287d6 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFENSU.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFENSU.java @@ -146,4 +146,30 @@ public class TileEntityMachineFENSU extends TileEntityMachineBattery { public double getMaxRenderDistanceSquared() { return 65536.0D; } + + @Override + public long transferPower(long power) { + + long overshoot = 0; + + // if power exceeds our transfer limit, truncate + if(power > maxTransfer) { + overshoot += power - maxTransfer; + power = maxTransfer; + } + + // this check is in essence the same as the default implementation, but re-arranged to never overflow the int64 range + // if the remaining power exceeds the power cap, truncate again + long freespace = this.getMaxPower() - this.getPower(); + + if(freespace < power) { + overshoot += power - freespace; + power = freespace; + } + + // what remains is sure to not exceed the transfer limit and the power cap (and therefore the int64 range) + this.setPower(this.getPower() + power); + + return overshoot; + } } diff --git a/src/main/java/com/hbm/util/TrackerUtil.java b/src/main/java/com/hbm/util/TrackerUtil.java index 9889d0c6e..62140046e 100644 --- a/src/main/java/com/hbm/util/TrackerUtil.java +++ b/src/main/java/com/hbm/util/TrackerUtil.java @@ -41,4 +41,13 @@ public class TrackerUtil { entry.ticks = 0; } } + + public static void setTrackingRange(World world, Entity e, int range) { + + if(world instanceof WorldServer) { + WorldServer server = (WorldServer) world; + EntityTrackerEntry entry = getTrackerEntry(server, e.getEntityId()); + entry.blocksDistanceThreshold = range; + } + } } diff --git a/src/main/java/com/hbm/util/function/Function.java b/src/main/java/com/hbm/util/function/Function.java index 544328e5c..4e8cc26b9 100644 --- a/src/main/java/com/hbm/util/function/Function.java +++ b/src/main/java/com/hbm/util/function/Function.java @@ -15,6 +15,7 @@ public abstract class Function { protected double div = 1D; protected double off = 0; + //the german prononciation of f(x) - "F von X", tee hee public abstract double effonix(double x); public abstract String getLabelForFuel(); public abstract String getDangerFromFuel(); diff --git a/src/main/java/com/hbm/world/feature/BedrockOre.java b/src/main/java/com/hbm/world/feature/BedrockOre.java index 19895823d..f20e79039 100644 --- a/src/main/java/com/hbm/world/feature/BedrockOre.java +++ b/src/main/java/com/hbm/world/feature/BedrockOre.java @@ -36,9 +36,9 @@ public class BedrockOre { registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.GOLD, 1), WorldConfig.bedrockGoldSpawn); registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.URANIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockUraniumSpawn); registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.THORIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockThoriumSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.FLUORITE, 1), WorldConfig.bedrockFluoriteSpawn); registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.coal, 4), 1, 0x202020), WorldConfig.bedrockCoalSpawn); registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(ModItems.niter, 4), 2, 0x808080, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockNiterSpawn); - registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(ModItems.fluorite, 4), 1, 0xd0d0d0), WorldConfig.bedrockFluoriteSpawn); registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.redstone, 4), 1, 0xd01010), WorldConfig.bedrockRedstoneSpawn); registerBedrockOre(weightedOresNether, new BedrockOreDefinition(new ItemStack(Items.glowstone_dust, 4), 1, 0xF9FF4D), WorldConfig.bedrockGlowstoneSpawn); diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index c764f300e..a1fef17c3 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -3959,6 +3959,7 @@ tile.machine_assembler.name=Fertigungsmaschine tile.machine_assemfac.name=Fertigungsfabrik tile.machine_autocrafter.name=Automatische Werkbank tile.machine_autosaw.name=Automatische Kreissäge +tile.machine_autosaw.desc=Schneidet Pflanzen nieder, pflanzt Bäume nach$Akzeptiert:$-Holzöl$-Ethanol$-Fischöl$-Schweröl tile.machine_bat9000.name=Big-Ass Tank 9000 tile.machine_battery.name=Energiespeicherblock tile.machine_battery_potato.name=Kartoffelbatterieblock diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 6e2e10e35..5aae8fd7b 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4891,6 +4891,7 @@ tile.machine_assembler.name=Assembly Machine tile.machine_assemfac.name=Assembly Factory tile.machine_autocrafter.name=Automatic Crafting Table tile.machine_autosaw.name=Automatic Buzz Saw +tile.machine_autosaw.desc=Cuts down nearby plants, re-plants trees$Accepts:$-Wood oil$-Ethanol$-Fish oil$-Heavy oil tile.machine_bat9000.name=Big-Ass Tank 9000 tile.machine_battery.name=Energy Storage Block tile.machine_battery_potato.name=Potato Battery Block diff --git a/src/main/resources/assets/hbm/sounds.json b/src/main/resources/assets/hbm/sounds.json index 90efc5334..d2c6248c7 100644 --- a/src/main/resources/assets/hbm/sounds.json +++ b/src/main/resources/assets/hbm/sounds.json @@ -58,6 +58,7 @@ "block.hornNearDual": {"category": "block", "sounds": [{"name": "block/hornNearDual", "stream": false}]}, "block.hornFarSingle": {"category": "block", "sounds": [{"name": "block/hornFarSingle", "stream": false}]}, "block.hornFarDual": {"category": "block", "sounds": [{"name": "block/hornFarDual", "stream": false}]}, + "block.reactorLoop": {"category": "block", "sounds": [{"name": "block/reactorLoop", "stream": false}]}, "door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]}, "door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]}, diff --git a/src/main/resources/assets/hbm/sounds/block/reactorLoop.ogg b/src/main/resources/assets/hbm/sounds/block/reactorLoop.ogg new file mode 100644 index 000000000..428ddeabb Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/reactorLoop.ogg differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_block.png b/src/main/resources/assets/hbm/textures/blocks/pwr_block.png new file mode 100644 index 000000000..8483b2814 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_block.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_block_ct.png b/src/main/resources/assets/hbm/textures/blocks/pwr_block_ct.png new file mode 100644 index 000000000..d7b37f330 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_block_ct.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_block_ct_alt.png b/src/main/resources/assets/hbm/textures/blocks/pwr_block_ct_alt.png new file mode 100644 index 000000000..a1b7fd272 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_block_ct_alt.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_casing.png b/src/main/resources/assets/hbm/textures/blocks/pwr_casing.png new file mode 100644 index 000000000..23f51e503 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_casing.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_casing_blank.png b/src/main/resources/assets/hbm/textures/blocks/pwr_casing_blank.png new file mode 100644 index 000000000..6b8c7f6b4 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_casing_blank.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_casing_port.png b/src/main/resources/assets/hbm/textures/blocks/pwr_casing_port.png new file mode 100644 index 000000000..809c564c2 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_casing_port.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_casing_port_ct.png b/src/main/resources/assets/hbm/textures/blocks/pwr_casing_port_ct.png new file mode 100644 index 000000000..52fb4583a Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_casing_port_ct.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_channel_side.png b/src/main/resources/assets/hbm/textures/blocks/pwr_channel_side.png new file mode 100644 index 000000000..bc3b557a2 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_channel_side.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_channel_top.png b/src/main/resources/assets/hbm/textures/blocks/pwr_channel_top.png new file mode 100644 index 000000000..0e1e9a42a Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_channel_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_concrete_flat.png b/src/main/resources/assets/hbm/textures/blocks/pwr_concrete_flat.png new file mode 100644 index 000000000..7dd3c4ba5 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_concrete_flat.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_control_side.png b/src/main/resources/assets/hbm/textures/blocks/pwr_control_side.png new file mode 100644 index 000000000..b36c421a2 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_control_side.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_control_top.png b/src/main/resources/assets/hbm/textures/blocks/pwr_control_top.png new file mode 100644 index 000000000..d5ae636a0 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_control_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_controller.png b/src/main/resources/assets/hbm/textures/blocks/pwr_controller.png new file mode 100644 index 000000000..822cb4d26 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_controller.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_fuel_side.png b/src/main/resources/assets/hbm/textures/blocks/pwr_fuel_side.png new file mode 100644 index 000000000..1f22996bb Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_fuel_side.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_fuel_top.png b/src/main/resources/assets/hbm/textures/blocks/pwr_fuel_top.png new file mode 100644 index 000000000..d29654d60 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_fuel_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_heatex.png b/src/main/resources/assets/hbm/textures/blocks/pwr_heatex.png new file mode 100644 index 000000000..f579c8a45 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_heatex.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_neutron_source.png b/src/main/resources/assets/hbm/textures/blocks/pwr_neutron_source.png new file mode 100644 index 000000000..bc1d78027 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_neutron_source.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_port.png b/src/main/resources/assets/hbm/textures/blocks/pwr_port.png new file mode 100644 index 000000000..2fa42a61e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_port.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/pwr_reflector.png b/src/main/resources/assets/hbm/textures/blocks/pwr_reflector.png new file mode 100644 index 000000000..c139a402e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/pwr_reflector.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/fluids/heavywater_hot.png b/src/main/resources/assets/hbm/textures/gui/fluids/heavywater_hot.png new file mode 100644 index 000000000..119b76cda Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/fluids/heavywater_hot.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_catalytic_reformer.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_catalytic_reformer.png index 27b5d21fd..077d004fd 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/processing/gui_catalytic_reformer.png and b/src/main/resources/assets/hbm/textures/gui/processing/gui_catalytic_reformer.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/reactors/gui_pwr.png b/src/main/resources/assets/hbm/textures/gui/reactors/gui_pwr.png new file mode 100644 index 000000000..6910df3ee Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/reactors/gui_pwr.png differ diff --git a/src/main/resources/assets/hbm/textures/items/gem_sodalite.png b/src/main/resources/assets/hbm/textures/items/gem_sodalite.png new file mode 100644 index 000000000..10aaa045e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/gem_sodalite.png differ diff --git a/src/main/resources/assets/hbm/textures/items/powder_sodium.png b/src/main/resources/assets/hbm/textures/items/powder_sodium.png new file mode 100644 index 000000000..d7e6c4ffc Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/powder_sodium.png differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_357.png b/src/main/resources/assets/hbm/textures/items/primer_357.png deleted file mode 100644 index c20411ce7..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_357.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_44.png b/src/main/resources/assets/hbm/textures/items/primer_44.png deleted file mode 100644 index 1b7fd5435..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_44.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_50.png b/src/main/resources/assets/hbm/textures/items/primer_50.png deleted file mode 100644 index 17bee59b9..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_50.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_9.png b/src/main/resources/assets/hbm/textures/items/primer_9.png deleted file mode 100644 index e88ab382f..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_9.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_buckshot.png b/src/main/resources/assets/hbm/textures/items/primer_buckshot.png deleted file mode 100644 index 701799005..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_buckshot.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.hea242.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hea242.png new file mode 100644 index 000000000..02db8994d Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hea242.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.hen237.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hen237.png new file mode 100644 index 000000000..64228fb58 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hen237.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.hep239.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hep239.png new file mode 100644 index 000000000..c14fe4ec2 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hep239.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.hep241.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hep241.png new file mode 100644 index 000000000..2a99abe38 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hep241.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.hes326.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hes326.png new file mode 100644 index 000000000..d659fdd2f Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hes326.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.hes327.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hes327.png new file mode 100644 index 000000000..7a1f8df98 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.hes327.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.heu233.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.heu233.png new file mode 100644 index 000000000..8961cc636 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.heu233.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.heu235.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.heu235.png new file mode 100644 index 000000000..c80a207b0 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.heu235.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.mea.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.mea.png new file mode 100644 index 000000000..90305870d Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.mea.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.men.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.men.png new file mode 100644 index 000000000..c21db4157 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.men.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.mep.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.mep.png new file mode 100644 index 000000000..1d1334635 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.mep.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.meu.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.meu.png new file mode 100644 index 000000000..ca1e8e89e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.meu.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel.mox.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel.mox.png new file mode 100644 index 000000000..59d0a64a2 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel.mox.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel_base.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel_base.png new file mode 100644 index 000000000..9d614943b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel_base.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel_depleted.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel_depleted.png new file mode 100644 index 000000000..cb2b2d545 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel_depleted.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pwr_fuel_hot.png b/src/main/resources/assets/hbm/textures/items/pwr_fuel_hot.png new file mode 100644 index 000000000..84b4903d4 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pwr_fuel_hot.png differ