v5.5.6 Beta #1
*Added Robit. *Added Chargepads. *Fixed swords not able to be enchanted. *Energy displayed in tooltip when mouse hovering over display bar on GUIs. *General cleanups. *Fixed incorrect machine inventory configuration.
No files matched your search
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
@@ -3,4 +3,4 @@ dir.mcp=${dir.development}forge/mcp
|
||||
version.minecraft=1.5.2
|
||||
version.mod.major=5
|
||||
version.mod.minor=5
|
||||
version.mod.revis=5
|
||||
version.mod.revis=6
|
||||
@@ -3,7 +3,7 @@
|
||||
"modid": "Mekanism",
|
||||
"name": "Mekanism",
|
||||
"description": "Energy, Armor, Tools, Weapons, Machines, Magic.",
|
||||
"version": "5.5.5",
|
||||
"version": "5.5.6",
|
||||
"mcversion": "1.5.2",
|
||||
"updateUrl": "",
|
||||
"authors": [
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"modid": "MekanismGenerators",
|
||||
"name": "MekanismGenerators",
|
||||
"description": "Generators module of Mekanism.",
|
||||
"version": "5.5.5",
|
||||
"version": "5.5.6",
|
||||
"mcversion": "1.5.2",
|
||||
"updateUrl": "",
|
||||
"authors": [
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"modid": "MekanismTools",
|
||||
"name": "MekanismTools",
|
||||
"description": "Tools module for Mekanism.",
|
||||
"version": "5.5.5",
|
||||
"version": "5.5.6",
|
||||
"mcversion": "1.5.2",
|
||||
"updateUrl": "",
|
||||
"authors": [
|
||||
|
||||
@@ -6,11 +6,13 @@ import java.util.HashMap;
|
||||
import mekanism.api.EnumGas;
|
||||
import mekanism.common.CommonProxy;
|
||||
import mekanism.common.EntityObsidianTNT;
|
||||
import mekanism.common.EntityRobit;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.InventoryElectricChest;
|
||||
import mekanism.common.ItemPortableTeleporter;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.TileEntityAdvancedElectricMachine;
|
||||
import mekanism.common.TileEntityChargepad;
|
||||
import mekanism.common.TileEntityControlPanel;
|
||||
import mekanism.common.TileEntityDynamicTank;
|
||||
import mekanism.common.TileEntityDynamicValve;
|
||||
@@ -162,6 +164,7 @@ public class ClientProxy extends CommonProxy
|
||||
ClientRegistry.registerTileEntity(TileEntityMechanicalPipe.class, "MechanicalPipe", new RenderMechanicalPipe());
|
||||
ClientRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank", new RenderDynamicTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve", new RenderDynamicTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad", new RenderChargepad());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,13 +172,15 @@ public class ClientProxy extends CommonProxy
|
||||
{
|
||||
//Register entity rendering handlers
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNT());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRobit.class, new RenderRobit());
|
||||
|
||||
//Register item handler
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.energyCubeID, new ItemRenderingHandler());
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.machineBlockID, new ItemRenderingHandler());
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.Robit.itemID, new ItemRenderingHandler());
|
||||
|
||||
//Register block handlers
|
||||
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler());
|
||||
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
|
||||
RenderingRegistry.registerBlockHandler(new TransmitterRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
|
||||
|
||||
@@ -247,7 +252,22 @@ public class ClientProxy extends CommonProxy
|
||||
return new GuiPasswordEnter((TileEntityElectricChest)tileEntity);
|
||||
case 20:
|
||||
return new GuiPasswordModify((TileEntityElectricChest)tileEntity);
|
||||
case 21:
|
||||
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
|
||||
if(robit != null)
|
||||
{
|
||||
return new GuiRobitMain(player.inventory, robit);
|
||||
}
|
||||
case 22:
|
||||
return new GuiRobitCrafting(player.inventory, world, x);
|
||||
case 23:
|
||||
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
|
||||
if(robit1 != null)
|
||||
{
|
||||
return new GuiRobitInventory(player.inventory, robit1);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,13 @@ import mekanism.common.ContainerAdvancedElectricMachine;
|
||||
import mekanism.common.TileEntityAdvancedElectricMachine;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -23,12 +27,20 @@ public class GuiAdvancedElectricMachine extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString("S:" + (tileEntity.speedMultiplier+1) + "x", 179, 47, 0x404040);
|
||||
fontRenderer.drawString("E:" + (tileEntity.energyMultiplier+1) + "x", 179, 57, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -23,12 +26,20 @@ public class GuiElectricMachine extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString("S:" + (tileEntity.speedMultiplier+1) + "x", 179, 47, 0x404040);
|
||||
fontRenderer.drawString("E:" + (tileEntity.energyMultiplier+1) + "x", 179, 57, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -25,13 +28,21 @@ public class GuiFactory extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 48, 4, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 93) + 2, 0x404040);
|
||||
fontRenderer.drawString(RecipeType.values()[tileEntity.recipeType].getName(), 124, (ySize - 93) + 2, 0x404040);
|
||||
fontRenderer.drawString("S:" + (tileEntity.speedMultiplier+1) + "x", 179, 47, 0x404040);
|
||||
fontRenderer.drawString("E:" + (tileEntity.energyMultiplier+1) + "x", 179, 57, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -51,12 +54,20 @@ public class GuiMetallurgicInfuser extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString("S:" + (tileEntity.speedMultiplier+1) + "x", 179, 47, 0x404040);
|
||||
fontRenderer.drawString("E:" + (tileEntity.energyMultiplier+1) + "x", 179, 57, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package mekanism.client;
|
||||
|
||||
import mekanism.common.ContainerRobitCrafting;
|
||||
import mekanism.common.EnumPacketType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiRobitCrafting extends GuiContainer
|
||||
{
|
||||
public int entityId;
|
||||
|
||||
public GuiRobitCrafting(InventoryPlayer inventory, World world, int id)
|
||||
{
|
||||
super(new ContainerRobitCrafting(inventory, world));
|
||||
entityId = id;
|
||||
xSize += 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString("Robit Crafting", 8, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 96 + 3, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitCrafting.png");
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 10, 176 + 25, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 10, 176 + 25, 18, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 30, 176 + 25, 36, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 30, 176 + 25, 54, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 72, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendRobitGui(0, entityId);
|
||||
mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, entityId, 0, 0);
|
||||
}
|
||||
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
}
|
||||
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendRobitGui(2, entityId);
|
||||
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, entityId, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package mekanism.client;
|
||||
|
||||
import mekanism.common.ContainerRobitInventory;
|
||||
import mekanism.common.EntityRobit;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiRobitInventory extends GuiContainer
|
||||
{
|
||||
public EntityRobit robit;
|
||||
|
||||
public GuiRobitInventory(InventoryPlayer inventory, EntityRobit entity)
|
||||
{
|
||||
super(new ContainerRobitInventory(inventory, entity));
|
||||
xSize += 25;
|
||||
robit = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString("Robit Inventory", 8, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 96 + 3, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitInventory.png");
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 10, 176 + 25, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 10, 176 + 25, 18, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 30, 176 + 25, 36, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 30, 176 + 25, 54, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 72, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendRobitGui(0, robit.entityId);
|
||||
mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.entityId, 0, 0);
|
||||
}
|
||||
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendRobitGui(1, robit.entityId);
|
||||
mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.entityId, 0, 0);
|
||||
}
|
||||
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package mekanism.client;
|
||||
|
||||
import mekanism.common.ContainerRobitMain;
|
||||
import mekanism.common.EntityRobit;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
public class GuiRobitMain extends GuiContainer
|
||||
{
|
||||
public EntityRobit robit;
|
||||
|
||||
public GuiRobitMain(InventoryPlayer inventory, EntityRobit entity)
|
||||
{
|
||||
super(new ContainerRobitMain(inventory, entity));
|
||||
xSize += 25;
|
||||
robit = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString("Robit", 76, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 3, 0x404040);
|
||||
fontRenderer.drawString("Hi, I'm Robit!", 29, 18, 0x00CD00);
|
||||
fontRenderer.drawString("Energy: " + ElectricityDisplay.getDisplayShort(robit.getEnergy(), ElectricUnit.JOULES), 29, 36, 0x00CD00);
|
||||
fontRenderer.drawString("Following: " + robit.getFollowing(), 29, 45, 0x00CD00);
|
||||
fontRenderer.drawString("Owner: " + robit.getOwnerName(), 29, 54, 0x00CD00);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 20 && xAxis <= 24 && yAxis >= 17 && yAxis <= 70)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(robit.getEnergy(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
||||
{
|
||||
drawCreativeTabHoveringText("Toggle 'follow' mode", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitMain.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 10, 176 + 25, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 10, 176 + 25, 18, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 30, 176 + 25, 36, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 30, 176 + 25, 54, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 72, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
||||
}
|
||||
|
||||
if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 152, guiHeight + 53, 176 + 25, 108, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 152, guiHeight + 53, 176 + 25, 126, 18, 18);
|
||||
}
|
||||
|
||||
int displayInt;
|
||||
|
||||
displayInt = getScaledEnergyLevel(53);
|
||||
drawTexturedModalRect(guiWidth + 20, guiHeight + 17 + 53 - displayInt, 176 + 25 + 18, 36 + 53 - displayInt, 4, displayInt);
|
||||
}
|
||||
|
||||
private int getScaledEnergyLevel(int i)
|
||||
{
|
||||
return (int)(robit.getEnergy()*i / robit.MAX_ELECTRICITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
}
|
||||
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendRobitGui(1, robit.entityId);
|
||||
mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.entityId, 0, 0);
|
||||
}
|
||||
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendRobitGui(2, robit.entityId);
|
||||
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.entityId, 0, 0);
|
||||
}
|
||||
else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendFollowUpdate(!robit.getFollowing(), robit.entityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -25,11 +28,19 @@ public class GuiTeleporter extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.status, 66, 19, 0x00CD00);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,8 +119,14 @@ public class GuiTeleporter extends GuiContainer
|
||||
|
||||
public int getIncrementedNumber(int i)
|
||||
{
|
||||
if(i < 9) i++;
|
||||
else if(i == 9) i=0;
|
||||
if(i < 9)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
else if(i == 9)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package mekanism.client;
|
||||
|
||||
import mekanism.common.IEnergyCube;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.BlockMachine.MachineType;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.IEnergyCube;
|
||||
import mekanism.common.ItemBlockMachine;
|
||||
import mekanism.common.ItemRobit;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Tier.EnergyCubeTier;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -24,6 +25,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ItemRenderingHandler implements IItemRenderer
|
||||
{
|
||||
public ModelRobit robit = new ModelRobit();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
@@ -51,7 +54,7 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
|
||||
renderItem((RenderBlocks)data[0], tier.ordinal());
|
||||
}
|
||||
else if(item.getItemDamage() == MachineType.ELECTRIC_CHEST.meta)
|
||||
else if(item.getItem() instanceof ItemBlockMachine && item.getItemDamage() == MachineType.ELECTRIC_CHEST.meta)
|
||||
{
|
||||
IElectricChest chest = (IElectricChest)item.getItem();
|
||||
ModelChest electricChest = new ModelChest();
|
||||
@@ -69,6 +72,14 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||
|
||||
electricChest.renderAll();
|
||||
}
|
||||
else if(item.getItem() instanceof ItemRobit)
|
||||
{
|
||||
GL11.glRotatef(180, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -1.5F, 0.0F);
|
||||
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/Robit.png"));
|
||||
robit.render(0.08F);
|
||||
}
|
||||
else {
|
||||
RenderingRegistry.instance().renderInventoryBlock((RenderBlocks)data[0], Block.blocksList[Mekanism.machineBlockID], item.getItemDamage(), ClientProxy.MACHINE_RENDER_ID);
|
||||
}
|
||||
|
||||
@@ -16,12 +16,13 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public ModelTheoreticalElementizer theoreticalElementizer = new ModelTheoreticalElementizer();
|
||||
public ModelElectricPump electricPump = new ModelElectricPump();
|
||||
public ModelMetallurgicInfuser metallurgicInfuser = new ModelMetallurgicInfuser();
|
||||
public ModelChest electricChest = new ModelChest();
|
||||
public ModelChargepad chargepad = new ModelChargepad();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
@@ -35,7 +36,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslated(0.0F, -0.8F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.8F, 0.0F);
|
||||
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/TheoreticalElementizer.png"));
|
||||
theoreticalElementizer.render(0.0560F);
|
||||
}
|
||||
@@ -43,7 +44,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslated(0.0F, -0.85F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.85F, 0.0F);
|
||||
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/ElectricPump.png"));
|
||||
electricPump.render(0.0560F);
|
||||
}
|
||||
@@ -51,7 +52,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslated(0.0F, 0.3F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.3F, 0.0F);
|
||||
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/MetallurgicInfuser.png"));
|
||||
metallurgicInfuser.render(0.0625F);
|
||||
}
|
||||
@@ -63,6 +64,13 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/ElectricChest.png"));
|
||||
electricChest.renderAll();
|
||||
}
|
||||
else if(metadata == MachineType.CHARGEPAD.meta)
|
||||
{
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -1.4F, 0.0F);
|
||||
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/Chargepad.png"));
|
||||
chargepad.render(0.0625F);
|
||||
}
|
||||
else {
|
||||
renderItem(renderer, metadata, block);
|
||||
}
|
||||
@@ -110,9 +118,8 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
*/
|
||||
public void renderItem(RenderBlocks renderer, int metadata, Block block)
|
||||
{
|
||||
block.setBlockBoundsForItemRender();
|
||||
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
//nope
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
|
||||
if (renderer.useInventoryTint)
|
||||
{
|
||||
@@ -1,18 +1,25 @@
|
||||
package mekanism.client;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/*
|
||||
* Credit to BuildCraft
|
||||
*/
|
||||
public class ObjectRenderer
|
||||
public class MekanismRenderer
|
||||
{
|
||||
private static RenderBlocks renderBlocks = new RenderBlocks();
|
||||
|
||||
private static float lightmapLastX;
|
||||
private static float lightmapLastY;
|
||||
|
||||
public static class Model3D
|
||||
{
|
||||
public double minX;
|
||||
@@ -159,4 +166,19 @@ public class ObjectRenderer
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
public static void glowOn()
|
||||
{
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
lightmapLastX = OpenGlHelper.lastBrightnessX;
|
||||
lightmapLastY = OpenGlHelper.lastBrightnessY;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
|
||||
}
|
||||
|
||||
public static void glowOff()
|
||||
{
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapLastX, lightmapLastY);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package mekanism.client;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelChargepad extends ModelBase
|
||||
{
|
||||
public ModelRenderer Shape1;
|
||||
public ModelRenderer Shape2;
|
||||
|
||||
public ModelChargepad()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
Shape1 = new ModelRenderer(this, 0, 0);
|
||||
Shape1.addBox(0F, 0F, 0F, 16, 1, 16);
|
||||
Shape1.setRotationPoint(-8F, 23F, -8F);
|
||||
Shape1.setTextureSize(64, 64);
|
||||
Shape1.mirror = true;
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
Shape2 = new ModelRenderer(this, 0, 18);
|
||||
Shape2.addBox(0F, 0F, 0F, 4, 3, 2);
|
||||
Shape2.setRotationPoint(-2F, 20F, 6F);
|
||||
Shape2.setTextureSize(64, 64);
|
||||
Shape2.mirror = true;
|
||||
setRotation(Shape2, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
Shape1.render(f5);
|
||||
Shape2.render(f5);
|
||||
}
|
||||
|
||||
public void render(float size)
|
||||
{
|
||||
Shape1.render(size);
|
||||
Shape2.render(size);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package mekanism.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelRobit extends ModelBase
|
||||
{
|
||||
public ModelRenderer Body;
|
||||
public ModelRenderer Bottom;
|
||||
public ModelRenderer RightTrack;
|
||||
public ModelRenderer LeftTrack;
|
||||
public ModelRenderer Neck;
|
||||
public ModelRenderer Head;
|
||||
public ModelRenderer Backpack;
|
||||
public ModelRenderer headback;
|
||||
public ModelRenderer rightarn;
|
||||
public ModelRenderer leftarm;
|
||||
public ModelRenderer righthand;
|
||||
public ModelRenderer lefthand;
|
||||
|
||||
public ModelRobit()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
Body = new ModelRenderer(this, 0, 0);
|
||||
Body.addBox(0F, 0F, 1F, 6, 4, 5);
|
||||
Body.setRotationPoint(-3F, 17F, -3F);
|
||||
Body.setTextureSize(64, 64);
|
||||
Body.mirror = true;
|
||||
setRotation(Body, 0F, 0F, 0F);
|
||||
Bottom = new ModelRenderer(this, 22, 0);
|
||||
Bottom.addBox(0F, 0F, 0F, 6, 2, 7);
|
||||
Bottom.setRotationPoint(-3F, 21F, -2.5F);
|
||||
Bottom.setTextureSize(64, 64);
|
||||
Bottom.mirror = true;
|
||||
setRotation(Bottom, 0F, 0F, 0F);
|
||||
RightTrack = new ModelRenderer(this, 26, 9);
|
||||
RightTrack.addBox(0F, 0F, 0F, 2, 3, 9);
|
||||
RightTrack.setRotationPoint(3F, 21F, -4F);
|
||||
RightTrack.setTextureSize(64, 64);
|
||||
RightTrack.mirror = true;
|
||||
setRotation(RightTrack, 0F, 0F, 0F);
|
||||
LeftTrack = new ModelRenderer(this, 0, 9);
|
||||
LeftTrack.addBox(0F, 0F, 0F, 2, 3, 9);
|
||||
LeftTrack.setRotationPoint(-5F, 21F, -4F);
|
||||
LeftTrack.setTextureSize(64, 64);
|
||||
LeftTrack.mirror = true;
|
||||
setRotation(LeftTrack, 0F, 0F, 0F);
|
||||
Neck = new ModelRenderer(this, 0, 26);
|
||||
Neck.addBox(0F, 0F, 0F, 3, 1, 2);
|
||||
Neck.setRotationPoint(-1.5F, 16F, -0.5F);
|
||||
Neck.setTextureSize(64, 64);
|
||||
Neck.mirror = true;
|
||||
setRotation(Neck, 0F, 0F, 0F);
|
||||
Head = new ModelRenderer(this, 26, 21);
|
||||
Head.addBox(0F, 0F, 0F, 7, 3, 4);
|
||||
Head.setRotationPoint(-3.5F, 13.5F, -1.533333F);
|
||||
Head.setTextureSize(64, 64);
|
||||
Head.mirror = true;
|
||||
setRotation(Head, 0F, 0F, 0F);
|
||||
Backpack = new ModelRenderer(this, 14, 9);
|
||||
Backpack.addBox(0F, 0F, 0F, 4, 3, 6);
|
||||
Backpack.setRotationPoint(-2F, 16.8F, -4F);
|
||||
Backpack.setTextureSize(64, 64);
|
||||
Backpack.mirror = true;
|
||||
setRotation(Backpack, 0F, 0F, 0F);
|
||||
headback = new ModelRenderer(this, 17, 1);
|
||||
headback.addBox(0F, 0F, 0F, 5, 2, 1);
|
||||
headback.setRotationPoint(-2.5F, 14F, -2F);
|
||||
headback.setTextureSize(64, 64);
|
||||
headback.mirror = true;
|
||||
setRotation(headback, 0F, 0F, 0F);
|
||||
rightarn = new ModelRenderer(this, 0, 21);
|
||||
rightarn.addBox(0F, 0F, 0F, 1, 1, 4);
|
||||
rightarn.setRotationPoint(3F, 17.5F, 0F);
|
||||
rightarn.setTextureSize(64, 64);
|
||||
rightarn.mirror = true;
|
||||
setRotation(rightarn, 0F, 0F, 0F);
|
||||
leftarm = new ModelRenderer(this, 12, 21);
|
||||
leftarm.addBox(0F, 0F, 0F, 1, 1, 4);
|
||||
leftarm.setRotationPoint(-4F, 17.5F, 0F);
|
||||
leftarm.setTextureSize(64, 64);
|
||||
leftarm.mirror = true;
|
||||
setRotation(leftarm, 0F, 0F, 0F);
|
||||
righthand = new ModelRenderer(this, 15, 28);
|
||||
righthand.addBox(0F, 0F, 0F, 1, 1, 0);
|
||||
righthand.setRotationPoint(2.5F, 17.5F, 4F);
|
||||
righthand.setTextureSize(64, 64);
|
||||
righthand.mirror = true;
|
||||
setRotation(righthand, 0F, 0F, 0F);
|
||||
lefthand = new ModelRenderer(this, 15, 28);
|
||||
lefthand.addBox(0F, 0F, 0F, 1, 1, 0);
|
||||
lefthand.setRotationPoint(-3.5F, 17.5F, 4F);
|
||||
lefthand.setTextureSize(64, 64);
|
||||
lefthand.mirror = true;
|
||||
setRotation(lefthand, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
|
||||
MekanismRenderer.glowOn();
|
||||
|
||||
Body.render(f5);
|
||||
Bottom.render(f5);
|
||||
RightTrack.render(f5);
|
||||
LeftTrack.render(f5);
|
||||
Neck.render(f5);
|
||||
Head.render(f5);
|
||||
Backpack.render(f5);
|
||||
headback.render(f5);
|
||||
rightarn.render(f5);
|
||||
leftarm.render(f5);
|
||||
righthand.render(f5);
|
||||
lefthand.render(f5);
|
||||
|
||||
MekanismRenderer.glowOff();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void render(float size)
|
||||
{
|
||||
Body.render(size);
|
||||
Bottom.render(size);
|
||||
RightTrack.render(size);
|
||||
LeftTrack.render(size);
|
||||
Neck.render(size);
|
||||
Head.render(size);
|
||||
Backpack.render(size);
|
||||
headback.render(size);
|
||||
rightarn.render(size);
|
||||
leftarm.render(size);
|
||||
righthand.render(size);
|
||||
lefthand.render(size);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package mekanism.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import mekanism.common.TileEntityChargepad;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class RenderChargepad extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelChargepad model = new ModelChargepad();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
renderAModelAt((TileEntityChargepad)tileEntity, x, y, z, 1F);
|
||||
}
|
||||
|
||||
private void renderAModelAt(TileEntityChargepad tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
|
||||
bindTextureByName("/mods/mekanism/render/Chargepad.png");
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 2: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
|
||||
case 3: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
|
||||
case 4: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
|
||||
case 5: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
|
||||
}
|
||||
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
model.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.ObjectRenderer.Model3D;
|
||||
import mekanism.client.MekanismRenderer.Model3D;
|
||||
import mekanism.common.SynchronizedTankData.ValveData;
|
||||
import mekanism.common.TileEntityDynamicTank;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -130,7 +130,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = ((float)i/(float)stages)*(data.height-2) - .01;
|
||||
toReturn.maxZ = data.width-2 - .01;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
||||
}
|
||||
}
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
|
||||
return display;
|
||||
|
||||
@@ -3,7 +3,7 @@ package mekanism.client;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mekanism.client.ObjectRenderer.Model3D;
|
||||
import mekanism.client.MekanismRenderer.Model3D;
|
||||
import mekanism.common.CableUtils;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PipeUtils;
|
||||
@@ -174,7 +174,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 + offset;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 1.0;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.3 + offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 1.0;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.HashMap;
|
||||
import mekanism.api.EnumGas;
|
||||
import mekanism.api.GasTransmission;
|
||||
import mekanism.api.ITubeConnection;
|
||||
import mekanism.client.ObjectRenderer.Model3D;
|
||||
import mekanism.client.MekanismRenderer.Model3D;
|
||||
import mekanism.common.TileEntityPressurizedTube;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
@@ -136,7 +136,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 + offset;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 1.0;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.3 + offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 1.0;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package mekanism.client;
|
||||
|
||||
import mekanism.common.EntityRobit;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
|
||||
public class RenderRobit extends RenderLiving
|
||||
{
|
||||
public RenderRobit()
|
||||
{
|
||||
super(new ModelRobit(), 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class RenderTickHandler implements ITickHandler
|
||||
{
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
if(mc.currentScreen == null && mc.thePlayer != null && mc.theWorld != null && !MekanismUtils.isObfuscated())
|
||||
if(mc.currentScreen == null && mc.thePlayer != null && mc.theWorld != null && !MekanismUtils.isObfuscated() && !mc.gameSettings.showDebugInfo)
|
||||
{
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
World world = mc.theWorld;
|
||||
|
||||
@@ -3,7 +3,7 @@ package mekanism.client;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mekanism.client.ObjectRenderer.Model3D;
|
||||
import mekanism.client.MekanismRenderer.Model3D;
|
||||
import mekanism.common.CableUtils;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.TileEntityUniversalCable;
|
||||
@@ -151,7 +151,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 + offset;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 1.0;
|
||||
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.3 + offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 1.0;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||
toReturn.maxZ = 0.7 - offset;
|
||||
|
||||
ObjectRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
MekanismRenderer.renderObject(toReturn, world, 0, 0, 0, false, true);
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,14 @@ public class ThreadTankSparkle extends Thread
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(Mekanism.dynamicTankEasterEgg)
|
||||
{
|
||||
Mekanism.audioHandler.quickPlay("cj/CJ_" + (random.nextInt(3)+1) + ".ogg", pointer.worldObj, Object3D.get(pointer));
|
||||
}
|
||||
|
||||
loop(pointer);
|
||||
try {
|
||||
if(Mekanism.dynamicTankEasterEgg)
|
||||
{
|
||||
Mekanism.audioHandler.quickPlay("cj/CJ_" + (random.nextInt(3)+1) + ".ogg", pointer.worldObj, Object3D.get(pointer));
|
||||
}
|
||||
|
||||
loop(pointer);
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
public void loop(TileEntityDynamicTank tileEntity)
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.IUpgradeManagement;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.ClientProxy;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
@@ -20,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -47,6 +45,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* 11: Teleporter
|
||||
* 12: Electric Pump
|
||||
* 13: Electric Chest
|
||||
* 14: Chargepad
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@@ -133,7 +132,7 @@ public class BlockMachine extends BlockContainer
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
|
||||
if(MekanismUtils.isActive(world, x, y, z))
|
||||
if(MekanismUtils.isActive(world, x, y, z) && !(tileEntity instanceof TileEntityChargepad))
|
||||
{
|
||||
float xRandom = (float)x + 0.5F;
|
||||
float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
|
||||
@@ -485,6 +484,7 @@ public class BlockMachine extends BlockContainer
|
||||
list.add(new ItemStack(i, 1, 11));
|
||||
list.add(new ItemStack(i, 1, 12));
|
||||
list.add(new ItemStack(i, 1, 13));
|
||||
list.add(new ItemStack(i, 1, 14));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -600,7 +600,7 @@ public class BlockMachine extends BlockContainer
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!entityplayer.isSneaking())
|
||||
if(!entityplayer.isSneaking() && MachineType.getFromMetadata(metadata).guiId != -1)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, MachineType.getFromMetadata(metadata).guiId, world, x, y, z);
|
||||
return true;
|
||||
@@ -751,6 +751,31 @@ public class BlockMachine extends BlockContainer
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(metadata == MachineType.CHARGEPAD.meta)
|
||||
{
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.06F, 1.0F);
|
||||
}
|
||||
else {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
if(world.getBlockTileEntity(x, y, z) instanceof TileEntityChargepad)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
public static enum MachineType
|
||||
{
|
||||
ENRICHMENT_CHAMBER(0, 3, 2000, TileEntityEnrichmentChamber.class, false),
|
||||
@@ -766,7 +791,8 @@ public class BlockMachine extends BlockContainer
|
||||
ENERGIZED_SMELTER(10, 16, 2000, TileEntityEnergizedSmelter.class, false),
|
||||
TELEPORTER(11, 13, 5000000, TileEntityTeleporter.class, false),
|
||||
ELECTRIC_PUMP(12, 17, 10000, TileEntityElectricPump.class, true),
|
||||
ELECTRIC_CHEST(13, -1, 12000, TileEntityElectricChest.class, true);
|
||||
ELECTRIC_CHEST(13, -1, 12000, TileEntityElectricChest.class, true),
|
||||
CHARGEPAD(14, -1, 9000, TileEntityChargepad.class, true);
|
||||
|
||||
public int meta;
|
||||
public int guiId;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class CommonProxy
|
||||
GameRegistry.registerTileEntity(TileEntityMechanicalPipe.class, "MechanicalPipe");
|
||||
GameRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank");
|
||||
GameRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve");
|
||||
GameRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +194,22 @@ public class CommonProxy
|
||||
return new ContainerElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
|
||||
case 18:
|
||||
return new ContainerDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
|
||||
case 21:
|
||||
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
|
||||
if(robit != null)
|
||||
{
|
||||
return new ContainerRobitMain(player.inventory, robit);
|
||||
}
|
||||
case 22:
|
||||
return new ContainerRobitCrafting(player.inventory, world);
|
||||
case 23:
|
||||
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
|
||||
if(robit1 != null)
|
||||
{
|
||||
return new ContainerRobitInventory(player.inventory, robit1);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -88,27 +88,6 @@ public class CommonWorldTickHandler implements ITickHandler
|
||||
Mekanism.dynamicInventories.remove(inventoryID);
|
||||
}
|
||||
}
|
||||
|
||||
for(Object obj : world.loadedEntityList)
|
||||
{
|
||||
if(obj instanceof EntityItem)
|
||||
{
|
||||
EntityItem item = (EntityItem)obj;
|
||||
|
||||
if(item.getEntityItem() != null)
|
||||
{
|
||||
ItemStack itemStack = item.getEntityItem();
|
||||
|
||||
if(itemStack.getItem() instanceof IElectricChest)
|
||||
{
|
||||
if(((IElectricChest)itemStack.getItem()).isElectricChest(itemStack))
|
||||
{
|
||||
itemStack.getItem().onUpdate(itemStack, world, null, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package mekanism.common;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ContainerWorkbench;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ContainerRobitCrafting extends ContainerWorkbench
|
||||
{
|
||||
public ContainerRobitCrafting(InventoryPlayer inventory, World world)
|
||||
{
|
||||
super(inventory, world, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package mekanism.common;
|
||||
|
||||
import ic2.api.item.IElectricItem;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerRobitInventory extends Container
|
||||
{
|
||||
public EntityRobit robit;
|
||||
|
||||
public ContainerRobitInventory(InventoryPlayer inventory, EntityRobit entity)
|
||||
{
|
||||
robit = entity;
|
||||
robit.openChest();
|
||||
|
||||
for(int slotY = 0; slotY < 3; slotY++)
|
||||
{
|
||||
for(int slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(entity, slotX + slotY * 9, 8 + slotX * 18, 18 + slotY * 18));
|
||||
}
|
||||
}
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot currentSlot = (Slot)inventorySlots.get(slotID);
|
||||
|
||||
if(currentSlot != null && currentSlot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = currentSlot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if(slotID >= 27 && slotID <= 53)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 54, inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID > 53)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 27, 53, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 27, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0)
|
||||
{
|
||||
currentSlot.putStack((ItemStack)null);
|
||||
}
|
||||
else {
|
||||
currentSlot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == stack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
currentSlot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onCraftGuiClosed(entityplayer);
|
||||
robit.closeChest();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package mekanism.common;
|
||||
|
||||
import ic2.api.item.IElectricItem;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import mekanism.common.SlotEnergy.SlotDischarge;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
|
||||
public class ContainerRobitMain extends Container
|
||||
{
|
||||
private EntityRobit robit;
|
||||
|
||||
public ContainerRobitMain(InventoryPlayer inventory, EntityRobit entity)
|
||||
{
|
||||
robit = entity;
|
||||
addSlotToContainer(new SlotDischarge(entity, 27, 153, 17));
|
||||
|
||||
robit.openChest();
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onCraftGuiClosed(entityplayer);
|
||||
robit.closeChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,501 @@
|
||||
package mekanism.common;
|
||||
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import thermalexpansion.api.item.IChargeableItem;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import mekanism.api.EnergizedItemManager;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.Object3D;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import codechicken.core.alg.MathHelper;
|
||||
|
||||
public class EntityRobit extends EntityCreature implements IInventory, ISustainedInventory
|
||||
{
|
||||
public double MAX_ELECTRICITY = 100000;
|
||||
|
||||
public Object3D homeLocation;
|
||||
|
||||
public ItemStack[] inventory = new ItemStack[28];
|
||||
|
||||
public EntityRobit(World world)
|
||||
{
|
||||
super(world);
|
||||
|
||||
setSize(1, 1);
|
||||
moveSpeed = 0.2F;
|
||||
texture = "/mods/mekanism/render/Robit.png";
|
||||
|
||||
getNavigator().setAvoidsWater(true);
|
||||
|
||||
tasks.addTask(1, new RobitAIFollow(this, moveSpeed, 5.0F, 2.0F));
|
||||
tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
tasks.addTask(2, new EntityAILookIdle(this));
|
||||
tasks.addTask(3, new EntityAISwimming(this));
|
||||
}
|
||||
|
||||
public EntityRobit(World world, double x, double y, double z)
|
||||
{
|
||||
this(world);
|
||||
|
||||
setPosition(x, y, z);
|
||||
|
||||
prevPosX = x;
|
||||
prevPosY = y;
|
||||
prevPosZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateAITick() {}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
|
||||
dataWatcher.addObject(11, new String("")); /* Electricity */
|
||||
dataWatcher.addObject(12, new String("")); /* Owner */
|
||||
dataWatcher.addObject(13, new Byte((byte)0)); /* Follow */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityUpdate()
|
||||
{
|
||||
super.onEntityUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(homeLocation == null)
|
||||
{
|
||||
setDead();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(homeLocation.getTileEntity(worldObj) instanceof TileEntityChargepad))
|
||||
{
|
||||
drop();
|
||||
setDead();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(getEnergy() == 0 && !isOnChargepad())
|
||||
{
|
||||
setPositionAndUpdate(homeLocation.xCoord+0.5, homeLocation.yCoord+0.3, homeLocation.zCoord+0.5);
|
||||
|
||||
motionX = 0;
|
||||
motionY = 0;
|
||||
motionZ = 0;
|
||||
}
|
||||
|
||||
if(inventory[27] != null && getEnergy() < MAX_ELECTRICITY)
|
||||
{
|
||||
if(inventory[27].getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
setEnergy(getEnergy() + EnergizedItemManager.discharge(inventory[27], MAX_ELECTRICITY - getEnergy()));
|
||||
}
|
||||
else if(inventory[27].getItem() instanceof IItemElectric)
|
||||
{
|
||||
setEnergy(getEnergy() + ElectricItemHelper.dechargeItem(inventory[27], MAX_ELECTRICITY - getEnergy(), 120/*VOLTAGE*/));
|
||||
}
|
||||
else if(Mekanism.hooks.IC2Loaded && inventory[27].getItem() instanceof IElectricItem)
|
||||
{
|
||||
IElectricItem item = (IElectricItem)inventory[27].getItem();
|
||||
|
||||
if(item.canProvideEnergy(inventory[27]))
|
||||
{
|
||||
double gain = ElectricItem.discharge(inventory[27], (int)((MAX_ELECTRICITY - getEnergy())*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
|
||||
setEnergy(getEnergy() + gain);
|
||||
}
|
||||
}
|
||||
else if(inventory[27].getItem() instanceof IChargeableItem)
|
||||
{
|
||||
ItemStack itemStack = inventory[27];
|
||||
IChargeableItem item = (IChargeableItem)inventory[27].getItem();
|
||||
|
||||
float itemEnergy = (float)Math.min(Math.sqrt(item.getMaxEnergyStored(itemStack)), item.getEnergyStored(itemStack));
|
||||
float toTransfer = (float)Math.min(itemEnergy, ((MAX_ELECTRICITY - getEnergy())*Mekanism.TO_BC));
|
||||
|
||||
item.transferEnergy(itemStack, toTransfer, true);
|
||||
setEnergy(getEnergy() + (toTransfer*Mekanism.FROM_BC));
|
||||
}
|
||||
else if(inventory[27].itemID == Item.redstone.itemID && getEnergy()+1000 <= MAX_ELECTRICITY)
|
||||
{
|
||||
setEnergy(getEnergy() + 1000);
|
||||
inventory[27].stackSize--;
|
||||
|
||||
if(inventory[27].stackSize <= 0)
|
||||
{
|
||||
inventory[27] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOnChargepad()
|
||||
{
|
||||
int x = MathHelper.floor_double(posX);
|
||||
int y = MathHelper.floor_double(posY);
|
||||
int z = MathHelper.floor_double(posZ);
|
||||
|
||||
if(worldObj.getBlockTileEntity(x, y, z) instanceof TileEntityChargepad)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean interact(EntityPlayer entityplayer)
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
ItemStack itemStack = entityplayer.getCurrentEquippedItem();
|
||||
|
||||
if(itemStack != null && itemStack.getItem() instanceof ItemConfigurator)
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
drop();
|
||||
}
|
||||
|
||||
setDead();
|
||||
|
||||
entityplayer.swingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
entityplayer.openGui(Mekanism.instance, 21, worldObj, entityId, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void drop()
|
||||
{
|
||||
EntityItem entityItem = new EntityItem(worldObj, posX, posY+0.3, posZ, new ItemStack(Mekanism.Robit));
|
||||
|
||||
ItemRobit item = (ItemRobit)entityItem.getEntityItem().getItem();
|
||||
item.setEnergy(entityItem.getEntityItem(), getEnergy());
|
||||
item.setInventory(getInventory(), entityItem.getEntityItem());
|
||||
|
||||
float k = 0.05F;
|
||||
entityItem.motionX = 0;
|
||||
entityItem.motionY = rand.nextGaussian() * k + 0.2F;
|
||||
entityItem.motionZ = 0;
|
||||
|
||||
worldObj.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeEntityToNBT(nbtTags);
|
||||
|
||||
nbtTags.setDouble("electricityStored", getEnergy());
|
||||
|
||||
if(getOwnerName() != null)
|
||||
{
|
||||
nbtTags.setString("owner", getOwnerName());
|
||||
}
|
||||
|
||||
nbtTags.setBoolean("follow", getFollowing());
|
||||
|
||||
homeLocation.write(nbtTags);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int slotCount = 0; slotCount < inventory.length; slotCount++)
|
||||
{
|
||||
if(inventory[slotCount] != null)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte)slotCount);
|
||||
inventory[slotCount].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
nbtTags.setTag("Items", tagList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readEntityFromNBT(nbtTags);
|
||||
|
||||
setEnergy(nbtTags.getDouble("electricityStored"));
|
||||
|
||||
if(nbtTags.hasKey("owner"))
|
||||
{
|
||||
setOwner(nbtTags.getString("owner"));
|
||||
}
|
||||
|
||||
setFollowing(nbtTags.getBoolean("follow"));
|
||||
|
||||
homeLocation = Object3D.read(nbtTags);
|
||||
|
||||
NBTTagList tagList = nbtTags.getTagList("Items");
|
||||
inventory = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++)
|
||||
{
|
||||
NBTTagCompound tagCompound = (NBTTagCompound)tagList.tagAt(tagCount);
|
||||
byte slotID = tagCompound.getByte("Slot");
|
||||
|
||||
if(slotID >= 0 && slotID < inventory.length)
|
||||
{
|
||||
inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void damageEntity(DamageSource damageSource, int amount)
|
||||
{
|
||||
amount = ForgeHooks.onLivingHurt(this, damageSource, amount);
|
||||
|
||||
if(amount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
amount = applyArmorCalculations(damageSource, amount);
|
||||
amount = applyPotionDamageCalculations(damageSource, amount);
|
||||
int j = getHealth();
|
||||
|
||||
setEnergy(Math.max(0, getEnergy() - (amount*1000)));
|
||||
field_94063_bt.func_94547_a(damageSource, j, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeathUpdate() {}
|
||||
|
||||
public void setHome(Object3D home)
|
||||
{
|
||||
homeLocation = home;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed()
|
||||
{
|
||||
return getEnergy() > 0;
|
||||
}
|
||||
|
||||
public double getEnergy()
|
||||
{
|
||||
return Double.parseDouble(dataWatcher.getWatchableObjectString(11));
|
||||
}
|
||||
|
||||
public void setEnergy(double energy)
|
||||
{
|
||||
dataWatcher.updateObject(11, Double.toString(Math.max(Math.min(energy, MAX_ELECTRICITY), 0)));
|
||||
}
|
||||
|
||||
public EntityPlayer getOwner()
|
||||
{
|
||||
return worldObj.getPlayerEntityByName(getOwnerName());
|
||||
}
|
||||
|
||||
public String getOwnerName()
|
||||
{
|
||||
return dataWatcher.getWatchableObjectString(12);
|
||||
}
|
||||
|
||||
public void setOwner(String username)
|
||||
{
|
||||
dataWatcher.updateObject(12, username);
|
||||
}
|
||||
|
||||
public boolean getFollowing()
|
||||
{
|
||||
return dataWatcher.getWatchableObjectByte(13) == 1;
|
||||
}
|
||||
|
||||
public void setFollowing(boolean follow)
|
||||
{
|
||||
dataWatcher.updateObject(13, follow ? (byte)1 : (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHealth()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotID)
|
||||
{
|
||||
return inventory[slotID];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotID, int amount)
|
||||
{
|
||||
if(getStackInSlot(slotID) != null)
|
||||
{
|
||||
ItemStack tempStack;
|
||||
|
||||
if(getStackInSlot(slotID).stackSize <= amount)
|
||||
{
|
||||
tempStack = getStackInSlot(slotID);
|
||||
setInventorySlotContents(slotID, null);
|
||||
return tempStack;
|
||||
}
|
||||
else {
|
||||
tempStack = getStackInSlot(slotID).splitStack(amount);
|
||||
|
||||
if(getStackInSlot(slotID).stackSize == 0)
|
||||
{
|
||||
setInventorySlotContents(slotID, null);
|
||||
}
|
||||
|
||||
return tempStack;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotID)
|
||||
{
|
||||
if(getStackInSlot(slotID) != null)
|
||||
{
|
||||
ItemStack tempStack = getStackInSlot(slotID);
|
||||
setInventorySlotContents(slotID, null);
|
||||
return tempStack;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotID, ItemStack itemstack)
|
||||
{
|
||||
inventory[slotID] = itemstack;
|
||||
|
||||
if(itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "Robit";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest() {}
|
||||
|
||||
@Override
|
||||
public void closeChest() {}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventory(NBTTagList nbtTags, Object... data)
|
||||
{
|
||||
if(nbtTags == null || nbtTags.tagCount() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
inventory = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int slots = 0; slots < nbtTags.tagCount(); slots++)
|
||||
{
|
||||
NBTTagCompound tagCompound = (NBTTagCompound)nbtTags.tagAt(slots);
|
||||
byte slotID = tagCompound.getByte("Slot");
|
||||
|
||||
if(slotID >= 0 && slotID < inventory.length)
|
||||
{
|
||||
inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagList getInventory(Object... data)
|
||||
{
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int slots = 0; slots < inventory.length; slots++)
|
||||
{
|
||||
if(inventory[slots] != null)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte)slots);
|
||||
inventory[slots].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
return tagList;
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,12 @@ public enum EnumPacketType
|
||||
/** Used to send an electrolytic separator particle to all clients. */
|
||||
ELECTROLYTIC_SEPARATOR_PARTICLE(18),
|
||||
|
||||
/** Used to send a Robit GUI request to the server. */
|
||||
ROBIT_GUI(19),
|
||||
|
||||
/** Used to send a Robit follow update packet to the server. */
|
||||
FOLLOW_UPDATE(20),
|
||||
|
||||
/** A custom packet type. Handled in PacketHandler. */
|
||||
CUSTOM(-1);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import mekanism.api.IUpgradeManagement;
|
||||
import mekanism.common.BlockMachine.MachineType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -46,6 +47,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* 11: Teleporter
|
||||
* 12: Electric Pump
|
||||
* 13: Electric Chest
|
||||
* 14: Chargepad
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@@ -116,6 +118,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
|
||||
case 13:
|
||||
name = "ElectricChest";
|
||||
break;
|
||||
case 14:
|
||||
name = "Chargepad";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
@@ -371,6 +376,13 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntityItemUpdate(EntityItem entityItem)
|
||||
{
|
||||
onUpdate(entityItem.getEntityItem(), null, entityItem, 0, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Random;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.IUpgradeManagement;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package mekanism.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
public class ItemRobit extends ItemEnergized implements ISustainedInventory
|
||||
{
|
||||
public ItemRobit(int id)
|
||||
{
|
||||
super(id, 100000, 120);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElectricityPack getProvideRequest(ItemStack itemStack)
|
||||
{
|
||||
return new ElectricityPack();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagCount() != 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int x, int y, int z, int side, float posX, float posY, float posZ)
|
||||
{
|
||||
TileEntityChargepad tileEntity = (TileEntityChargepad)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
if(!tileEntity.isActive)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
EntityRobit robit = new EntityRobit(world, x+0.5, y+0.1, z+0.5);
|
||||
|
||||
robit.setHome(Object3D.get(tileEntity));
|
||||
robit.setEnergy(getEnergy(itemstack));
|
||||
robit.setOwner(entityplayer.username);
|
||||
robit.setInventory(getInventory(itemstack));
|
||||
|
||||
world.spawnEntityInWorld(robit);
|
||||
}
|
||||
|
||||
entityplayer.setCurrentItemOrArmor(0, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSend(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.5.5")
|
||||
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.5.6")
|
||||
@NetworkMod(channels = {"Mekanism"}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class Mekanism
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public class Mekanism
|
||||
public static Configuration configuration;
|
||||
|
||||
/** Mekanism version number */
|
||||
public static Version versionNumber = new Version(5, 5, 5);
|
||||
public static Version versionNumber = new Version(5, 5, 6);
|
||||
|
||||
/** Map of Teleporters */
|
||||
public static Map<Teleporter.Code, ArrayList<Object3D>> teleporters = new HashMap<Teleporter.Code, ArrayList<Object3D>>();
|
||||
@@ -130,6 +130,7 @@ public class Mekanism
|
||||
public static ItemEnergized EnergyTablet;
|
||||
public static Item SpeedUpgrade;
|
||||
public static Item EnergyUpgrade;
|
||||
public static ItemRobit Robit;
|
||||
public static ItemAtomicDisassembler AtomicDisassembler;
|
||||
public static Item AtomicCore;
|
||||
public static ItemStorageTank StorageTank;
|
||||
@@ -334,6 +335,9 @@ public class Mekanism
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 11), new Object[] {
|
||||
" I ", "ICI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('C'), ControlCircuit
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 14), new Object[] {
|
||||
"PPP", "SES", Character.valueOf('P'), Block.pressurePlateStone, Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), EnergyTablet.getUnchargedItem()
|
||||
}));
|
||||
|
||||
//Factory Recipes
|
||||
CraftingManager.getInstance().getRecipeList().add(new FactoryRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, RecipeType.SMELTING), new Object[] {
|
||||
@@ -438,6 +442,7 @@ public class Mekanism
|
||||
LanguageRegistry.addName(EnergyTablet, "Energy Tablet");
|
||||
LanguageRegistry.addName(SpeedUpgrade, "Speed Upgrade");
|
||||
LanguageRegistry.addName(EnergyUpgrade, "Energy Upgrade");
|
||||
LanguageRegistry.addName(Robit, "Robit");
|
||||
LanguageRegistry.addName(AtomicDisassembler, "Atomic Disassembler");
|
||||
LanguageRegistry.addName(AtomicCore, "Atomic Core");
|
||||
LanguageRegistry.addName(ElectricBow, "Electric Bow");
|
||||
@@ -481,6 +486,7 @@ public class Mekanism
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Teleporter.name", "Teleporter");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.ElectricPump.name", "Electric Pump");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.ElectricChest.name", "Electric Chest");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Chargepad.name", "Chargepad");
|
||||
|
||||
//Localization for OreBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.OsmiumOre.name", "Osmium Ore");
|
||||
@@ -555,7 +561,7 @@ public class Mekanism
|
||||
EnergyTablet = (ItemEnergized) new ItemEnergized(configuration.getItem("EnergyTablet", 11206).getInt(), 1000000, 120).setUnlocalizedName("EnergyTablet");
|
||||
SpeedUpgrade = new ItemMachineUpgrade(configuration.getItem("SpeedUpgrade", 11207).getInt(), 0, 150).setUnlocalizedName("SpeedUpgrade");
|
||||
EnergyUpgrade = new ItemMachineUpgrade(configuration.getItem("EnergyUpgrade", 11208).getInt(), 1000, 0).setUnlocalizedName("EnergyUpgrade");
|
||||
//Free ID...again :(
|
||||
Robit = (ItemRobit) new ItemRobit(configuration.getItem("Robit", 11209).getInt()).setUnlocalizedName("Robit");
|
||||
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");
|
||||
@@ -584,6 +590,7 @@ public class Mekanism
|
||||
GameRegistry.registerItem(EnergyTablet, "EnergyTablet");
|
||||
GameRegistry.registerItem(SpeedUpgrade, "SpeedUpgrade");
|
||||
GameRegistry.registerItem(EnergyUpgrade, "EnergyUpgrade");
|
||||
GameRegistry.registerItem(Robit, "Robit");
|
||||
GameRegistry.registerItem(AtomicDisassembler, "AtomicDisassembler");
|
||||
GameRegistry.registerItem(AtomicCore, "AtomicCore");
|
||||
GameRegistry.registerItem(EnrichedAlloy, "EnrichedAlloy");
|
||||
@@ -967,9 +974,11 @@ public class Mekanism
|
||||
{
|
||||
//Entity IDs
|
||||
EntityRegistry.registerGlobalEntityID(EntityObsidianTNT.class, "ObsidianTNT", EntityRegistry.findGlobalUniqueEntityId());
|
||||
EntityRegistry.registerGlobalEntityID(EntityRobit.class, "Robit", EntityRegistry.findGlobalUniqueEntityId());
|
||||
|
||||
//Registrations
|
||||
EntityRegistry.registerModEntity(EntityObsidianTNT.class, "ObsidianTNT", 51, this, 40, 5, true);
|
||||
EntityRegistry.registerModEntity(EntityObsidianTNT.class, "ObsidianTNT", 0, this, 40, 5, true);
|
||||
EntityRegistry.registerModEntity(EntityRobit.class, "Robit", 1, this, 40, 5, true);
|
||||
|
||||
//Tile entities
|
||||
GameRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber");
|
||||
@@ -1009,6 +1018,7 @@ public class Mekanism
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
File config = event.getSuggestedConfigurationFile();
|
||||
|
||||
//Set the mod's configuration
|
||||
configuration = new Configuration(config);
|
||||
|
||||
@@ -1016,6 +1026,10 @@ public class Mekanism
|
||||
{
|
||||
System.out.println("[Mekanism] Detected Voltz in root directory - hello, fellow user!");
|
||||
}
|
||||
else if(config.getAbsolutePath().contains("tekkit"))
|
||||
{
|
||||
System.out.println("[Mekanism] Detected Tekkit in root directory - hello, fellow user!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostInit
|
||||
@@ -1046,11 +1060,6 @@ public class Mekanism
|
||||
//Get data from server.
|
||||
new ThreadGetData();
|
||||
|
||||
//Load proxy
|
||||
proxy.registerRenderInformation();
|
||||
proxy.loadConfiguration();
|
||||
proxy.loadUtilities();
|
||||
|
||||
//Register to receive subscribed events
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new IC2EnergyHandler());
|
||||
@@ -1062,6 +1071,11 @@ public class Mekanism
|
||||
addRecipes();
|
||||
addEntities();
|
||||
|
||||
//Load proxy
|
||||
proxy.registerRenderInformation();
|
||||
proxy.loadConfiguration();
|
||||
proxy.loadUtilities();
|
||||
|
||||
//Completion notification
|
||||
System.out.println("[Mekanism] Loading complete.");
|
||||
|
||||
|
||||
@@ -31,12 +31,6 @@ public final class MekanismHooks
|
||||
private Class ForestryItem;
|
||||
private Class Forestry;
|
||||
|
||||
public int BuildCraftFuelID = 19108;
|
||||
public ItemStack BuildCraftFuelBucket;
|
||||
|
||||
public int BuildCraftOilID = 1521;
|
||||
public ItemStack BuildCraftOilBucket;
|
||||
|
||||
public int ForestryBiofuelID = 5013;
|
||||
public ItemStack ForestryBiofuelBucket;
|
||||
|
||||
@@ -102,10 +96,6 @@ public final class MekanismHooks
|
||||
}
|
||||
if(BuildCraftLoaded)
|
||||
{
|
||||
BuildCraftFuelID = getBuildCraftItem("fuel").itemID;
|
||||
BuildCraftFuelBucket = getBuildCraftItem("bucketFuel");
|
||||
BuildCraftOilID = getBuildCraftItem("oilStill").itemID;
|
||||
BuildCraftOilBucket = getBuildCraftItem("bucketOil");
|
||||
System.out.println("[Mekanism] Hooked into BuildCraft successfully.");
|
||||
}
|
||||
if(ForestryLoaded)
|
||||
|
||||
@@ -44,8 +44,6 @@ import cpw.mods.fml.server.FMLServerHandler;
|
||||
*/
|
||||
public final class MekanismUtils
|
||||
{
|
||||
public static int[][] CUBE_SIDE_MATRIX = {{3, 2, 1, 0, 5, 4}, {4, 5, 0, 1, 2, 3}, {0, 1, 3, 2, 5, 4}, {0, 1, 2, 3, 4, 5}, {0, 1, 5, 4, 3, 2}, {0, 1, 4, 5, 2, 3 }};
|
||||
|
||||
/**
|
||||
* Checks for a new version of Mekanism.
|
||||
*/
|
||||
@@ -435,7 +433,34 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static int getBaseOrientation(int side, int blockFacing)
|
||||
{
|
||||
return CUBE_SIDE_MATRIX[blockFacing][side];
|
||||
if(blockFacing == 3 || side == 1 || side == 0)
|
||||
{
|
||||
if(side == 2 || side == 3)
|
||||
{
|
||||
return ForgeDirection.getOrientation(side).getOpposite().ordinal();
|
||||
}
|
||||
|
||||
return side;
|
||||
}
|
||||
else if(blockFacing == 2)
|
||||
{
|
||||
if(side == 2 || side == 3)
|
||||
{
|
||||
return side;
|
||||
}
|
||||
|
||||
return ForgeDirection.getOrientation(side).getOpposite().ordinal();
|
||||
}
|
||||
else if(blockFacing == 4)
|
||||
{
|
||||
return getRight(side).ordinal();
|
||||
}
|
||||
else if(blockFacing == 5)
|
||||
{
|
||||
return getLeft(side).ordinal();
|
||||
}
|
||||
|
||||
return side;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -446,7 +446,7 @@ public class PacketHandler implements IPacketHandler
|
||||
new GasTransferProtocol(tileEntity, null, type, 0).clientUpdate();
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error while handling energy transfer update packet.");
|
||||
System.err.println("[Mekanism] Error while handling gas transfer update packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -464,7 +464,47 @@ public class PacketHandler implements IPacketHandler
|
||||
tileEntity.spawnParticle();
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error while handling energy transfer update packet.");
|
||||
System.err.println("[Mekanism] Error while handling electrolytic separator particle packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(packetType == EnumPacketType.ROBIT_GUI.id)
|
||||
{
|
||||
try {
|
||||
int type = dataStream.readInt();
|
||||
int id = dataStream.readInt();
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 21, entityplayer.worldObj, id, 0, 0);
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 22, entityplayer.worldObj, id, 0, 0);
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 23, entityplayer.worldObj, id, 0, 0);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error while handling robit GUI packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(packetType == EnumPacketType.FOLLOW_UPDATE.id)
|
||||
{
|
||||
try {
|
||||
boolean value = dataStream.readBoolean();
|
||||
int id = dataStream.readInt();
|
||||
|
||||
EntityRobit robit = (EntityRobit)entityplayer.worldObj.getEntityByID(id);
|
||||
|
||||
if(robit != null)
|
||||
{
|
||||
robit.setFollowing(value);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error while handling follow update packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -1026,6 +1066,68 @@ public class PacketHandler implements IPacketHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Robit GUI packet to the server.
|
||||
* @param type - GUI type to open
|
||||
* @param id - the robit's entity ID
|
||||
*/
|
||||
public static void sendRobitGui(int type, int id)
|
||||
{
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
DataOutputStream data = new DataOutputStream(bytes);
|
||||
|
||||
try {
|
||||
data.writeInt(EnumPacketType.ROBIT_GUI.id);
|
||||
data.writeInt(type);
|
||||
data.writeInt(id);
|
||||
} catch (IOException e) {
|
||||
System.out.println("[Mekanism] An error occured while writing packet data.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "Mekanism";
|
||||
packet.data = bytes.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
|
||||
if(Mekanism.logPackets)
|
||||
{
|
||||
System.out.println("[Mekanism] Sent robit GUI packet to server.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Robit follow update packet to the server.
|
||||
* @param value - new follow value
|
||||
* @param id - the robit's entity ID
|
||||
*/
|
||||
public static void sendFollowUpdate(boolean value, int id)
|
||||
{
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
DataOutputStream data = new DataOutputStream(bytes);
|
||||
|
||||
try {
|
||||
data.writeInt(EnumPacketType.FOLLOW_UPDATE.id);
|
||||
data.writeBoolean(value);
|
||||
data.writeInt(id);
|
||||
} catch (IOException e) {
|
||||
System.out.println("[Mekanism] An error occured while writing packet data.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "Mekanism";
|
||||
packet.data = bytes.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
|
||||
if(Mekanism.logPackets)
|
||||
{
|
||||
System.out.println("[Mekanism] Sent follow update packet to server.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the server the defined packet data int.
|
||||
* @param type - packet type
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package mekanism.common;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.pathfinding.PathNavigate;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RobitAIFollow extends EntityAIBase
|
||||
{
|
||||
/** The robit entity. */
|
||||
private EntityRobit theRobit;
|
||||
|
||||
/** The robit's owner. */
|
||||
private EntityPlayer theOwner;
|
||||
|
||||
/** The world the robit is located in. */
|
||||
private World theWorld;
|
||||
|
||||
/** How fast the robit can travel. */
|
||||
private float moveSpeed;
|
||||
|
||||
/** The robit's pathfinder. */
|
||||
private PathNavigate thePathfinder;
|
||||
|
||||
/** The ticker for updates. */
|
||||
private int ticker;
|
||||
|
||||
/** The distance between the owner the robit must be at in order for the protocol to begin. */
|
||||
private float maxDist;
|
||||
|
||||
/** The distance between the owner the robit must reach before it stops the protocol. */
|
||||
private float minDist;
|
||||
|
||||
/** Whether or not this robit avoids water. */
|
||||
private boolean avoidWater;
|
||||
|
||||
public RobitAIFollow(EntityRobit entityRobit, float speed, float min, float max)
|
||||
{
|
||||
theRobit = entityRobit;
|
||||
theWorld = entityRobit.worldObj;
|
||||
moveSpeed = speed;
|
||||
thePathfinder = entityRobit.getNavigator();
|
||||
minDist = min;
|
||||
maxDist = max;
|
||||
setMutexBits(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
EntityPlayer player = theRobit.getOwner();
|
||||
|
||||
if(player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(!theRobit.getFollowing())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(theRobit.getDistanceSqToEntity(player) < (minDist * minDist))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
theOwner = player;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting()
|
||||
{
|
||||
return !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(theOwner) > (maxDist * maxDist) && theRobit.getFollowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
ticker = 0;
|
||||
avoidWater = theRobit.getNavigator().getAvoidsWater();
|
||||
theRobit.getNavigator().setAvoidsWater(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTask()
|
||||
{
|
||||
theOwner = null;
|
||||
thePathfinder.clearPathEntity();
|
||||
theRobit.getNavigator().setAvoidsWater(avoidWater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
theRobit.getLookHelper().setLookPositionWithEntity(theOwner, 10.0F, theRobit.getVerticalFaceSpeed());
|
||||
|
||||
if(theRobit.getFollowing())
|
||||
{
|
||||
if(--ticker <= 0)
|
||||
{
|
||||
ticker = 10;
|
||||
|
||||
if(!thePathfinder.tryMoveToEntityLiving(theOwner, moveSpeed))
|
||||
{
|
||||
if(theRobit.getDistanceSqToEntity(theOwner) >= 144.0D)
|
||||
{
|
||||
int x = MathHelper.floor_double(theOwner.posX) - 2;
|
||||
int y = MathHelper.floor_double(theOwner.posZ) - 2;
|
||||
int z = MathHelper.floor_double(theOwner.boundingBox.minY);
|
||||
|
||||
for(int l = 0; l <= 4; ++l)
|
||||
{
|
||||
for(int i1 = 0; i1 <= 4; ++i1)
|
||||
{
|
||||
if((l < 1 || i1 < 1 || l > 3 || i1 > 3) && theWorld.doesBlockHaveSolidTopSurface(x + l, z - 1, y + i1) && !theWorld.isBlockNormalCube(x + l, z, y + i1) && !theWorld.isBlockNormalCube(x + l, z + 1, y + i1))
|
||||
{
|
||||
theRobit.setLocationAndAngles((x + l) + 0.5F, z, (y + i1) + 0.5F, theRobit.rotationYaw, theRobit.rotationPitch);
|
||||
thePathfinder.clearPathEntity();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package mekanism.common;
|
||||
|
||||
import ic2.api.Direction;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import thermalexpansion.api.item.IChargeableItem;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
|
||||
import mekanism.api.EnergizedItemManager;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.IStrictEnergyAcceptor;
|
||||
import mekanism.client.IHasSound;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
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.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityChargepad extends TileEntityElectricBlock implements IActiveState, IEnergySink, IStrictEnergyAcceptor, IHasSound
|
||||
{
|
||||
public boolean isActive;
|
||||
|
||||
public boolean prevActive;
|
||||
|
||||
public Random random = new Random();
|
||||
|
||||
public TileEntityChargepad()
|
||||
{
|
||||
super("Chargepad", 9000);
|
||||
inventory = new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
isActive = false;
|
||||
|
||||
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+0.2, zCoord+1));
|
||||
|
||||
for(EntityLiving entity : entities)
|
||||
{
|
||||
if(entity instanceof EntityPlayer || entity instanceof EntityRobit)
|
||||
{
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
if(electricityStored > 0)
|
||||
{
|
||||
if(entity instanceof EntityRobit)
|
||||
{
|
||||
EntityRobit robit = (EntityRobit)entity;
|
||||
|
||||
double canGive = Math.min(electricityStored, 1000);
|
||||
double toGive = Math.min(robit.MAX_ELECTRICITY-robit.getEnergy(), canGive);
|
||||
|
||||
robit.setEnergy(robit.getEnergy() + toGive);
|
||||
setEnergy(electricityStored - toGive);
|
||||
}
|
||||
else if(entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
|
||||
double prevEnergy = getEnergy();
|
||||
|
||||
for(ItemStack itemstack : player.inventory.mainInventory)
|
||||
{
|
||||
if(itemstack != null)
|
||||
{
|
||||
if(itemstack.getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
setEnergy(getEnergy() - EnergizedItemManager.charge(itemstack, getEnergy()));
|
||||
}
|
||||
else if(itemstack.getItem() instanceof IItemElectric)
|
||||
{
|
||||
setEnergy(getEnergy() - ElectricItemHelper.chargeItem(itemstack, getEnergy(), getVoltage()));
|
||||
}
|
||||
else if(Mekanism.hooks.IC2Loaded && itemstack.getItem() instanceof IElectricItem)
|
||||
{
|
||||
double sent = ElectricItem.charge(itemstack, (int)(getEnergy()*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
|
||||
setEnergy(getEnergy() - sent);
|
||||
}
|
||||
else if(itemstack.getItem() instanceof IChargeableItem)
|
||||
{
|
||||
IChargeableItem item = (IChargeableItem)itemstack.getItem();
|
||||
|
||||
float itemEnergy = (float)Math.min(Math.sqrt(item.getMaxEnergyStored(itemstack)), item.getMaxEnergyStored(itemstack) - item.getEnergyStored(itemstack));
|
||||
float toTransfer = (float)Math.min(itemEnergy, (getEnergy()*Mekanism.TO_BC));
|
||||
|
||||
item.receiveEnergy(itemstack, toTransfer, true);
|
||||
setEnergy(getEnergy() - (toTransfer*Mekanism.FROM_BC));
|
||||
}
|
||||
|
||||
if(prevEnergy != getEnergy())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(prevActive != isActive)
|
||||
{
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.1, zCoord + 0.5, "random.click", 0.3F, isActive ? 0.6F : 0.5F);
|
||||
setActive(isActive);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Mekanism.proxy.registerSound(this);
|
||||
|
||||
if(isActive)
|
||||
{
|
||||
worldObj.spawnParticle("reddust", xCoord+random.nextDouble(), yCoord+0.15, zCoord+random.nextDouble(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
Mekanism.proxy.unregisterSound(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EnumSet<ForgeDirection> getConsumingSides()
|
||||
{
|
||||
return EnumSet.of(ForgeDirection.DOWN, ForgeDirection.getOrientation(facing));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActive()
|
||||
{
|
||||
return isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
isActive = active;
|
||||
|
||||
if(prevActive != active)
|
||||
{
|
||||
PacketHandler.sendTileEntityPacketToClients(this, 0, getNetworkedData(new ArrayList()));
|
||||
}
|
||||
|
||||
prevActive = active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
isActive = nbtTags.getBoolean("isActive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("isActive", isActive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
isActive = dataStream.readBoolean();
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
data.add(isActive);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(double amount)
|
||||
{
|
||||
double rejects = 0;
|
||||
double neededElectricity = MAX_ELECTRICITY-electricityStored;
|
||||
|
||||
if(amount <= neededElectricity)
|
||||
{
|
||||
electricityStored += amount;
|
||||
}
|
||||
else {
|
||||
electricityStored += neededElectricity;
|
||||
rejects = amount-neededElectricity;
|
||||
}
|
||||
|
||||
return rejects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side)
|
||||
{
|
||||
return side == ForgeDirection.DOWN || side == ForgeDirection.getOrientation(facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int demandsEnergy()
|
||||
{
|
||||
return (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput()
|
||||
{
|
||||
return 2048;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int injectEnergy(Direction direction, int i)
|
||||
{
|
||||
double rejects = 0;
|
||||
double neededEnergy = MAX_ELECTRICITY-electricityStored;
|
||||
if(i <= neededEnergy)
|
||||
{
|
||||
electricityStored += i;
|
||||
}
|
||||
else if(i > neededEnergy)
|
||||
{
|
||||
electricityStored += neededEnergy;
|
||||
rejects = i-neededEnergy;
|
||||
}
|
||||
|
||||
return (int)(rejects*Mekanism.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction)
|
||||
{
|
||||
return direction.toForgeDirection() == ForgeDirection.DOWN || direction.toForgeDirection() == ForgeDirection.getOrientation(facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoundPath()
|
||||
{
|
||||
return "Chargepad.ogg";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getVolumeMultiplier()
|
||||
{
|
||||
return 0.7F;
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,21 @@ public class GuiBioGenerator extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString("BioFuel: " + tileEntity.bioFuelSlot.liquidStored, 51, 35, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -87,11 +90,19 @@ public class GuiElectrolyticSeparator extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Output", 124, 73, 0x404040);
|
||||
fontRenderer.drawString("Dump", 21, 73, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,13 +28,21 @@ public class GuiHeatGenerator extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString("Fuel: " + (tileEntity.lavaTank.getLiquid() != null ? tileEntity.lavaTank.getLiquid().amount : 0), 51, 35, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,13 +28,21 @@ public class GuiHydrogenGenerator extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString("H: " + tileEntity.hydrogenStored, 51, 35, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,13 +28,21 @@ public class GuiSolarGenerator extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, tileEntity.fullName != "Advanced Solar Generator" ? 45 : 30, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString("Sun: " + tileEntity.seesSun, 51, 35, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,8 +29,11 @@ public class GuiWindTurbine extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||
@@ -48,8 +51,13 @@ public class GuiWindTurbine extends GuiContainer
|
||||
if(!tileEntity.worldObj.canBlockSeeTheSky(tileEntity.xCoord, tileEntity.yCoord+4, tileEntity.zCoord))
|
||||
{
|
||||
size += 9;
|
||||
fontRenderer.drawString(EnumColor.DARK_RED + "Sky blocked", 51, size, 0x00CD00);
|
||||
fontRenderer.drawString(EnumColor.DARK_RED + "Sky blocked", 51, size, 0x00CD00);
|
||||
}
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -80,8 +80,7 @@ public class ContainerHeatGenerator extends Container
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(tileEntity.getFuel(slotStack) > 0 ||
|
||||
(Mekanism.hooks.BuildCraftLoaded && (slotStack.itemID == Mekanism.hooks.BuildCraftFuelBucket.itemID || slotStack.itemID == Mekanism.hooks.BuildCraftOilBucket.itemID)))
|
||||
else if(tileEntity.getFuel(slotStack) > 0)
|
||||
{
|
||||
if(slotID != 0 && slotID != 1)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "5.5.5", dependencies = "required-after:Mekanism")
|
||||
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "5.5.6", dependencies = "required-after:Mekanism")
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
|
||||
public class MekanismGenerators implements IModule
|
||||
{
|
||||
@@ -36,7 +36,7 @@ public class MekanismGenerators implements IModule
|
||||
public static MekanismGenerators instance;
|
||||
|
||||
/** MekanismGenerators version number */
|
||||
public static Version versionNumber = new Version(5, 5, 5);
|
||||
public static Version versionNumber = new Version(5, 5, 6);
|
||||
|
||||
//Items
|
||||
public static Item BioFuel;
|
||||
|
||||
@@ -2,34 +2,19 @@ package mekanism.tools.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.ItemMekanism;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import mekanism.common.Mekanism;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
||||
public class ItemMekanismSword extends ItemMekanism
|
||||
public class ItemMekanismSword extends ItemSword
|
||||
{
|
||||
private int weaponDamage;
|
||||
private final EnumToolMaterial toolMaterial;
|
||||
|
||||
public ItemMekanismSword(int id, EnumToolMaterial enumtoolmaterial)
|
||||
{
|
||||
super(id);
|
||||
toolMaterial = enumtoolmaterial;
|
||||
maxStackSize = 1;
|
||||
setMaxDamage(enumtoolmaterial.getMaxUses());
|
||||
weaponDamage = 4 + enumtoolmaterial.getDamageVsEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack itemstack, Block block)
|
||||
{
|
||||
return block.blockID != Block.web.blockID ? 1.5F : 15F;
|
||||
super(id, enumtoolmaterial);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,61 +22,10 @@ public class ItemMekanismSword extends ItemMekanism
|
||||
{
|
||||
list.add("HP: " + (itemstack.getMaxDamage() - itemstack.getItemDamage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityplayer, EntityLiving entityliving)
|
||||
{
|
||||
itemstack.damageItem(1, entityliving);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, int x, int y, int z, int facing, EntityLiving entityplayer)
|
||||
{
|
||||
itemstack.damageItem(2, entityplayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageVsEntity(Entity entity)
|
||||
{
|
||||
return weaponDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack itemstack)
|
||||
{
|
||||
return EnumAction.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack itemstack)
|
||||
{
|
||||
return 0x11940;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
return block.blockID == Block.web.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return toolMaterial.getEnchantability();
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(IconRegister register)
|
||||
{
|
||||
itemIcon = register.registerIcon("mekanism:" + getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.5.5", dependencies = "required-after:Mekanism")
|
||||
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.5.6", dependencies = "required-after:Mekanism")
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
|
||||
public class MekanismTools implements IModule
|
||||
{
|
||||
@@ -33,7 +33,7 @@ public class MekanismTools implements IModule
|
||||
public static MekanismTools instance;
|
||||
|
||||
/** MekanismTools version number */
|
||||
public static Version versionNumber = new Version(5, 5, 5);
|
||||
public static Version versionNumber = new Version(5, 5, 6);
|
||||
|
||||
//Enums: Tools
|
||||
public static EnumToolMaterial toolOBSIDIAN = EnumHelper.addToolMaterial("OBSIDIAN", 3, 2500, 20F, 10, 100);
|
||||
|
||||