new igen GUI, gauge util
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
BIN
src/main/java/assets/hbm/textures/gui/gauges/large_wide.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/java/assets/hbm/textures/gui/gauges/small_bar.png
Normal file
|
After Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
src/main/java/assets/hbm/textures/gui/gauges/small_wide.png
Normal file
|
After Width: | Height: | Size: 582 B |
BIN
src/main/java/assets/hbm/textures/gui/generators/gui_igen.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 295 B |
@ -1,3 +1,5 @@
|
||||
{
|
||||
"animation": {}
|
||||
}
|
||||
"animation": {
|
||||
"frametime": 2
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,34 +1,17 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.MultiblockHandler;
|
||||
import com.hbm.interfaces.IMultiblock;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
|
||||
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.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineIGenerator extends BlockContainer implements IMultiblock {
|
||||
public class MachineIGenerator extends BlockDummyable {
|
||||
|
||||
public MachineIGenerator(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
@ -37,46 +20,8 @@ public class MachineIGenerator extends BlockContainer implements IMultiblock {
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineIGenerator();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
//front
|
||||
ret.add(new ItemStack(ModItems.ingot_steel, 3));
|
||||
ret.add(new ItemStack(ModItems.plate_steel, 6));
|
||||
ret.add(new ItemStack(ModItems.tank_steel, 4));
|
||||
ret.add(new ItemStack(ModItems.turbine_titanium, 1));
|
||||
ret.add(new ItemStack(ModItems.wire_red_copper, 6));
|
||||
ret.add(new ItemStack(ModItems.wire_gold, 4));
|
||||
|
||||
//body
|
||||
ret.add(new ItemStack(ModItems.wire_gold, 42));
|
||||
ret.add(new ItemStack(Items.iron_ingot, 6));
|
||||
ret.add(new ItemStack(ModItems.ingot_steel, 3));
|
||||
|
||||
ret.add(new ItemStack(ModItems.plate_iron, 1));
|
||||
ret.add(new ItemStack(ModItems.wire_gold, 42));
|
||||
ret.add(new ItemStack(ModItems.ingot_steel, 3));
|
||||
|
||||
//rotor
|
||||
ret.add(new ItemStack(ModItems.wire_gold, 42));
|
||||
ret.add(new ItemStack(Items.iron_ingot, 6));
|
||||
ret.add(new ItemStack(ModItems.ingot_steel, 3));
|
||||
|
||||
ret.add(new ItemStack(ModItems.ingot_steel, 6));
|
||||
ret.add(new ItemStack(ModItems.board_copper, 4));
|
||||
ret.add(new ItemStack(ModItems.wire_gold, 8));
|
||||
ret.add(new ItemStack(ModBlocks.red_wire_coated, 2));
|
||||
ret.add(new ItemStack(ModItems.pedestal_steel, 2));
|
||||
ret.add(new ItemStack(ModItems.circuit_copper, 4));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
@ -91,128 +36,6 @@ public class MachineIGenerator extends BlockContainer implements IMultiblock {
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@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, 5, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.iGenDimensionEast)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.iGenDimensionEast, ModBlocks.dummy_block_igenerator);
|
||||
|
||||
//
|
||||
DummyBlockIGenerator.safeBreak = true;
|
||||
world.setBlock(x + 2, y, z, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te = world.getTileEntity(x + 2, y, z);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 3, y, z, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te2 = world.getTileEntity(x - 3, y, z);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockIGenerator.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
if (i == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.iGenDimensionSouth)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.iGenDimensionSouth, ModBlocks.dummy_block_igenerator);
|
||||
|
||||
//
|
||||
DummyBlockIGenerator.safeBreak = true;
|
||||
world.setBlock(x, y, z + 2, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te = world.getTileEntity(x, y, z + 2);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x, y, z - 3, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te2 = world.getTileEntity(x, y, z - 3);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockIGenerator.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
if (i == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.iGenDimensionWest)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.iGenDimensionWest, ModBlocks.dummy_block_igenerator);
|
||||
|
||||
//
|
||||
DummyBlockIGenerator.safeBreak = true;
|
||||
world.setBlock(x + 3, y, z, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te = world.getTileEntity(x + 3, y, z);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 2, y, z, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te2 = world.getTileEntity(x - 2, y, z);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockIGenerator.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
if (i == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.iGenDimensionNorth)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.iGenDimensionNorth, ModBlocks.dummy_block_igenerator);
|
||||
|
||||
//
|
||||
DummyBlockIGenerator.safeBreak = true;
|
||||
world.setBlock(x, y, z + 3, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te = world.getTileEntity(x, y, z + 3);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x, y, z - 2, ModBlocks.dummy_port_igenerator);
|
||||
TileEntity te2 = world.getTileEntity(x, y, z - 2);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockIGenerator.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
@ -221,65 +44,20 @@ public class MachineIGenerator extends BlockContainer implements IMultiblock {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentText("The IGen has been retired, you may break it for recycling."));
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_industrial_generator, world, x, y, z);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private static boolean keepInventory;
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
public int[] getDimensions() {
|
||||
return new int [] {0,0,0,0,0,0};
|
||||
}
|
||||
|
||||
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 int getOffset() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,12 +126,6 @@ public class MachineRecipes {
|
||||
List<GasCentOutput> list = new ArrayList();
|
||||
|
||||
switch(fluid) {
|
||||
case LAVA:
|
||||
list.add(new GasCentOutput(1, new ItemStack(ModBlocks.gravel_obsidian), 1));
|
||||
list.add(new GasCentOutput(2, new ItemStack(Blocks.gravel), 2));
|
||||
list.add(new GasCentOutput(1, new ItemStack(ModItems.powder_lithium), 3));
|
||||
list.add(new GasCentOutput(1, new ItemStack(ModItems.powder_iron, 2), 4));
|
||||
return list;
|
||||
case UF6:
|
||||
list.add(new GasCentOutput(4, new ItemStack(ModItems.nugget_u238), 1));
|
||||
list.add(new GasCentOutput(4, new ItemStack(ModItems.nugget_u238), 2));
|
||||
|
||||
@ -12,69 +12,58 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerIGenerator extends Container {
|
||||
|
||||
private TileEntityMachineIGenerator diFurnace;
|
||||
|
||||
private int torque;
|
||||
private int heat;
|
||||
private int water;
|
||||
private int lubricant;
|
||||
private int fuel;
|
||||
private int burn;
|
||||
private TileEntityMachineIGenerator igen;
|
||||
|
||||
public ContainerIGenerator(InventoryPlayer invPlayer, TileEntityMachineIGenerator tedf) {
|
||||
public ContainerIGenerator(InventoryPlayer invPlayer, TileEntityMachineIGenerator te) {
|
||||
|
||||
diFurnace = tedf;
|
||||
igen = te;
|
||||
|
||||
//Multi Purpose Slots
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 26, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 44, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 62, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 80, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 98, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 8, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 26, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 8, 44, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 62, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 10, 80, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 11, 98, 36));
|
||||
//Solid Fuel Slot
|
||||
this.addSlotToContainer(new Slot(tedf, 12, 62, 108));
|
||||
//Fluid Slot
|
||||
this.addSlotToContainer(new Slot(tedf, 13, 98, 108));
|
||||
//Container Slot
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 14, 98, 72));
|
||||
//Battery Slot
|
||||
this.addSlotToContainer(new Slot(tedf, 15, 152, 108));
|
||||
//Solid Fuel
|
||||
this.addSlotToContainer(new Slot(te, 0, 5, 27));
|
||||
//RTG In
|
||||
this.addSlotToContainer(new Slot(te, 1, 41, 63));
|
||||
//RTG Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 2, 41, 99));
|
||||
//Thermo Slots
|
||||
this.addSlotToContainer(new Slot(te, 3, 68, 36));
|
||||
this.addSlotToContainer(new Slot(te, 4, 86, 36));
|
||||
this.addSlotToContainer(new Slot(te, 5, 104, 36));
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(te, 6, 86, 108));
|
||||
//Water In
|
||||
this.addSlotToContainer(new Slot(te, 7, 131, 27));
|
||||
//Water Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 8, 167, 27));
|
||||
//Fuel In
|
||||
this.addSlotToContainer(new Slot(te, 9, 131, 63));
|
||||
//Fuel Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 10, 167, 63));
|
||||
//ID In
|
||||
this.addSlotToContainer(new Slot(te, 11, 131, 81));
|
||||
//ID Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 12, 167, 81));
|
||||
//Lube In
|
||||
this.addSlotToContainer(new Slot(te, 13, 131, 99));
|
||||
//Lube Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 14, 167, 99));
|
||||
|
||||
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));
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 14 + j * 18, 84 + i * 18 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 14 + i * 18, 142 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: use smart shift click magic
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.torque);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.diFurnace.heat);
|
||||
crafting.sendProgressBarUpdate(this, 3, this.diFurnace.water);
|
||||
crafting.sendProgressBarUpdate(this, 4, this.diFurnace.lubricant);
|
||||
crafting.sendProgressBarUpdate(this, 5, this.diFurnace.fuel);
|
||||
crafting.sendProgressBarUpdate(this, 6, this.diFurnace.burn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
@ -83,8 +72,8 @@ public class ContainerIGenerator extends Container {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 15) {
|
||||
if (!this.mergeItemStack(var5, 16, this.inventorySlots.size(), true))
|
||||
if (par2 <= 14) {
|
||||
if (!this.mergeItemStack(var5, 15, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -107,76 +96,6 @@ public class ContainerIGenerator extends Container {
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.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.torque != this.diFurnace.torque)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 1, this.diFurnace.torque);
|
||||
}
|
||||
if(this.heat != this.diFurnace.heat)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 2, this.diFurnace.heat);
|
||||
}
|
||||
if(this.water != this.diFurnace.water)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 3, this.diFurnace.water);
|
||||
}
|
||||
if(this.lubricant != this.diFurnace.lubricant)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 4, this.diFurnace.lubricant);
|
||||
}
|
||||
if(this.fuel != this.diFurnace.fuel)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 5, this.diFurnace.fuel);
|
||||
}
|
||||
if(this.burn != this.diFurnace.burn)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 6, this.diFurnace.burn);
|
||||
}
|
||||
}
|
||||
|
||||
this.torque = this.diFurnace.torque;
|
||||
this.heat = this.diFurnace.heat;
|
||||
this.water = this.diFurnace.water;
|
||||
this.lubricant = this.diFurnace.lubricant;
|
||||
this.fuel = this.diFurnace.fuel;
|
||||
this.burn = this.diFurnace.burn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if(i == 1)
|
||||
{
|
||||
diFurnace.torque = j;
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
diFurnace.heat = j;
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
diFurnace.water = j;
|
||||
}
|
||||
if(i == 4)
|
||||
{
|
||||
diFurnace.lubricant = j;
|
||||
}
|
||||
if(i == 5)
|
||||
{
|
||||
diFurnace.fuel = j;
|
||||
}
|
||||
if(i == 6)
|
||||
{
|
||||
diFurnace.burn = j;
|
||||
}
|
||||
return igen.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerIGenerator;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.render.util.GaugeUtil.Gauge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -13,22 +15,20 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIIGenerator extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_igenerator.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_igen.png");
|
||||
private TileEntityMachineIGenerator diFurnace;
|
||||
|
||||
public GUIIGenerator(InventoryPlayer invPlayer, TileEntityMachineIGenerator tedf) {
|
||||
super(new ContainerIGenerator(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.xSize = 188;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 106 - 88, 16, 88, diFurnace.power, diFurnace.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,48 +44,20 @@ public class GUIIGenerator extends GuiInfoContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int[] pellets = new int[] {0,1,0,1,0,0,0,1,2,0,0,2};
|
||||
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
|
||||
drawTexturedModalRect(guiLeft + 6, guiTop + 106 - 4 * i, 188, 9 * pellets[i], 14, 9);
|
||||
}
|
||||
|
||||
if(diFurnace.fuel > 0)
|
||||
{
|
||||
int j = diFurnace.getFuelScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 122, guiTop + 106 - j, 176, 88 - j, 4, j);
|
||||
}
|
||||
if(diFurnace.lubricant > 0)
|
||||
{
|
||||
int j = diFurnace.getLubeScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 128, guiTop + 106 - j, 180, 88 - j, 4, j);
|
||||
}
|
||||
if(diFurnace.water > 0)
|
||||
{
|
||||
int j = diFurnace.getWaterScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 134, guiTop + 106 - j, 184, 88 - j, 4, j);
|
||||
}
|
||||
if(diFurnace.heat > 0)
|
||||
{
|
||||
int j = diFurnace.getHeatScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 140, guiTop + 106 - j, 188, 88 - j, 4, j);
|
||||
}
|
||||
if(diFurnace.torque > 0)
|
||||
{
|
||||
int j = diFurnace.getTorqueScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 146, guiTop + 106 - j, 192, 88 - j, 4, j);
|
||||
}
|
||||
if(diFurnace.power > 0)
|
||||
{
|
||||
int j = (int)diFurnace.getPowerScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 106 - j, 196, 88 - j, 16, j);
|
||||
}
|
||||
if(diFurnace.burn > 0)
|
||||
{
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 90, 212, 0, 18, 18);
|
||||
}
|
||||
if(diFurnace.getHeatScaled(100) < 90 && diFurnace.fuel > 0) {
|
||||
drawTexturedModalRect(guiLeft + 62 + 18 + 18, guiTop + 90 - 18 - 18, 212, 0, 18, 18);
|
||||
}
|
||||
if(diFurnace.water <= 0) {
|
||||
drawTexturedModalRect(guiLeft + 12, guiTop + 59, 230, 0, 6, 6);
|
||||
} else {
|
||||
drawTexturedModalRect(guiLeft + 12, guiTop + 59 + 24, 230, 0, 6, 6);
|
||||
}
|
||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 20, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 56, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 92, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||
|
||||
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 26, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 62, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 98, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.sound.SoundLoopAssembler;
|
||||
import com.hbm.sound.SoundLoopBroadcaster;
|
||||
import com.hbm.sound.SoundLoopCentrifuge;
|
||||
import com.hbm.sound.SoundLoopChemplant;
|
||||
import com.hbm.sound.SoundLoopIGen;
|
||||
import com.hbm.sound.SoundLoopMiner;
|
||||
import com.hbm.sound.SoundLoopTurbofan;
|
||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
||||
@ -12,7 +12,6 @@ import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemplant;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineMiningDrill;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
||||
|
||||
@ -26,6 +25,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@Spaghetti("this class should be destroyed")
|
||||
public class LoopedSoundPacket implements IMessage {
|
||||
|
||||
int x;
|
||||
@ -102,18 +102,6 @@ public class LoopedSoundPacket implements IMessage {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopAssembler(new ResourceLocation("hbm:block.assemblerOperate"), te));
|
||||
}
|
||||
|
||||
if (te != null && te instanceof TileEntityMachineIGenerator) {
|
||||
|
||||
boolean flag = true;
|
||||
for(int i = 0; i < SoundLoopIGen.list.size(); i++) {
|
||||
if(SoundLoopIGen.list.get(i).getTE() == te && !SoundLoopIGen.list.get(i).isDonePlaying())
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineIGenerator)te).torque > 0)
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopIGen(new ResourceLocation("hbm:block.igeneratorOperate"), te));
|
||||
}
|
||||
|
||||
if (te != null && te instanceof TileEntityMachineTurbofan) {
|
||||
|
||||
boolean flag = true;
|
||||
|
||||
@ -19,8 +19,6 @@ public class PacketDispatcher {
|
||||
wrapper.registerMessage(TEPylonSenderPacket.Handler.class, TEPylonSenderPacket.class, i++, Side.CLIENT);
|
||||
//Resets connection list in client-sided pole rendering
|
||||
wrapper.registerMessage(TEPylonDestructorPacket.Handler.class, TEPylonDestructorPacket.class, i++, Side.CLIENT);
|
||||
//Flywheel rotation for industrial generator rendering
|
||||
wrapper.registerMessage(TEIGeneratorPacket.Handler.class, TEIGeneratorPacket.class, i++, Side.CLIENT);
|
||||
//Machine type for marker rendering
|
||||
wrapper.registerMessage(TEStructurePacket.Handler.class, TEStructurePacket.class, i++, Side.CLIENT);
|
||||
//Mining drill rotation for rendering
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TEIGeneratorPacket implements IMessage {
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
float spin;
|
||||
int torque;
|
||||
|
||||
public TEIGeneratorPacket()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TEIGeneratorPacket(int x, int y, int z, float spin, int torque)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.spin = spin;
|
||||
this.torque = torque;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
spin = buf.readFloat();
|
||||
torque = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeFloat(spin);
|
||||
buf.writeInt(torque);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<TEIGeneratorPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(TEIGeneratorPacket m, MessageContext ctx) {
|
||||
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
|
||||
|
||||
if (te != null && te instanceof TileEntityMachineIGenerator) {
|
||||
|
||||
TileEntityMachineIGenerator gen = (TileEntityMachineIGenerator) te;
|
||||
gen.rotation = m.spin;
|
||||
gen.torque = m.torque;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,94 +2,111 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.BeamPronter;
|
||||
import com.hbm.render.util.BeamPronter.EnumBeamType;
|
||||
import com.hbm.render.util.BeamPronter.EnumWaveType;
|
||||
|
||||
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;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderIGenerator extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation body = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/generator_body.obj");
|
||||
private static final ResourceLocation rotor = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/generator_rotor.obj");
|
||||
private IModelCustom genModel;
|
||||
private IModelCustom rotModel;
|
||||
private ResourceLocation genTexture;
|
||||
private ResourceLocation rotTexture;
|
||||
|
||||
public RenderIGenerator()
|
||||
{
|
||||
genModel = AdvancedModelLoader.loadModel(body);
|
||||
rotModel = AdvancedModelLoader.loadModel(rotor);
|
||||
//gadgetTexture = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_.png");
|
||||
genTexture = new ResourceLocation(RefStrings.MODID, "textures/models/textureIGen.png");
|
||||
rotTexture = new ResourceLocation(RefStrings.MODID, "textures/models/textureIGenRotor.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
public void renderTileEntityAt(TileEntity te, 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);
|
||||
switch(tileEntity.getBlockMetadata())
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
case 4:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
case 3:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
case 5:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
}
|
||||
|
||||
bindTexture(genTexture);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
genModel.renderAll();
|
||||
|
||||
bindTexture(ResourceManager.igen_tex);
|
||||
ResourceManager.igen.renderPart("Base");
|
||||
|
||||
float angle = System.currentTimeMillis() * 1 % 360;
|
||||
float px = 0.0625F;
|
||||
float sine = (float) Math.sin(Math.toRadians(angle));
|
||||
float cosine = (float) Math.cos(Math.toRadians(angle));
|
||||
float armAng = 22.5F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 3.5, 0);
|
||||
GL11.glRotatef(angle, 0, 0, 1);
|
||||
GL11.glTranslated(0, -3.5, 0);
|
||||
|
||||
bindTexture(ResourceManager.igen_rotor);
|
||||
ResourceManager.igen.renderPart("Rotor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderTileEntityAt2(tileEntity, x, y, z, f);
|
||||
}
|
||||
|
||||
public void renderTileEntityAt2(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
switch(tileEntity.getBlockMetadata())
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
case 4:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
case 3:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
case 5:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.5D, 0.0D, 0.0D); break;
|
||||
}
|
||||
|
||||
GL11.glRotatef(((TileEntityMachineIGenerator)tileEntity).rotation, 1F, 0F, 0F);
|
||||
GL11.glTranslated(0, 3.5, px * 5);
|
||||
GL11.glRotatef(angle, -1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_cog);
|
||||
ResourceManager.igen.renderPart("CogLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 3.5, px * 5);
|
||||
GL11.glRotatef(angle, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_cog);
|
||||
ResourceManager.igen.renderPart("CogRight");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0, cosine * 0.8725 - 1);
|
||||
|
||||
bindTexture(ResourceManager.igen_pistons);
|
||||
ResourceManager.igen.renderPart("Pistons");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, sine * 0.55, cosine * 0.8725 - 1.125);
|
||||
|
||||
GL11.glTranslated(0, 3.5, px * 6.5);
|
||||
GL11.glRotatef(sine * -armAng, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_arm);
|
||||
ResourceManager.igen.renderPart("ArmLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, -sine * 0.55, cosine * 0.8725 - 1.125);
|
||||
|
||||
GL11.glTranslated(0, 3.5, px * 6.5);
|
||||
GL11.glRotatef(sine * armAng, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_arm);
|
||||
ResourceManager.igen.renderPart("ArmRight");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
bindTexture(rotTexture);
|
||||
rotModel.renderAll();
|
||||
GL11.glTranslated(-0.75, 5.5625, -7);
|
||||
for(int i = 0; i < 2; i++) {
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(1.5, 0, 0), EnumWaveType.RANDOM, EnumBeamType.LINE, 0x8080ff, 0x0000ff, (int)te.getWorldObj().getTotalWorldTime() % 1000 + i, 5, px * 4, 0, 0);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(1.5, 0, 0), EnumWaveType.RANDOM, EnumBeamType.LINE, 0xffffff, 0x0000ff, (int)te.getWorldObj().getTotalWorldTime() % 1000 + 2 + i, 5, px * 4, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
te.getWorldObj().spawnParticle("splash", te.xCoord + 2.1, te.yCoord + 5.875, te.zCoord + 0.5, 0, 0, -0.25);
|
||||
te.getWorldObj().spawnParticle("smoke", te.xCoord + 2.8, te.yCoord + 5.05, te.zCoord + 2, 0, 0, -0.1);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);*/
|
||||
|
||||
/*GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
@ -183,9 +183,9 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
bindTexture(ResourceManager.soyuz_module_solar_tex);
|
||||
ResourceManager.soyuz_module.renderPart("Solar");
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);*/
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/*GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
bindTexture(ResourceManager.igen_tex);
|
||||
@ -279,7 +279,7 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
for(int i = 0; i < 5; i++) {
|
||||
tileEntity.getWorldObj().spawnParticle("smoke", tileEntity.xCoord + 2.8, tileEntity.yCoord + 5.05, tileEntity.zCoord + 2, 0, 0, -0.3);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
59
src/main/java/com/hbm/render/util/GaugeUtil.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GaugeUtil {
|
||||
|
||||
public static enum Gauge {
|
||||
|
||||
ROUND_SMALL(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/small_round.png"), 18, 18, 13),
|
||||
ROUND_LARGE(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/large_round.png"), 36, 36, 13),
|
||||
BOW_SMALL(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/small_bow.png"), 18, 18, 13),
|
||||
BOW_LARGE(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/large_bow.png"), 36, 36, 13),
|
||||
WIDE_SMALL(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/small_wide.png"), 18, 12, 7),
|
||||
WIDE_LARGE(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/large_wide.png"), 36, 24, 11),
|
||||
BAR_SMALL(new ResourceLocation(RefStrings.MODID + ":textures/gui/gauges/small_bar.png"), 36, 12, 16);
|
||||
|
||||
ResourceLocation texture;
|
||||
int width;
|
||||
int height;
|
||||
int count;
|
||||
|
||||
private Gauge(ResourceLocation texture, int width, int height, int count) {
|
||||
this.texture = texture;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gauge The gauge enum to use
|
||||
* @param x The x coord in the GUI (left)
|
||||
* @param y The y coord in the GUI (top)
|
||||
* @param z The z-level (from GUI.zLevel)
|
||||
* @param progress Double from 0-1 how far the gauge has progressed
|
||||
*/
|
||||
public static void renderGauge(Gauge gauge, double x, double y, double z, double progress) {
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(gauge.texture);
|
||||
|
||||
int frameNum = (int) Math.round((gauge.count - 1) * progress);
|
||||
double singleFrame = 1D / (double)gauge.count;
|
||||
double frameOffset = singleFrame * frameNum;
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(x, y + gauge.height, z, 0, frameOffset + singleFrame);
|
||||
tess.addVertexWithUV(x + gauge.width, y + gauge.height, z, 1, frameOffset + singleFrame);
|
||||
tess.addVertexWithUV(x + gauge.width, y, z, 1, frameOffset);
|
||||
tess.addVertexWithUV(x, y, z, 0, frameOffset);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.hbm.sound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SoundLoopIGen extends SoundLoopMachine {
|
||||
|
||||
public static List<SoundLoopIGen> list = new ArrayList<SoundLoopIGen>();
|
||||
|
||||
public SoundLoopIGen(ResourceLocation path, TileEntity te) {
|
||||
super(path, te);
|
||||
list.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if(te instanceof TileEntityMachineIGenerator) {
|
||||
TileEntityMachineIGenerator drill = (TileEntityMachineIGenerator)te;
|
||||
|
||||
if(this.volume != 3)
|
||||
volume = 3;
|
||||
|
||||
if(drill.torque <= 0)
|
||||
this.donePlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity getTE() {
|
||||
return te;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,308 +1,69 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TEIGeneratorPacket;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
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;
|
||||
|
||||
public class TileEntityMachineIGenerator extends TileEntity implements ISidedInventory, ISource {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power;
|
||||
public int torque;
|
||||
public int heat;
|
||||
public int water;
|
||||
public int lubricant;
|
||||
public int fuel;
|
||||
public int burn;
|
||||
public int soundCycle = 0;
|
||||
public float rotation;
|
||||
public static final long maxPower = 100000;
|
||||
public static final int maxTorque = 2500;
|
||||
public static final int maxHeat = 7500;
|
||||
public static final int maxWater = 10000;
|
||||
public static final int maxLubricant = 10000;
|
||||
public static final int maxFuel = 50000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
private static final int[] slots_top = new int[] { 0 };
|
||||
private static final int[] slots_bottom = new int[] { 0, 0 };
|
||||
private static final int[] slots_side = new int[] { 0 };
|
||||
|
||||
private String customName;
|
||||
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements ISource {
|
||||
|
||||
public TileEntityMachineIGenerator() {
|
||||
slots = new ItemStack[16];
|
||||
super(15);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
public String getName() {
|
||||
return "container.iGenerator";
|
||||
}
|
||||
|
||||
@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.iGenerator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||
return false;
|
||||
} else {
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
}
|
||||
|
||||
// You scrubs aren't needed for anything (right now)
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return 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.getLong("power");
|
||||
this.torque = nbt.getInteger("torque");
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.water = nbt.getInteger("water");
|
||||
this.lubricant = nbt.getInteger("lubricant");
|
||||
this.fuel = nbt.getInteger("fuel");
|
||||
this.burn = nbt.getInteger("burn");
|
||||
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.setLong("power", power);
|
||||
nbt.setInteger("torque", torque);
|
||||
nbt.setInteger("heat", heat);
|
||||
nbt.setInteger("water", water);
|
||||
nbt.setInteger("lubricant", lubricant);
|
||||
nbt.setInteger("fuel", fuel);
|
||||
nbt.setInteger("burn", burn);
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() { }
|
||||
|
||||
public int getFuelScaled(int i) {
|
||||
return (fuel * i) / maxFuel;
|
||||
}
|
||||
|
||||
public int getLubeScaled(int i) {
|
||||
return (lubricant * i) / maxLubricant;
|
||||
}
|
||||
|
||||
public int getWaterScaled(int i) {
|
||||
return (water * i) / maxWater;
|
||||
}
|
||||
|
||||
public int getHeatScaled(int i) {
|
||||
return (heat * i) / maxHeat;
|
||||
}
|
||||
|
||||
public int getTorqueScaled(int i) {
|
||||
return (torque * i) / maxTorque;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
public void updateEntity() {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
int i = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
if(i == 5) {
|
||||
ffgeua(this.xCoord + 3, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 4, this.yCoord, this.zCoord, getTact());
|
||||
}
|
||||
if(i == 3) {
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 3, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 4, getTact());
|
||||
}
|
||||
if(i == 4) {
|
||||
ffgeua(this.xCoord + 4, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 3, this.yCoord, this.zCoord, getTact());
|
||||
}
|
||||
if(i == 2) {
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 4, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 3, getTact());
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared()
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||