better particle spawner structure, killed off boilers

This commit is contained in:
Boblet 2024-07-18 16:04:41 +02:00
parent b3047c875e
commit 8a200a50bd
19 changed files with 231 additions and 1602 deletions

View File

@ -1,3 +1,9 @@
## Changed
* Removed most legacy boilers
* Electric boilers have been completely removed
* Fired boilers no longer have an on-state, GUI or functionality
* Fired boilers still sometimes spawn in certain structures as loot, they drop 3-6 steel scraps containing 1 ingot worth of steel each
## Fixed
* Fixed automatic crafting table filters being broken
* Fixed missing localization for black lung death messages

View File

@ -955,10 +955,6 @@ public class ModBlocks {
public static Block machine_coker;
public static Block machine_boiler_off;
public static Block machine_boiler_on;
public static Block machine_boiler_electric_off;
public static Block machine_boiler_electric_on;
public static Block machine_steam_engine;
public static Block machine_turbine;
@ -2213,9 +2209,6 @@ public class ModBlocks {
machine_controller = new MachineReactorControl(Material.iron).setBlockName("machine_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
machine_boiler_off = new MachineBoiler(false).setBlockName("machine_boiler_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_off");
machine_boiler_on = new MachineBoiler(true).setBlockName("machine_boiler_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_on");
machine_boiler_electric_off = new MachineBoiler(false).setBlockName("machine_boiler_electric_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_electric_off");
machine_boiler_electric_on = new MachineBoiler(true).setBlockName("machine_boiler_electric_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_electric_on");
machine_steam_engine = new MachineSteamEngine().setBlockName("machine_steam_engine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_turbine = new MachineTurbine(Material.iron).setBlockName("machine_turbine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_turbine");
@ -3229,9 +3222,6 @@ public class ModBlocks {
register(machine_bat9000);
register(machine_orbus);
GameRegistry.registerBlock(machine_boiler_off, machine_boiler_off.getUnlocalizedName());
GameRegistry.registerBlock(machine_boiler_on, machine_boiler_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_boiler_electric_on, machine_boiler_electric_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_boiler_electric_off, machine_boiler_electric_off.getUnlocalizedName());
register(machine_steam_engine);
register(machine_turbine);
register(machine_large_turbine);

View File

@ -1,38 +1,27 @@
package com.hbm.blocks.machine;
import java.util.Random;
import java.util.ArrayList;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.material.Mats;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
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.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
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;
public class MachineBoiler extends BlockContainer {
public class MachineBoiler extends Block {
private final Random field_149933_a = new Random();
private final boolean isActive;
private static boolean keepInventory;
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@SideOnly(Side.CLIENT)
@ -42,274 +31,82 @@ public class MachineBoiler extends BlockContainer {
super(Material.iron);
isActive = blockState;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
if(this == ModBlocks.machine_boiler_off || this == ModBlocks.machine_boiler_on) {
if(this == ModBlocks.machine_boiler_off) {
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_boiler_front_lit" : ":machine_boiler_front"));
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_boiler_base");
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":machine_boiler_side");
}
if(this == ModBlocks.machine_boiler_electric_off || this == ModBlocks.machine_boiler_electric_on) {
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_boiler_electric_front_lit" : ":machine_boiler_electric_front"));
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_boiler_port");
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":machine_boiler_side");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if(side == 0 || side == 1)
return this.blockIcon;
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.iconSide);
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
if(this == ModBlocks.machine_boiler_off || this == ModBlocks.machine_boiler_on)
return Item.getItemFromBlock(ModBlocks.machine_boiler_off);
if(this == ModBlocks.machine_boiler_electric_off || this == ModBlocks.machine_boiler_electric_on)
return Item.getItemFromBlock(ModBlocks.machine_boiler_electric_off);
return null;
}
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(ModItems.scraps, 3 + world.rand.nextInt(4), Mats.MAT_STEEL.id));
return ret;
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
private void setDefaultDirection(World world, int x, int y, int z) {
if(!world.isRemote)
{
if(!world.isRemote) {
Block block1 = world.getBlock(x, y, z - 1);
Block block2 = world.getBlock(x, y, z + 1);
Block block3 = world.getBlock(x - 1, y, z);
Block block4 = world.getBlock(x + 1, y, z);
byte b0 = 3;
if(block1.func_149730_j() && !block2.func_149730_j())
{
if(block1.func_149730_j() && !block2.func_149730_j()) {
b0 = 3;
}
if(block2.func_149730_j() && !block1.func_149730_j())
{
if(block2.func_149730_j() && !block1.func_149730_j()) {
b0 = 2;
}
if(block3.func_149730_j() && !block4.func_149730_j())
{
if(block3.func_149730_j() && !block4.func_149730_j()) {
b0 = 5;
}
if(block4.func_149730_j() && !block3.func_149730_j())
{
if(block4.func_149730_j() && !block3.func_149730_j()) {
b0 = 4;
}
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
}
}
@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)
{
if(i == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if(i == 1)
{
if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2)
{
if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3)
{
if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if(itemStack.hasDisplayName())
{
((TileEntityMachineBoiler)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
}
}
@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()) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
} else {
return false;
}
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
if(this == ModBlocks.machine_boiler_off || this == ModBlocks.machine_boiler_on)
return new TileEntityMachineBoiler();
if(this == ModBlocks.machine_boiler_electric_off || this == ModBlocks.machine_boiler_electric_on)
return new TileEntityMachineBoilerElectric();
return null;
}
public static void updateBlockState(boolean isProcessing, World world, int x, int y, int z) {
int i = world.getBlockMetadata(x, y, z);
Block block = world.getBlock(x, y, z);
TileEntity entity = world.getTileEntity(x, y, z);
keepInventory = true;
if(block == ModBlocks.machine_boiler_off || block == ModBlocks.machine_boiler_on)
if(isProcessing)
{
world.setBlock(x, y, z, ModBlocks.machine_boiler_on);
} else {
world.setBlock(x, y, z, ModBlocks.machine_boiler_off);
}
if(block == ModBlocks.machine_boiler_electric_off || block == ModBlocks.machine_boiler_electric_on)
if(isProcessing)
{
world.setBlock(x, y, z, ModBlocks.machine_boiler_electric_on);
} else {
world.setBlock(x, y, z, ModBlocks.machine_boiler_electric_off);
}
keepInventory = false;
world.setBlockMetadataWithNotify(x, y, z, i, 3);
if(entity != null) {
entity.validate();
world.setTileEntity(x, y, z, entity);
}
}
@Override
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
if (!keepInventory)
{
ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
if (tileentityfurnace != null)
{
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
{
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
if (itemstack != null)
{
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
while (itemstack.stackSize > 0)
{
int j1 = this.field_149933_a.nextInt(21) + 10;
if (j1 > itemstack.stackSize)
{
j1 = itemstack.stackSize;
}
itemstack.stackSize -= j1;
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
if (itemstack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
}
float f3 = 0.05F;
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
p_149749_1_.spawnEntityInWorld(entityitem);
}
}
}
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
}
}
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
{
if (isActive) {
if(this == ModBlocks.machine_boiler_on) {
int l = p_149734_1_.getBlockMetadata(x, y, z);
float f = x + 0.5F;
float f1 = y + 0.25F + rand.nextFloat() * 6.0F / 16.0F;
float f2 = z + 0.5F;
float f3 = 0.52F;
float f4 = rand.nextFloat() * 0.6F - 0.3F;
if (l == 4)
{
p_149734_1_.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
p_149734_1_.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
else if (l == 5)
{
p_149734_1_.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
p_149734_1_.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
else if (l == 2)
{
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
}
else if (l == 3)
{
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
}
} else {
int l = p_149734_1_.getBlockMetadata(x, y, z);
float f = x + 0.5F;
float f1 = y + 0.25F + rand.nextFloat() * 6.0F / 16.0F;
float f2 = z + 0.5F;
float f3 = 0.52F;
float f4 = rand.nextFloat() * 0.6F - 0.3F;
if (l == 4)
{
p_149734_1_.spawnParticle("reddust", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
else if (l == 5)
{
p_149734_1_.spawnParticle("reddust", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
else if (l == 2)
{
p_149734_1_.spawnParticle("reddust", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
}
else if (l == 3)
{
p_149734_1_.spawnParticle("reddust", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
}
}
}
}
}

View File

@ -87,8 +87,6 @@ public class BobmazonOfferFactory {
machines.add(new Offer(new ItemStack(ModBlocks.machine_lithium_battery), Requirement.CHEMICS, 60 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_assembler), Requirement.ASSEMBLY, 30 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_chemplant), Requirement.CHEMICS, 50 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_boiler_off), Requirement.CHEMICS, 25 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_boiler_electric_off), Requirement.OIL, 60 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_shredder), Requirement.ASSEMBLY, 45 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_well), Requirement.OIL, 40 * inflation));
machines.add(new Offer(new ItemStack(ModBlocks.machine_refinery), Requirement.OIL, 80 * inflation));

View File

@ -1,93 +0,0 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineBoiler extends Container {
private TileEntityMachineBoiler diFurnace;
public ContainerMachineBoiler(InventoryPlayer invPlayer, TileEntityMachineBoiler tedf) {
diFurnace = tedf;
//Fluid ID
this.addSlotToContainer(new Slot(tedf, 0, 8, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 1, 8, 53));
//Input IO
this.addSlotToContainer(new Slot(tedf, 2, 44, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 3, 44, 53));
//Fuel
this.addSlotToContainer(new Slot(tedf, 4, 98, 53));
//Output IO
this.addSlotToContainer(new Slot(tedf, 5, 152, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 152, 53));
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, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
}
@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 <= 6) {
if (!this.mergeItemStack(var5, 7, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 4, 5, false))
{
if (!this.mergeItemStack(var5, 2, 3, false))
if (!this.mergeItemStack(var5, 5, 6, false))
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 diFurnace.isUseableByPlayer(player);
}
}

View File

@ -1,94 +0,0 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineBoilerElectric extends Container {
private TileEntityMachineBoilerElectric diFurnace;
public ContainerMachineBoilerElectric(InventoryPlayer invPlayer, TileEntityMachineBoilerElectric tedf) {
diFurnace = tedf;
//Fluid ID
this.addSlotToContainer(new Slot(tedf, 0, 8, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 1, 8, 53));
//Input IO
this.addSlotToContainer(new Slot(tedf, 2, 44, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 3, 44, 53));
//Battery
this.addSlotToContainer(new Slot(tedf, 4, 98, 53));
//Output IO
this.addSlotToContainer(new Slot(tedf, 5, 152, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 152, 53));
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, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
}
@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 <= 6) {
if (!this.mergeItemStack(var5, 7, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 4, 5, false))
{
if (!this.mergeItemStack(var5, 2, 3, false))
if (!this.mergeItemStack(var5, 5, 6, false))
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 diFurnace.isUseableByPlayer(player);
}
}

View File

@ -1,103 +0,0 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineBoiler;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineBoiler extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_boiler.png");
private TileEntityMachineBoiler diFurnace;
public GUIMachineBoiler(InventoryPlayer invPlayer, TileEntityMachineBoiler tedf) {
super(new ContainerMachineBoiler(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 168;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
TileEntityMachineBoiler dud = diFurnace;
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineBoiler)
dud = (TileEntityMachineBoiler) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
dud.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
dud.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 102, guiTop + 16, 8, 18, mouseX, mouseY, new String[] { String.valueOf((int)((double)dud.heat / 100D)) + "°C"});
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 97, guiTop + 34, 18, 18, mouseX, mouseY, new String[] { String.valueOf((int)(Math.ceil((double)dud.burnTime / 20D))) + "s"});
String[] text = new String[] { "Heat produced:",
" 0.5°C/t",
" or 10°C/s",
"Heat consumed:",
" 0.15°C/t",
" or 3.0°C/s (base)",
" 0.25°C/t",
" or 5.0°C/s (once boiling point is reached)",
" 0.4°C/t",
" or 8.0°C/s (for every subsequent multiple of boiling point)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Boiling rate:",
" Base rate * amount of full multiples",
" of boiling points reached" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
if(dud.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
String[] text2 = new String[] { "Error: Liquid can not be boiled!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@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);
//"It just works" -Todd Howard
TileEntityMachineBoiler dud = diFurnace;
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineBoiler)
dud = (TileEntityMachineBoiler) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
if(dud.burnTime > 0)
drawTexturedModalRect(guiLeft + 97, guiTop + 34, 176, 0, 18, 18);
int j = (int)dud.getHeatScaled(17);
drawTexturedModalRect(guiLeft + 103, guiTop + 33 - j, 194, 16 - j, 6, j);
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
if(dud.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
dud.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
dud.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -1,99 +0,0 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineBoilerElectric;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineBoilerElectric extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_boiler_electric.png");
private TileEntityMachineBoilerElectric diFurnace;
public GUIMachineBoilerElectric(InventoryPlayer invPlayer, TileEntityMachineBoilerElectric tedf) {
super(new ContainerMachineBoilerElectric(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 168;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 102, guiTop + 16, 8, 18, mouseX, mouseY, new String[] { String.valueOf((int)((double)diFurnace.heat / 100D)) + "°C"});
String[] text = new String[] { "Heat produced:",
" 1.5°C/t",
" or 30°C/s",
"Heat consumed:",
" 0.15°C/t",
" or 3.0°C/s (base)",
" 0.25°C/t",
" or 5.0°C/t (once boiling point is reached)",
" 0.4°C/t",
" or 8.0°C/t (for every subsequent multiple of boiling point)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Boiling rate:",
" Base rate * amount of full multiples",
" of boiling points reached" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
if(diFurnace.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
String[] text2 = new String[] { "Error: Liquid can not be boiled!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 123, guiTop + 69 - 34, 7, 34, diFurnace.power, diFurnace.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@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(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineBoilerElectric)
diFurnace = (TileEntityMachineBoilerElectric) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
if(diFurnace.power > 0)
drawTexturedModalRect(guiLeft + 97, guiTop + 34, 176, 0, 18, 18);
int j = (int)diFurnace.getHeatScaled(17);
drawTexturedModalRect(guiLeft + 103, guiTop + 33 - j, 194, 16 - j, 6, j);
int i = (int)diFurnace.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 123, guiTop + 69 - i, 200, 34 - i, 7, i);
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
if(diFurnace.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
diFurnace.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
diFurnace.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -5,15 +5,11 @@ import java.util.List;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
import com.hbm.lib.Library;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import com.hbm.particle.helper.ExplosionCreator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
@ -47,20 +43,22 @@ public class ItemWandD extends Item {
Component comp = new RuralHouse1(world.rand, i, j);
comp.addComponentParts(world, world.rand, new StructureBoundingBox(i, j, i + 32, j + 32));*/
ExplosionVNT vnt = new ExplosionVNT(world, pos.blockX + 0.5, pos.blockY + 1, pos.blockZ + 0.5, 25F);
ExplosionVNT vnt = new ExplosionVNT(world, pos.blockX + 0.5, pos.blockY + 1, pos.blockZ + 0.5, 40F);
vnt.makeStandard();
vnt.setSFX();
vnt.setBlockAllocator(new BlockAllocatorStandard(32));
vnt.explode();
for(int i = 0; i < 10; i++) {
ExplosionCreator.composeEffect(world, pos.blockX + 0.5, pos.blockY + 0.5, pos.blockZ + 0.5, 30, 6.5F, 2F, 65F, 25, 16, 50, 1.25F, 3F, -2F);
/*for(int i = 0; i < 10; i++) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "debris");
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.blockX + world.rand.nextGaussian() * 3, pos.blockY - 2, pos.blockZ + world.rand.nextGaussian() * 3), new TargetPoint(world.provider.dimensionId, pos.blockX, pos.blockY, pos.blockZ, 100));
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "oomph");
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.blockX, pos.blockY, pos.blockZ), new TargetPoint(world.provider.dimensionId, pos.blockX, pos.blockY, pos.blockZ, 100));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.blockX, pos.blockY, pos.blockZ), new TargetPoint(world.provider.dimensionId, pos.blockX, pos.blockY, pos.blockZ, 100));*/
/*TimeAnalyzer.startCount("setBlock");
world.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.dirt);

View File

@ -87,6 +87,8 @@ import com.hbm.items.IAnimatedItem;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.particle.*;
import com.hbm.particle.helper.ExplosionCreator;
import com.hbm.particle.helper.IParticleCreator;
import com.hbm.particle.psys.engine.EventHandlerParticleEngine;
import com.hbm.render.anim.*;
import com.hbm.render.anim.HbmAnimations.Animation;
@ -124,7 +126,6 @@ import com.hbm.tileentity.turret.*;
import com.hbm.util.BobMathUtil;
import com.hbm.util.ColorUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.wiaj.WorldInAJar;
import com.hbm.wiaj.cannery.Jars;
import cpw.mods.fml.client.registry.ClientRegistry;
@ -985,6 +986,12 @@ public class ClientProxy extends ServerProxy {
}
}
public static HashMap<String, IParticleCreator> particleCreators = new HashMap();
static {
particleCreators.put("explosionLarge", new ExplosionCreator());
}
//mk3, only use this one
@Override
public void effectNT(NBTTagCompound data) {
@ -1003,60 +1010,9 @@ public class ClientProxy extends ServerProxy {
double y = data.getDouble("posY");
double z = data.getDouble("posZ");
if("oomph".equals(type)) {
for(int i = 0; i < 15; i++) {
ParticleRocketFlame fx = new ParticleRocketFlame(man, world, x, y, z).setScale(5F);
fx.prevPosX = fx.posX;
fx.prevPosY = fx.posY;
fx.prevPosZ = fx.posZ;
fx.motionX = rand.nextGaussian() * 0.5;
fx.motionY = rand.nextDouble() * 3;
fx.motionZ = rand.nextGaussian() * 0.5;
fx.setMaxAge(70 + rand.nextInt(20));
fx.noClip = true;
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
ParticleMukeWave wave = new ParticleMukeWave(man, world, x, y + 2, z);
Minecraft.getMinecraft().effectRenderer.addEffect(wave);
}
if("debris".equals(type)) {
int ix = (int) Math.floor(x);
int iy = (int) Math.floor(y);
int iz = (int) Math.floor(z);
Vec3 motion = Vec3.createVectorHelper(1, 0, 0);
motion.rotateAroundZ((float) -Math.toRadians(45 + rand.nextFloat() * 25));
motion.rotateAroundY((float) (rand.nextDouble() * Math.PI * 2));
ParticleDebris particle = new ParticleDebris(world, x, y, z, motion.xCoord, motion.yCoord, motion.zCoord);
WorldInAJar wiaj = new WorldInAJar(16, 16, 16);
particle.world = wiaj;
int cX = (int) Math.floor(x + 0.5);
int cY = (int) Math.floor(y + 0.5);
int cZ = (int) Math.floor(z + 0.5);
for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++)
wiaj.setBlock(7 + i, 7 + j, 7 + k, world.getBlock(cX + i, cY + j, cZ + k), world.getBlockMetadata(cX + i, cY+ j, cZ + k));
for(int layer = 2; layer <= 8; layer++) {
for(int i = 0; i < 50; i++) {
int jx = -layer + rand.nextInt(layer * 2 + 1);
int jy = -layer + rand.nextInt(layer * 2 + 1);
int jz = -layer + rand.nextInt(layer * 2 + 1);
if(wiaj.getBlock(7 + jx + 1, 7 + jy, 7 + jz) != Blocks.air || wiaj.getBlock(7 + jx - 1, 7 + jy, 7 + jz) != Blocks.air ||
wiaj.getBlock(7 + jx, 7 + jy + 1, 7 + jz) != Blocks.air || wiaj.getBlock(7 + jx, 7 + jy - 1, 7 + jz) != Blocks.air ||
wiaj.getBlock(7 + jx, 7 + jy, 7 + jz + 1) != Blocks.air || wiaj.getBlock(7 + jx, 7 + jy, 7 + jz - 1) != Blocks.air) {
Block b = world.getBlock(cX + jx, cY + jy, cZ + jz);
int m = world.getBlockMetadata(cX + jx, cY + jy, cZ + jz);
wiaj.setBlock(7 + jx, 7+ jy, 7 + jz, b, m);
}
}
}
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
if(particleCreators.containsKey(type)) {
particleCreators.get(type).makeParticle(world, player, man, rand, x, y, z, data);
return;
}
if("missileContrail".equals(type)) {

View File

@ -1342,6 +1342,9 @@ public class MainRegistry {
ignoreMappings.add("hbm:item.warhead_mirvlet");
ignoreMappings.add("hbm:item.generator_front");
ignoreMappings.add("hbm:tile.rbmk_heatex");
ignoreMappings.add("hbm:tile.machine_boiler_on");
ignoreMappings.add("hbm:tile.machine_boiler_electric_off");
ignoreMappings.add("hbm:tile.machine_boiler_electric_on");
/// REMAP ///
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);

View File

@ -6,8 +6,6 @@ import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.bomb.TileEntityCompactLauncher;
import com.hbm.tileentity.bomb.TileEntityLaunchTable;
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@ -67,26 +65,12 @@ public class AuxGaugePacket implements IMessage {
public IMessage onMessage(AuxGaugePacket m, MessageContext ctx) {
try {
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
if (te instanceof TileEntityMachineBoiler) {
TileEntityMachineBoiler boiler = (TileEntityMachineBoiler)te;
if(m.id == 0)
boiler.heat = m.value;
if(m.id == 1)
boiler.burnTime = m.value;
}
if (te instanceof TileEntityMachineArcFurnace) {
TileEntityMachineArcFurnace furn = (TileEntityMachineArcFurnace)te;
if(m.id == 0)
furn.dualCookTime = m.value;
}
if (te instanceof TileEntityMachineBoilerElectric) {
TileEntityMachineBoilerElectric boiler = (TileEntityMachineBoilerElectric)te;
if(m.id == 0)
boiler.heat = m.value;
}
if (te instanceof TileEntityCompactLauncher) {
TileEntityCompactLauncher launcher = (TileEntityCompactLauncher)te;

View File

@ -58,7 +58,7 @@ public class ParticleDebris extends EntityFX {
if(this.getEntityId() % 3 == 0) {
TextureManager man = Minecraft.getMinecraft().renderEngine;
ParticleRocketFlame fx = new ParticleRocketFlame(man, worldObj, posX, posY, posZ).setScale(1F);
ParticleRocketFlame fx = new ParticleRocketFlame(man, worldObj, posX, posY, posZ).setScale(1F * world.sizeY / 16F);
fx.prevPosX = fx.posX;
fx.prevPosY = fx.posY;
fx.prevPosZ = fx.posZ;

View File

@ -18,6 +18,8 @@ public class ParticleMukeWave extends EntityFX {
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/shockwave.png");
private TextureManager theRenderEngine;
private float waveScale = 45F;
public ParticleMukeWave(TextureManager texman,World world, double x, double y, double z) {
super(world, x, y, z);
@ -28,6 +30,11 @@ public class ParticleMukeWave extends EntityFX {
public int getFXLayer() {
return 3;
}
public void setup(float scale, int maxAge) {
this.waveScale = scale;
this.particleMaxAge = maxAge;
}
public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) {
@ -41,6 +48,9 @@ public class ParticleMukeWave extends EntityFX {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDisable(GL11.GL_CULL_FACE);
RenderHelper.disableStandardItemLighting();
boolean fog = GL11.glIsEnabled(GL11.GL_FOG);
if(fog) GL11.glDisable(GL11.GL_FOG);
tess.startDrawingQuads();
@ -48,14 +58,14 @@ public class ParticleMukeWave extends EntityFX {
tess.setBrightness(240);
this.particleAlpha = 1 - (((float)this.particleAge + interp) / (float)this.particleMaxAge);
float scale = (1 - (float)Math.pow(Math.E, (this.particleAge + interp) * -0.125)) * 45;
float scale = (1 - (float)Math.pow(Math.E, (this.particleAge + interp) * -0.125)) * waveScale;
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, this.particleAlpha);
float pX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double)interp - interpPosX);
float pY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double)interp - interpPosY);
float pZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double)interp - interpPosZ);
float pX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX);
float pY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY);
float pZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ);
tess.addVertexWithUV((double)(pX - 1 * scale), (double)(pY - 0.25), (double)(pZ - 1 * scale), 1, 1);
tess.addVertexWithUV((double)(pX - 1 * scale), (double)(pY - 0.25), (double)(pZ + 1 * scale), 1, 0);
tess.addVertexWithUV((double)(pX + 1 * scale), (double)(pY - 0.25), (double)(pZ + 1 * scale), 0, 0);
@ -66,5 +76,6 @@ public class ParticleMukeWave extends EntityFX {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glEnable(GL11.GL_LIGHTING);
if(fog) GL11.glEnable(GL11.GL_FOG);
}
}

View File

@ -0,0 +1,132 @@
package com.hbm.particle.helper;
import java.util.Random;
import com.hbm.particle.ParticleDebris;
import com.hbm.particle.ParticleMukeWave;
import com.hbm.particle.ParticleRocketFlame;
import com.hbm.wiaj.WorldInAJar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class ExplosionCreator implements IParticleCreator {
public static void composeEffect(World world, double x, double y, double z, int cloudCount, float cloudScale, float cloudSpeedMult, float waveScale,
int debrisCount, int debrisSize, int debrisRetry, float debrisVelocity, float debrisHorizontalDeviation, float debrisVerticalOffset) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "explosionLarge");
data.setByte("cloudCount", (byte) cloudCount);
data.setFloat("cloudScale", cloudScale);
data.setFloat("cloudSpeedMult", cloudSpeedMult);
data.setFloat("waveScale", waveScale);
data.setByte("debrisCount", (byte) debrisCount);
data.setByte("debrisSize", (byte) debrisSize);
data.setShort("debrisRetry", (byte) debrisRetry);
data.setFloat("debrisVelocity", debrisVelocity);
data.setFloat("debrisHorizontalDeviation", debrisHorizontalDeviation);
data.setFloat("debrisVerticalOffset", debrisVerticalOffset);
IParticleCreator.sendPacket(world, x, y, z, 200, data);
}
/** Downscaled for small bombs */
public static void composeEffectSmall(World world, double x, double y, double z) { composeEffect(world, x, y, z, 10, 2F, 0.5F, 25F, 5, 8, 20, 0.75F, 1F, -2F); }
/** Development version */
public static void composeEffectStandard(World world, double x, double y, double z) { composeEffect(world, x, y, z, 15, 5F, 1F, 45F, 10, 16, 50, 1F, 3F, -2F); }
/** Upscaled version, ATACMS go brrt */
public static void composeEffectLarge(World world, double x, double y, double z) { composeEffect(world, x, y, z, 30, 6.5F, 2F, 65F, 25, 16, 50, 1.25F, 3F, -2F); }
@Override
@SideOnly(Side.CLIENT)
public void makeParticle(World world, EntityPlayer player, TextureManager man, Random rand, double x, double y, double z, NBTTagCompound data) {
int cloudCount = data.getByte("cloudCount");
float cloudScale = data.getFloat("cloudScale");
float cloudSpeedMult = data.getFloat("cloudSpeedMult");
float waveScale = data.getFloat("waveScale");
int debrisCount = data.getByte("debrisCount");
int debrisSize = data.getByte("debrisSize");
int debrisRetry = data.getShort("debrisRetry");
float debrisVelocity = data.getFloat("debrisVelocity");
float debrisHorizontalDeviation = data.getFloat("debrisHorizontalDeviation");
float debrisVerticalOffset = data.getFloat("debrisVerticalOffset");
// WAVE
ParticleMukeWave wave = new ParticleMukeWave(man, world, x, y + 2, z);
wave.setup(waveScale, (int) (25F * waveScale / 45));
Minecraft.getMinecraft().effectRenderer.addEffect(wave);
// SMOKE PLUME
for(int i = 0; i < cloudCount; i++) {
ParticleRocketFlame fx = new ParticleRocketFlame(man, world, x, y, z).setScale(cloudScale);
fx.prevPosX = fx.posX;
fx.prevPosY = fx.posY;
fx.prevPosZ = fx.posZ;
fx.motionX = rand.nextGaussian() * 0.5 * cloudSpeedMult;
fx.motionY = rand.nextDouble() * 3 * cloudSpeedMult;
fx.motionZ = rand.nextGaussian() * 0.5 * cloudSpeedMult;
fx.setMaxAge(70 + rand.nextInt(20));
fx.noClip = true;
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
// DEBRIS
for(int c = 0; c < debrisCount; c++) {
double oX = rand.nextGaussian() * debrisHorizontalDeviation;
double oY = debrisVerticalOffset;
double oZ = rand.nextGaussian() * debrisHorizontalDeviation;
int ix = (int) Math.floor(x + oX);
int iy = (int) Math.floor(y + oY);
int iz = (int) Math.floor(z + oZ);
int cX = (int) Math.floor(x + oX + 0.5);
int cY = (int) Math.floor(y + oY + 0.5);
int cZ = (int) Math.floor(z + oZ + 0.5);
Vec3 motion = Vec3.createVectorHelper(debrisVelocity, 0, 0);
motion.rotateAroundZ((float) -Math.toRadians(45 + rand.nextFloat() * 25));
motion.rotateAroundY((float) (rand.nextDouble() * Math.PI * 2));
ParticleDebris particle = new ParticleDebris(world, x, y, z, motion.xCoord, motion.yCoord, motion.zCoord);
WorldInAJar wiaj = new WorldInAJar(debrisSize, debrisSize, debrisSize);
particle.world = wiaj;
if(debrisSize > 0) {
int middle = debrisSize / 2 - 1;
for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++)
wiaj.setBlock(middle + i, middle + j, middle + k, world.getBlock(cX + i, cY + j, cZ + k), world.getBlockMetadata(cX + i, cY+ j, cZ + k));
for(int layer = 2; layer <= (debrisSize / 2); layer++) {
for(int i = 0; i < debrisRetry; i++) {
int jx = -layer + rand.nextInt(layer * 2 + 1);
int jy = -layer + rand.nextInt(layer * 2 + 1);
int jz = -layer + rand.nextInt(layer * 2 + 1);
if(wiaj.getBlock(middle + jx + 1, middle + jy, middle + jz) != Blocks.air || wiaj.getBlock(middle + jx - 1, middle + jy, middle + jz) != Blocks.air ||
wiaj.getBlock(middle + jx, middle + jy + 1, middle + jz) != Blocks.air || wiaj.getBlock(middle + jx, middle + jy - 1, middle + jz) != Blocks.air ||
wiaj.getBlock(middle + jx, middle + jy, middle + jz + 1) != Blocks.air || wiaj.getBlock(middle + jx, middle + jy, middle + jz - 1) != Blocks.air) {
Block b = world.getBlock(cX + jx, cY + jy, cZ + jz);
int m = world.getBlockMetadata(cX + jx, cY + jy, cZ + jz);
wiaj.setBlock(middle + jx, middle + jy, middle + jz, b, m);
}
}
}
}
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
}
}

View File

@ -0,0 +1,24 @@
package com.hbm.particle.helper;
import java.util.Random;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public interface IParticleCreator {
@SideOnly(Side.CLIENT)
public void makeParticle(World world, EntityPlayer player, TextureManager texman, Random rand, double x, double y, double z, NBTTagCompound data);
public static void sendPacket(World world, double x, double y, double z, int range, NBTTagCompound data) {
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, range));
}
}

View File

@ -127,8 +127,6 @@ public class TileMappings {
put(TileEntityBlastDoor.class, "tileentity_blast_door");
put(TileEntitySafe.class, "tileentity_safe");
put(TileEntityMachineGasCent.class, "tileentity_gas_centrifuge");
put(TileEntityMachineBoiler.class, "tileentity_boiler");
put(TileEntityMachineBoilerElectric.class, "tileentity_electric_boiler");
put(TileEntityGeiger.class, "tileentity_geiger");
put(TileEntityFF.class, "tileentity_forcefield");
put(TileEntityForceField.class, "tileentity_machine_field");

View File

@ -1,430 +0,0 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineBoiler;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.container.ContainerMachineBoiler;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineBoiler;
import com.hbm.inventory.recipes.MachineRecipes;
import com.hbm.lib.Library;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
public class TileEntityMachineBoiler extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IFluidStandardTransceiver, IGUIProvider {
private ItemStack slots[];
public int burnTime;
public int heat = 2000;
public static final int maxHeat = 50000;
public int age = 0;
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank[] tanks;
private String customName;
public TileEntityMachineBoiler() {
slots = new ItemStack[7];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(Fluids.OIL, 8000, 0);
tanks[1] = new FluidTank(Fluids.HOTOIL, 8000, 1);
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.machineBoiler";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
return i == 4 && TileEntityFurnace.getItemBurnTime(stack) > 0;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
heat = nbt.getInteger("heat");
burnTime = nbt.getInteger("burnTime");
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "steam");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("heat", heat);
nbt.setInteger("burnTime", burnTime);
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "steam");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] { 4 };
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return i == 4 && !this.isItemValidForSlot(i, itemStack);
}
public int getHeatScaled(int i) {
return (heat * i) / maxHeat;
}
@Override
public void updateEntity() {
boolean mark = false;
if(!worldObj.isRemote) {
this.subscribeToAllAround(tanks[0].getTankType(), this);
this.sendFluidToAll(tanks[1], this);
age++;
if(age >= 20)
{
age = 0;
}
if(age == 9 || age == 19)
fillFluidInit(tanks[1].getTankType());
tanks[0].setType(0, 1, slots);
tanks[0].loadTank(2, 3, slots);
Object[] outs = MachineRecipes.getBoilerOutput(tanks[0].getTankType());
if(outs == null) {
tanks[1].setTankType(Fluids.NONE);
} else {
tanks[1].setTankType((FluidType) outs[0]);
}
tanks[1].unloadTank(5, 6, slots);
for(int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
boolean flag1 = false;
if(heat > 2000) {
heat -= 15;
}
if(burnTime > 0) {
burnTime--;
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
heat += 50;
flag1 = true;
}
if(burnTime == 0 && flag1) {
mark = true;
}
if(burnTime <= 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_on)
MachineBoiler.updateBlockState(false, worldObj, xCoord, yCoord, zCoord);
if(heat > maxHeat)
heat = maxHeat;
if(burnTime == 0 && TileEntityFurnace.getItemBurnTime(slots[4]) > 0) {
burnTime = (int) (TileEntityFurnace.getItemBurnTime(slots[4]) * 0.25);
slots[4].stackSize--;
if(slots[4].stackSize <= 0) {
if(slots[4].getItem().getContainerItem() != null)
slots[4] = new ItemStack(slots[4].getItem().getContainerItem());
else
slots[4] = null;
}
if(!flag1) {
mark = true;
}
}
if(burnTime > 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_off)
MachineBoiler.updateBlockState(true, worldObj, xCoord, yCoord, zCoord);
if(outs != null) {
for(int i = 0; i < (heat / ((Integer)outs[3]).intValue()); i++) {
if(tanks[0].getFill() >= ((Integer)outs[2]).intValue() && tanks[1].getFill() + ((Integer)outs[1]).intValue() <= tanks[1].getMaxFill()) {
tanks[0].setFill(tanks[0].getFill() - ((Integer)outs[2]).intValue());
tanks[1].setFill(tanks[1].getFill() + ((Integer)outs[1]).intValue());
if(i == 0)
heat -= 25;
else
heat -= 40;
}
}
}
if(heat < 2000) {
heat = 2000;
}
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, heat, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, burnTime, 1), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
}
if(mark) {
this.markDirty();
}
}
public boolean isItemValid() {
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0)
{
return true;
}
return false;
}
@Override
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, 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
public boolean getTact() {
if(age >= 0 && age < 10)
{
return true;
}
return false;
}
@Override
public void setFluidFill(int i, FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
}
@Override
public int getFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
return 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
return 0;
}
@Override
public void setFillForSync(int fill, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setTypeForSync(FluidType type, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list;
}
@Override
public void clearFluidList(FluidType type) {
list.clear();
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tanks[1]};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tanks[0]};
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineBoiler(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineBoiler(player.inventory, this);
}
}

View File

@ -1,449 +0,0 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineBoiler;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.container.ContainerMachineBoilerElectric;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineBoilerElectric;
import com.hbm.inventory.recipes.MachineRecipes;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.energymk2.IBatteryItem;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineBoilerElectric extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider {
private ItemStack slots[];
public long power;
public int heat = 2000;
public static final long maxPower = 10000;
public static final int maxHeat = 80000;
public int age = 0;
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank[] tanks;
private String customName;
public TileEntityMachineBoilerElectric() {
slots = new ItemStack[7];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(Fluids.OIL, 16000, 0);
tanks[1] = new FluidTank(Fluids.HOTOIL, 16000, 1);
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.machineElectricBoiler";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 4)
if(stack != null && stack.getItem() instanceof IBatteryItem)
return true;
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
heat = nbt.getInteger("heat");
power = nbt.getLong("power");
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "steam");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("heat", heat);
nbt.setLong("power", power);
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "steam");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[0];
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return false;
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
public int getHeatScaled(int i) {
return (heat * i) / maxHeat;
}
public long getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void updateEntity() {
boolean mark = false;
if(!worldObj.isRemote)
{
this.updateConnections();
this.subscribeToAllAround(tanks[0].getTankType(), this);
this.sendFluidToAll(tanks[1], this);
age++;
if(age >= 20)
{
age = 0;
}
if(age == 9 || age == 19)
fillFluidInit(tanks[1].getTankType());
power = Library.chargeTEFromItems(slots, 4, power, maxPower);
tanks[0].setType(0, 1, slots);
tanks[0].loadTank(2, 3, slots);
Object[] outs = MachineRecipes.getBoilerOutput(tanks[0].getTankType());
if(outs == null) {
tanks[1].setTankType(Fluids.NONE);
} else {
tanks[1].setTankType((FluidType) outs[0]);
}
tanks[1].unloadTank(5, 6, slots);
for(int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
if(heat > 2000) {
heat -= 30;
}
if(power >= 150) {
power -= 150;
heat += Math.min(((double)power / (double)maxPower * 300), 150);
} else {
heat -= 100;
}
if(power <= 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_electric_on) {
power = 0;
MachineBoiler.updateBlockState(false, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
if(heat > maxHeat)
heat = maxHeat;
if(power > 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_electric_off) {
MachineBoiler.updateBlockState(true, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
if(outs != null) {
for(int i = 0; i < (heat / ((Integer)outs[3]).intValue()); i++) {
if(tanks[0].getFill() >= ((Integer)outs[2]).intValue() && tanks[1].getFill() + ((Integer)outs[1]).intValue() <= tanks[1].getMaxFill()) {
tanks[0].setFill(tanks[0].getFill() - ((Integer)outs[2]).intValue());
tanks[1].setFill(tanks[1].getFill() + ((Integer)outs[1]).intValue());
if(i == 0)
heat -= 35;
else
heat -= 50;
}
}
}
if(heat < 2000) {
heat = 2000;
}
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, heat, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
}
if(mark) {
this.markDirty();
}
}
private void updateConnections() {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
public boolean isItemValid() {
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0)
{
return true;
}
return false;
}
@Override
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, 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
public boolean getTact() {
if(age >= 0 && age < 10)
{
return true;
}
return false;
}
@Override
public void setFluidFill(int i, FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
}
@Override
public int getFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
return 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
return 0;
}
@Override
public void setFillForSync(int fill, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setTypeForSync(FluidType type, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list;
}
@Override
public void clearFluidList(FluidType type) {
list.clear();
}
@Override
public void setPower(long i) {
power = i;
}
@Override
public long getPower() {
return power;
}
@Override
public long getMaxPower() {
return maxPower;
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tanks[1]};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tanks[0]};
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineBoilerElectric(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineBoilerElectric(player.inventory, this);
}
}