Fixed multimeter gui
This commit is contained in:
parent
b83b2f8336
commit
8046f99144
4 changed files with 43 additions and 43 deletions
|
@ -13,10 +13,11 @@ import resonantinduction.multimeter.PartMultimeter;
|
|||
import resonantinduction.render.BlockRenderingHandler;
|
||||
import resonantinduction.render.RenderEMContractor;
|
||||
import resonantinduction.render.RenderItemMultimeter;
|
||||
import resonantinduction.render.RenderMultimeter;
|
||||
import resonantinduction.render.RenderTesla;
|
||||
import resonantinduction.tesla.TileEntityTesla;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
@ -38,28 +39,23 @@ public class ClientProxy extends CommonProxy
|
|||
RenderingRegistry.registerBlockHandler(BlockRenderingHandler.INSTANCE);
|
||||
MinecraftForgeClient.registerItemRenderer(ResonantInduction.itemMultimeter.itemID, new RenderItemMultimeter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTesla.class, new RenderTesla());
|
||||
// ClientRegistry.bindTileEntitySpecialRenderer(PartMultimeter.class, new
|
||||
// RenderMultimeter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEMContractor.class, new RenderEMContractor());
|
||||
// ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBattery.class, new
|
||||
// RenderBattery());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
/*
|
||||
* if (tileEntity instanceof PartMultimeter)
|
||||
* {
|
||||
* return new GuiMultimeter(player.inventory, ((PartMultimeter) tileEntity));
|
||||
* }
|
||||
* else if (tileEntity instanceof TileEntityBattery)
|
||||
* {
|
||||
* return new GuiBattery(player.inventory, ((TileEntityBattery) tileEntity));
|
||||
* }
|
||||
*/
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
TMultiPart part = ((TileMultipart) tileEntity).partMap(id);
|
||||
|
||||
if (part instanceof PartMultimeter)
|
||||
{
|
||||
return new GuiMultimeter(player.inventory, (PartMultimeter) part);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@ import net.minecraft.world.World;
|
|||
import resonantinduction.multimeter.ContainerMultimeter;
|
||||
import resonantinduction.multimeter.PartMultimeter;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.lib.colour.Colour;
|
||||
import codechicken.lib.colour.ColourRGBA;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
/**
|
||||
|
@ -25,20 +26,18 @@ public class CommonProxy implements IGuiHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
/*if (tileEntity instanceof PartMultimeter)
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
return new ContainerMultimeter(player.inventory, ((PartMultimeter) tileEntity));
|
||||
TMultiPart part = ((TileMultipart) tileEntity).partMap(id);
|
||||
if (part instanceof PartMultimeter)
|
||||
{
|
||||
return new ContainerMultimeter(player.inventory, ((PartMultimeter) part));
|
||||
}
|
||||
}
|
||||
|
||||
* else if (tileEntity instanceof TileEntityBattery)
|
||||
* {
|
||||
* return new ContainerBattery(player.inventory, ((TileEntityBattery) tileEntity));
|
||||
* }
|
||||
*/
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package resonantinduction.multimeter;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -13,20 +11,12 @@ import net.minecraftforge.common.Configuration;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.TabRI;
|
||||
import resonantinduction.Utility;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import resonantinduction.wire.part.PartFlatWire;
|
||||
import resonantinduction.wire.render.RenderFlatWire;
|
||||
import universalelectricity.api.energy.UnitDisplay;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemMultimeter extends JItemMultiPart
|
||||
{
|
||||
|
|
|
@ -9,12 +9,11 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -22,7 +21,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.base.PartAdvanced;
|
||||
import resonantinduction.render.RenderMultimeter;
|
||||
import resonantinduction.wire.render.RenderFlatWire;
|
||||
import scala.reflect.ClassTag;
|
||||
import universalelectricity.api.Compatibility.CompatibilityType;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import universalelectricity.api.energy.IEnergyContainer;
|
||||
|
@ -31,7 +30,6 @@ import universalelectricity.api.net.IConnectable;
|
|||
import buildcraft.api.power.IPowerReceptor;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.lighting.LazyLightMatrix;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.TextureUtils;
|
||||
|
@ -95,6 +93,13 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
|||
this.side = (byte) (side ^ 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
player.openGui(ResonantInduction.INSTANCE, this.side, world(), x(), y(), z());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
|
@ -189,8 +194,7 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
|||
energyLimit = packet.readLong();
|
||||
}
|
||||
else if (packetID == 3)
|
||||
{ System.out.println("READ");
|
||||
|
||||
{
|
||||
this.detectMode = DetectMode.values()[packet.readByte()];
|
||||
this.detectedEnergy = packet.readLong();
|
||||
this.detectedAverageEnergy = packet.readLong();
|
||||
|
@ -344,14 +348,25 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
|||
return true;
|
||||
}
|
||||
|
||||
protected ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(ResonantInduction.itemMultimeter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ItemStack> getDrops()
|
||||
{
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add(new ItemStack(ResonantInduction.itemMultimeter));
|
||||
drops.add(getItem());
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack pickItem(MovingObjectPosition hit)
|
||||
{
|
||||
return getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderDynamic(Vector3 pos, float frame, int pass)
|
||||
|
|
Loading…
Reference in a new issue