Oil ducts, enhanced derrick, oil flare base

This commit is contained in:
HbmMods 2017-05-28 18:10:28 +02:00
parent 60d6ecd565
commit 972dd2049d
58 changed files with 3780 additions and 46 deletions

View File

@ -156,6 +156,12 @@ container.cyclotron=Zyklotron
tile.machine_well.name=Ölbohrturm
tile.oil_pipe.name=Rohölrohr
container.oilWell=Ölbohrturm
tile.machine_refinery.name=Ölraffinerie
container.machineRefinery=Ölraffinerie
tile.oil_duct.name=Ölrohr
tile.oil_duct_solid.name=Verstärktes Ölrohr
tile.machine_flare.name=Abfackelturm
container.gasFlare=Abfackelturm
tile.rail_highspeed.name=Hochgeschwindigkeitsschienen
tile.rail_booster.name=Hochgeschwindigkeits-Boosterschienen
@ -490,6 +496,7 @@ item.inf_antischrabidium.name=Unendlicher Antischrabidiumtank
item.oil_canola.name=Rohes Canola-Öl
item.canister_empty.name=Leerer Kanister
item.canister_smear.name=Industrieölkanister
item.canister_canola.name=Schmiermittelkanister
item.canister_oil.name=Rohölkanister
item.canister_fuel.name=Treibstoffkanister

View File

@ -154,8 +154,14 @@ container.iGenerator=Industrial Generator
tile.machine_cyclotron.name=Cyclotron
container.cyclotron=Cyclotron
tile.machine_well.name=Oil Derrick
tile.oil_pipe.name=Cruse Oil Pipe
tile.oil_pipe.name=Crude Oil Extraction Pipe
container.oilWell=Oil Derrick
tile.machine_refinery.name=Oil Refinery
container.machineRefinery=Oil Refinery
tile.oil_duct.name=Oil Pipe
tile.oil_duct_solid.name=Coated Oil Pipe
tile.machine_flare.name=Gas Flare
container.gasFlare=Gas Flare
tile.rail_highspeed.name=High Speed Rail
tile.rail_booster.name=High Speed Booster Rail
@ -490,6 +496,7 @@ item.inf_antischrabidium.name=Infinite Antischrabidium Tank
item.oil_canola.name=Raw Canola Oil
item.canister_empty.name=Empty Canister
item.canister_smear.name=Industrial Oil Canister
item.canister_canola.name=Engine Lubricant
item.canister_oil.name=Crude Oil Canister
item.canister_fuel.name=Fuel Canister

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 KiB

View File

@ -49,10 +49,13 @@ import com.hbm.blocks.machine.BlockCable;
import com.hbm.blocks.machine.BlockConverterHeRf;
import com.hbm.blocks.machine.BlockConverterRfHe;
import com.hbm.blocks.machine.BlockHatch;
import com.hbm.blocks.machine.BlockOilDuct;
import com.hbm.blocks.machine.OilDuctSolid;
import com.hbm.blocks.machine.BlockReactor;
import com.hbm.blocks.machine.BlockSeal;
import com.hbm.blocks.machine.DummyBlockCentrifuge;
import com.hbm.blocks.machine.DummyBlockCyclotron;
import com.hbm.blocks.machine.DummyBlockFlare;
import com.hbm.blocks.machine.DummyBlockIGenerator;
import com.hbm.blocks.machine.DummyBlockWell;
import com.hbm.blocks.machine.FWatzCore;
@ -71,6 +74,7 @@ import com.hbm.blocks.machine.MachineDeuterium;
import com.hbm.blocks.machine.MachineDiFurnace;
import com.hbm.blocks.machine.MachineDiesel;
import com.hbm.blocks.machine.MachineElectricFurnace;
import com.hbm.blocks.machine.MachineGasFlare;
import com.hbm.blocks.machine.MachineGenerator;
import com.hbm.blocks.machine.MachineIGenerator;
import com.hbm.blocks.machine.MachineNukeFurnace;
@ -78,6 +82,7 @@ import com.hbm.blocks.machine.MachineOilWell;
import com.hbm.blocks.machine.MachinePuF6Tank;
import com.hbm.blocks.machine.MachineRTG;
import com.hbm.blocks.machine.MachineReactor;
import com.hbm.blocks.machine.MachineRefinery;
import com.hbm.blocks.machine.MachineReiXMainframe;
import com.hbm.blocks.machine.MachineRtgFurnace;
import com.hbm.blocks.machine.MachineSchrabidiumTransmutator;
@ -334,6 +339,8 @@ public class ModBlocks {
public static Block red_wire_coated;
public static Block red_cable;
public static Block oil_duct_solid;
public static Block oil_duct;
public static Block bomb_multi_large;
public static final int guiID_bomb_multi_large = 18;
@ -423,6 +430,12 @@ public class ModBlocks {
public static Block oil_pipe;
public static final int guiID_machine_well = 40;
public static Block machine_flare;
public static final int guiID_machine_flare = 44;
public static Block machine_refinery;
public static final int guiID_machine_refinery = 43;
public static Block launch_pad;
public static Block launch_pad_generic;
public static Block launch_pad_incendiary;
@ -478,6 +491,8 @@ public class ModBlocks {
public static Block dummy_port_cyclotron;
public static Block dummy_block_well;
public static Block dummy_port_well;
public static Block dummy_block_flare;
public static Block dummy_port_flare;
private static void initializeBlock() {
@ -670,6 +685,8 @@ public class ModBlocks {
red_wire_coated = new WireCoated(Material.iron).setBlockName("red_wire_coated").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_wire_coated");
red_cable = new BlockCable(Material.iron).setBlockName("red_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_cable_icon");
oil_duct_solid = new OilDuctSolid(Material.iron).setBlockName("oil_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":oil_duct_solid");
oil_duct = new BlockOilDuct(Material.iron).setBlockName("oil_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":oil_duct_icon");
factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull");
factory_titanium_furnace = new FactoryHatch(Material.iron).setBlockName("factory_titanium_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_titanium_furnace");
@ -745,7 +762,9 @@ public class ModBlocks {
crate = new BlockCrate(Material.iron).setBlockName("crate").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabNuke).setBlockTextureName(RefStrings.MODID + ":crate");
machine_well = new MachineOilWell(Material.iron).setBlockName("machine_well").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":machine_well");
oil_pipe = new BlockNoDrop(Material.iron).setBlockName("oil_pipe").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabNuke).setBlockTextureName(RefStrings.MODID + ":oil_pipe");
oil_pipe = new BlockNoDrop(Material.iron).setBlockName("oil_pipe").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":oil_pipe");
machine_flare = new MachineGasFlare(Material.iron).setBlockName("machine_flare").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":machine_flare");
machine_refinery = new MachineRefinery(Material.iron).setBlockName("machine_refinery").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":machine_refinery_side");
machine_schrabidium_transmutator = new MachineSchrabidiumTransmutator(Material.iron).setBlockName("machine_schrabidium_transmutator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock);
@ -781,6 +800,8 @@ public class ModBlocks {
dummy_port_cyclotron = new DummyBlockCyclotron(Material.iron).setBlockName("dummy_port_cyclotron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_block_well = new DummyBlockWell(Material.iron).setBlockName("dummy_block_well").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_port_well = new DummyBlockWell(Material.iron).setBlockName("dummy_port_well").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_block_flare = new DummyBlockFlare(Material.iron).setBlockName("dummy_block_flare").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_port_flare = new DummyBlockFlare(Material.iron).setBlockName("dummy_port_flare").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
}
private static void registerBlock() {
@ -961,6 +982,8 @@ public class ModBlocks {
//GameRegistry.registerBlock(machine_rtg_purple, machine_rtg_purple.getUnlocalizedName());
GameRegistry.registerBlock(red_cable, red_cable.getUnlocalizedName());
GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
GameRegistry.registerBlock(oil_duct, oil_duct.getUnlocalizedName());
GameRegistry.registerBlock(oil_duct_solid, oil_duct_solid.getUnlocalizedName());
GameRegistry.registerBlock(machine_battery, machine_battery.getUnlocalizedName());
GameRegistry.registerBlock(machine_converter_he_rf, machine_converter_he_rf.getUnlocalizedName());
GameRegistry.registerBlock(machine_converter_rf_he, machine_converter_rf_he.getUnlocalizedName());
@ -969,6 +992,8 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_shredder, machine_shredder.getUnlocalizedName());
GameRegistry.registerBlock(machine_deuterium, machine_deuterium.getUnlocalizedName());
GameRegistry.registerBlock(machine_well, machine_well.getUnlocalizedName());
GameRegistry.registerBlock(machine_flare, machine_flare.getUnlocalizedName());
GameRegistry.registerBlock(machine_refinery, machine_refinery.getUnlocalizedName());
GameRegistry.registerBlock(machine_schrabidium_transmutator, machine_schrabidium_transmutator.getUnlocalizedName());
GameRegistry.registerBlock(machine_combine_factory, machine_combine_factory.getUnlocalizedName());
GameRegistry.registerBlock(machine_teleporter, machine_teleporter.getUnlocalizedName());
@ -1067,6 +1092,8 @@ public class ModBlocks {
GameRegistry.registerBlock(dummy_port_cyclotron, dummy_port_cyclotron.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_well, dummy_block_well.getUnlocalizedName());
GameRegistry.registerBlock(dummy_port_well, dummy_port_well.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_flare, dummy_block_flare.getUnlocalizedName());
GameRegistry.registerBlock(dummy_port_flare, dummy_port_flare.getUnlocalizedName());
//Other Technical Blocks
GameRegistry.registerBlock(oil_pipe, oil_pipe.getUnlocalizedName());

View File

@ -0,0 +1,75 @@
package com.hbm.blocks.machine;
import com.hbm.tileentity.TileEntityOilDuct;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockOilDuct extends BlockContainer {
public BlockOilDuct(Material p_i45386_1_) {
super(p_i45386_1_);
float p = 1F/16F;
this.setBlockBounds(11 * p / 2, 11 * p / 2, 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2);
this.useNeighborBrightness = true;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
TileEntityOilDuct cable = (TileEntityOilDuct)world.getTileEntity(x, y, z);
if(cable != null)
{
float p = 1F/16F;
float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0);
float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0);
float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0);
float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0);
float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0);
float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0);
this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
}
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
TileEntityOilDuct cable = (TileEntityOilDuct)world.getTileEntity(x, y, z);
if(cable != null)
{
float p = 1F/16F;
float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0);
float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0);
float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0);
float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0);
float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0);
float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0);
this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
}
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityOilDuct();
}
@Override
public int getRenderType(){
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
}

View File

@ -0,0 +1,105 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.interfaces.IDummy;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityDummy;
import com.hbm.tileentity.TileEntityMachineCyclotron;
import com.hbm.tileentity.TileEntityMachineGasFlare;
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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class DummyBlockFlare extends BlockContainer implements IDummy {
public static boolean safeBreak = false;
public DummyBlockFlare(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityDummy();
}
public void breakBlock(World world, int x, int y, int z, Block block, int i)
{
if(!safeBreak) {
TileEntity te = world.getTileEntity(x, y, z);
if(te != null && te instanceof TileEntityDummy) {
int a = ((TileEntityDummy)te).targetX;
int b = ((TileEntityDummy)te).targetY;
int c = ((TileEntityDummy)te).targetZ;
//world.getBlock(a, b, c).breakBlock(world, a, b, c, block, i);
if(!world.isRemote)
world.func_147480_a(a, b, c, true);
}
}
world.removeTileEntity(x, y, z);
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return null;
}
@Override
@SideOnly(Side.CLIENT)
public Item getItem(World world, int x, int y, int z)
{
return Item.getItemFromBlock(ModBlocks.machine_flare);
}
@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())
{
TileEntity te = world.getTileEntity(x, y, z);
if(te != null && te instanceof TileEntityDummy) {
int a = ((TileEntityDummy)te).targetX;
int b = ((TileEntityDummy)te).targetY;
int c = ((TileEntityDummy)te).targetZ;
TileEntityMachineGasFlare entity = (TileEntityMachineGasFlare) world.getTileEntity(a, b, c);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_flare, world, a, b, c);
}
}
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,177 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.MultiblockHandler;
import com.hbm.interfaces.IMultiblock;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityDummy;
import com.hbm.tileentity.TileEntityMachineGasFlare;
import com.hbm.tileentity.TileEntityMachineOilWell;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class MachineGasFlare extends BlockContainer implements IMultiblock {
private final Random field_149933_a = new Random();
private Random rand;
private static boolean keepInventory;
public MachineGasFlare(Material p_i45386_1_) {
super(p_i45386_1_);
rand = new Random();
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.getItemFromBlock(ModBlocks.machine_flare);
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
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)
{
return true;
} else if(!player.isSneaking())
{
TileEntityMachineGasFlare entity = (TileEntityMachineGasFlare) world.getTileEntity(x, y, z);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_flare, world, x, y, z);
}
return true;
} else {
return false;
}
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityMachineGasFlare();
}
@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)
{
TileEntityMachineGasFlare tileentityfurnace = (TileEntityMachineGasFlare)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
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.flareDimension)) {
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.flareDimension, ModBlocks.dummy_block_flare);
DummyBlockFlare.safeBreak = true;
world.setBlock(x, y, z + 1, ModBlocks.dummy_port_flare);
TileEntity te = world.getTileEntity(x, y, z + 1);
if(te instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
world.setBlock(x, y, z - 1, ModBlocks.dummy_port_flare);
TileEntity te2 = world.getTileEntity(x, y, z - 1);
if(te instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te2;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
world.setBlock(x + 1, y, z, ModBlocks.dummy_port_flare);
TileEntity te3 = world.getTileEntity(x + 1, y, z);
if(te3 instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te3;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
world.setBlock(x - 1, y, z, ModBlocks.dummy_port_flare);
TileEntity te4 = world.getTileEntity(x - 1, y, z);
if(te4 instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te4;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
DummyBlockFlare.safeBreak = false;
} else
world.func_147480_a(x, y, z, true);
}
}

View File

@ -78,7 +78,7 @@ public class MachineOilWell extends BlockContainer implements IMultiblock {
return new TileEntityMachineOilWell();
}
/*@Override
@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)
@ -128,7 +128,7 @@ public class MachineOilWell extends BlockContainer implements IMultiblock {
}
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
}*/
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {

View File

@ -0,0 +1,134 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityMachineCMBFactory;
import com.hbm.tileentity.TileEntityMachineDiesel;
import com.hbm.tileentity.TileEntityMachineRefinery;
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.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
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.world.World;
public class MachineRefinery extends BlockContainer {
private final Random field_149933_a = new Random();
private Random rand;
private static boolean keepInventory;
@SideOnly(Side.CLIENT)
private IIcon iconTop;
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_refinery_top");
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_refinery_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.getItemFromBlock(ModBlocks.machine_refinery);
}
public MachineRefinery(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityMachineRefinery();
}
@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())
{
TileEntityMachineRefinery entity = (TileEntityMachineRefinery) world.getTileEntity(x, y, z);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_refinery, world, x, y, z);
}
return true;
} else {
return false;
}
}
@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)
{
TileEntityMachineRefinery tileentityfurnace = (TileEntityMachineRefinery)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_);
}
}

View File

@ -0,0 +1,25 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil;
import com.hbm.tileentity.TileEntityOilDuctSolid;
import com.hbm.tileentity.TileEntityWireCoated;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class OilDuctSolid extends BlockContainer {
public OilDuctSolid(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityOilDuctSolid();
}
}

View File

@ -0,0 +1,18 @@
package com.hbm.calc;
import com.hbm.interfaces.IOilSource;
import com.hbm.interfaces.ISource;
import net.minecraft.tileentity.TileEntity;
public class UnionOfTileEntitiesAndBooleansForOil {
public UnionOfTileEntitiesAndBooleansForOil(IOilSource tileentity, boolean bool)
{
source = tileentity;
ticked = bool;
}
public IOilSource source;
public boolean ticked = false;
}

View File

@ -0,0 +1,81 @@
package com.hbm.entity.particle;
import net.minecraft.world.World;
public class EntityGasFX extends EntityModFX
{
float smokeParticleScale;
public int particleAge;
public int maxAge;
private static final String __OBFID = "CL_00000924";
public EntityGasFX(World world) {
super(world, 0, 0, 0);
}
public EntityGasFX(World p_i1225_1_, double p_i1225_2_, double p_i1225_4_, double p_i1225_6_, double p_i1225_8_, double p_i1225_10_, double p_i1225_12_)
{
this(p_i1225_1_, p_i1225_2_, p_i1225_4_, p_i1225_6_, p_i1225_8_, p_i1225_10_, p_i1225_12_, 1.0F);
}
public EntityGasFX(World p_i1226_1_, double p_i1226_2_, double p_i1226_4_, double p_i1226_6_, double p_i1226_8_, double p_i1226_10_, double p_i1226_12_, float p_i1226_14_)
{
super(p_i1226_1_, p_i1226_2_, p_i1226_4_, p_i1226_6_, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i1226_8_;
this.motionY += p_i1226_10_;
this.motionZ += p_i1226_12_;
this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D);
this.particleScale *= 0.75F;
this.particleScale *= p_i1226_14_;
this.smokeParticleScale = this.particleScale;
//this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
//this.particleMaxAge = (int)((float)this.particleMaxAge * p_i1226_14_);
this.noClip = false;
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(maxAge < 15)
{
maxAge = rand.nextInt(4) + 15;
}
this.particleAge++;
if (this.particleAge >= maxAge)
{
this.setDead();
}
this.motionX *= 0.7599999785423279D;
//this.motionY *= 0.7599999785423279D;
this.motionY += 0.1D;
this.motionZ *= 0.7599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
if(this.isBurning()) {
this.setDead();
worldObj.createExplosion(null, posX, posY, posZ, 3F, true);
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
}
}

View File

@ -53,13 +53,6 @@ public class EntityOilSpill extends EntityThrowable {
@Override
protected void onImpact(MovingObjectPosition p_70184_1_)
{
if (p_70184_1_.entityHit != null)
{
byte b0 = 0;
p_70184_1_.entityHit.attackEntityFrom(ModDamageSource.shrapnel, b0);
}
if(this.ticksExisted > 5) {
this.setDead();
}

View File

@ -20,8 +20,10 @@ import com.hbm.inventory.container.ContainerMachineCoal;
import com.hbm.inventory.container.ContainerMachineCyclotron;
import com.hbm.inventory.container.ContainerMachineDeuterium;
import com.hbm.inventory.container.ContainerMachineDiesel;
import com.hbm.inventory.container.ContainerMachineGasFlare;
import com.hbm.inventory.container.ContainerMachineOilWell;
import com.hbm.inventory.container.ContainerMachineRTG;
import com.hbm.inventory.container.ContainerMachineRefinery;
import com.hbm.inventory.container.ContainerMachineSchrabidiumTransmutator;
import com.hbm.inventory.container.ContainerMachineShredder;
import com.hbm.inventory.container.ContainerMachineTeleporter;
@ -59,11 +61,13 @@ import com.hbm.inventory.gui.GUIMachineCyclotron;
import com.hbm.inventory.gui.GUIMachineDeuterium;
import com.hbm.inventory.gui.GUIMachineDiesel;
import com.hbm.inventory.gui.GUIMachineElectricFurnace;
import com.hbm.inventory.gui.GUIMachineGasFlare;
import com.hbm.inventory.gui.GUIMachineGenerator;
import com.hbm.inventory.gui.GUIMachineOilWell;
import com.hbm.inventory.gui.GUIMachinePuF6Tank;
import com.hbm.inventory.gui.GUIMachineRTG;
import com.hbm.inventory.gui.GUIMachineReactor;
import com.hbm.inventory.gui.GUIMachineRefinery;
import com.hbm.inventory.gui.GUIMachineSchrabidiumTransmutator;
import com.hbm.inventory.gui.GUIMachineShredder;
import com.hbm.inventory.gui.GUIMachineTeleporter;
@ -102,10 +106,12 @@ import com.hbm.tileentity.TileEntityMachineCyclotron;
import com.hbm.tileentity.TileEntityMachineDeuterium;
import com.hbm.tileentity.TileEntityMachineDiesel;
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
import com.hbm.tileentity.TileEntityMachineGasFlare;
import com.hbm.tileentity.TileEntityMachineGenerator;
import com.hbm.tileentity.TileEntityMachinePuF6Tank;
import com.hbm.tileentity.TileEntityMachineRTG;
import com.hbm.tileentity.TileEntityMachineReactor;
import com.hbm.tileentity.TileEntityMachineRefinery;
import com.hbm.tileentity.TileEntityMachineSchrabidiumTransmutator;
import com.hbm.tileentity.TileEntityMachineShredder;
import com.hbm.tileentity.TileEntityMachineTeleporter;
@ -466,6 +472,22 @@ public class GUIHandler implements IGuiHandler {
return new ContainerMachineOilWell(player.inventory, (TileEntityMachineOilWell) entity);
}
}
case ModBlocks.guiID_machine_refinery:
{
if(entity instanceof TileEntityMachineRefinery)
{
return new ContainerMachineRefinery(player.inventory, (TileEntityMachineRefinery) entity);
}
}
case ModBlocks.guiID_machine_flare:
{
if(entity instanceof TileEntityMachineGasFlare)
{
return new ContainerMachineGasFlare(player.inventory, (TileEntityMachineGasFlare) entity);
}
}
}
return null;
}
@ -806,6 +828,22 @@ public class GUIHandler implements IGuiHandler {
return new GUIMachineOilWell(player.inventory, (TileEntityMachineOilWell) entity);
}
}
case ModBlocks.guiID_machine_refinery:
{
if(entity instanceof TileEntityMachineRefinery)
{
return new GUIMachineRefinery(player.inventory, (TileEntityMachineRefinery) entity);
}
}
case ModBlocks.guiID_machine_flare:
{
if(entity instanceof TileEntityMachineGasFlare)
{
return new GUIMachineGasFlare(player.inventory, (TileEntityMachineGasFlare) entity);
}
}
}
}
return null;

View File

@ -47,6 +47,7 @@ public class MultiblockHandler {
public static final int[] centDimension = new int[] { 0, 0, 2, 0, 0, 0 };
public static final int[] cyclDimension = new int[] { 1, 1, 5, 0, 1, 1 };
public static final int[] wellDimension = new int[] { 1, 1, 5, 0, 1, 1 };
public static final int[] flareDimension = new int[] { 1, 1, 9, 0, 1, 1 };
//Approved!
public static boolean checkSpace(World world, int x, int y, int z, int[] i) {

View File

@ -0,0 +1,5 @@
package com.hbm.interfaces;
public interface IDuct {
}

View File

@ -0,0 +1,11 @@
package com.hbm.interfaces;
public interface IOilAcceptor {
void setFill(int i);
int getFill();
int getMaxFill();
}

View File

@ -0,0 +1,17 @@
package com.hbm.interfaces;
import java.util.List;
public interface IOilSource {
void fillInit();
void fill(int x, int y, int z, boolean newTact);
boolean getTact();
int getSFill();
void setSFill(int i);
List<IOilAcceptor> getList();
void clearList();
}

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.TileEntityMachineIGenerator;
import com.hbm.tileentity.TileEntityReiXMainframe;
@ -44,7 +45,7 @@ public class ContainerIGenerator extends Container {
//Fluid Slot
this.addSlotToContainer(new Slot(tedf, 13, 98, 108));
//Container Slot
this.addSlotToContainer(new Slot(tedf, 14, 98, 72));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 14, 98, 72));
//Battery Slot
this.addSlotToContainer(new Slot(tedf, 15, 152, 108));
@ -85,8 +86,8 @@ public class ContainerIGenerator extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 4) {
if (!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true))
if (par2 <= 15) {
if (!this.mergeItemStack(var5, 16, this.inventorySlots.size(), true))
{
return null;
}

View File

@ -0,0 +1,124 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.TileEntityMachineGasFlare;
import com.hbm.tileentity.TileEntityMachineRTG;
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 ContainerMachineGasFlare extends Container {
private TileEntityMachineGasFlare testNuke;
private int gas;
private int power;
public ContainerMachineGasFlare(InventoryPlayer invPlayer, TileEntityMachineGasFlare tedf) {
gas = 0;
power = 0;
testNuke = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 44, 53));
this.addSlotToContainer(new Slot(tedf, 1, 134, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 2, 134, 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);
crafting.sendProgressBarUpdate(this, 0, this.testNuke.gas);
crafting.sendProgressBarUpdate(this, 1, this.testNuke.power);
}
@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 <= 1) {
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 0, 3, false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return testNuke.isUseableByPlayer(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.gas != this.testNuke.gas)
{
par1.sendProgressBarUpdate(this, 0, this.testNuke.gas);
}
if(this.power != this.testNuke.power)
{
par1.sendProgressBarUpdate(this, 1, this.testNuke.power);
}
}
this.gas = this.testNuke.gas;
this.power = this.testNuke.power;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
testNuke.gas = j;
}
if(i == 1)
{
testNuke.power = j;
}
}
}

View File

@ -18,32 +18,42 @@ public class ContainerMachineOilWell extends Container {
private int oil;
private int power;
private int warning;
private int gas;
private int warning2;
public ContainerMachineOilWell(InventoryPlayer invPlayer, TileEntityMachineOilWell tedf) {
oil = 0;
power = 0;
warning = 0;
gas = 0;
warning2 = 0;
testNuke = tedf;
//Battery
this.addSlotToContainer(new Slot(tedf, 0, 44, 53));
this.addSlotToContainer(new Slot(tedf, 0, 44, 54));
//Canister Input
this.addSlotToContainer(new Slot(tedf, 1, 134, 17));
this.addSlotToContainer(new Slot(tedf, 1, 134, 18));
//Canister Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 2, 134, 53));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 2, 134, 54));
//Gas Input
this.addSlotToContainer(new Slot(tedf, 3, 134, 72));
//Gas Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 4, 134, 108));
//Chip
this.addSlotToContainer(new Slot(tedf, 5, 8, 90));
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));
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
}
}
@ -53,6 +63,8 @@ public class ContainerMachineOilWell extends Container {
crafting.sendProgressBarUpdate(this, 0, this.testNuke.oil);
crafting.sendProgressBarUpdate(this, 1, this.testNuke.power);
crafting.sendProgressBarUpdate(this, 2, this.testNuke.warning);
crafting.sendProgressBarUpdate(this, 3, this.testNuke.gas);
crafting.sendProgressBarUpdate(this, 4, this.testNuke.warning2);
}
@Override
@ -66,14 +78,16 @@ public class ContainerMachineOilWell extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 14) {
if (!this.mergeItemStack(var5, 15, this.inventorySlots.size(), true))
if (par2 <= 5) {
if (!this.mergeItemStack(var5, 6, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 0, 15, false))
else if (!this.mergeItemStack(var5, 0, 2, false))
{
if (!this.mergeItemStack(var5, 3, 4, false))
if (!this.mergeItemStack(var5, 5, 6, false))
return null;
}
@ -111,15 +125,25 @@ public class ContainerMachineOilWell extends Container {
{
par1.sendProgressBarUpdate(this, 1, this.testNuke.power);
}
if(this.power != this.testNuke.warning)
if(this.warning != this.testNuke.warning)
{
par1.sendProgressBarUpdate(this, 2, this.testNuke.warning);
}
if(this.gas != this.testNuke.gas)
{
par1.sendProgressBarUpdate(this, 3, this.testNuke.gas);
}
if(this.warning2 != this.testNuke.warning2)
{
par1.sendProgressBarUpdate(this, 4, this.testNuke.warning2);
}
}
this.oil = this.testNuke.oil;
this.power = this.testNuke.power;
this.warning = this.testNuke.warning;
this.gas = this.testNuke.gas;
this.warning2 = this.testNuke.warning2;
}
@Override
@ -136,5 +160,13 @@ public class ContainerMachineOilWell extends Container {
{
testNuke.warning = j;
}
if(i == 3)
{
testNuke.gas = j;
}
if(i == 4)
{
testNuke.warning2 = j;
}
}
}

View File

@ -0,0 +1,197 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.TileEntityMachineOilWell;
import com.hbm.tileentity.TileEntityMachineRefinery;
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 ContainerMachineRefinery extends Container {
private TileEntityMachineRefinery testNuke;
private int power;
private float oil;
private int fuel;
private int lubricant;
private int diesel;
private int kerosene;
public ContainerMachineRefinery(InventoryPlayer invPlayer, TileEntityMachineRefinery tedf) {
power = 0;
oil = 0;
fuel = 0;
lubricant = 0;
diesel = 0;
kerosene = 0;
testNuke = tedf;
//Battery
this.addSlotToContainer(new Slot(tedf, 0, 44, 54));
//Canister Input
this.addSlotToContainer(new Slot(tedf, 1, 134, 18));
//Canister Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 2, 134, 54));
//Fuel Input
this.addSlotToContainer(new Slot(tedf, 3, 26, 72));
//Fuel Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 4, 26, 108));
//Lubricant Input
this.addSlotToContainer(new Slot(tedf, 5, 62, 72));
//Lubricant Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 6, 62, 108));
//Diesel Input
this.addSlotToContainer(new Slot(tedf, 7, 98, 72));
//Diesel Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 8, 98, 108));
//Kerosene Input
this.addSlotToContainer(new Slot(tedf, 9, 134, 72));
//Kerosene Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 10, 134, 108));
//Sulfur Output
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 11, 152, 108));
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 + 56));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.testNuke.power);
crafting.sendProgressBarUpdate(this, 1, (int)this.testNuke.oil);
crafting.sendProgressBarUpdate(this, 2, this.testNuke.fuel);
crafting.sendProgressBarUpdate(this, 3, this.testNuke.lubricant);
crafting.sendProgressBarUpdate(this, 4, this.testNuke.diesel);
crafting.sendProgressBarUpdate(this, 5, this.testNuke.kerosene);
}
@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 <= 11) {
if (!this.mergeItemStack(var5, 12, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 0, 1, false))
if (!this.mergeItemStack(var5, 1, 2, false))
if (!this.mergeItemStack(var5, 3, 4, false))
if (!this.mergeItemStack(var5, 5, 6, false))
if (!this.mergeItemStack(var5, 7, 8, false))
if (!this.mergeItemStack(var5, 9, 10, false)) {
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return testNuke.isUseableByPlayer(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.power != this.testNuke.power)
{
par1.sendProgressBarUpdate(this, 0, this.testNuke.power);
}
if(this.oil != this.testNuke.oil)
{
par1.sendProgressBarUpdate(this, 1, (int)this.testNuke.oil);
}
if(this.fuel != this.testNuke.fuel)
{
par1.sendProgressBarUpdate(this, 2, this.testNuke.fuel);
}
if(this.lubricant != this.testNuke.lubricant)
{
par1.sendProgressBarUpdate(this, 3, this.testNuke.lubricant);
}
if(this.diesel != this.testNuke.diesel)
{
par1.sendProgressBarUpdate(this, 4, this.testNuke.diesel);
}
if(this.kerosene != this.testNuke.kerosene)
{
par1.sendProgressBarUpdate(this, 5, this.testNuke.kerosene);
}
}
this.power = this.testNuke.power;
this.oil = this.testNuke.oil;
this.oil = this.testNuke.fuel;
this.oil = this.testNuke.lubricant;
this.oil = this.testNuke.diesel;
this.oil = this.testNuke.kerosene;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
testNuke.power = j;
}
if(i == 1)
{
testNuke.oil = j;
}
if(i == 2)
{
testNuke.fuel = j;
}
if(i == 3)
{
testNuke.lubricant = j;
}
if(i == 4)
{
testNuke.diesel = j;
}
if(i == 5)
{
testNuke.kerosene = j;
}
}
}

View File

@ -0,0 +1,49 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineGasFlare;
import com.hbm.inventory.container.ContainerMachineRTG;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.TileEntityMachineGasFlare;
import com.hbm.tileentity.TileEntityMachineRTG;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineGasFlare extends GuiContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_gasFlare.png");
private TileEntityMachineGasFlare flare;
public GUIMachineGasFlare(InventoryPlayer invPlayer, TileEntityMachineGasFlare tedf) {
super(new ContainerMachineGasFlare(invPlayer, tedf));
flare = tedf;
this.xSize = 176;
this.ySize = 166;
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.flare.hasCustomInventoryName() ? this.flare.getInventoryName() : I18n.format(this.flare.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);
int i = flare.getGasScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 69 - i, 192, 52 - i, 34, i);
int j = flare.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 69 - j, 176, 52 - j, 16, j);
}
}

View File

@ -18,7 +18,7 @@ import net.minecraft.util.ResourceLocation;
public class GUIMachineOilWell extends GuiContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_well.png");
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_well_large.png");
private TileEntityMachineOilWell derrick;
public GUIMachineOilWell(InventoryPlayer invPlayer, TileEntityMachineOilWell tedf) {
@ -26,7 +26,7 @@ public class GUIMachineOilWell extends GuiContainer {
derrick = tedf;
this.xSize = 176;
this.ySize = 166;
this.ySize = 222;
}
@Override
@ -44,15 +44,24 @@ public class GUIMachineOilWell extends GuiContainer {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int i = derrick.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 69 - i, 176, 52 - i, 16, i);
drawTexturedModalRect(guiLeft + 8, guiTop + 70 - i, 176, 52 - i, 16, i);
int j = derrick.getOilScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 69 - j, 192, 52 - j, 34, j);
drawTexturedModalRect(guiLeft + 80, guiTop + 70 - j, 192, 52 - j, 34, j);
int x = derrick.getGasScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 124 - x, 176, 120 - x, 34, x);
int k = derrick.warning;
if(k == 2)
drawTexturedModalRect(guiLeft + 44, guiTop + 17, 176, 52, 16, 16);
drawTexturedModalRect(guiLeft + 44, guiTop + 18, 176, 52, 16, 16);
if(k == 1)
drawTexturedModalRect(guiLeft + 44, guiTop + 17, 192, 52, 16, 16);
drawTexturedModalRect(guiLeft + 44, guiTop + 18, 192, 52, 16, 16);
int l = derrick.warning2;
if(l == 1)
drawTexturedModalRect(guiLeft + 44, guiTop + 90, 208, 52, 16, 16);
if(l == 2)
drawTexturedModalRect(guiLeft + 44, guiTop + 90, 224, 52, 16, 16);
}
}

View File

@ -0,0 +1,57 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerIGenerator;
import com.hbm.inventory.container.ContainerMachineRefinery;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.TileEntityMachineIGenerator;
import com.hbm.tileentity.TileEntityMachineRefinery;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineRefinery extends GuiContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_refinery.png");
private TileEntityMachineRefinery diFurnace;
public GUIMachineRefinery(InventoryPlayer invPlayer, TileEntityMachineRefinery tedf) {
super(new ContainerMachineRefinery(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 222;
}
@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);
int i = diFurnace.getOilScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 70 - i, 192, 52 - i, 34, i);
int j = diFurnace.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 70 - j, 176, 52 - j, 16, j);
int k = diFurnace.getSmearScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 124 - k, 176, 104 - k, 7, k);
int l = diFurnace.getLubricantScaled(52);
drawTexturedModalRect(guiLeft + 44, guiTop + 124 - l, 183, 104 - l, 7, l);
int m = diFurnace.getDieselScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 124 - m, 190, 104 - m, 7, m);
int n = diFurnace.getKeroseneScaled(52);
drawTexturedModalRect(guiLeft + 116, guiTop + 124 - n, 197, 104 - n, 7, n);
}
}

View File

@ -419,6 +419,7 @@ public class ModItems {
public static Item oil_canola;
public static Item canister_empty;
public static Item canister_smear;
public static Item canister_canola;
public static Item canister_oil;
public static Item canister_fuel;
@ -426,6 +427,9 @@ public class ModItems {
public static Item canister_napalm;
public static Item canister_NITAN;
public static Item gas_empty;
public static Item gas_full;
public static Item syringe_empty;
public static Item syringe_antidote;
public static Item syringe_poison;
@ -947,6 +951,14 @@ public class ModItems {
public static Item spill6;
public static Item spill7;
public static Item spill8;
public static Item gas1;
public static Item gas2;
public static Item gas3;
public static Item gas4;
public static Item gas5;
public static Item gas6;
public static Item gas7;
public static Item gas8;
public static Item energy_ball;
public static Item discharge;
public static Item empblast;
@ -1272,12 +1284,15 @@ public class ModItems {
oil_canola = new Item().setUnlocalizedName("oil_canola").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":oil_canola");
canister_empty = new ItemCustomLore().setUnlocalizedName("canister_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":canister_empty");
canister_smear = new ItemCustomLore().setUnlocalizedName("canister_smear").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_smear");
canister_canola = new ItemCustomLore().setUnlocalizedName("canister_canola").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_canola");
canister_oil = new ItemCustomLore().setUnlocalizedName("canister_oil").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_oil");
canister_fuel = new ItemCustomLore().setUnlocalizedName("canister_fuel").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_fuel");
canister_kerosene = new ItemCustomLore().setUnlocalizedName("canister_kerosene").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_kerosene");
canister_napalm = new ItemCustomLore().setUnlocalizedName("canister_napalm").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_napalm");
canister_NITAN = new ItemCustomLore().setUnlocalizedName("canister_NITAN").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_superfuel");
gas_empty = new Item().setUnlocalizedName("gas_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":gas_empty");
gas_full = new Item().setUnlocalizedName("gas_full").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.gas_empty).setTextureName(RefStrings.MODID + ":gas_full");
tank_waste = new ItemTankWaste().setUnlocalizedName("tank_waste").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts);
@ -1797,6 +1812,14 @@ public class ModItems {
spill6 = new Item().setUnlocalizedName("spill6").setTextureName(RefStrings.MODID + ":spill6");
spill7 = new Item().setUnlocalizedName("spill7").setTextureName(RefStrings.MODID + ":spill7");
spill8 = new Item().setUnlocalizedName("spill8").setTextureName(RefStrings.MODID + ":spill8");
gas1 = new Item().setUnlocalizedName("gas1").setTextureName(RefStrings.MODID + ":gas1");
gas2 = new Item().setUnlocalizedName("gas2").setTextureName(RefStrings.MODID + ":gas2");
gas3 = new Item().setUnlocalizedName("gas3").setTextureName(RefStrings.MODID + ":gas3");
gas4 = new Item().setUnlocalizedName("gas4").setTextureName(RefStrings.MODID + ":gas4");
gas5 = new Item().setUnlocalizedName("gas5").setTextureName(RefStrings.MODID + ":gas5");
gas6 = new Item().setUnlocalizedName("gas6").setTextureName(RefStrings.MODID + ":gas6");
gas7 = new Item().setUnlocalizedName("gas7").setTextureName(RefStrings.MODID + ":gas7");
gas8 = new Item().setUnlocalizedName("gas8").setTextureName(RefStrings.MODID + ":gas8");
energy_ball = new Item().setUnlocalizedName("energy_ball").setTextureName(RefStrings.MODID + ":energy_ball");
discharge = new Item().setUnlocalizedName("discharge").setTextureName(RefStrings.MODID + ":discharge");
empblast = new Item().setUnlocalizedName("empblast").setTextureName(RefStrings.MODID + ":empblast");
@ -2161,6 +2184,7 @@ public class ModItems {
//Canisters
GameRegistry.registerItem(canister_empty, canister_empty.getUnlocalizedName());
GameRegistry.registerItem(canister_smear, canister_smear.getUnlocalizedName());
GameRegistry.registerItem(canister_canola, canister_canola.getUnlocalizedName());
GameRegistry.registerItem(canister_oil, canister_oil.getUnlocalizedName());
GameRegistry.registerItem(canister_fuel, canister_fuel.getUnlocalizedName());
@ -2168,6 +2192,10 @@ public class ModItems {
GameRegistry.registerItem(canister_napalm, canister_napalm.getUnlocalizedName());
GameRegistry.registerItem(canister_NITAN, canister_NITAN.getUnlocalizedName());
//Gastanks
GameRegistry.registerItem(gas_empty, gas_empty.getUnlocalizedName());
GameRegistry.registerItem(gas_full, gas_full.getUnlocalizedName());
//Batteries
GameRegistry.registerItem(battery_generic, battery_generic.getUnlocalizedName());
GameRegistry.registerItem(battery_advanced, battery_advanced.getUnlocalizedName());
@ -2732,6 +2760,14 @@ public class ModItems {
GameRegistry.registerItem(spill6, spill6.getUnlocalizedName());
GameRegistry.registerItem(spill7, spill7.getUnlocalizedName());
GameRegistry.registerItem(spill8, spill8.getUnlocalizedName());
GameRegistry.registerItem(gas1, gas1.getUnlocalizedName());
GameRegistry.registerItem(gas2, gas2.getUnlocalizedName());
GameRegistry.registerItem(gas3, gas3.getUnlocalizedName());
GameRegistry.registerItem(gas4, gas4.getUnlocalizedName());
GameRegistry.registerItem(gas5, gas5.getUnlocalizedName());
GameRegistry.registerItem(gas6, gas6.getUnlocalizedName());
GameRegistry.registerItem(gas7, gas7.getUnlocalizedName());
GameRegistry.registerItem(gas8, gas8.getUnlocalizedName());
GameRegistry.registerItem(energy_ball, energy_ball.getUnlocalizedName());
GameRegistry.registerItem(discharge, discharge.getUnlocalizedName());
GameRegistry.registerItem(empblast, empblast.getUnlocalizedName());

View File

@ -6,10 +6,14 @@ import java.util.UUID;
import com.hbm.blocks.ModBlocks;
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
import com.hbm.interfaces.IConductor;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IDuct;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.interfaces.IOilSource;
import com.hbm.interfaces.ISource;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
@ -18,6 +22,8 @@ import com.hbm.tileentity.TileEntityLaunchPad;
import com.hbm.tileentity.TileEntityMachineBattery;
import com.hbm.tileentity.TileEntityMachineDeuterium;
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
import com.hbm.tileentity.TileEntityOilDuct;
import com.hbm.tileentity.TileEntityOilDuctSolid;
import com.hbm.tileentity.TileEntityWireCoated;
import net.minecraft.block.Block;
@ -244,7 +250,7 @@ public class Library {
return false;
}
public static boolean checkConnectables(World world, int x, int y, int z)
public static boolean checkCableConnectables(World world, int x, int y, int z)
{
TileEntity tileentity = world.getTileEntity(x, y, z);
if((tileentity != null && (tileentity instanceof IConductor ||
@ -265,6 +271,18 @@ public class Library {
return false;
}
public static boolean checkDuctConnectables(World world, int x, int y, int z)
{
TileEntity tileentity = world.getTileEntity(x, y, z);
if((tileentity != null && tileentity instanceof IDuct) ||
world.getBlock(x, y, z) == ModBlocks.dummy_port_well ||
world.getBlock(x, y, z) == ModBlocks.machine_refinery)
{
return true;
}
return false;
}
public static boolean checkUnionList(List<UnionOfTileEntitiesAndBooleans> list, ISource that) {
for(UnionOfTileEntitiesAndBooleans union : list)
@ -278,6 +296,19 @@ public class Library {
return false;
}
public static boolean checkOilUnionListForOil(List<UnionOfTileEntitiesAndBooleansForOil> list, IOilSource that) {
for(UnionOfTileEntitiesAndBooleansForOil union : list)
{
if(union.source == that)
{
return true;
}
}
return false;
}
////// ////// ////// ////// ////// //// ////// ////// //////
// // // // // // // // // // //
//// ////// ///// // //// //// //// // // // //
@ -651,4 +682,90 @@ public class Library {
that.clearList();
}
}
public static void transmitOil(int x, int y, int z, boolean newTact, IOilSource that, World worldObj) {
Block block = worldObj.getBlock(x, y, z);
TileEntity tileentity = worldObj.getTileEntity(x, y, z);
if(tileentity instanceof IDuct)
{
if(tileentity instanceof TileEntityOilDuct)
{
if(Library.checkOilUnionListForOil(((TileEntityOilDuct)tileentity).uoteab, that))
{
for(int i = 0; i < ((TileEntityOilDuct)tileentity).uoteab.size(); i++)
{
if(((TileEntityOilDuct)tileentity).uoteab.get(i).source == that)
{
if(((TileEntityOilDuct)tileentity).uoteab.get(i).ticked != newTact)
{
((TileEntityOilDuct)tileentity).uoteab.get(i).ticked = newTact;
that.fill(x, y + 1, z, that.getTact());
that.fill(x, y - 1, z, that.getTact());
that.fill(x - 1, y, z, that.getTact());
that.fill(x + 1, y, z, that.getTact());
that.fill(x, y, z - 1, that.getTact());
that.fill(x, y, z + 1, that.getTact());
}
}
}
} else {
((TileEntityOilDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForOil(that, newTact));
}
}
if(tileentity instanceof TileEntityOilDuctSolid)
{
if(Library.checkOilUnionListForOil(((TileEntityOilDuctSolid)tileentity).uoteab, that))
{
for(int i = 0; i < ((TileEntityOilDuctSolid)tileentity).uoteab.size(); i++)
{
if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).source == that)
{
if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked != newTact)
{
((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked = newTact;
that.fill(x, y + 1, z, that.getTact());
that.fill(x, y - 1, z, that.getTact());
that.fill(x - 1, y, z, that.getTact());
that.fill(x + 1, y, z, that.getTact());
that.fill(x, y, z - 1, that.getTact());
that.fill(x, y, z + 1, that.getTact());
}
}
}
} else {
((TileEntityOilDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForOil(that, newTact));
}
}
}
if(tileentity instanceof IOilAcceptor && newTact)
{
that.getList().add((IOilAcceptor)tileentity);
}
if(!newTact)
{
int size = that.getList().size();
if(size > 0)
{
int part = that.getSFill() / size;
for(IOilAcceptor consume : that.getList())
{
if(consume.getFill() < consume.getMaxFill())
{
if(consume.getMaxFill() - consume.getFill() >= part)
{
that.setSFill(that.getSFill()-part);
consume.setFill(consume.getFill() + part);
} else {
that.setSFill(that.getSFill() - (consume.getMaxFill() - consume.getFill()));
consume.setFill(consume.getMaxFill());
}
}
}
}
that.clearList();
}
}
}

View File

@ -57,6 +57,7 @@ import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.particle.EntityBSmokeFX;
import com.hbm.entity.particle.EntityDSmokeFX;
import com.hbm.entity.particle.EntityGasFX;
import com.hbm.entity.particle.EntityOilSpillFX;
import com.hbm.entity.particle.EntitySSmokeFX;
import com.hbm.entity.particle.EntitySmokeFX;
@ -83,6 +84,7 @@ import com.hbm.items.ModItems;
import com.hbm.render.entity.BSmokeRenderer;
import com.hbm.render.entity.DSmokeRenderer;
import com.hbm.render.entity.ElectricityRenderer;
import com.hbm.render.entity.GasRenderer;
import com.hbm.render.entity.ModEffectRenderer;
import com.hbm.render.entity.RenderBaleflare;
import com.hbm.render.entity.RenderBeam;
@ -162,6 +164,7 @@ import com.hbm.render.tileentity.RenderCyclotron;
import com.hbm.render.tileentity.RenderDecoBlock;
import com.hbm.render.tileentity.RenderDecoBlockAlt;
import com.hbm.render.tileentity.RenderDerrick;
import com.hbm.render.tileentity.RenderGasFlare;
import com.hbm.render.tileentity.RenderIGenerator;
import com.hbm.render.tileentity.RenderLaunchPadTier1;
import com.hbm.render.tileentity.RenderNukeBoy;
@ -172,6 +175,7 @@ import com.hbm.render.tileentity.RenderNukeMan;
import com.hbm.render.tileentity.RenderNukeMike;
import com.hbm.render.tileentity.RenderNukePrototype;
import com.hbm.render.tileentity.RenderNukeTsar;
import com.hbm.render.tileentity.RenderOilDuct;
import com.hbm.render.tileentity.RenderPoleSatelliteReceiver;
import com.hbm.render.tileentity.RenderPoleTop;
import com.hbm.render.tileentity.RenderPuF6Tank;
@ -203,6 +207,7 @@ import com.hbm.tileentity.TileEntityMachineOilWell;
import com.hbm.tileentity.TileEntityLaunchPad;
import com.hbm.tileentity.TileEntityMachineCentrifuge;
import com.hbm.tileentity.TileEntityMachineCyclotron;
import com.hbm.tileentity.TileEntityMachineGasFlare;
import com.hbm.tileentity.TileEntityMachinePuF6Tank;
import com.hbm.tileentity.TileEntityMachineUF6Tank;
import com.hbm.tileentity.TileEntityNukeBoy;
@ -214,6 +219,7 @@ import com.hbm.tileentity.TileEntityNukeMike;
import com.hbm.tileentity.TileEntityNukePrototype;
import com.hbm.tileentity.TileEntityNukeTsar;
import com.hbm.tileentity.TileEntityObjTester;
import com.hbm.tileentity.TileEntityOilDuct;
import com.hbm.tileentity.TileEntityRedBarrel;
import com.hbm.tileentity.TileEntityRotationTester;
import com.hbm.tileentity.TileEntityTestBombAdvanced;
@ -255,6 +261,7 @@ public class ClientProxy extends ServerProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineIGenerator.class, new RenderIGenerator());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCyclotron.class, new RenderCyclotron());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineOilWell.class, new RenderDerrick());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineGasFlare.class, new RenderGasFlare());
//RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderRocket());
RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderSnowball(ModItems.man_core));
@ -375,6 +382,7 @@ public class ClientProxy extends ServerProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaunchPad.class, new RenderLaunchPadTier1());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCable.class, new RenderCable());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityOilDuct.class, new RenderOilDuct());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileGeneric.class, new RenderMissileGeneric());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileAntiBallistic.class, new RenderMissileGeneric());
@ -424,6 +432,7 @@ public class ClientProxy extends ServerProxy
RenderingRegistry.registerEntityRenderingHandler(EntityDSmokeFX.class, new DSmokeRenderer(ModItems.nuclear_waste));
RenderingRegistry.registerEntityRenderingHandler(EntitySSmokeFX.class, new SSmokeRenderer(ModItems.nuclear_waste));
RenderingRegistry.registerEntityRenderingHandler(EntityOilSpillFX.class, new SpillRenderer(ModItems.nuclear_waste));
RenderingRegistry.registerEntityRenderingHandler(EntityGasFX.class, new GasRenderer(ModItems.nuclear_waste));
RenderingRegistry.registerEntityRenderingHandler(EntityCombineBall.class, new RenderSnowball(ModItems.energy_ball));
RenderingRegistry.registerEntityRenderingHandler(EntityDischarge.class, new ElectricityRenderer(ModItems.discharge));
RenderingRegistry.registerEntityRenderingHandler(EntityEMPBlast.class, new RenderEMPBlast());

View File

@ -81,6 +81,7 @@ import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.particle.EntityBSmokeFX;
import com.hbm.entity.particle.EntityDSmokeFX;
import com.hbm.entity.particle.EntityGasFX;
import com.hbm.entity.particle.EntityOilSpillFX;
import com.hbm.entity.particle.EntitySSmokeFX;
import com.hbm.entity.particle.EntitySmokeFX;
@ -139,9 +140,11 @@ import com.hbm.tileentity.TileEntityMachineCyclotron;
import com.hbm.tileentity.TileEntityMachineDeuterium;
import com.hbm.tileentity.TileEntityMachineDiesel;
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
import com.hbm.tileentity.TileEntityMachineGasFlare;
import com.hbm.tileentity.TileEntityMachineGenerator;
import com.hbm.tileentity.TileEntityMachinePuF6Tank;
import com.hbm.tileentity.TileEntityMachineReactor;
import com.hbm.tileentity.TileEntityMachineRefinery;
import com.hbm.tileentity.TileEntityMachineSchrabidiumTransmutator;
import com.hbm.tileentity.TileEntityMachineShredder;
import com.hbm.tileentity.TileEntityMachineTeleporter;
@ -156,6 +159,8 @@ import com.hbm.tileentity.TileEntityNukeMike;
import com.hbm.tileentity.TileEntityNukePrototype;
import com.hbm.tileentity.TileEntityNukeTsar;
import com.hbm.tileentity.TileEntityObjTester;
import com.hbm.tileentity.TileEntityOilDuct;
import com.hbm.tileentity.TileEntityOilDuctSolid;
import com.hbm.tileentity.TileEntityReactorMultiblock;
import com.hbm.tileentity.TileEntityRedBarrel;
import com.hbm.tileentity.TileEntityRotationTester;
@ -383,6 +388,10 @@ public class MainRegistry
GameRegistry.registerTileEntity(TileEntityDummy.class, "tileentity_dummy");
GameRegistry.registerTileEntity(TileEntityMachineCyclotron.class, "tileentity_cyclotron");
GameRegistry.registerTileEntity(TileEntityMachineOilWell.class, "tileentity_derrick");
GameRegistry.registerTileEntity(TileEntityMachineGasFlare.class, "tileentity_gasflare");
GameRegistry.registerTileEntity(TileEntityMachineRefinery.class, "tileentity_refinery");
GameRegistry.registerTileEntity(TileEntityOilDuct.class, "tileentity_oil_duct");
GameRegistry.registerTileEntity(TileEntityOilDuctSolid.class, "tileentity_oil_duct_solid");
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
@ -458,6 +467,7 @@ public class MainRegistry
EntityRegistry.registerModEntity(EntityGrenadeBlackHole.class, "entity_grenade_black_hole", 71, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityOilSpillFX.class, "entity_spill_fx", 72, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityOilSpill.class, "entity_oil_spill", 73, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityGasFX.class, "entity_spill_fx", 74, this, 1000, 1, true);
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
EntityRegistry.registerGlobalEntityID(EntityHunterChopper.class, "entity_mob_hunter_chopper", EntityRegistry.findGlobalUniqueEntityId(), 0x000020, 0x2D2D72);

View File

@ -0,0 +1,124 @@
package com.hbm.render.entity;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.entity.particle.EntityGasFX;
import com.hbm.entity.particle.EntityOilSpillFX;
import com.hbm.items.ModItems;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class GasRenderer extends Render {
private Item field_94151_a;
private int field_94150_f;
private static final String __OBFID = "CL_00001008";
public GasRenderer(Item p_i1259_1_, int p_i1259_2_) {
this.field_94151_a = p_i1259_1_;
this.field_94150_f = p_i1259_2_;
}
public GasRenderer(Item p_i1260_1_) {
this(p_i1260_1_, 0);
}
/**
* Actually renders the given argument. This is a synthetic bridge method,
* always casting down its argument and then handing it off to a worker
* function which does the actual work. In all probabilty, the class Render
* is generic (Render<T extends Entity) and this method has signature public
* void func_76986_a(T entity, double d, double d1, double d2, float f,
* float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_,
float p_76986_9_) {
if (p_76986_1_ instanceof EntityGasFX) {
EntityGasFX fx = (EntityGasFX) p_76986_1_;
if (fx.particleAge <= fx.maxAge && fx.particleAge >= fx.maxAge / 8 * 7) {
field_94151_a = ModItems.gas8;
}
if (fx.particleAge < fx.maxAge / 8 * 7 && fx.particleAge >= fx.maxAge / 8 * 6) {
field_94151_a = ModItems.gas7;
}
if (fx.particleAge < fx.maxAge / 8 * 6 && fx.particleAge >= fx.maxAge / 8 * 5) {
field_94151_a = ModItems.gas6;
}
if (fx.particleAge < fx.maxAge / 8 * 5 && fx.particleAge >= fx.maxAge / 8 * 4) {
field_94151_a = ModItems.gas5;
}
if (fx.particleAge < fx.maxAge / 8 * 4 && fx.particleAge >= fx.maxAge / 8 * 3) {
field_94151_a = ModItems.gas4;
}
if (fx.particleAge < fx.maxAge / 8 * 3 && fx.particleAge >= fx.maxAge / 8 * 2) {
field_94151_a = ModItems.gas3;
}
if (fx.particleAge < fx.maxAge / 8 * 2 && fx.particleAge >= fx.maxAge / 8 * 1) {
field_94151_a = ModItems.gas2;
}
if (fx.particleAge < fx.maxAge / 8 && fx.particleAge >= 0) {
field_94151_a = ModItems.gas1;
}
IIcon iicon = field_94151_a.getIconFromDamage(0);
if (iicon != null) {
GL11.glPushMatrix();
GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glScalef(7.5F, 7.5F, 7.5F);
//
GL11.glScalef(0.25F, 0.25F, 0.25F);
//
this.bindEntityTexture(p_76986_1_);
Tessellator tessellator = Tessellator.instance;
this.func_77026_a(tessellator, iicon);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called
* unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return TextureMap.locationItemsTexture;
}
private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_) {
float f = p_77026_2_.getMinU();
float f1 = p_77026_2_.getMaxU();
float f2 = p_77026_2_.getMinV();
float f3 = p_77026_2_.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
p_77026_1_.startDrawingQuads();
p_77026_1_.setNormal(0.0F, 1.0F, 0.0F);
p_77026_1_.addVertexWithUV((double) (0.0F - f5), (double) (0.0F - f6), 0.0D, (double) f, (double) f3);
p_77026_1_.addVertexWithUV((double) (f4 - f5), (double) (0.0F - f6), 0.0D, (double) f1, (double) f3);
p_77026_1_.addVertexWithUV((double) (f4 - f5), (double) (f4 - f6), 0.0D, (double) f1, (double) f2);
p_77026_1_.addVertexWithUV((double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2);
p_77026_1_.draw();
}
}

View File

@ -0,0 +1,40 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderGasFlare extends TileEntitySpecialRenderer {
private static final ResourceLocation body = new ResourceLocation(RefStrings.MODID, "models/oilFlare.obj");
private IModelCustom genModel;
private ResourceLocation genTexture;
public RenderGasFlare()
{
genModel = AdvancedModelLoader.loadModel(body);
genTexture = new ResourceLocation(RefStrings.MODID, "textures/models/oilFlareTexture.png");
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotatef(180, 0F, 1F, 0F);
bindTexture(genTexture);
genModel.renderAll();
GL11.glPopMatrix();
}
}

View File

@ -0,0 +1,154 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.TileEntityCable;
import com.hbm.tileentity.TileEntityOilDuct;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
public class RenderOilDuct extends TileEntitySpecialRenderer {
public ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "textures/blocks/oil_duct.png");
float pixel = 1F/16F;
float textureP = 1F / 32F;
@Override
public void renderTileEntityAt(TileEntity tileentity, double offsetX, double offsetY, double offsetZ, float f) {
GL11.glTranslated(offsetX, offsetY, offsetZ);
GL11.glDisable(GL11.GL_LIGHTING);
this.bindTexture(texture);
drawCore(tileentity);
TileEntityOilDuct cable = (TileEntityOilDuct) tileentity;
for(int i = 0; i < cable.connections.length; i++)
{
if(cable.connections[i] != null)
{
drawConnection(cable.connections[i]);
}
}
GL11.glTranslated(-offsetX, -offsetY, -offsetZ);
GL11.glEnable(GL11.GL_LIGHTING);
}
public void drawCore(TileEntity tileentity) {
Tessellator tesseract = Tessellator.instance;
tesseract.startDrawingQuads();
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * textureP, 5 * textureP);
tesseract.draw();
}
public void drawConnection(ForgeDirection direction)
{
Tessellator tesseract = Tessellator.instance;
tesseract.startDrawingQuads();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
if(direction.equals(ForgeDirection.UP))
{
}
if(direction.equals(ForgeDirection.DOWN))
{
GL11.glRotatef(180, 1, 0, 0);
}
if(direction.equals(ForgeDirection.NORTH))
{
GL11.glRotatef(270, 1, 0, 0);
}
if(direction.equals(ForgeDirection.SOUTH))
{
GL11.glRotatef(90, 1, 0, 0);
}
if(direction.equals(ForgeDirection.EAST))
{
GL11.glRotatef(270, 0, 0, 1);
}
if(direction.equals(ForgeDirection.WEST))
{
GL11.glRotatef(90, 0, 0, 1);
}
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 5 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 0 * textureP);
tesseract.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1, 1 - 11 * pixel / 2, 10 * textureP, 5 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1, 11 * pixel / 2, 10 * textureP, 0 * textureP);
tesseract.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * textureP, 0 * textureP);
tesseract.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
if(direction.equals(ForgeDirection.UP))
{
}
if(direction.equals(ForgeDirection.DOWN))
{
GL11.glRotatef(-180, 1, 0, 0);
}
if(direction.equals(ForgeDirection.NORTH))
{
GL11.glRotatef(-270, 1, 0, 0);
}
if(direction.equals(ForgeDirection.SOUTH))
{
GL11.glRotatef(-90, 1, 0, 0);
}
if(direction.equals(ForgeDirection.EAST))
{
GL11.glRotatef(-270, 0, 0, 1);
}
if(direction.equals(ForgeDirection.WEST))
{
GL11.glRotatef(-90, 0, 0, 1);
}
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
}
}

View File

@ -28,22 +28,22 @@ public class TileEntityCable extends TileEntity implements IConductor {
}
public void updateConnections() {
if(Library.checkConnectables(this.worldObj, xCoord, yCoord + 1, zCoord)) connections[0] = ForgeDirection.UP;
if(Library.checkCableConnectables(this.worldObj, xCoord, yCoord + 1, zCoord)) connections[0] = ForgeDirection.UP;
else connections[0] = null;
if(Library.checkConnectables(this.worldObj, xCoord, yCoord - 1, zCoord)) connections[1] = ForgeDirection.DOWN;
if(Library.checkCableConnectables(this.worldObj, xCoord, yCoord - 1, zCoord)) connections[1] = ForgeDirection.DOWN;
else connections[1] = null;
if(Library.checkConnectables(this.worldObj, xCoord, yCoord, zCoord - 1)) connections[2] = ForgeDirection.NORTH;
if(Library.checkCableConnectables(this.worldObj, xCoord, yCoord, zCoord - 1)) connections[2] = ForgeDirection.NORTH;
else connections[2] = null;
if(Library.checkConnectables(this.worldObj, xCoord + 1, yCoord, zCoord)) connections[3] = ForgeDirection.EAST;
if(Library.checkCableConnectables(this.worldObj, xCoord + 1, yCoord, zCoord)) connections[3] = ForgeDirection.EAST;
else connections[3] = null;
if(Library.checkConnectables(this.worldObj, xCoord, yCoord, zCoord + 1)) connections[4] = ForgeDirection.SOUTH;
if(Library.checkCableConnectables(this.worldObj, xCoord, yCoord, zCoord + 1)) connections[4] = ForgeDirection.SOUTH;
else connections[4] = null;
if(Library.checkConnectables(this.worldObj, xCoord - 1, yCoord, zCoord)) connections[5] = ForgeDirection.WEST;
if(Library.checkCableConnectables(this.worldObj, xCoord - 1, yCoord, zCoord)) connections[5] = ForgeDirection.WEST;
else connections[5] = null;
}

View File

@ -0,0 +1,284 @@
package com.hbm.tileentity;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.interfaces.IOilSource;
import com.hbm.interfaces.ISource;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.oredict.OreDictionary;
public class TileEntityMachineGasFlare extends TileEntity implements ISidedInventory, ISource {
private ItemStack slots[];
public int gas;
public int power;
public static final int maxPower = 100000;
public static final int maxGas = 640;
public int age = 0;
public List<IConsumer> list = new ArrayList();
private static final int[] slots_top = new int[] {1};
private static final int[] slots_bottom = new int[] {2, 0};
private static final int[] slots_side = new int[] {0};
Random rand = new Random();
private String customName;
public TileEntityMachineGasFlare() {
slots = new ItemStack[3];
}
@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.gasFlare";
}
@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) <=128;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
if(i == 0)
if(itemStack.getItem() instanceof ItemBattery)
return true;
if(i == 1)
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);
this.power = nbt.getInteger("powerTime");
this.gas = nbt.getInteger("gas");
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("powerTime", power);
nbt.setInteger("gas", gas);
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 p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@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 false;
}
public int getGasScaled(int i) {
return (gas * i) / maxGas;
}
public int getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void updateEntity() {
age++;
if(age >= 20)
age -= 20;
if(age == 9 || age == 19)
ffgeuaInit();
if(!worldObj.isRemote) {
}
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
@Override
public boolean getTact() {
if (age >= 0 && age < 10) {
return true;
}
return false;
}
@Override
public void clearList() {
this.list.clear();
}
@Override
public void ffgeuaInit() {
ffgeua(this.xCoord + 2, this.yCoord, this.zCoord, getTact());
ffgeua(this.xCoord - 2, this.yCoord, this.zCoord, getTact());
ffgeua(this.xCoord, this.yCoord, this.zCoord + 2, getTact());
ffgeua(this.xCoord, this.yCoord, this.zCoord - 2, getTact());
}
@Override
public void ffgeua(int x, int y, int z, boolean newTact) {
Library.ffgeua(x, y, z, newTact, this, worldObj);
}
@Override
public int getSPower() {
return this.power;
}
@Override
public void setSPower(int i) {
this.power = i;
}
@Override
public List<IConsumer> getList() {
return this.list;
}
}

View File

@ -6,9 +6,13 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineElectricFurnace;
import com.hbm.entity.particle.EntityGasFX;
import com.hbm.entity.particle.EntityOilSpillFX;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.handler.ShredderRecipeHandler;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.interfaces.IOilSource;
import com.hbm.inventory.MachineRecipes;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
@ -26,28 +30,34 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
public class TileEntityMachineOilWell extends TileEntity implements ISidedInventory, IConsumer {
public class TileEntityMachineOilWell extends TileEntity implements ISidedInventory, IConsumer, IOilSource {
private ItemStack slots[];
public int oil;
public int gas;
public int power;
public int warning;
public int warning2;
public static final int maxPower = 100000;
public static final int maxOil = 640;
public static final int maxGas = 640;
public int age = 0;
public int age2 = 0;
public List<IOilAcceptor> aclist = new ArrayList();
private static final int[] slots_top = new int[] {1};
private static final int[] slots_bottom = new int[] {2, 0};
private static final int[] slots_side = new int[] {0};
Random rand = new Random();
int age = 0;
private String customName;
public TileEntityMachineOilWell() {
slots = new ItemStack[3];
slots = new ItemStack[6];
}
@Override
@ -106,7 +116,7 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=128;
}
}
@ -157,6 +167,7 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
this.power = nbt.getInteger("powerTime");
this.oil = nbt.getInteger("oil");
this.gas = nbt.getInteger("gas");
this.age = nbt.getInteger("age");
slots = new ItemStack[getSizeInventory()];
@ -176,6 +187,7 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
super.writeToNBT(nbt);
nbt.setInteger("powerTime", power);
nbt.setInteger("oil", oil);
nbt.setInteger("gas", gas);
nbt.setInteger("age", age);
NBTTagList list = new NBTTagList();
@ -212,6 +224,10 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
return (oil * i) / maxOil;
}
public int getGasScaled(int i) {
return (gas * i) / maxGas;
}
public int getPowerScaled(int i) {
return (power * i) / maxPower;
}
@ -222,8 +238,13 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
int timer = 50;
age++;
age2++;
if(age >= timer)
age -= timer;
if(age2 >= 20)
age2 -= 20;
if(age2 == 9 || age2 == 19)
fillInit();
if(!worldObj.isRemote) {
@ -233,19 +254,35 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
slots[2] = new ItemStack(ModItems.canister_oil);
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1]= null;
slots[1] = null;
} else if(slots[2] != null && slots[2].getItem() == ModItems.canister_oil && slots[2].stackSize < slots[2].getMaxStackSize()) {
oil -= 10;
slots[2].stackSize++;
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1]= null;
slots[1] = null;
}
}
if(slots[3] != null && slots[3].getItem() == ModItems.gas_empty && gas >= 10) {
if(slots[4] == null) {
gas -= 10;
slots[4] = new ItemStack(ModItems.gas_full);
slots[3].stackSize--;
if(slots[3].stackSize <= 0)
slots[3] = null;
} else if(slots[4] != null && slots[4].getItem() == ModItems.gas_full && slots[4].stackSize < slots[4].getMaxStackSize()) {
gas -= 10;
slots[4].stackSize++;
slots[3].stackSize--;
if(slots[3].stackSize <= 0)
slots[3] = null;
}
}
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
if(power >= 10) {
if(power >= 100) {
//operation start
@ -279,13 +316,18 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
warning = 2;
break;
} else if((b == ModBlocks.ore_oil || b == ModBlocks.ore_oil_empty) && this.oil < this.maxOil) {
} else if((b == ModBlocks.ore_oil || b == ModBlocks.ore_oil_empty) && this.oil < this.maxOil && this.gas < this.maxGas) {
if(succ(this.xCoord, i, this.zCoord)) {
oil += 5;
if(oil > maxOil)
oil = maxOil;
gas += rand.nextInt(26) + 25;
if(gas > maxGas)
gas = maxGas;
ExplosionLarge.spawnOilSpills(worldObj, xCoord + 0.5F, yCoord + 5.5F, zCoord + 0.5F, 3);
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "game.neutral.swim.splash", 3.0F, 0.5F);
break;
} else {
@ -303,10 +345,23 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
//operation end
power -= 10;
power -= 100;
} else {
warning = 1;
}
warning2 = 0;
if(gas > 0) {
if(slots[5] != null && (slots[5].getItem() == ModItems.fuse || slots[5].getItem() == ModItems.screwdriver)) {
warning2 = 2;
gas -= 1;
if(gas <= 0)
gas = 0;
worldObj.spawnEntityInWorld(new EntityGasFX(worldObj, this.xCoord + 0.5F, this.yCoord + 6.5F, this.zCoord + 0.5F, 0.0, 0.0, 0.0));
} else {
warning2 = 1;
}
}
}
}
@ -417,4 +472,46 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
return 65536.0D;
}
@Override
public void fillInit() {
fill(this.xCoord + 2, this.yCoord, this.zCoord, getTact());
fill(this.xCoord - 2, this.yCoord, this.zCoord, getTact());
fill(this.xCoord, this.yCoord, this.zCoord + 2, getTact());
fill(this.xCoord, this.yCoord, this.zCoord - 2, getTact());
}
@Override
public void fill(int x, int y, int z, boolean newTact) {
Library.transmitOil(x, y, z, newTact, this, worldObj);
}
@Override
public boolean getTact() {
if (age2 >= 0 && age2 < 10) {
return true;
}
return false;
}
@Override
public int getSFill() {
return this.oil;
}
@Override
public void setSFill(int i) {
this.oil = i;
}
@Override
public List<IOilAcceptor> getList() {
return aclist;
}
@Override
public void clearList() {
this.aclist.clear();
}
}

View File

@ -0,0 +1,412 @@
package com.hbm.tileentity;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
public class TileEntityMachineRefinery extends TileEntity implements ISidedInventory, IConsumer, IOilAcceptor {
private ItemStack slots[];
public int power = 0;
public int oil = 0;
public int fuel = 0;
public int lubricant = 0;
public int diesel = 0;
public int kerosene = 0;
public int sulfur = 0;
public static final int maxPower = 100000;
public static final int maxOil = 640;
public static final int maxFuel = 64 * 100;
public static final int maxLubricant = 64 * 100;
public static final int maxDiesel = 64 * 100;
public static final int maxKerosene = 64 * 100;
public static final int maxSulfur = 100;
public int age = 0;
private static final int[] slots_top = new int[] { 1 };
private static final int[] slots_bottom = new int[] { 0, 2, 4, 6, 8, 10, 11};
private static final int[] slots_side = new int[] { 0, 3, 5, 7, 9 };
private String customName;
public TileEntityMachineRefinery() {
slots = new ItemStack[12];
}
@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.machineRefinery";
}
@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;
}
}
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 0 && stack.getItem() instanceof ItemBattery)
return true;
if(i == 1 && stack.getItem() == ModItems.canister_oil)
return true;
if(stack.getItem() == ModItems.canister_empty) {
if(i == 3)
return true;
if(i == 5)
return true;
if(i == 7)
return true;
if(i == 9)
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);
power = nbt.getInteger("power");
oil = nbt.getInteger("oil");
fuel = nbt.getInteger("fuel");
lubricant = nbt.getInteger("lubricant");
diesel = nbt.getInteger("diesel");
kerosene = nbt.getInteger("kerosene");
sulfur = nbt.getInteger("sulfur");
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("power", power);
nbt.setInteger("oil", oil);
nbt.setInteger("fuel", fuel);
nbt.setInteger("lubricant", lubricant);
nbt.setInteger("diesel", diesel);
nbt.setInteger("kerosene", kerosene);
nbt.setInteger("sulfur", sulfur);
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 p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@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) {
if(i == 0 && itemStack.getItem() instanceof ItemBattery)
if(itemStack.getItemDamage() == itemStack.getMaxDamage())
return true;
if(i == 2)
return true;
if(i == 4)
return true;
if(i == 6)
return true;
if(i == 8)
return true;
if(i == 10)
return true;
if(i == 11)
return true;
return false;
}
@Override
public void updateEntity() {
int timer = 20;
age++;
if(age >= timer)
age -= timer;
if (!worldObj.isRemote) {
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
if(slots[1] != null && slots[1].getItem() == ModItems.canister_oil && oil + 5 <= maxOil) {
if(slots[2] == null) {
oil += 5;
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
slots[2] = new ItemStack(ModItems.canister_empty);
}else if(slots[2] != null && slots[2].getItem() == ModItems.canister_empty && slots[2].stackSize < slots[2].getMaxStackSize()) {
oil += 5;
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
slots[2].stackSize++;
}
}
if(age == 0)
if(power >= 100 && oil - 5 >= 0 && fuel + 45 <= maxFuel &&
lubricant + 30 <= maxLubricant &&
diesel + 20 <= maxDiesel &&
kerosene + 5 <= maxKerosene) {
oil -= 5;
fuel += 45;
lubricant += 30;
diesel += 20;
kerosene += 5;
sulfur += 1;
power -= 100;
}
if(slots[3] != null && slots[3].getItem() == ModItems.canister_empty && fuel - 100 >= 0) {
if(slots[4] == null) {
slots[4] = new ItemStack(ModItems.canister_smear);
fuel -= 100;
slots[3].stackSize--;
if(slots[3].stackSize <= 0)
slots[3] = null;
} else if(slots[4] != null && slots[4].getItem() == ModItems.canister_smear && slots[4].stackSize < slots[4].getMaxStackSize()) {
slots[4].stackSize++;
fuel -= 100;
slots[3].stackSize--;
if(slots[3].stackSize <= 0)
slots[3] = null;
}
}
if(slots[5] != null && slots[5].getItem() == ModItems.canister_empty && lubricant - 100 >= 0) {
if(slots[6] == null) {
slots[6] = new ItemStack(ModItems.canister_canola);
lubricant -= 100;
slots[5].stackSize--;
if(slots[5].stackSize <= 0)
slots[5] = null;
} else if(slots[6] != null && slots[6].getItem() == ModItems.canister_canola && slots[6].stackSize < slots[6].getMaxStackSize()) {
slots[6].stackSize++;
lubricant -= 100;
slots[5].stackSize--;
if(slots[5].stackSize <= 0)
slots[5] = null;
}
}
if(slots[7] != null && slots[7].getItem() == ModItems.canister_empty && diesel - 100 >= 0) {
if(slots[8] == null) {
slots[8] = new ItemStack(ModItems.canister_fuel);
diesel -= 100;
slots[7].stackSize--;
if(slots[7].stackSize <= 0)
slots[7] = null;
} else if(slots[8] != null && slots[8].getItem() == ModItems.canister_fuel && slots[8].stackSize < slots[8].getMaxStackSize()) {
slots[8].stackSize++;
diesel -= 100;
slots[7].stackSize--;
if(slots[7].stackSize <= 0)
slots[7] = null;
}
}
if(slots[9] != null && slots[9].getItem() == ModItems.canister_empty && kerosene - 100 >= 0) {
if(slots[10] == null) {
slots[10] = new ItemStack(ModItems.canister_kerosene);
kerosene -= 100;
slots[9].stackSize--;
if(slots[9].stackSize <= 0)
slots[9] = null;
} else if(slots[10] != null && slots[10].getItem() == ModItems.canister_kerosene && slots[10].stackSize < slots[10].getMaxStackSize()) {
slots[10].stackSize++;
kerosene -= 100;
slots[9].stackSize--;
if(slots[9].stackSize <= 0)
slots[9] = null;
}
}
if(sulfur >= maxSulfur) {
if(slots[11] == null) {
slots[11] = new ItemStack(ModItems.sulfur);
sulfur -= maxSulfur;
} else if(slots[11] != null && slots[11].getItem() == ModItems.sulfur && slots[11].stackSize < slots[11].getMaxStackSize()) {
slots[11].stackSize++;
sulfur -= maxSulfur;
}
}
}
}
public int getPowerScaled(int i) {
return (power * i) / maxPower;
}
public int getOilScaled(int i) {
return (int)((oil * i) / maxOil);
}
public int getSmearScaled(int i) {
return (fuel * i) / maxFuel;
}
public int getLubricantScaled(int i) {
return (lubricant * i) / maxLubricant;
}
public int getDieselScaled(int i) {
return (diesel * i) / maxDiesel;
}
public int getKeroseneScaled(int i) {
return (kerosene * i) / maxKerosene;
}
@Override
public void setPower(int i) {
power = i;
}
@Override
public int getPower() {
return power;
}
@Override
public int getMaxPower() {
return maxPower;
}
@Override
public void setFill(int i) {
this.oil = i;
}
@Override
public int getFill() {
return this.oil;
}
@Override
public int getMaxFill() {
return this.maxOil;
}
}

View File

@ -0,0 +1,58 @@
package com.hbm.tileentity;
import java.util.ArrayList;
import java.util.List;
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil;
import com.hbm.interfaces.IConductor;
import com.hbm.interfaces.IDuct;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.lib.Library;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityOilDuct extends TileEntity implements IDuct {
public ForgeDirection[] connections = new ForgeDirection[6];
public List<UnionOfTileEntitiesAndBooleansForOil> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForOil>();
public TileEntityOilDuct() {
}
public void updateEntity() {
this.updateConnections();
}
public void updateConnections() {
if(Library.checkDuctConnectables(this.worldObj, xCoord, yCoord + 1, zCoord)) connections[0] = ForgeDirection.UP;
else connections[0] = null;
if(Library.checkDuctConnectables(this.worldObj, xCoord, yCoord - 1, zCoord)) connections[1] = ForgeDirection.DOWN;
else connections[1] = null;
if(Library.checkDuctConnectables(this.worldObj, xCoord, yCoord, zCoord - 1)) connections[2] = ForgeDirection.NORTH;
else connections[2] = null;
if(Library.checkDuctConnectables(this.worldObj, xCoord + 1, yCoord, zCoord)) connections[3] = ForgeDirection.EAST;
else connections[3] = null;
if(Library.checkDuctConnectables(this.worldObj, xCoord, yCoord, zCoord + 1)) connections[4] = ForgeDirection.SOUTH;
else connections[4] = null;
if(Library.checkDuctConnectables(this.worldObj, xCoord - 1, yCoord, zCoord)) connections[5] = ForgeDirection.WEST;
else connections[5] = null;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
}

View File

@ -0,0 +1,15 @@
package com.hbm.tileentity;
import java.util.ArrayList;
import java.util.List;
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil;
import com.hbm.interfaces.IDuct;
import net.minecraft.tileentity.TileEntity;
public class TileEntityOilDuctSolid extends TileEntity implements IDuct {
public List<UnionOfTileEntitiesAndBooleansForOil> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForOil>();
}