more half-finished crap
@ -775,8 +775,9 @@ public class ModBlocks {
|
||||
public static Block capacitor_tantalium;
|
||||
public static Block capacitor_schrabidate;
|
||||
|
||||
public static Block machine_coal_off;
|
||||
public static Block machine_coal_on;
|
||||
@Deprecated public static Block machine_coal_off;
|
||||
@Deprecated public static Block machine_coal_on;
|
||||
public static Block machine_wood_burner;
|
||||
|
||||
public static Block red_wire_coated;
|
||||
public static Block red_cable;
|
||||
@ -900,13 +901,13 @@ public class ModBlocks {
|
||||
public static Block pwr_controller;
|
||||
public static Block pwr_block;
|
||||
|
||||
public static Block reactor_element;
|
||||
public static Block reactor_control;
|
||||
public static Block reactor_hatch;
|
||||
public static Block reactor_ejector;
|
||||
public static Block reactor_inserter;
|
||||
public static Block reactor_conductor;
|
||||
public static Block reactor_computer;
|
||||
@Deprecated public static Block reactor_element;
|
||||
@Deprecated public static Block reactor_control;
|
||||
@Deprecated public static Block reactor_hatch;
|
||||
@Deprecated public static Block reactor_ejector;
|
||||
@Deprecated public static Block reactor_inserter;
|
||||
@Deprecated public static Block reactor_conductor;
|
||||
@Deprecated public static Block reactor_computer;
|
||||
|
||||
public static Block fusion_conductor;
|
||||
public static Block fusion_center;
|
||||
@ -1933,8 +1934,9 @@ public class ModBlocks {
|
||||
capacitor_tantalium = new MachineCapacitor(Material.iron, 150_000_000L, "tantalium").setBlockName("capacitor_tantalium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_tantalium");
|
||||
capacitor_schrabidate = new MachineCapacitor(Material.iron, 50_000_000_000L, "schrabidate").setBlockName("capacitor_schrabidate").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_schrabidate");
|
||||
|
||||
machine_coal_off = new MachineCoal(false).setBlockName("machine_coal_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_coal_on = new MachineCoal(true).setBlockName("machine_coal_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
machine_coal_off = new MachineCoal(false).setBlockName("machine_coal_off").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_copper");
|
||||
machine_coal_on = new MachineCoal(true).setBlockName("machine_coal_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_copper");
|
||||
machine_wood_burner = new MachineWoodBurner(Material.iron).setBlockName("machine_wood_burner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
machine_diesel = new MachineDiesel().setBlockName("machine_diesel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_combustion_engine = new MachineCombustionEngine().setBlockName("machine_combustion_engine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -2075,20 +2077,19 @@ public class ModBlocks {
|
||||
pwr_controller = new MachinePWRController(Material.iron).setBlockName("pwr_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pwr_casing_blank");
|
||||
pwr_block = new BlockPWR(Material.iron).setBlockName("pwr_block").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":pwr_block");
|
||||
|
||||
reactor_element = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_element_top", RefStrings.MODID + ":reactor_element_base").setBlockName("reactor_element").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_element_side");
|
||||
reactor_control = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_control_top").setBlockName("reactor_control").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_control_side");
|
||||
reactor_hatch = new ReactorHatch(Material.iron).setBlockName("reactor_hatch").setHardness(5.0F).setResistance(1000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_ejector = new BlockRotatable(Material.iron).setBlockName("reactor_ejector").setHardness(5.0F).setResistance(1000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_inserter = new BlockRotatable(Material.iron).setBlockName("reactor_inserter").setHardness(5.0F).setResistance(1000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_conductor_top").setBlockName("reactor_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_conductor_side");
|
||||
reactor_computer = new ReactorCore(Material.iron).setBlockName("reactor_computer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_computer");
|
||||
reactor_element = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_element_top", RefStrings.MODID + ":reactor_element_base").setBlockName("reactor_element").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":reactor_element_side");
|
||||
reactor_control = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_control_top").setBlockName("reactor_control").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":reactor_control_side");
|
||||
reactor_hatch = new ReactorHatch(Material.iron).setBlockName("reactor_hatch").setHardness(5.0F).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_ejector = new BlockRotatable(Material.iron).setBlockName("reactor_ejector").setHardness(5.0F).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_inserter = new BlockRotatable(Material.iron).setBlockName("reactor_inserter").setHardness(5.0F).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_conductor_top").setBlockName("reactor_conductor").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":reactor_conductor_side");
|
||||
reactor_computer = new ReactorCore(Material.iron).setBlockName("reactor_computer").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":reactor_computer");
|
||||
|
||||
fusion_conductor = new BlockToolConversionPillar(Material.iron).addVariant("_welded").setBlockName("fusion_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_conductor");
|
||||
fusion_center = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_center_top_alt").setBlockName("fusion_center").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_center_side_alt");
|
||||
fusion_motor = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_motor_top_alt").setBlockName("fusion_motor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_motor_side_alt");
|
||||
fusion_heater = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_heater_top").setBlockName("fusion_heater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_heater_side");
|
||||
fusion_hatch = new FusionHatch(Material.iron).setBlockName("fusion_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_hatch");
|
||||
//fusion_core = new FusionCore(Material.iron).setBlockName("fusion_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_core_side");
|
||||
plasma = new BlockPlasma(Material.iron).setBlockName("plasma").setHardness(5.0F).setResistance(6000.0F).setLightLevel(1.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":plasma");
|
||||
iter = new MachineITER().setBlockName("iter").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":iter");
|
||||
plasma_heater = new MachinePlasmaHeater().setBlockName("plasma_heater").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":plasma_heater");
|
||||
@ -3153,6 +3154,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_rtg_furnace_on, machine_rtg_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_coal_off, machine_coal_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_coal_on, machine_coal_on.getUnlocalizedName());
|
||||
register(machine_wood_burner);
|
||||
register(machine_diesel);
|
||||
register(machine_selenium);
|
||||
register(machine_combustion_engine);
|
||||
|
||||
@ -1,257 +1,21 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCoal;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@Deprecated
|
||||
public class MachineCoal extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepInventory;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
public MachineCoal(boolean blockState) {
|
||||
super(Material.iron);
|
||||
isActive = blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_coal_front_on" : ":machine_coal_front_off"));
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_coal_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_coal_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
if(itemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityMachineCoal)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityMachineCoal entity = (TileEntityMachineCoal) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineCoal();
|
||||
}
|
||||
|
||||
public static void updateBlockState(boolean isProcessing, World world, int x, int y, int z) {
|
||||
int i = world.getBlockMetadata(x, y, z);
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
keepInventory = true;
|
||||
|
||||
if(isProcessing)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_coal_on);
|
||||
}else{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_coal_off);
|
||||
}
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
if(entity != null) {
|
||||
entity.validate();
|
||||
world.setTileEntity(x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
TileEntityMachineCoal tileentityfurnace = (TileEntityMachineCoal)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
int l = p_149734_1_.getBlockMetadata(x, y, z);
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.0F + rand.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = rand.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (l == 4)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 5)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
src/main/java/com/hbm/blocks/machine/MachineWoodBurner.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineWoodBurner;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineWoodBurner extends BlockDummyable {
|
||||
|
||||
public MachineWoodBurner(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineWoodBurner();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
||||
return new TileEntityProxyCombo().inventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {1, 0, 1, 0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,8 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -23,72 +18,6 @@ public class ReactorCore extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineReactorLarge();
|
||||
return null;
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
TileEntityMachineReactorLarge tileentityfurnace = (TileEntityMachineReactorLarge)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 onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_)
|
||||
{
|
||||
if (!p_149723_1_.isRemote)
|
||||
{
|
||||
TileEntityMachineReactorLarge entity = (TileEntityMachineReactorLarge) p_149723_1_.getTileEntity(p_149723_2_, p_149723_3_, p_149723_4_);
|
||||
if(entity != null && entity.isLoaded)
|
||||
{
|
||||
entity.explode();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@ public class MachineTab extends CreativeTabs {
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
|
||||
if(ModBlocks.reactor_element != null)
|
||||
return Item.getItemFromBlock(ModBlocks.reactor_element);
|
||||
if(ModBlocks.pwr_controller != null)
|
||||
return Item.getItemFromBlock(ModBlocks.pwr_controller);
|
||||
|
||||
return Items.iron_pickaxe;
|
||||
}
|
||||
|
||||
@ -1,85 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCoal;
|
||||
|
||||
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 ContainerMachineCoal extends Container {
|
||||
|
||||
private TileEntityMachineCoal diFurnace;
|
||||
|
||||
public ContainerMachineCoal(InventoryPlayer invPlayer, TileEntityMachineCoal tedf) {
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 44, 53 - 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 116, 53));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 3, 44, 53));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 3) {
|
||||
if (!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(var5, 1, 2, false))
|
||||
{
|
||||
if (!this.mergeItemStack(var5, 0, 1, false))
|
||||
if (!this.mergeItemStack(var5, 2, 3, false))
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineCoal;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCoal;
|
||||
|
||||
public class GUIMachineCoal extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/GUICoal.png");
|
||||
private TileEntityMachineCoal diFurnace;
|
||||
|
||||
public GUIMachineCoal(InventoryPlayer invPlayer, TileEntityMachineCoal tedf) {
|
||||
super(new ContainerMachineCoal(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 69 - 52, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.maxPower);
|
||||
|
||||
String[] text = new String[] { "Power generation rate:",
|
||||
" 25 HE/t",
|
||||
" 500 HE/s",
|
||||
"Accepts all furnace fuels.",
|
||||
"(All fuels burn half as long in this generator",
|
||||
"as in a regular furnace)" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
|
||||
|
||||
String[] text1 = new String[] { "Water consumption rate:",
|
||||
" 1 mB/t",
|
||||
" 20 mB/s",
|
||||
"(Consumption rate is constant)" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
|
||||
|
||||
if(diFurnace.tank.getFill() <= 0) {
|
||||
|
||||
String[] text2 = new String[] { "Error: Water is required for",
|
||||
"the generator to function properly!" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
|
||||
}
|
||||
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 79, guiTop + 34, 18, 18, mouseX, mouseY, new String[] { String.valueOf((int)(Math.ceil((double)diFurnace.burnTime / 20D))) + "s"});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
//It's as horrifying as it is functional.
|
||||
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineCoal)
|
||||
diFurnace = (TileEntityMachineCoal) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
|
||||
|
||||
if(diFurnace.power > 0) {
|
||||
int i = (int)diFurnace.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
}
|
||||
|
||||
if(diFurnace.burnTime > 0)
|
||||
{
|
||||
drawTexturedModalRect(guiLeft + 79, guiTop + 34, 208, 0, 18, 18);
|
||||
}
|
||||
|
||||
if(diFurnace.tank.getFill() <= 0)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
|
||||
|
||||
diFurnace.tank.renderTank(guiLeft + 8, guiTop + 69, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -1169,8 +1169,7 @@ public class AssemblerRecipes {
|
||||
new OreDictStack(ANY_TAR.any(), 8),
|
||||
new ComparableStack(ModItems.catalyst_clay, 4),
|
||||
new ComparableStack(ModItems.coil_tungsten, 8),
|
||||
new ComparableStack(ModItems.tank_steel, 2),
|
||||
new ComparableStack(ModItems.inf_water_mk2, 2)
|
||||
new ComparableStack(ModItems.tank_steel, 2)
|
||||
}, 200);
|
||||
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_solidifier), new AStack[] {
|
||||
|
||||
@ -245,7 +245,7 @@ public class HbmChestContents {
|
||||
new WeightedRandomChestContent(ModItems.powder_niobium, 0, 1, 1, 1),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.fusion_conductor), 0, 2, 4, 5),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.fusion_heater), 0, 1, 3, 5),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.reactor_element), 0, 1, 2, 5),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.pwr_fuel), 0, 1, 2, 5),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.block_tungsten), 0, 3, 8, 5),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.red_wire_coated), 0, 4, 8, 5),
|
||||
new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.red_cable), 0, 8, 16, 5) };
|
||||
@ -418,26 +418,16 @@ public class HbmChestContents {
|
||||
String key;
|
||||
int pages;
|
||||
switch(rand.nextInt(10)) {
|
||||
case 0:
|
||||
key = "resignation_note"; pages = 3; break;
|
||||
case 1:
|
||||
key = "memo_stocks"; pages = 1; break;
|
||||
case 2:
|
||||
key = "memo_schrab_gsa"; pages = 2; break;
|
||||
case 3:
|
||||
key = "memo_schrab_rd"; pages = 4; break;
|
||||
case 4:
|
||||
key = "memo_schrab_nuke"; pages = 3; break;
|
||||
case 5:
|
||||
key = "bf_bomb_1"; pages = 4; break;
|
||||
case 6:
|
||||
key = "bf_bomb_2"; pages = 6; break;
|
||||
case 7:
|
||||
key = "bf_bomb_3"; pages = 6; break;
|
||||
case 8:
|
||||
key = "bf_bomb_4"; pages = 5; break;
|
||||
case 9:
|
||||
key = "bf_bomb_5"; pages = 9; break;
|
||||
case 0: key = "resignation_note"; pages = 3; break;
|
||||
case 1: key = "memo_stocks"; pages = 1; break;
|
||||
case 2: key = "memo_schrab_gsa"; pages = 2; break;
|
||||
case 3: key = "memo_schrab_rd"; pages = 4; break;
|
||||
case 4: key = "memo_schrab_nuke"; pages = 3; break;
|
||||
case 5: key = "bf_bomb_1"; pages = 4; break;
|
||||
case 6: key = "bf_bomb_2"; pages = 6; break;
|
||||
case 7: key = "bf_bomb_3"; pages = 6; break;
|
||||
case 8: key = "bf_bomb_4"; pages = 5; break;
|
||||
case 9: key = "bf_bomb_5"; pages = 9; break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -295,6 +295,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePumpSteam.class, new RenderPump());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePumpElectric.class, new RenderPump());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineArcWelder.class, new RenderArcWelder());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineWoodBurner.class, new RenderWoodBurner());
|
||||
//Foundry
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFoundryBasin.class, new RenderFoundry());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFoundryMold.class, new RenderFoundry());
|
||||
|
||||
@ -110,6 +110,9 @@ public class ResourceManager {
|
||||
public static final IModelCustom tower_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/tower_large.obj"));
|
||||
public static final IModelCustom condenser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/condenser.obj"));
|
||||
|
||||
//Wood burner
|
||||
public static final IModelCustom wood_burner = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/wood_burner.obj"));
|
||||
|
||||
//IGen
|
||||
public static final IModelCustom igen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/igen.obj"));
|
||||
|
||||
@ -476,6 +479,9 @@ public class ResourceManager {
|
||||
//Deuterium Tower
|
||||
public static final ResourceLocation deuterium_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/machine_deuterium_tower.png");
|
||||
|
||||
//Wood Burner
|
||||
public static final ResourceLocation wood_burner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/wood_burner.png");
|
||||
|
||||
//IGen
|
||||
public static final ResourceLocation igen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen.png");
|
||||
public static final ResourceLocation igen_rotor = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen_rotor.png");
|
||||
|
||||
@ -13,11 +13,6 @@ import com.hbm.tileentity.machine.TileEntityAMSLimiter;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCoal;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge.ReactorFuelType;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
@ -113,11 +108,6 @@ public class AuxGaugePacket implements IMessage {
|
||||
if(m.id == 1)
|
||||
selenium.powerCap = m.value;
|
||||
}
|
||||
if (te instanceof TileEntityMachineDiesel) {
|
||||
TileEntityMachineDiesel selenium = (TileEntityMachineDiesel)te;
|
||||
|
||||
selenium.powerCap = m.value;
|
||||
}
|
||||
if (te instanceof TileEntityBomber) {
|
||||
TileEntityBomber bomber = (TileEntityBomber)te;
|
||||
|
||||
@ -136,18 +126,6 @@ public class AuxGaugePacket implements IMessage {
|
||||
if(m.id == 1)
|
||||
boiler.burnTime = m.value;
|
||||
}
|
||||
if (te instanceof TileEntityMachineCoal) {
|
||||
TileEntityMachineCoal coalgen = (TileEntityMachineCoal)te;
|
||||
|
||||
if(m.id == 0)
|
||||
coalgen.burnTime = m.value;
|
||||
}
|
||||
if (te instanceof TileEntityMachineElectricFurnace) {
|
||||
TileEntityMachineElectricFurnace furn = (TileEntityMachineElectricFurnace)te;
|
||||
|
||||
if(m.id == 0)
|
||||
furn.progress = m.value;
|
||||
}
|
||||
if (te instanceof TileEntityMachineArcFurnace) {
|
||||
TileEntityMachineArcFurnace furn = (TileEntityMachineArcFurnace)te;
|
||||
|
||||
@ -165,24 +143,6 @@ public class AuxGaugePacket implements IMessage {
|
||||
|
||||
nuke.primed = m.value == 1;
|
||||
}
|
||||
if (te instanceof TileEntityMachineReactorLarge) {
|
||||
TileEntityMachineReactorLarge reactor = (TileEntityMachineReactorLarge)te;
|
||||
|
||||
if(m.id == 0)
|
||||
reactor.rods = m.value;
|
||||
if(m.id == 1)
|
||||
reactor.coreHeat = m.value;
|
||||
if(m.id == 2)
|
||||
reactor.hullHeat = m.value;
|
||||
if(m.id == 3)
|
||||
reactor.size = m.value;
|
||||
if(m.id == 4)
|
||||
reactor.fuel = m.value;
|
||||
if(m.id == 5)
|
||||
reactor.waste = m.value;
|
||||
if(m.id == 6)
|
||||
reactor.type = ReactorFuelType.getEnum(m.value);
|
||||
}
|
||||
if (te instanceof TileEntityCompactLauncher) {
|
||||
TileEntityCompactLauncher launcher = (TileEntityCompactLauncher)te;
|
||||
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderWoodBurner extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(tile.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
GL11.glTranslated(-0.5, 0, -0.5);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.wood_burner_tex);
|
||||
ResourceManager.wood_burner.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_wood_burner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase( ) {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -4, 0);
|
||||
GL11.glScaled(3.5, 3.5, 3.5);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.wood_burner_tex);
|
||||
ResourceManager.wood_burner.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -67,6 +67,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineBattery.class, "tileentity_battery");
|
||||
put(TileEntityCapacitor.class, "tileentity_capacitor");
|
||||
put(TileEntityMachineCoal.class, "tileentity_coal");
|
||||
put(TileEntityMachineWoodBurner.class, "tileentity_wood_burner");
|
||||
put(TileEntityRedBarrel.class, "tileentity_barrel");
|
||||
put(TileEntityYellowBarrel.class, "tileentity_nukebarrel");
|
||||
put(TileEntityLaunchPad.class, "tileentity_launch1");
|
||||
|
||||
@ -1,265 +1,33 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.blocks.machine.MachineCoal;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.container.ContainerMachineCoal;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineCoal;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCoal extends TileEntityMachinePolluting implements ISidedInventory, IEnergyGenerator, IFluidStandardTransceiver, IConfigurableMachine, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public int burnTime;
|
||||
public static final long maxPower = 100000;
|
||||
public FluidTank tank;
|
||||
|
||||
private static final int[] slots_top = new int[] {1};
|
||||
private static final int[] slots_bottom = new int[] {0, 2};
|
||||
private static final int[] slots_side = new int[] {0, 2};
|
||||
|
||||
/* CONFIGURABLE CONSTANTS */
|
||||
public static int waterCap = 5000;
|
||||
public static int genRate = 25;
|
||||
public static double fuelMod = 0.5D;
|
||||
@Deprecated
|
||||
public class TileEntityMachineCoal extends TileEntityMachineBase implements ISidedInventory {
|
||||
|
||||
public TileEntityMachineCoal() {
|
||||
super(4, 50);
|
||||
tank = new FluidTank(Fluids.WATER, waterCap, 0);
|
||||
super(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineCoal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
if(i == 0)
|
||||
if(FluidContainerRegistry.getFluidContent(stack, Fluids.WATER) > 0)
|
||||
return true;
|
||||
if(i == 2)
|
||||
if(stack.getItem() instanceof IBatteryItem)
|
||||
return true;
|
||||
if(i == 1)
|
||||
if(TileEntityFurnace.getItemBurnTime(stack) > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.power = nbt.getLong("powerTime");
|
||||
tank.readFromNBT(nbt, "water");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("powerTime", power);
|
||||
tank.writeToNBT(nbt, "water");
|
||||
}
|
||||
|
||||
@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)
|
||||
if(itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty || itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty)
|
||||
return true;
|
||||
if(i == 2)
|
||||
if (itemStack.getItem() instanceof IBatteryItem && ((IBatteryItem)itemStack.getItem()).getCharge(itemStack) == ((IBatteryItem)itemStack.getItem()).getMaxCharge())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
this.sendSmoke(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
this.subscribeToAllAround(Fluids.WATER, this);
|
||||
|
||||
//Water
|
||||
tank.loadTank(0, 3, slots);
|
||||
|
||||
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
//Battery Item
|
||||
power = Library.chargeItemsFromTE(slots, 2, power, maxPower);
|
||||
|
||||
boolean trigger = true;
|
||||
|
||||
if(isItemValid() && this.burnTime == 0) {
|
||||
trigger = false;
|
||||
}
|
||||
|
||||
if(trigger) {
|
||||
MachineCoal.updateBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
generate();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("burnTime", burnTime);
|
||||
tank.writeToNBT(data, "tank");
|
||||
this.networkPack(data, 15);
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
EntityItem drop = new EntityItem(worldObj);
|
||||
drop.setEntityItemStack(new ItemStack(ModBlocks.machine_wood_burner));
|
||||
drop.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
worldObj.spawnEntityInWorld(drop);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
this.burnTime = nbt.getInteger("burnTime");
|
||||
this.tank.readFromNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
public void generate() {
|
||||
|
||||
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0 && burnTime <= 0)
|
||||
{
|
||||
burnTime = (int) (TileEntityFurnace.getItemBurnTime(slots[1]) * fuelMod);
|
||||
slots[1].stackSize -= 1;
|
||||
if(slots[1].stackSize == 0)
|
||||
{
|
||||
if(slots[1].getItem().getContainerItem() != null)
|
||||
slots[1] = new ItemStack(slots[1].getItem().getContainerItem());
|
||||
else
|
||||
slots[1] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(burnTime > 0) {
|
||||
burnTime--;
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
|
||||
|
||||
if(tank.getFill() > 0) {
|
||||
tank.setFill(tank.getFill() - 1);
|
||||
|
||||
power += genRate;
|
||||
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isItemValid() {
|
||||
|
||||
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return this.getSmokeTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigName() {
|
||||
return "combustiongen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readIfPresent(JsonObject obj) {
|
||||
waterCap = IConfigurableMachine.grab(obj, "I:waterCapacity", waterCap);
|
||||
genRate = IConfigurableMachine.grab(obj, "I:powerGen", genRate);
|
||||
fuelMod = IConfigurableMachine.grab(obj, "D:burnTimeMod", fuelMod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeConfig(JsonWriter writer) throws IOException {
|
||||
writer.name("I:waterCapacity").value(waterCap);
|
||||
writer.name("I:powerGen").value(genRate);
|
||||
writer.name("D:burnTimeMod").value(fuelMod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerMachineCoal(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineCoal(player.inventory, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,112 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.module.ModuleBurnTime;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineWoodBurner extends TileEntityMachinePolluting implements IFluidStandardTransceiver, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100_000;
|
||||
public int burnTime;
|
||||
public int maxBurnTime;
|
||||
public boolean liquidBurn = false;
|
||||
public boolean isOn = false;
|
||||
|
||||
public FluidTank tank;
|
||||
|
||||
public static ModuleBurnTime burnModule = new ModuleBurnTime().setLogTimeMod(3).setWoodTimeMod(2);
|
||||
|
||||
public int ashLevelWood;
|
||||
public int ashLevelCoal;
|
||||
public int ashLevelMisc;
|
||||
|
||||
public TileEntityMachineWoodBurner() {
|
||||
super(6, 60);
|
||||
this.tank = new FluidTank(Fluids.WOODOIL, 16_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineWoodBurner";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(!liquidBurn) {
|
||||
|
||||
if(this.burnTime <= 0) {
|
||||
|
||||
if(slots[0] != null) {
|
||||
int burn = this.burnModule.getBurnTime(slots[0]);
|
||||
if(burn > 0) {
|
||||
this.maxBurnTime = burn;
|
||||
this.decrStackSize(0, 1);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
} else if(this.power < this.maxPower){
|
||||
this.burnTime--;
|
||||
this.power += 100;
|
||||
if(power > maxPower) this.power = this.maxPower;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(this.power < this.maxPower && tank.getFill() > 0) {
|
||||
FT_Flammable trait = tank.getTankType().getTrait(FT_Flammable.class);
|
||||
|
||||
if(trait != null) {
|
||||
this.power += trait.getHeatEnergy() / 2L;
|
||||
tank.setFill(tank.getFill() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
this.networkPack(data, 25);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] {tank, smoke, smoke_leaded, smoke_poison};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return this.getSmokeTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
}
|
||||
}
|
||||
@ -802,9 +802,9 @@ public class BunkerComponents {
|
||||
default:
|
||||
fillWithBlocks(world, box, 6, 1, 1, 6, 3, 1, ModBlocks.deco_pipe_framed_rusted);
|
||||
for(int i = 7; i <= 9; i += 2) {
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.machine_coal_off, decoMetaN, i, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, decoMetaN, i, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.steel_beam, 2, i, 2, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.machine_coal_off, decoMetaN, i, 3, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, decoMetaN, i, 3, 1, box);
|
||||
}
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 8, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored_ext, 5, 8, 2, 1, box);
|
||||
@ -853,18 +853,18 @@ public class BunkerComponents {
|
||||
fillWithBlocks(world, box, i, 3, 2, i, 3, 4, ModBlocks.deco_lead);
|
||||
}
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored_ext, 5, 8, 1, 4, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reactor_computer, 0, 8, 2, 4, box);
|
||||
placeBlockAtCurrentPosition(world, Blocks.redstone_lamp, 0, 8, 2, 4, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored_ext, 5, 8, 3, 4, box);
|
||||
placeLever(world, box, 3, rand.nextBoolean(), 8, 2, 5);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reactor_element, 0, 8, 1, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reactor_control, 0, 8, 2, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reactor_element, 0, 8, 3, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.pwr_fuel, 0, 8, 1, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.pwr_control, 0, 8, 2, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.pwr_fuel, 0, 8, 3, 3, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.block_copper, 0, 8, 1, 2, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.block_lead, 0, 8, 2, 2, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.block_copper, 0, 8, 3, 2, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reactor_conductor, 0, 8, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.pwr_channel, 0, 8, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.machine_turbine, 0, 8, 2, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.reactor_conductor, 0, 8, 3, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.pwr_channel, 0, 8, 3, 1, box);
|
||||
fillWithBlocks(world, box, 9, 1, 1, 9, 3, 1, ModBlocks.deco_steel);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 10, 1, 1, box);
|
||||
placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 10, 2, 1, box);
|
||||
|
||||
1112
src/main/resources/assets/hbm/models/machines/wood_burner.obj
Normal file
|
Before Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 481 B |
|
Before Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 391 B |
|
Before Width: | Height: | Size: 578 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 9.8 KiB |