v5.5.6 Beta #6

*Configurable machines now render colored overlays when being hovered
over with a configurator.
*Fixed render NPE.
*Fixed config being loaded after blocks/items.
*Byte[] packet management.
*Machine side config is now synced to the client.
This commit is contained in:
Aidan Brady 2013-05-23 13:30:12 -04:00
parent 251e936a96
commit d7566428d5
36 changed files with 415 additions and 56 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -84,6 +84,11 @@ public class Object3D
return (int)MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ); return (int)MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ);
} }
public boolean sideVisible(ForgeDirection side, World world)
{
return world.getBlockId(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ) == 0;
}
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {

View file

@ -12,19 +12,27 @@ import mekanism.common.InventoryElectricChest;
import mekanism.common.ItemPortableTeleporter; import mekanism.common.ItemPortableTeleporter;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.TileEntityAdvancedElectricMachine; import mekanism.common.TileEntityAdvancedElectricMachine;
import mekanism.common.TileEntityAdvancedFactory;
import mekanism.common.TileEntityChargepad; import mekanism.common.TileEntityChargepad;
import mekanism.common.TileEntityCombiner;
import mekanism.common.TileEntityControlPanel; import mekanism.common.TileEntityControlPanel;
import mekanism.common.TileEntityCrusher;
import mekanism.common.TileEntityDynamicTank; import mekanism.common.TileEntityDynamicTank;
import mekanism.common.TileEntityDynamicValve; import mekanism.common.TileEntityDynamicValve;
import mekanism.common.TileEntityElectricChest; import mekanism.common.TileEntityElectricChest;
import mekanism.common.TileEntityElectricMachine; import mekanism.common.TileEntityElectricMachine;
import mekanism.common.TileEntityElectricPump; import mekanism.common.TileEntityElectricPump;
import mekanism.common.TileEntityEliteFactory;
import mekanism.common.TileEntityEnergizedSmelter;
import mekanism.common.TileEntityEnergyCube; import mekanism.common.TileEntityEnergyCube;
import mekanism.common.TileEntityEnrichmentChamber;
import mekanism.common.TileEntityFactory; import mekanism.common.TileEntityFactory;
import mekanism.common.TileEntityGasTank; import mekanism.common.TileEntityGasTank;
import mekanism.common.TileEntityMechanicalPipe; import mekanism.common.TileEntityMechanicalPipe;
import mekanism.common.TileEntityMetallurgicInfuser; import mekanism.common.TileEntityMetallurgicInfuser;
import mekanism.common.TileEntityOsmiumCompressor;
import mekanism.common.TileEntityPressurizedTube; import mekanism.common.TileEntityPressurizedTube;
import mekanism.common.TileEntityPurificationChamber;
import mekanism.common.TileEntityTeleporter; import mekanism.common.TileEntityTeleporter;
import mekanism.common.TileEntityTheoreticalElementizer; import mekanism.common.TileEntityTheoreticalElementizer;
import mekanism.common.TileEntityUniversalCable; import mekanism.common.TileEntityUniversalCable;
@ -39,6 +47,7 @@ import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -155,6 +164,15 @@ public class ClientProxy extends CommonProxy
@Override @Override
public void registerSpecialTileEntities() public void registerSpecialTileEntities()
{ {
ClientRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityOsmiumCompressor.class, "OsmiumCompressor", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityCombiner.class, "Combiner", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityCrusher.class, "Crusher", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityFactory.class, "SmeltingFactory", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityAdvancedFactory.class, "AdvancedSmeltingFactory", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityEliteFactory.class, "UltimateSmeltingFactory", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer", new RenderTheoreticalElementizer()); ClientRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer", new RenderTheoreticalElementizer());
ClientRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser", new RenderMetallurgicInfuser()); ClientRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser", new RenderMetallurgicInfuser());
ClientRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube", new RenderPressurizedTube()); ClientRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube", new RenderPressurizedTube());

View file

@ -2,6 +2,7 @@ package mekanism.client;
import java.util.EnumSet; import java.util.EnumSet;
import mekanism.api.EnumColor;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils; import mekanism.common.MekanismUtils;

View file

@ -27,6 +27,11 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
@Override @Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{ {
if(block == null || renderer == null)
{
return;
}
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);

View file

@ -181,4 +181,70 @@ public class MekanismRenderer
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapLastX, lightmapLastY); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapLastX, lightmapLastY);
GL11.glPopAttrib(); GL11.glPopAttrib();
} }
public static void renderOverlay(int x, int y, int z, int side, double minX, double maxX, double minY, double maxY)
{
Tessellator tessellator = Tessellator.instance;
double[] bounds = new double[] {x - .01, x + 1.01, y - .01, y + 1.01, z - .01, z + 1.01};
switch(side)
{
case 0:
tessellator.addVertexWithUV(bounds[0], bounds[2], bounds[4], minX, minY);
tessellator.addVertexWithUV(bounds[1], bounds[2], bounds[4], maxX, minY);
tessellator.addVertexWithUV(bounds[1], bounds[2], bounds[5], maxX, maxY);
tessellator.addVertexWithUV(bounds[0], bounds[2], bounds[5], minX, maxY);
break;
case 1:
tessellator.addVertexWithUV(bounds[1], bounds[3], bounds[4], maxX, minY);
tessellator.addVertexWithUV(bounds[0], bounds[3], bounds[4], minX, minY);
tessellator.addVertexWithUV(bounds[0], bounds[3], bounds[5], minX, maxY);
tessellator.addVertexWithUV(bounds[1], bounds[3], bounds[5], maxX, maxY);
break;
case 2:
tessellator.addVertexWithUV(bounds[0], bounds[3], bounds[4], maxX, minY);
tessellator.addVertexWithUV(bounds[1], bounds[3], bounds[4], minX, minY);
tessellator.addVertexWithUV(bounds[1], bounds[2], bounds[4], minX, maxY);
tessellator.addVertexWithUV(bounds[0], bounds[2], bounds[4], maxX, maxY);
break;
case 3:
tessellator.addVertexWithUV(bounds[1], bounds[3], bounds[5], maxX, minY);
tessellator.addVertexWithUV(bounds[0], bounds[3], bounds[5], minX, minY);
tessellator.addVertexWithUV(bounds[0], bounds[2], bounds[5], minX, maxY);
tessellator.addVertexWithUV(bounds[1], bounds[2], bounds[5], maxX, maxY);
break;
case 4:
tessellator.addVertexWithUV(bounds[0], bounds[3], bounds[5], maxX, minY);
tessellator.addVertexWithUV(bounds[0], bounds[3], bounds[4], minX, minY);
tessellator.addVertexWithUV(bounds[0], bounds[2], bounds[4], minX, maxY);
tessellator.addVertexWithUV(bounds[0], bounds[2], bounds[5], maxX, maxY);
break;
case 5:
tessellator.addVertexWithUV(bounds[1], bounds[3], bounds[4], maxX, minY);
tessellator.addVertexWithUV(bounds[1], bounds[3], bounds[5], minX, minY);
tessellator.addVertexWithUV(bounds[1], bounds[2], bounds[5], minX, maxY);
tessellator.addVertexWithUV(bounds[1], bounds[2], bounds[4], maxX, maxY);
break;
}
}
public static class DisplayInteger
{
public int display;
@Override
public int hashCode()
{
int code = 1;
code = 31 * code + display;
return code;
}
@Override
public boolean equals(Object obj)
{
return obj instanceof DisplayInteger && ((DisplayInteger)obj).display == display;
}
}
} }

View file

@ -0,0 +1,225 @@
package mekanism.client;
import java.util.HashMap;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.Object3D;
import mekanism.client.MekanismRenderer.DisplayInteger;
import mekanism.client.MekanismRenderer.Model3D;
import mekanism.common.ItemConfigurator;
import mekanism.common.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class RenderConfigurableMachine extends TileEntitySpecialRenderer
{
private static Icon[] coloredOverlays;
private Minecraft mc = FMLClientHandler.instance().getClient();
private HashMap<ForgeDirection, HashMap<EnumColor, DisplayInteger>> cachedOverlays = new HashMap<ForgeDirection, HashMap<EnumColor, DisplayInteger>>();
public RenderConfigurableMachine()
{
if(coloredOverlays == null)
{
coloredOverlays = new Icon[16];
TextureMap registrar = mc.renderEngine.textureMapBlocks;
coloredOverlays[0] = registrar.registerIcon("mekanism:OverlayBlack");
coloredOverlays[1] = registrar.registerIcon("mekanism:OverlayDarkBlue");
coloredOverlays[2] = registrar.registerIcon("mekanism:OverlayDarkGreen");
coloredOverlays[3] = registrar.registerIcon("mekanism:OverlayDarkAqua");
coloredOverlays[4] = registrar.registerIcon("mekanism:OverlayDarkRed");
coloredOverlays[5] = registrar.registerIcon("mekanism:OverlayPurple");
coloredOverlays[6] = registrar.registerIcon("mekanism:OverlayOrange");
coloredOverlays[7] = registrar.registerIcon("mekanism:OverlayGrey");
coloredOverlays[8] = registrar.registerIcon("mekanism:OverlayDarkGrey");
coloredOverlays[9] = registrar.registerIcon("mekanism:OverlayIndigo");
coloredOverlays[10] = registrar.registerIcon("mekanism:OverlayBrightGreen");
coloredOverlays[11] = registrar.registerIcon("mekanism:OverlayAqua");
coloredOverlays[12] = registrar.registerIcon("mekanism:OverlayRed");
coloredOverlays[13] = registrar.registerIcon("mekanism:OverlayPink");
coloredOverlays[14] = registrar.registerIcon("mekanism:OverlayYellow");
coloredOverlays[15] = registrar.registerIcon("mekanism:OverlayWhite");
}
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
renderAModelAt((IConfigurable)tileEntity, x, y, z, partialTick);
}
public void renderAModelAt(IConfigurable configurable, double x, double y, double z, float partialTick)
{
TileEntity tileEntity = (TileEntity)configurable;
EntityPlayer player = mc.thePlayer;
World world = mc.thePlayer.worldObj;
MovingObjectPosition pos = player.rayTrace(8.0D, 1.0F);
if(pos != null && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemConfigurator)
{
int xPos = MathHelper.floor_double(pos.blockX);
int yPos = MathHelper.floor_double(pos.blockY);
int zPos = MathHelper.floor_double(pos.blockZ);
Object3D obj = new Object3D(xPos, yPos, zPos);
if(xPos == tileEntity.xCoord && yPos == tileEntity.yCoord && zPos == tileEntity.zCoord)
{
EnumColor color = configurable.getSideData().get(configurable.getConfiguration()[MekanismUtils.getBaseOrientation(pos.sideHit, configurable.getOrientation())]).color;
push();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
bindTextureByName("/mods/mekanism/textures/blocks/Overlay" + color.friendlyName.replace(" ", "") + ".png");
GL11.glTranslatef((float)x, (float)y, (float)z);
int display = getOverlayDisplay(world, ForgeDirection.getOrientation(pos.sideHit), color).display;
GL11.glCallList(display);
pop();
}
}
}
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);
}
private DisplayInteger getOverlayDisplay(World world, ForgeDirection side, EnumColor color)
{
if(cachedOverlays.containsKey(side) && cachedOverlays.get(side).containsKey(color))
{
return cachedOverlays.get(side).get(color);
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Block.stone;
toReturn.texture = coloredOverlays[color.ordinal()];
DisplayInteger display = new DisplayInteger();
if(cachedOverlays.containsKey(side))
{
cachedOverlays.get(side).put(color, display);
}
else {
HashMap<EnumColor, DisplayInteger> map = new HashMap<EnumColor, DisplayInteger>();
map.put(color, display);
cachedOverlays.put(side, map);
}
display.display = GLAllocation.generateDisplayLists(1);
GL11.glNewList(display.display, 4864);
switch(side)
{
case DOWN:
{
toReturn.minY = -.01;
toReturn.maxY = 0;
toReturn.minX = 0;
toReturn.minZ = 0;
toReturn.maxX = 1;
toReturn.maxZ = 1;
break;
}
case UP:
{
toReturn.minY = 1;
toReturn.maxY = 1.01;
toReturn.minX = 0;
toReturn.minZ = 0;
toReturn.maxX = 1;
toReturn.maxZ = 1;
break;
}
case NORTH:
{
toReturn.minZ = -.01;
toReturn.maxZ = 0;
toReturn.minX = 0;
toReturn.minY = 0;
toReturn.maxX = 1;
toReturn.maxY = 1;
break;
}
case SOUTH:
{
toReturn.minZ = 1;
toReturn.maxZ = 1.01;
toReturn.minX = 0;
toReturn.minY = 0;
toReturn.maxX = 1;
toReturn.maxY = 1;
break;
}
case WEST:
{
toReturn.minX = -.01;
toReturn.maxX = 0;
toReturn.minY = 0;
toReturn.minZ = 0;
toReturn.maxY = 1;
toReturn.maxZ = 1;
break;
}
case EAST:
{
toReturn.minX = 1;
toReturn.maxX = 1.01;
toReturn.minY = 0;
toReturn.minZ = 0;
toReturn.maxY = 1;
toReturn.maxZ = 1;
break;
}
default:
{
break;
}
}
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
GL11.glEndList();
return display;
}
}

View file

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import mekanism.api.Object3D; import mekanism.api.Object3D;
import mekanism.client.MekanismRenderer.DisplayInteger;
import mekanism.client.MekanismRenderer.Model3D; import mekanism.client.MekanismRenderer.Model3D;
import mekanism.common.SynchronizedTankData.ValveData; import mekanism.common.SynchronizedTankData.ValveData;
import mekanism.common.TileEntityDynamicTank; import mekanism.common.TileEntityDynamicTank;
@ -21,10 +22,8 @@ import org.lwjgl.opengl.GL11;
public class RenderDynamicTank extends TileEntitySpecialRenderer public class RenderDynamicTank extends TileEntitySpecialRenderer
{ {
private static RenderBlocks renderBlocks = new RenderBlocks();
private static Map<RenderData, HashMap<LiquidStack, int[]>> cachedCenterLiquids = new HashMap<RenderData, HashMap<LiquidStack, int[]>>(); private static Map<RenderData, HashMap<LiquidStack, int[]>> cachedCenterLiquids = new HashMap<RenderData, HashMap<LiquidStack, int[]>>();
private static Map<ValveRenderData, HashMap<LiquidStack, ValveDisplayInteger>> cachedValveLiquids = new HashMap<ValveRenderData, HashMap<LiquidStack, ValveDisplayInteger>>(); private static Map<ValveRenderData, HashMap<LiquidStack, DisplayInteger>> cachedValveLiquids = new HashMap<ValveRenderData, HashMap<LiquidStack, DisplayInteger>>();
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
@ -137,7 +136,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
return displays; return displays;
} }
private ValveDisplayInteger getValveDisplay(ValveRenderData data, LiquidStack stack, World world) private DisplayInteger getValveDisplay(ValveRenderData data, LiquidStack stack, World world)
{ {
if(cachedValveLiquids.containsKey(data) && cachedValveLiquids.get(data).containsKey(stack)) if(cachedValveLiquids.containsKey(data) && cachedValveLiquids.get(data).containsKey(stack))
{ {
@ -153,14 +152,14 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
toReturn.baseBlock = Block.blocksList[stack.itemID]; toReturn.baseBlock = Block.blocksList[stack.itemID];
} }
ValveDisplayInteger display = new ValveDisplayInteger(); DisplayInteger display = new DisplayInteger();
if(cachedValveLiquids.containsKey(data)) if(cachedValveLiquids.containsKey(data))
{ {
cachedValveLiquids.get(data).put(stack, display); cachedValveLiquids.get(data).put(stack, display);
} }
else { else {
HashMap<LiquidStack, ValveDisplayInteger> map = new HashMap<LiquidStack, ValveDisplayInteger>(); HashMap<LiquidStack, DisplayInteger> map = new HashMap<LiquidStack, DisplayInteger>();
map.put(stack, display); map.put(stack, display);
cachedValveLiquids.put(data, map); cachedValveLiquids.put(data, map);
} }
@ -335,23 +334,4 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
return code; return code;
} }
} }
public static class ValveDisplayInteger
{
public int display;
@Override
public int hashCode()
{
int code = 1;
code = 31 * code + display;
return code;
}
@Override
public boolean equals(Object obj)
{
return obj instanceof ValveDisplayInteger && ((ValveDisplayInteger)obj).display == display;
}
}
} }

View file

@ -7,7 +7,6 @@ import mekanism.common.MekanismUtils;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -26,12 +25,13 @@ public class RenderTickHandler implements ITickHandler
@Override @Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) public void tickEnd(EnumSet<TickType> type, Object... tickData)
{ {
float partialTick = (Float)tickData[0];
Minecraft mc = FMLClientHandler.instance().getClient(); Minecraft mc = FMLClientHandler.instance().getClient();
if(mc.currentScreen == null && mc.thePlayer != null && mc.theWorld != null && !MekanismUtils.isObfuscated() && !mc.gameSettings.showDebugInfo) if(mc.thePlayer != null && mc.theWorld != null)
{ {
EntityPlayer player = mc.thePlayer; EntityPlayer player = mc.thePlayer;
World world = mc.theWorld; World world = mc.thePlayer.worldObj;
FontRenderer font = mc.fontRenderer; FontRenderer font = mc.fontRenderer;
@ -45,19 +45,23 @@ public class RenderTickHandler implements ITickHandler
Object3D obj = new Object3D(x, y, z); Object3D obj = new Object3D(x, y, z);
String tileDisplay = "no"; if(!MekanismUtils.isObfuscated() && mc.currentScreen == null && !mc.gameSettings.showDebugInfo)
if(obj.getTileEntity(world) != null)
{ {
if(obj.getTileEntity(world).getClass() != null) String tileDisplay = "";
if(obj.getTileEntity(world) != null)
{ {
tileDisplay = obj.getTileEntity(world).getClass().getSimpleName(); if(obj.getTileEntity(world).getClass() != null)
{
tileDisplay = obj.getTileEntity(world).getClass().getSimpleName();
}
} }
}
font.drawStringWithShadow("Block ID: " + obj.getBlockId(world), 1, 1, 0x404040); font.drawStringWithShadow("Block ID: " + obj.getBlockId(world), 1, 1, 0x404040);
font.drawStringWithShadow("Metadata: " + obj.getMetadata(world), 1, 10, 0x404040); font.drawStringWithShadow("Metadata: " + obj.getMetadata(world), 1, 10, 0x404040);
font.drawStringWithShadow("TileEntity: " + tileDisplay, 1, 19, 0x404040); font.drawStringWithShadow("TileEntity: " + tileDisplay, 1, 19, 0x404040);
font.drawStringWithShadow("Side: " + pos.sideHit, 1, 28, 0x404040);
}
} }
} }
} }
@ -73,4 +77,4 @@ public class RenderTickHandler implements ITickHandler
{ {
return "MekanismRender"; return "MekanismRender";
} }
} }

View file

@ -43,32 +43,32 @@ public class ThreadTankSparkle extends Thread
for(int i = 0; i < 6; i++) for(int i = 0; i < 6; i++)
{ {
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord-1, tileEntity.zCoord) == 0) if(Object3D.get(tileEntity).sideVisible(ForgeDirection.DOWN, world))
{ {
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + -.01, tileEntity.zCoord + random.nextDouble(), 0, 0, 0); world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + -.01, tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
} }
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord+1, tileEntity.zCoord) == 0) if(Object3D.get(tileEntity).sideVisible(ForgeDirection.UP, world))
{ {
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + 1.01, tileEntity.zCoord + random.nextDouble(), 0, 0, 0); world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + 1.01, tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
} }
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord-1) == 0) if(Object3D.get(tileEntity).sideVisible(ForgeDirection.NORTH, world))
{ {
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + -.01, 0, 0, 0); world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + -.01, 0, 0, 0);
} }
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord+1) == 0) if(Object3D.get(tileEntity).sideVisible(ForgeDirection.SOUTH, world))
{ {
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + 1.01, 0, 0, 0); world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + 1.01, 0, 0, 0);
} }
if(world.getBlockId(tileEntity.xCoord-1, tileEntity.yCoord, tileEntity.zCoord) == 0) if(Object3D.get(tileEntity).sideVisible(ForgeDirection.WEST, world))
{ {
world.spawnParticle("reddust", tileEntity.xCoord + -.01, tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + random.nextDouble(), 0, 0, 0); world.spawnParticle("reddust", tileEntity.xCoord + -.01, tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
} }
if(world.getBlockId(tileEntity.xCoord+1, tileEntity.yCoord, tileEntity.zCoord) == 0) if(Object3D.get(tileEntity).sideVisible(ForgeDirection.EAST, world))
{ {
world.spawnParticle("reddust", tileEntity.xCoord + 1.01, tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + random.nextDouble(), 0, 0, 0); world.spawnParticle("reddust", tileEntity.xCoord + 1.01, tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
} }

View file

@ -75,7 +75,7 @@ public class BlockBasic extends Block
icons[3] = register.registerIcon("mekanism:CoalBlock"); icons[3] = register.registerIcon("mekanism:CoalBlock");
icons[4] = register.registerIcon("mekanism:RefinedGlowstone"); icons[4] = register.registerIcon("mekanism:RefinedGlowstone");
icons[5] = register.registerIcon("mekanism:SteelBlock"); icons[5] = register.registerIcon("mekanism:SteelBlock");
icons[6] = register.registerIcon("mekanism:ControlPanel"); //icons[6] = register.registerIcon("mekanism:ControlPanel");
icons[7] = register.registerIcon("mekanism:TeleporterFrame"); icons[7] = register.registerIcon("mekanism:TeleporterFrame");
icons[8] = register.registerIcon("mekanism:SteelCasing"); icons[8] = register.registerIcon("mekanism:SteelCasing");
icons[9] = register.registerIcon("mekanism:DynamicTank"); icons[9] = register.registerIcon("mekanism:DynamicTank");

View file

@ -2,8 +2,12 @@ package mekanism.common;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -18,6 +22,10 @@ public class BlockBounding extends Block
setHardness(3.5F); setHardness(3.5F);
setResistance(8F); setResistance(8F);
} }
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register) {}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ)

View file

@ -11,6 +11,7 @@ import mekanism.api.ITubeConnection;
import mekanism.client.ClientProxy; import mekanism.client.ClientProxy;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -32,6 +33,10 @@ public class BlockTransmitter extends Block
setCreativeTab(Mekanism.tabMekanism); setCreativeTab(Mekanism.tabMekanism);
} }
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register) {}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(int i, CreativeTabs creativetabs, List list) public void getSubBlocks(int i, CreativeTabs creativetabs, List list)

View file

@ -21,6 +21,15 @@ public class CommonProxy
*/ */
public void registerSpecialTileEntities() public void registerSpecialTileEntities()
{ {
GameRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber");
GameRegistry.registerTileEntity(TileEntityOsmiumCompressor.class, "OsmiumCompressor");
GameRegistry.registerTileEntity(TileEntityCombiner.class, "Combiner");
GameRegistry.registerTileEntity(TileEntityCrusher.class, "Crusher");
GameRegistry.registerTileEntity(TileEntityFactory.class, "SmeltingFactory");
GameRegistry.registerTileEntity(TileEntityAdvancedFactory.class, "AdvancedSmeltingFactory");
GameRegistry.registerTileEntity(TileEntityEliteFactory.class, "UltimateSmeltingFactory");
GameRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber");
GameRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter");
GameRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer"); GameRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer");
GameRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser"); GameRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser");
GameRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube"); GameRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube");

View file

@ -74,6 +74,12 @@ public class ItemConfigurator extends ItemEnergized
setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE); setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation())); MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()); player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
if(config instanceof TileEntityBasicBlock)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
PacketHandler.sendTileEntityPacketToClients(tileEntity, 50, tileEntity.getNetworkedData(new ArrayList()));
}
return true; return true;
} }
} }

View file

@ -991,20 +991,11 @@ public class Mekanism
EntityRegistry.registerModEntity(EntityRobit.class, "Robit", 1, this, 40, 5, true); EntityRegistry.registerModEntity(EntityRobit.class, "Robit", 1, this, 40, 5, true);
//Tile entities //Tile entities
GameRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber");
GameRegistry.registerTileEntity(TileEntityOsmiumCompressor.class, "OsmiumCompressor");
GameRegistry.registerTileEntity(TileEntityCombiner.class, "Combiner");
GameRegistry.registerTileEntity(TileEntityCrusher.class, "Crusher");
GameRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube"); GameRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube");
GameRegistry.registerTileEntity(TileEntityBoundingBlock.class, "BoundingBlock"); GameRegistry.registerTileEntity(TileEntityBoundingBlock.class, "BoundingBlock");
GameRegistry.registerTileEntity(TileEntityControlPanel.class, "ControlPanel"); GameRegistry.registerTileEntity(TileEntityControlPanel.class, "ControlPanel");
GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank"); GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank");
GameRegistry.registerTileEntity(TileEntityFactory.class, "SmeltingFactory");
GameRegistry.registerTileEntity(TileEntityAdvancedFactory.class, "AdvancedSmeltingFactory");
GameRegistry.registerTileEntity(TileEntityEliteFactory.class, "UltimateSmeltingFactory");
GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter"); GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter");
GameRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber");
GameRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter");
//Load tile entities that have special renderers. //Load tile entities that have special renderers.
proxy.registerSpecialTileEntities(); proxy.registerSpecialTileEntities();
@ -1073,6 +1064,9 @@ public class Mekanism
//Register to receive subscribed events //Register to receive subscribed events
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new IC2EnergyHandler()); MinecraftForge.EVENT_BUS.register(new IC2EnergyHandler());
//Load configuration
proxy.loadConfiguration();
//Load this module //Load this module
addItems(); addItems();
@ -1083,7 +1077,6 @@ public class Mekanism
//Load proxy //Load proxy
proxy.registerRenderInformation(); proxy.registerRenderInformation();
proxy.loadConfiguration();
proxy.loadUtilities(); proxy.loadUtilities();
//Completion notification //Completion notification

View file

@ -575,6 +575,13 @@ public class PacketHandler implements IPacketHandler
output.writeInt(i); output.writeInt(i);
} }
} }
else if(data instanceof byte[])
{
for(byte b : (byte[])data)
{
output.writeByte(b);
}
}
} }
Packet250CustomPayload packet = new Packet250CustomPayload(); Packet250CustomPayload packet = new Packet250CustomPayload();
@ -641,6 +648,13 @@ public class PacketHandler implements IPacketHandler
output.writeInt(i); output.writeInt(i);
} }
} }
else if(data instanceof byte[])
{
for(byte b : (byte[])data)
{
output.writeByte(b);
}
}
} }
Packet250CustomPayload packet = new Packet250CustomPayload(); Packet250CustomPayload packet = new Packet250CustomPayload();

View file

@ -98,7 +98,7 @@ public class RobitAIFollow extends EntityAIBase
@Override @Override
public void updateTask() public void updateTask()
{ {
theRobit.getLookHelper().setLookPositionWithEntity(theOwner, 10.0F, theRobit.getVerticalFaceSpeed()); theRobit.getLookHelper().setLookPositionWithEntity(theOwner, 12.0F, theRobit.getVerticalFaceSpeed());
if(theRobit.getFollowing()) if(theRobit.getFollowing())
{ {

View file

@ -138,6 +138,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
speedMultiplier = dataStream.readInt(); speedMultiplier = dataStream.readInt();
energyMultiplier = dataStream.readInt(); energyMultiplier = dataStream.readInt();
upgradeTicks = dataStream.readInt(); upgradeTicks = dataStream.readInt();
for(int i = 0; i < 6; i++)
{
sideConfig[i] = dataStream.readByte();
}
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
} }
@ -150,6 +156,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
data.add(speedMultiplier); data.add(speedMultiplier);
data.add(energyMultiplier); data.add(energyMultiplier);
data.add(upgradeTicks); data.add(upgradeTicks);
data.add(sideConfig);
return data; return data;
} }

View file

@ -470,6 +470,11 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
progress[i] = dataStream.readInt(); progress[i] = dataStream.readInt();
} }
for(int i = 0; i < 6; i++)
{
sideConfig[i] = dataStream.readByte();
}
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
} }
@ -535,6 +540,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
data.add(upgradeTicks); data.add(upgradeTicks);
data.add(recipeTicks); data.add(recipeTicks);
data.add(progress); data.add(progress);
data.add(sideConfig);
return data; return data;
} }

View file

@ -456,6 +456,12 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
operatingTicks = dataStream.readInt(); operatingTicks = dataStream.readInt();
infuseStored = dataStream.readInt(); infuseStored = dataStream.readInt();
type = InfusionType.getFromName(dataStream.readUTF()); type = InfusionType.getFromName(dataStream.readUTF());
for(int i = 0; i < 6; i++)
{
sideConfig[i] = dataStream.readByte();
}
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
} }
@ -469,6 +475,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
data.add(operatingTicks); data.add(operatingTicks);
data.add(infuseStored); data.add(infuseStored);
data.add(type.name); data.add(type.name);
data.add(sideConfig);
return data; return data;
} }