Lots of things!

This commit is contained in:
Aidan Brady 2013-11-03 16:54:33 -05:00
parent b12d9ce65a
commit 01a6174fdb
27 changed files with 587 additions and 337 deletions

View file

@ -1,9 +1,12 @@
package mekanism.api.transmitters;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
@ -135,7 +138,9 @@ public class TransmitterNetworkRegistry implements ITickHandler
try {
if(c != null)
{
for(Object obj : c.chunkTileEntityMap.values())
Map copy = (Map)((HashMap)c.chunkTileEntityMap).clone();
for(Object obj : copy.values())
{
if(obj instanceof TileEntity)
{

View file

@ -1,8 +1,11 @@
package mekanism.client;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import mekanism.api.EnumColor;
import mekanism.api.Object3D;
import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.item.ItemConfigurator;
@ -11,12 +14,11 @@ import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.network.PacketConfiguratorState;
import mekanism.common.network.PacketElectricBowState;
import mekanism.common.network.PacketWalkieTalkieState;
import mekanism.common.tileentity.TileEntityUniversalCable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatMessageComponent;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
@ -24,7 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClientPlayerTickHandler implements ITickHandler
{
{
public boolean lastTickUpdate = false;
@Override
@ -37,6 +39,24 @@ public class ClientPlayerTickHandler implements ITickHandler
{
EntityPlayer entityPlayer = (EntityPlayer)tickData[0];
Set<UpdateQueueData> toRemove = new HashSet<UpdateQueueData>();
for(UpdateQueueData data : MekanismClient.cableUpdateQueue)
{
TileEntity tile = data.object3D.getTileEntity(entityPlayer.worldObj);
if(tile instanceof TileEntityUniversalCable)
{
new EnergyClientUpdate(tile, data.energy).clientUpdate();
toRemove.add(data);
}
}
for(UpdateQueueData rem : toRemove)
{
MekanismClient.cableUpdateQueue.remove(rem);
}
if(entityPlayer.getCurrentEquippedItem() != null)
{
ItemStack stack = entityPlayer.getCurrentEquippedItem();
@ -113,4 +133,16 @@ public class ClientPlayerTickHandler implements ITickHandler
{
return "MekanismClientPlayer";
}
public static class UpdateQueueData
{
public Object3D object3D;
public double energy;
public UpdateQueueData(Object3D obj, double d)
{
object3D = obj;
energy = d;
}
}
}

View file

@ -1,9 +1,13 @@
package mekanism.client;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import mekanism.client.ClientPlayerTickHandler.UpdateQueueData;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MekanismClient extends Mekanism
{
@ -11,6 +15,8 @@ public class MekanismClient extends Mekanism
/** The main SoundHandler instance that is used by all audio sources */
public static SoundHandler audioHandler;
public static List<UpdateQueueData> cableUpdateQueue = new ArrayList<UpdateQueueData>();
//General Configuration
public static boolean enableSounds = true;
public static boolean fancyUniversalCableRender = true;

View file

@ -39,6 +39,7 @@ public class RenderObsidianTNTPrimed extends Render
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y-1.2f, (float)z);
GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glRotatef(180, 1, 0, 0);
if((entityobsidiantnt.fuse - f1) + 1.0F < 10F)
{

View file

@ -223,7 +223,6 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
private DisplayInteger getDisplayList(ForgeDirection side)
{
DisplayInteger newDisplayList;
Model3D toRender = energy[side.ordinal()];

View file

@ -31,10 +31,12 @@ import cpw.mods.fml.common.FMLCommonHandler;
public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{
private double lastPowerScale = 0;
private double lastPowerScale = -1;
private double joulesTransmitted = 0;
private double joulesLastTick = 0;
private boolean needsUpdate = false;
public EnergyNetwork(ITransmitter<EnergyNetwork>... varCables)
{
transmitters.addAll(Arrays.asList(varCables));
@ -238,14 +240,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
}
}
double currentPowerScale = getPowerScale();
if(FMLCommonHandler.instance().getEffectiveSide().isServer())
{
lastPowerScale = currentPowerScale;
MinecraftForge.EVENT_BUS.post(new EnergyTransferEvent(this, currentPowerScale));
}
needsUpdate = true;
}
@Override
@ -289,11 +284,20 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
double currentPowerScale = getPowerScale();
if(currentPowerScale != lastPowerScale && FMLCommonHandler.instance().getEffectiveSide().isServer())
if(FMLCommonHandler.instance().getEffectiveSide().isServer())
{
if(currentPowerScale != lastPowerScale)
{
needsUpdate = true;
}
lastPowerScale = currentPowerScale;
MinecraftForge.EVENT_BUS.post(new EnergyTransferEvent(this, currentPowerScale));
if(needsUpdate)
{
MinecraftForge.EVENT_BUS.post(new EnergyTransferEvent(this, currentPowerScale));
needsUpdate = false;
}
}
}

View file

@ -6,8 +6,10 @@ import ic2.api.recipe.Recipes;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import mekanism.api.Object3D;
@ -34,6 +36,7 @@ import mekanism.common.block.BlockTransmitter;
import mekanism.common.item.ItemAtomicDisassembler;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.item.ItemBlockEnergyCube;
import mekanism.common.item.ItemBlockGasTank;
import mekanism.common.item.ItemBlockMachine;
import mekanism.common.item.ItemBlockOre;
import mekanism.common.item.ItemBlockTransmitter;
@ -49,7 +52,6 @@ import mekanism.common.item.ItemMekanism;
import mekanism.common.item.ItemNetworkReader;
import mekanism.common.item.ItemPortableTeleporter;
import mekanism.common.item.ItemRobit;
import mekanism.common.item.ItemStorageTank;
import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.network.PacketConfigurationUpdate;
import mekanism.common.network.PacketConfiguratorState;
@ -72,9 +74,7 @@ import mekanism.common.network.PacketTransmitterTransferUpdate;
import mekanism.common.network.PacketTransmitterTransferUpdate.TransmitterTransferType;
import mekanism.common.network.PacketWalkieTalkieState;
import mekanism.common.tileentity.TileEntityBoundingBlock;
import mekanism.common.tileentity.TileEntityEnergyCube;
import mekanism.common.tileentity.TileEntityGasTank;
import mekanism.common.tileentity.TileEntityLogisticalSorter;
import mekanism.common.tileentity.TileEntityElectricBlock;
import mekanism.common.tileentity.TileEntityTeleporter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -84,9 +84,11 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import rebelkeithy.mods.metallurgy.api.IOreInfo;
@ -161,6 +163,8 @@ public class Mekanism
/** A list of the usernames of players who have donated to Mekanism. */
public static List<String> donators = new ArrayList<String>();
public static Set<Object3D> ic2Registered = new HashSet<Object3D>();
//Block IDs
public static int basicBlockID = 3000;
@ -181,7 +185,6 @@ public class Mekanism
public static ItemRobit Robit;
public static ItemAtomicDisassembler AtomicDisassembler;
public static Item AtomicCore;
public static ItemStorageTank StorageTank;
public static Item ControlCircuit;
public static Item EnrichedIron;
public static Item CompressedCarbon;
@ -316,9 +319,6 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(AtomicDisassembler.getUnchargedItem(), new Object[] {
"AEA", "ACA", " O ", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('C'), AtomicCore, Character.valueOf('O'), "ingotRefinedObsidian"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(StorageTank.getEmptyItem(), new Object[] {
"III", "IDI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('D'), "dustIron"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(GasTank), new Object[] {
"PPP", "PDP", "PPP", Character.valueOf('P'), "ingotOsmium", Character.valueOf('D'), "dustIron"
}));
@ -513,7 +513,7 @@ public class Mekanism
AtomicDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(configuration.getItem("AtomicDisassembler", 11210).getInt()).setUnlocalizedName("AtomicDisassembler");
AtomicCore = new ItemMekanism(configuration.getItem("AtomicCore", 11211).getInt()).setUnlocalizedName("AtomicCore");
EnrichedAlloy = new ItemMekanism(configuration.getItem("EnrichedAlloy", 11212).getInt()).setUnlocalizedName("EnrichedAlloy");
StorageTank = (ItemStorageTank) new ItemStorageTank(configuration.getItem("StorageTank", 11213).getInt(), 1600, 16).setUnlocalizedName("StorageTank");
//OPEN 11213
ControlCircuit = new ItemMekanism(configuration.getItem("ControlCircuit", 11214).getInt()).setUnlocalizedName("ControlCircuit");
EnrichedIron = new ItemMekanism(configuration.getItem("EnrichedIron", 11215).getInt()).setUnlocalizedName("EnrichedIron");
CompressedCarbon = new ItemMekanism(configuration.getItem("CompressedCarbon", 11216).getInt()).setUnlocalizedName("CompressedCarbon");
@ -538,7 +538,6 @@ public class Mekanism
GameRegistry.registerItem(AtomicDisassembler, "AtomicDisassembler");
GameRegistry.registerItem(AtomicCore, "AtomicCore");
GameRegistry.registerItem(EnrichedAlloy, "EnrichedAlloy");
GameRegistry.registerItem(StorageTank, "StorageTank");
GameRegistry.registerItem(ControlCircuit, "ControlCircuit");
GameRegistry.registerItem(EnrichedIron, "EnrichedIron");
GameRegistry.registerItem(CompressedCarbon, "CompressedCarbon");
@ -577,6 +576,7 @@ public class Mekanism
Item.itemsList[machineBlockID] = new ItemBlockMachine(machineBlockID - 256, MachineBlock).setUnlocalizedName("MachineBlock");
Item.itemsList[oreBlockID] = new ItemBlockOre(oreBlockID - 256, OreBlock).setUnlocalizedName("OreBlock");
Item.itemsList[energyCubeID] = new ItemBlockEnergyCube(energyCubeID - 256, EnergyCube).setUnlocalizedName("EnergyCube");
Item.itemsList[gasTankID] = new ItemBlockGasTank(gasTankID - 256, GasTank).setUnlocalizedName("GasTank");
Item.itemsList[transmitterID] = new ItemBlockTransmitter(transmitterID - 256, Transmitter).setUnlocalizedName("Transmitter");
}
@ -1163,4 +1163,26 @@ public class Mekanism
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.FLUID, event.fluidNetwork.transmitters.iterator().next(), event.fluidSent));
} catch(Exception e) {}
}
@ForgeSubscribe
public void onChunkLoad(ChunkEvent.Load event)
{
if(event.getChunk() != null)
{
Map copy = (Map)((HashMap)event.getChunk().chunkTileEntityMap).clone();
for(Object obj : copy.values())
{
if(obj instanceof TileEntity)
{
TileEntity tileEntity = (TileEntity)obj;
if(tileEntity instanceof TileEntityElectricBlock)
{
((TileEntityElectricBlock)tileEntity).register();
}
}
}
}
}
}

View file

@ -7,6 +7,7 @@ import java.util.List;
import java.util.Random;
import mekanism.api.energy.IEnergizedItem;
import mekanism.api.transmitters.ITransmitter;
import mekanism.client.ClientProxy;
import mekanism.common.IEnergyCube;
import mekanism.common.ISustainedInventory;
@ -14,6 +15,7 @@ import mekanism.common.Mekanism;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.item.ItemBlockEnergyCube;
import mekanism.common.tileentity.TileEntityBasicBlock;
import mekanism.common.tileentity.TileEntityElectricBlock;
import mekanism.common.tileentity.TileEntityEnergyCube;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -192,8 +194,6 @@ public class BlockEnergyCube extends BlockContainer
{
if(!player.capabilities.isCreativeMode && !world.isRemote && canHarvestBlock(player, world.getBlockMetadata(x, y, z)))
{
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getBlockTileEntity(x, y, z);
float motion = 0.7F;
double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
@ -248,6 +248,17 @@ public class BlockEnergyCube extends BlockContainer
return itemStack;
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if(!world.isRemote)
{
((TileEntityElectricBlock)tileEntity).register();
}
}
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{

View file

@ -2,9 +2,10 @@ package mekanism.common.block;
import java.util.Random;
import mekanism.api.IStorageTank;
import mekanism.common.ISustainedInventory;
import mekanism.common.Mekanism;
import mekanism.common.tileentity.TileEntityBasicBlock;
import mekanism.common.tileentity.TileEntityContainerBlock;
import mekanism.common.tileentity.TileEntityElectricBlock;
import mekanism.common.tileentity.TileEntityGasTank;
import net.minecraft.block.BlockContainer;
@ -15,12 +16,9 @@ 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.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
@ -62,55 +60,6 @@ public class BlockGasTank extends BlockContainer
tileEntity.setFacing((short)change);
}
@Override
public void breakBlock(World world, int x, int y, int z, int i1, int i2)
{
TileEntityContainerBlock tileEntity = (TileEntityContainerBlock)world.getBlockTileEntity(x, y, z);
if(tileEntity != null)
{
for(int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
if(slotStack != null)
{
float xRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float yRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float zRandom = machineRand.nextFloat() * 0.8F + 0.1F;
while(slotStack.stackSize > 0)
{
int j = machineRand.nextInt(21) + 10;
if(j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, (double)((float)x + xRandom), (double)((float)y + yRandom), (double)((float)z + zRandom), new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if(slotStack.hasTagCompound())
{
item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = (double)((float)machineRand.nextGaussian() * k);
item.motionY = (double)((float)machineRand.nextGaussian() * k + 0.2F);
item.motionZ = (double)((float)machineRand.nextGaussian() * k);
world.spawnEntityInWorld(item);
}
}
}
tileEntity.invalidate();
}
super.breakBlock(world, x, y, z, i1, i2);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ)
{
@ -174,6 +123,24 @@ public class BlockGasTank extends BlockContainer
return false;
}
@Override
public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z)
{
if(!player.capabilities.isCreativeMode && !world.isRemote && canHarvestBlock(player, world.getBlockMetadata(x, y, z)))
{
float motion = 0.7F;
double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z));
world.spawnEntityInWorld(entityItem);
}
return world.setBlockToAir(x, y, z);
}
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
@ -196,6 +163,18 @@ public class BlockGasTank extends BlockContainer
return itemStack;
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public int idDropped(int i, Random random, int j)
{
return 0;
}
@Override
public boolean renderAsNormalBlock()
{
@ -223,6 +202,16 @@ public class BlockGasTank extends BlockContainer
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
return new ItemStack(blockID, 1, world.getBlockMetadata(x, y, z));
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(Mekanism.GasTank);
IStorageTank storageTank = (IStorageTank)itemStack.getItem();
storageTank.setGasType(itemStack, tileEntity.gasType);
storageTank.setGas(tileEntity.gasType, tileEntity.gasStored, itemStack);
ISustainedInventory inventory = (ISustainedInventory)itemStack.getItem();
inventory.setInventory(((ISustainedInventory)tileEntity).getInventory(), itemStack);
return itemStack;
}
}

View file

@ -195,23 +195,30 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
float zRandom = (float)z + 0.5F;
float iRandom = 0.52F;
float jRandom = random.nextFloat() * 0.6F - 0.3F;
int side = tileEntity.facing;
if(tileEntity instanceof TileEntityMetallurgicInfuser)
{
side = ForgeDirection.getOrientation(side).getOpposite().ordinal();
}
if(tileEntity.facing == 4)
if(side == 4)
{
world.spawnParticle("smoke", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
}
else if(tileEntity.facing == 5)
else if(side == 5)
{
world.spawnParticle("smoke", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
}
else if(tileEntity.facing == 2)
else if(side == 2)
{
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
}
else if(tileEntity.facing == 3)
else if(side == 3)
{
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
@ -852,6 +859,17 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
return false;
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if(!world.isRemote)
{
((TileEntityElectricBlock)tileEntity).register();
}
}
public static enum MachineType
{

View file

@ -1,8 +1,5 @@
package mekanism.common.block;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.tile.IEnergyTile;
import java.util.Arrays;
import java.util.List;
@ -33,7 +30,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -326,6 +322,11 @@ public class BlockTransmitter extends Block
if(tileEntity instanceof ITransmitter)
{
((ITransmitter)tileEntity).refreshTransmitterNetwork();
if(tileEntity instanceof TileEntityUniversalCable)
{
((TileEntityUniversalCable)tileEntity).register();
}
}
}
}

View file

@ -2,35 +2,76 @@ package mekanism.common.item;
import java.util.List;
import mekanism.api.EnumColor;
import mekanism.api.IStorageTank;
import mekanism.api.gas.EnumGas;
import mekanism.common.IEnergyCube;
import mekanism.common.ISustainedInventory;
import mekanism.common.Mekanism;
import mekanism.common.tileentity.TileEntityGasTank;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
public class ItemStorageTank extends ItemMekanism implements IStorageTank
import org.lwjgl.input.Keyboard;
public class ItemBlockGasTank extends ItemBlock implements IStorageTank, ISustainedInventory
{
public Block metaBlock;
/** The maximum amount of gas this tank can hold. */
public int MAX_GAS;
public int MAX_GAS = 96000;
/** How fast this tank can transfer gas. */
public int TRANSFER_RATE;
public int TRANSFER_RATE = 16;
public ItemStorageTank(int id, int maxGas, int transferRate)
public ItemBlockGasTank(int id, Block block)
{
super(id);
MAX_GAS = maxGas;
TRANSFER_RATE = transferRate;
metaBlock = block;
setHasSubtypes(true);
setMaxStackSize(1);
setMaxDamage(100);
setNoRepair();
setCreativeTab(Mekanism.tabMekanism);
}
@Override
public int getMetadata(int i)
{
return i;
}
@Override
public Icon getIconFromDamage(int i)
{
return metaBlock.getIcon(2, i);
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
{
boolean place = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
if(place)
{
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getBlockTileEntity(x, y, z);
tileEntity.gasType = getGasType(stack);
tileEntity.gasStored = getGas(getGasType(stack), stack);
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
}
return place;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
@ -43,6 +84,14 @@ public class ItemStorageTank extends ItemMekanism implements IStorageTank
else {
list.add("Stored " + getGasType(itemstack).name + ": " + gas);
}
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more details.");
}
else {
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagCount() != 0));
}
}
@Override
@ -81,7 +130,7 @@ public class ItemStorageTank extends ItemMekanism implements IStorageTank
stored = itemstack.stackTagCompound.getInteger("gas");
}
itemstack.setItemDamage((int)(Math.abs((((float)stored/MAX_GAS)*100)-100)));
itemstack.setItemDamage((int)Math.max(1, (Math.abs((((float)stored/MAX_GAS)*100)-100))));
return stored;
}
}
@ -110,7 +159,7 @@ public class ItemStorageTank extends ItemMekanism implements IStorageTank
{
int stored = Math.max(Math.min(amount, MAX_GAS), 0);
itemstack.stackTagCompound.setInteger("gas", stored);
itemstack.setItemDamage((int)(Math.abs((((float)stored/MAX_GAS)*100)-100)));
itemstack.setItemDamage((int)Math.max(1, (Math.abs((((float)stored/MAX_GAS)*100)-100))));
}
if(getGas(getGasType(itemstack), itemstack) == 0)
@ -235,4 +284,38 @@ public class ItemStorageTank extends ItemMekanism implements IStorageTank
itemstack.stackTagCompound.setString("gasType", type.name);
}
@Override
public void setInventory(NBTTagList nbtTags, Object... data)
{
if(data[0] instanceof ItemStack)
{
ItemStack itemStack = (ItemStack)data[0];
if(itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
itemStack.stackTagCompound.setTag("Items", nbtTags);
}
}
@Override
public NBTTagList getInventory(Object... data)
{
if(data[0] instanceof ItemStack)
{
ItemStack itemStack = (ItemStack)data[0];
if(itemStack.stackTagCompound == null)
{
return null;
}
return itemStack.stackTagCompound.getTagList("Items");
}
return null;
}
}

View file

@ -65,6 +65,7 @@ public class ItemBlockOre extends ItemBlock
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch(itemstack.getItemDamage())
{
case 0:
@ -74,6 +75,7 @@ public class ItemBlockOre extends ItemBlock
name = "Unknown";
break;
}
return getUnlocalizedName() + "." + name;
}
}

View file

@ -2,10 +2,13 @@ package mekanism.common.network;
import java.io.DataOutputStream;
import mekanism.api.Object3D;
import mekanism.api.gas.EnumGas;
import mekanism.client.ClientPlayerTickHandler.UpdateQueueData;
import mekanism.client.EnergyClientUpdate;
import mekanism.client.GasClientUpdate;
import mekanism.client.FluidClientUpdate;
import mekanism.client.GasClientUpdate;
import mekanism.client.MekanismClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -13,6 +16,9 @@ import net.minecraftforge.fluids.FluidStack;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PacketTransmitterTransferUpdate implements IMekanismPacket
{
public TransmitterTransferType activeType;
@ -72,6 +78,11 @@ public class PacketTransmitterTransferUpdate implements IMekanismPacket
{
new EnergyClientUpdate(tileEntity, powerLevel).clientUpdate();
}
else {
try {
appendToQueue(Object3D.get(tileEntity), powerLevel);
} catch(Exception e) {}
}
}
else if(transmitterType == 1)
{
@ -95,6 +106,12 @@ public class PacketTransmitterTransferUpdate implements IMekanismPacket
}
}
}
@SideOnly(Side.CLIENT)
public void appendToQueue(Object3D obj, double energy) throws Exception
{
MekanismClient.cableUpdateQueue.add(new UpdateQueueData(obj, energy));
}
@Override
public void write(DataOutputStream dataStream) throws Exception

View file

@ -1,11 +1,13 @@
package mekanism.common.tileentity;
import java.util.EnumSet;
import java.util.Map;
import net.minecraft.util.ResourceLocation;
import mekanism.common.Mekanism;
import mekanism.common.RecipeHandler.Recipe;
import mekanism.common.block.BlockMachine.MachineType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
public class TileEntityCrusher extends TileEntityElectricMachine
{
@ -46,6 +48,12 @@ public class TileEntityCrusher extends TileEntityElectricMachine
}
}
@Override
protected EnumSet<ForgeDirection> getConsumingSides()
{
return EnumSet.of(ForgeDirection.getOrientation(0));
}
@Override
public Map getRecipes()
{

View file

@ -8,6 +8,7 @@ import ic2.api.tile.IWrenchable;
import java.util.ArrayList;
import java.util.EnumSet;
import mekanism.api.Object3D;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.common.ITileNetwork;
import mekanism.common.Mekanism;
@ -51,16 +52,23 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
powerHandler.configure(0, 100, 0, (int)(maxEnergy*Mekanism.TO_BC));
}
public void register()
{
if(!worldObj.isRemote)
{
if(!Mekanism.ic2Registered.contains(Object3D.get(this)))
{
Mekanism.ic2Registered.add(Object3D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
}
}
}
@Override
public void onUpdate()
{
if(!worldObj.isRemote)
{
if(packetTick == 0)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
}
if(getEnergy() < getMaxEnergy() && powerHandler.getEnergyStored() > 0)
{
setEnergy(getEnergy() + powerHandler.useEnergy(0, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), true)*Mekanism.FROM_BC);
@ -129,17 +137,15 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
}
@Override
public void invalidate()
public void onChunkUnload()
{
if(!worldObj.isRemote)
{
if(Mekanism.hooks.IC2Loaded)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
Mekanism.ic2Registered.remove(Object3D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
super.invalidate();
super.onChunkUnload();
}
@Override

View file

@ -37,8 +37,6 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
public double energyScale;
public boolean registeredIC2 = false;
public TileEntityUniversalCable()
{
ueNetwork = new FakeUENetwork();
@ -105,11 +103,8 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
{
getTransmitterNetwork().split(this);
if(registeredIC2)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
registeredIC2 = false;
}
Mekanism.ic2Registered.remove(Object3D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
super.invalidate();
@ -145,13 +140,18 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
@Override
public void chunkLoad()
{
register();
}
public void register()
{
if(!worldObj.isRemote)
{
if(!registeredIC2)
if(!Mekanism.ic2Registered.contains(Object3D.get(this)))
{
Mekanism.ic2Registered.add(Object3D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
registeredIC2 = true;
}
}
}

View file

@ -48,7 +48,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
GL11.glTranslated(0.0F, -1.0F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "BioGenerator.png"));
bioGenerator.render(0.0625F, 0.0F);
bioGenerator.render(0.0625F);
}
else if(metadata == GeneratorType.ADVANCED_SOLAR_GENERATOR.meta)
{

View file

@ -2,184 +2,161 @@ package mekanism.generators.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelBioGenerator extends ModelBase
public class ModelBioGenerator extends ModelBase
{
ModelRenderer MAIN_BASE;
ModelRenderer MATERIAL_INLET;
ModelRenderer CONVEYOR_BELT_1;
ModelRenderer CONVEYOR_BELT_SUPPORT;
ModelRenderer PISTON_SUPPORT_1;
ModelRenderer PISTON_SUPPORT_2;
ModelRenderer CONVEYOR_BELT_2;
ModelRenderer FUEL_CONTAINER_WALL_1;
ModelRenderer FUEL_CONTAINER_WALL_2;
ModelRenderer FUEL_CONTAINER_WALL_3;
ModelRenderer FUEL_CONTAINER_WALL_4;
ModelRenderer FUEL_CONTAINER_TOP_1;
ModelRenderer FUEL_CONTAINER_TOP_2;
ModelRenderer FUEL_OUTLET_1;
ModelRenderer FUEL_OUTLET_2;
ModelRenderer PLUG_PANEL;
ModelRenderer PISTON_HEAD_MOVES;
ModelRenderer PISTON_ARM_MOVES;
ModelRenderer PISTON_BODY;
public ModelBioGenerator()
{
textureWidth = 128;
textureHeight = 128;
MAIN_BASE = new ModelRenderer(this, 0, 0);
MAIN_BASE.addBox(0F, 0F, 0F, 16, 1, 16);
MAIN_BASE.setRotationPoint(-8F, 23F, -8F);
MAIN_BASE.setTextureSize(128, 128);
MAIN_BASE.mirror = true;
setRotation(MAIN_BASE, 0F, 0F, 0F);
MATERIAL_INLET = new ModelRenderer(this, 0, 18);
MATERIAL_INLET.addBox(0F, 0F, 0F, 4, 6, 4);
MATERIAL_INLET.setRotationPoint(3F, 17F, -7F);
MATERIAL_INLET.setTextureSize(128, 128);
MATERIAL_INLET.mirror = true;
setRotation(MATERIAL_INLET, 0F, 0F, 0F);
CONVEYOR_BELT_1 = new ModelRenderer(this, 0, 29);
CONVEYOR_BELT_1.addBox(0F, 0F, 0F, 6, 1, 4);
CONVEYOR_BELT_1.setRotationPoint(-3F, 17F, -7F);
CONVEYOR_BELT_1.setTextureSize(128, 128);
CONVEYOR_BELT_1.mirror = true;
setRotation(CONVEYOR_BELT_1, 0F, 0F, 0F);
CONVEYOR_BELT_SUPPORT = new ModelRenderer(this, 17, 18);
CONVEYOR_BELT_SUPPORT.addBox(0F, 0F, 0F, 4, 6, 4);
CONVEYOR_BELT_SUPPORT.setRotationPoint(-7F, 17F, -7F);
CONVEYOR_BELT_SUPPORT.setTextureSize(128, 128);
CONVEYOR_BELT_SUPPORT.mirror = true;
setRotation(CONVEYOR_BELT_SUPPORT, 0F, 0F, 0F);
PISTON_SUPPORT_1 = new ModelRenderer(this, 0, 50);
PISTON_SUPPORT_1.addBox(0F, 0F, 0F, 2, 10, 1);
PISTON_SUPPORT_1.setRotationPoint(-1F, 13F, -8F);
PISTON_SUPPORT_1.setTextureSize(128, 128);
PISTON_SUPPORT_1.mirror = true;
setRotation(PISTON_SUPPORT_1, 0F, 0F, 0F);
PISTON_SUPPORT_2 = new ModelRenderer(this, 0, 50);
PISTON_SUPPORT_2.addBox(0F, 0F, 0F, 2, 10, 1);
PISTON_SUPPORT_2.setRotationPoint(-1F, 13F, -3F);
PISTON_SUPPORT_2.setTextureSize(128, 128);
PISTON_SUPPORT_2.mirror = true;
setRotation(PISTON_SUPPORT_2, 0F, 0F, 0F);
CONVEYOR_BELT_2 = new ModelRenderer(this, 0, 36);
CONVEYOR_BELT_2.addBox(0F, 0F, 0F, 7, 1, 4);
CONVEYOR_BELT_2.setRotationPoint(-3F, 17F, -3F);
CONVEYOR_BELT_2.setTextureSize(128, 128);
CONVEYOR_BELT_2.mirror = true;
setRotation(CONVEYOR_BELT_2, 0F, -1.570796F, 0.33161255787892263F);
FUEL_CONTAINER_WALL_1 = new ModelRenderer(this, 65, 15);
FUEL_CONTAINER_WALL_1.addBox(0F, 0F, 0F, 4, 13, 1);
FUEL_CONTAINER_WALL_1.setRotationPoint(-7F, 10F, 3F);
FUEL_CONTAINER_WALL_1.setTextureSize(128, 128);
FUEL_CONTAINER_WALL_1.mirror = true;
setRotation(FUEL_CONTAINER_WALL_1, 0F, 0F, 0F);
FUEL_CONTAINER_WALL_2 = new ModelRenderer(this, 77, 0);
FUEL_CONTAINER_WALL_2.addBox(0F, 0F, 0F, 1, 13, 3);
FUEL_CONTAINER_WALL_2.setRotationPoint(-8F, 10F, 4F);
FUEL_CONTAINER_WALL_2.setTextureSize(128, 128);
FUEL_CONTAINER_WALL_2.mirror = true;
setRotation(FUEL_CONTAINER_WALL_2, 0F, 0F, 0F);
FUEL_CONTAINER_WALL_3 = new ModelRenderer(this, 65, 0);
FUEL_CONTAINER_WALL_3.addBox(0F, 0F, 0F, 4, 13, 1);
FUEL_CONTAINER_WALL_3.setRotationPoint(-7F, 10F, 7F);
FUEL_CONTAINER_WALL_3.setTextureSize(128, 128);
FUEL_CONTAINER_WALL_3.mirror = true;
setRotation(FUEL_CONTAINER_WALL_3, 0F, 0F, 0F);
FUEL_CONTAINER_WALL_4 = new ModelRenderer(this, 77, 0);
FUEL_CONTAINER_WALL_4.addBox(0F, 0F, 0F, 1, 13, 3);
FUEL_CONTAINER_WALL_4.setRotationPoint(-3F, 10F, 4F);
FUEL_CONTAINER_WALL_4.setTextureSize(128, 128);
FUEL_CONTAINER_WALL_4.mirror = true;
setRotation(FUEL_CONTAINER_WALL_4, 0F, 0F, 0F);
FUEL_CONTAINER_TOP_1 = new ModelRenderer(this, 86, 0);
FUEL_CONTAINER_TOP_1.addBox(0F, 0F, 0F, 6, 1, 5);
FUEL_CONTAINER_TOP_1.setRotationPoint(-8F, 9F, 3F);
FUEL_CONTAINER_TOP_1.setTextureSize(128, 128);
FUEL_CONTAINER_TOP_1.mirror = true;
setRotation(FUEL_CONTAINER_TOP_1, 0F, 0F, 0F);
FUEL_CONTAINER_TOP_2 = new ModelRenderer(this, 86, 7);
FUEL_CONTAINER_TOP_2.addBox(0F, 0F, 0F, 2, 1, 1);
FUEL_CONTAINER_TOP_2.setRotationPoint(-6F, 8F, 5F);
FUEL_CONTAINER_TOP_2.setTextureSize(128, 128);
FUEL_CONTAINER_TOP_2.mirror = true;
setRotation(FUEL_CONTAINER_TOP_2, 0F, 0F, 0F);
FUEL_OUTLET_1 = new ModelRenderer(this, 86, 10);
FUEL_OUTLET_1.addBox(0F, 0F, 0F, 4, 1, 1);
FUEL_OUTLET_1.setRotationPoint(-2F, 16F, 5F);
FUEL_OUTLET_1.setTextureSize(128, 128);
FUEL_OUTLET_1.mirror = true;
setRotation(FUEL_OUTLET_1, 0F, 0F, 0.2617994F);
FUEL_OUTLET_2 = new ModelRenderer(this, 86, 14);
FUEL_OUTLET_2.addBox(0F, 0F, 0F, 1, 2, 1);
FUEL_OUTLET_2.setRotationPoint(1F, 17F, 5F);
FUEL_OUTLET_2.setTextureSize(128, 128);
FUEL_OUTLET_2.mirror = true;
setRotation(FUEL_OUTLET_2, 0F, 0F, 0F);
PLUG_PANEL = new ModelRenderer(this, 44, 18);
PLUG_PANEL.addBox(0F, 0F, 0F, 4, 9, 6);
PLUG_PANEL.setRotationPoint(4F, 14F, -3F);
PLUG_PANEL.setTextureSize(128, 128);
PLUG_PANEL.mirror = true;
setRotation(PLUG_PANEL, 0F, 0F, 0F);
PISTON_ARM_MOVES = new ModelRenderer(this, 8, 57);
PISTON_ARM_MOVES.addBox(0F, 0F, 0F, 2, 2, 2);
PISTON_ARM_MOVES.setRotationPoint(-1F, 11F, -6F);
PISTON_ARM_MOVES.setTextureSize(128, 128);
PISTON_ARM_MOVES.mirror = true;
setRotation(PISTON_ARM_MOVES, 0F, 0F, 0F);
PISTON_BODY = new ModelRenderer(this, 0, 63);
PISTON_BODY.addBox(0F, 0F, 0F, 6, 4, 6);
PISTON_BODY.setRotationPoint(-3F, 9F, -8F);
PISTON_BODY.setTextureSize(128, 128);
PISTON_BODY.mirror = true;
setRotation(PISTON_BODY, 0F, 0F, 0F);
PISTON_HEAD_MOVES = new ModelRenderer(this, 8, 50);
PISTON_HEAD_MOVES.addBox(0F, 0F, 0F, 4, 2, 4);
PISTON_HEAD_MOVES.setRotationPoint(-2F, 13F, -7F);
PISTON_HEAD_MOVES.setTextureSize(128, 128);
PISTON_HEAD_MOVES.mirror = true;
setRotation(PISTON_HEAD_MOVES, 0F, 0F, 0F);
ModelRenderer Base;
ModelRenderer Pipe1;
ModelRenderer Pipe2;
ModelRenderer ContainerLid;
ModelRenderer ContainerRight;
ModelRenderer ContainerBottom;
ModelRenderer ContainerFront;
ModelRenderer ContainerBack;
ModelRenderer ContainerLeft;
ModelRenderer Decor1;
ModelRenderer Decor2;
ModelRenderer BackTop;
ModelRenderer FrontPanel1;
ModelRenderer FrontPanel2;
ModelRenderer LeftPanel;
ModelRenderer RightPanel;
ModelRenderer BackPanel;
}
public ModelBioGenerator()
{
textureWidth = 64;
textureHeight = 64;
public void render(float size, float depth)
{
MAIN_BASE.render(size);
MATERIAL_INLET.render(size);
CONVEYOR_BELT_1.render(size);
CONVEYOR_BELT_SUPPORT.render(size);
PISTON_SUPPORT_1.render(size);
PISTON_SUPPORT_2.render(size);
CONVEYOR_BELT_2.render(size);
FUEL_CONTAINER_WALL_1.render(size);
FUEL_CONTAINER_WALL_2.render(size);
FUEL_CONTAINER_WALL_3.render(size);
FUEL_CONTAINER_WALL_4.render(size);
FUEL_CONTAINER_TOP_1.render(size);
FUEL_CONTAINER_TOP_2.render(size);
FUEL_OUTLET_1.render(size);
FUEL_OUTLET_2.render(size);
PLUG_PANEL.render(size);
PISTON_HEAD_MOVES.setRotationPoint(-2F, 13F+depth, -7F);
PISTON_HEAD_MOVES.render(size);
PISTON_ARM_MOVES.render(size);
PISTON_BODY.render(size);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
Base = new ModelRenderer(this, 0, 0);
Base.addBox(0F, 0F, 0F, 14, 1, 14);
Base.setRotationPoint(-7F, 23F, -7F);
Base.setTextureSize(64, 64);
Base.mirror = true;
setRotation(Base, 0F, 0F, 0F);
Pipe1 = new ModelRenderer(this, 0, 16);
Pipe1.addBox(0F, 0F, 0F, 2, 2, 2);
Pipe1.setRotationPoint(-1F, 13F, -3F);
Pipe1.setTextureSize(64, 64);
Pipe1.mirror = true;
setRotation(Pipe1, 0F, 0F, 0F);
Pipe2 = new ModelRenderer(this, 0, 21);
Pipe2.addBox(0F, 0F, 0F, 2, 2, 8);
Pipe2.setRotationPoint(-1F, 11F, -3F);
Pipe2.setTextureSize(64, 64);
Pipe2.mirror = true;
setRotation(Pipe2, 0F, 0F, 0F);
ContainerLid = new ModelRenderer(this, 0, 32);
ContainerLid.addBox(0F, 0F, 0F, 4, 1, 4);
ContainerLid.setRotationPoint(-2F, 15F, -5F);
ContainerLid.setTextureSize(64, 64);
ContainerLid.mirror = true;
setRotation(ContainerLid, 0F, 0F, 0F);
ContainerRight = new ModelRenderer(this, 0, 38);
ContainerRight.addBox(0F, 0F, 0F, 1, 6, 4);
ContainerRight.setRotationPoint(2F, 16F, -5F);
ContainerRight.setTextureSize(64, 64);
ContainerRight.mirror = true;
setRotation(ContainerRight, 0F, 0F, 0F);
ContainerBottom = new ModelRenderer(this, 0, 49);
ContainerBottom.addBox(0F, 0F, 0F, 6, 1, 6);
ContainerBottom.setRotationPoint(-3F, 22F, -6F);
ContainerBottom.setTextureSize(64, 64);
ContainerBottom.mirror = true;
setRotation(ContainerBottom, 0F, 0F, 0F);
ContainerFront = new ModelRenderer(this, 11, 41);
ContainerFront.addBox(0F, 0F, 0F, 6, 6, 1);
ContainerFront.setRotationPoint(-3F, 16F, -6F);
ContainerFront.setTextureSize(64, 64);
ContainerFront.mirror = true;
setRotation(ContainerFront, 0F, 0F, 0F);
ContainerBack = new ModelRenderer(this, 11, 41);
ContainerBack.addBox(0F, 0F, 0F, 6, 6, 1);
ContainerBack.setRotationPoint(-3F, 16F, -1F);
ContainerBack.setTextureSize(64, 64);
ContainerBack.mirror = true;
setRotation(ContainerBack, 0F, 0F, 0F);
ContainerLeft = new ModelRenderer(this, 0, 38);
ContainerLeft.addBox(0F, 0F, 0F, 1, 6, 4);
ContainerLeft.setRotationPoint(-3F, 16F, -5F);
ContainerLeft.setTextureSize(64, 64);
setRotation(ContainerLeft, 0F, 0F, 0F);
ContainerLeft.mirror = false;
Decor1 = new ModelRenderer(this, 21, 20);
Decor1.addBox(0F, 0F, 0F, 2, 2, 3);
Decor1.setRotationPoint(4.1F, 15F, 2F);
Decor1.setTextureSize(64, 64);
Decor1.mirror = true;
setRotation(Decor1, 0F, 0F, 0F);
Decor2 = new ModelRenderer(this, 21, 20);
Decor2.addBox(0F, 0F, 0F, 2, 2, 3);
Decor2.setRotationPoint(-6.1F, 15F, 2F);
Decor2.setTextureSize(64, 64);
Decor2.mirror = true;
setRotation(Decor2, 0F, 0F, 0F);
BackTop = new ModelRenderer(this, 21, 26);
BackTop.addBox(0F, 0F, 0F, 8, 1, 3);
BackTop.setRotationPoint(-4F, 10F, 5F);
BackTop.setTextureSize(64, 64);
BackTop.mirror = true;
setRotation(BackTop, 0F, 0F, 0F);
FrontPanel1 = new ModelRenderer(this, 17, 32);
FrontPanel1.addBox(0F, 0F, 0F, 3, 6, 2);
FrontPanel1.setRotationPoint(-7F, 17F, -6F);
FrontPanel1.setTextureSize(64, 64);
FrontPanel1.mirror = true;
setRotation(FrontPanel1, 0F, 0F, 0F);
FrontPanel2 = new ModelRenderer(this, 17, 32);
FrontPanel2.addBox(0F, 0F, 0F, 3, 6, 2);
FrontPanel2.setRotationPoint(4F, 17F, -6F);
FrontPanel2.setTextureSize(64, 64);
FrontPanel2.mirror = true;
setRotation(FrontPanel2, 0F, 0F, 0F);
LeftPanel = new ModelRenderer(this, 28, 31);
LeftPanel.addBox(0F, 0F, 0F, 3, 7, 10);
LeftPanel.setRotationPoint(-7F, 16F, -4F);
LeftPanel.setTextureSize(64, 64);
LeftPanel.mirror = true;
setRotation(LeftPanel, 0F, 0F, 0F);
RightPanel = new ModelRenderer(this, 28, 31);
RightPanel.addBox(0F, 0F, 0F, 3, 7, 10);
RightPanel.setRotationPoint(4F, 16F, -4F);
RightPanel.setTextureSize(64, 64);
RightPanel.mirror = true;
setRotation(RightPanel, 0F, 0F, 0F);
BackPanel = new ModelRenderer(this, 28, 49);
BackPanel.addBox(0F, 0F, 0F, 10, 12, 3);
BackPanel.setRotationPoint(-5F, 11F, 5F);
BackPanel.setTextureSize(64, 64);
BackPanel.mirror = true;
setRotation(BackPanel, 0F, 0F, 0F);
}
public void render(float size)
{
Base.render(size);
Pipe1.render(size);
Pipe2.render(size);
ContainerLid.render(size);
ContainerRight.render(size);
ContainerBottom.render(size);
ContainerFront.render(size);
ContainerBack.render(size);
ContainerLeft.render(size);
Decor1.render(size);
Decor2.render(size);
BackTop.render(size);
FrontPanel1.render(size);
FrontPanel2.render(size);
LeftPanel.render(size);
RightPanel.render(size);
BackPanel.render(size);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -1,11 +1,17 @@
package mekanism.generators.client.render;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
import mekanism.client.render.MekanismRenderer.Model3D;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.generators.client.model.ModelBioGenerator;
import mekanism.generators.common.tileentity.TileEntityBioGenerator;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
@ -17,6 +23,8 @@ public class RenderBioGenerator extends TileEntitySpecialRenderer
{
private ModelBioGenerator model = new ModelBioGenerator();
private static Icon renderIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidEnergy");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
@ -31,14 +39,90 @@ public class RenderBioGenerator extends TileEntitySpecialRenderer
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
}
GL11.glRotatef(180, 0f, 0f, 1f);
model.render(0.0625F, tileEntity.isActive ? tileEntity.getMatrix() : 0);
model.render(0.0625F);
GL11.glPopMatrix();
}
/*
@SuppressWarnings("incomplete-switch")
private DisplayInteger getDisplayList(TileEntityBioGenerator tileEntity)
{
Model3D model3D = new Model3D();
model3D.baseBlock = Block.waterStill;
model3D.setTexture(renderIcon);
switch(ForgeDirection.getOrientation(tileEntity.facing))
{
case NORTH:
{
model3D.minZ = -.01;
model3D.maxZ = 0;
model3D.minX = 0;
model3D.minY = .0625;
model3D.maxX = 1;
model3D.maxY = 1;
break;
}
case SOUTH:
{
model3D.minZ = 1;
model3D.maxZ = 1.01;
model3D.minX = 0;
model3D.minY = .0625;
model3D.maxX = 1;
model3D.maxY = 1;
break;
}
case WEST:
{
model3D.minX = -.01;
model3D.maxX = 0;
model3D.minY = .0625;
model3D.minZ = 0;
model3D.maxY = 1;
model3D.maxZ = 1;
break;
}
case EAST:
{
model3D.minX = 1;
model3D.maxX = 1.01;
model3D.minY = .0625;
model3D.minZ = 0;
model3D.maxY = 1;
model3D.maxZ = 1;
break;
}
}
MekanismRenderer.renderObject(model3D);
}
*/
private void pop()
{
GL11.glPopAttrib();
GL11.glPopMatrix();
}
private void push()
{
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
}

View file

@ -32,7 +32,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
@ -488,6 +487,17 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
return itemStack;
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if(!world.isRemote)
{
((TileEntityElectricBlock)tileEntity).register();
}
}
public static enum GeneratorType
{
HEAT_GENERATOR(0, "HeatGenerator", 0, 160000, TileEntityHeatGenerator.class, true),

View file

@ -31,9 +31,6 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui
@SideOnly(Side.CLIENT)
public Sound audio;
/** Where the crush piston should be on the model. */
public float crushMatrix = 0;
/** The FluidSlot biofuel instance for this generator. */
public FluidSlot bioFuelSlot = new FluidSlot(24000, -1);
@ -43,35 +40,11 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui
inventory = new ItemStack[2];
}
public float getMatrix()
{
float matrix = 0;
if(crushMatrix <= 2)
{
return crushMatrix;
}
else {
return 2 - (crushMatrix-2);
}
}
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote)
{
if(crushMatrix < 4)
{
crushMatrix+=0.2F;
}
else {
crushMatrix = 0;
}
}
ChargeUtils.charge(1, this);
if(inventory[0] != null)
@ -242,6 +215,12 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui
data.add(bioFuelSlot.fluidStored);
return data;
}
@Override
public ForgeDirection getOutputtingSide()
{
return ForgeDirection.getOrientation(facing).getOpposite();
}
@Override
public String[] getMethodNames()

View file

@ -12,7 +12,6 @@ item.Robit.name=Robit
item.AtomicDisassembler.name=Atomar-Disassembler
item.AtomicCore.name=Atomar-Kern
item.ElectricBow.name=Elektrischer Bogen
item.StorageTank.name=Wasserstofftank
item.BoundingBlock.name=Begrenzungsblock
tile.GasTank.name=Gastank
item.StorageTank.name=Speichertank

View file

@ -12,7 +12,6 @@ item.Robit.name=Robit
item.AtomicDisassembler.name=Atomic Disassembler
item.AtomicCore.name=Atomic Core
item.ElectricBow.name=Electric Bow
item.StorageTank.name=Hydrogen Tank
item.BoundingBlock.name=Bounding Block
tile.GasTank.name=Gas Tank
item.StorageTank.name=Storage Tank

View file

@ -12,7 +12,6 @@ item.Robit.name=Robit
item.AtomicDisassembler.name=Atomic Disassembler
item.AtomicCore.name=Atomowe Jądro
item.ElectricBow.name=Elektryczny Łuk
item.StorageTank.name=Zbiornik Wodoru
item.BoundingBlock.name=Blok Graniczny
tile.GasTank.name=Zbiornik na Gaz
item.StorageTank.name=Zbiornik

View file

@ -12,7 +12,6 @@ item.Robit.name=机器人
item.AtomicDisassembler.name=原子分解机
item.AtomicCore.name=原子核
item.ElectricBow.name=电动弓
item.StorageTank.name=氢气储罐
item.BoundingBlock.name=绑定方块
tile.GasTank.name=燃气储罐
item.StorageTank.name=储罐

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB