v5.5.6 Beta #2
*Robit uses energy when following it's owner. *Robit has built in furnace. *Robit only moves when it has energy. *Fixed Wind Turbine/Adv Solar Gen crash. *Fixed bad direct IC2 conversion. *Chargepads charge armor inventory. *Better Heat/Bio generation. *Crafting recipe for Robit. *Ore Dictionary support for iron/gold ore.
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 8 KiB After Width: | Height: | Size: 8.7 KiB |
BIN
bin/minecraft/mods/mekanism/gui/GuiRobitSmelting.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
|
@ -266,6 +266,12 @@ public class ClientProxy extends CommonProxy
|
||||||
{
|
{
|
||||||
return new GuiRobitInventory(player.inventory, robit1);
|
return new GuiRobitInventory(player.inventory, robit1);
|
||||||
}
|
}
|
||||||
|
case 24:
|
||||||
|
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
|
||||||
|
if(robit2 != null)
|
||||||
|
{
|
||||||
|
return new GuiRobitSmelting(player.inventory, robit2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -64,6 +64,14 @@ public class GuiRobitCrafting extends GuiContainer
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 108, 18, 18);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 126, 18, 18);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,6 +100,12 @@ public class GuiRobitCrafting extends GuiContainer
|
||||||
PacketHandler.sendRobitGui(2, entityId);
|
PacketHandler.sendRobitGui(2, entityId);
|
||||||
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, entityId, 0, 0);
|
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, entityId, 0, 0);
|
||||||
}
|
}
|
||||||
|
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendRobitGui(3, entityId);
|
||||||
|
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, entityId, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,14 @@ public class GuiRobitInventory extends GuiContainer
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 108, 18, 18);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 126, 18, 18);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,6 +99,12 @@ public class GuiRobitInventory extends GuiContainer
|
||||||
{
|
{
|
||||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendRobitGui(3, robit.entityId);
|
||||||
|
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.entityId, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,12 +83,20 @@ public class GuiRobitMain extends GuiContainer
|
||||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 50, 176 + 25, 90, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
{
|
{
|
||||||
drawTexturedModalRect(guiWidth + 152, guiHeight + 53, 176 + 25, 108, 18, 18);
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 108, 18, 18);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 152, guiHeight + 53, 176 + 25, 126, 18, 18);
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 126, 18, 18);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 152, guiHeight + 53, 176 + 25, 144, 18, 18);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 152, guiHeight + 53, 176 + 25, 162, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayInt;
|
int displayInt;
|
||||||
|
@ -128,6 +136,12 @@ public class GuiRobitMain extends GuiContainer
|
||||||
PacketHandler.sendRobitGui(2, robit.entityId);
|
PacketHandler.sendRobitGui(2, robit.entityId);
|
||||||
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.entityId, 0, 0);
|
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.entityId, 0, 0);
|
||||||
}
|
}
|
||||||
|
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendRobitGui(3, robit.entityId);
|
||||||
|
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.entityId, 0, 0);
|
||||||
|
}
|
||||||
else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 53 && yAxis <= 71)
|
||||||
{
|
{
|
||||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
|
138
src/minecraft/mekanism/client/GuiRobitSmelting.java
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
package mekanism.client;
|
||||||
|
|
||||||
|
import mekanism.common.ContainerRobitSmelting;
|
||||||
|
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 org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class GuiRobitSmelting extends GuiContainer
|
||||||
|
{
|
||||||
|
public EntityRobit robit;
|
||||||
|
|
||||||
|
public GuiRobitSmelting(InventoryPlayer inventory, EntityRobit entity)
|
||||||
|
{
|
||||||
|
super(new ContainerRobitSmelting(inventory, entity));
|
||||||
|
xSize += 25;
|
||||||
|
robit = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||||
|
{
|
||||||
|
fontRenderer.drawString("Robit Smelting", 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/GuiRobitSmelting.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 108, 18, 18);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 179, guiHeight + 70, 176 + 25, 126, 18, 18);
|
||||||
|
}
|
||||||
|
|
||||||
|
int displayInt;
|
||||||
|
|
||||||
|
if(robit.furnaceBurnTime > 0)
|
||||||
|
{
|
||||||
|
displayInt = getBurnTimeRemainingScaled(12);
|
||||||
|
drawTexturedModalRect(guiWidth + 56, guiHeight + 36 + 12 - displayInt, 176 + 25 + 18, 36 + 12 - displayInt, 14, displayInt + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
displayInt = getCookProgressScaled(24);
|
||||||
|
drawTexturedModalRect(guiWidth + 79, guiHeight + 34, 176 + 25 + 18, 36 + 14, displayInt + 1, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
PacketHandler.sendRobitGui(2, robit.entityId);
|
||||||
|
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.entityId, 0, 0);
|
||||||
|
}
|
||||||
|
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getCookProgressScaled(int i)
|
||||||
|
{
|
||||||
|
return robit.furnaceCookTime * i / 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getBurnTimeRemainingScaled(int i)
|
||||||
|
{
|
||||||
|
if(robit.currentItemBurnTime == 0)
|
||||||
|
{
|
||||||
|
robit.currentItemBurnTime = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
return robit.furnaceBurnTime * i / robit.currentItemBurnTime;
|
||||||
|
}
|
||||||
|
}
|
|
@ -208,6 +208,12 @@ public class CommonProxy
|
||||||
{
|
{
|
||||||
return new ContainerRobitInventory(player.inventory, robit1);
|
return new ContainerRobitInventory(player.inventory, robit1);
|
||||||
}
|
}
|
||||||
|
case 24:
|
||||||
|
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
|
||||||
|
if(robit2 != null)
|
||||||
|
{
|
||||||
|
return new ContainerRobitSmelting(player.inventory, robit2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
188
src/minecraft/mekanism/common/ContainerRobitSmelting.java
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
package mekanism.common;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.inventory.SlotFurnace;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
|
|
||||||
|
public class ContainerRobitSmelting extends Container
|
||||||
|
{
|
||||||
|
public EntityRobit robit;
|
||||||
|
|
||||||
|
private int lastCookTime = 0;
|
||||||
|
private int lastBurnTime = 0;
|
||||||
|
private int lastItemBurnTime = 0;
|
||||||
|
|
||||||
|
public ContainerRobitSmelting(InventoryPlayer inventory, EntityRobit entity)
|
||||||
|
{
|
||||||
|
robit = entity;
|
||||||
|
robit.openChest();
|
||||||
|
|
||||||
|
addSlotToContainer(new Slot(entity, 28, 56, 17));
|
||||||
|
addSlotToContainer(new Slot(entity, 29, 56, 53));
|
||||||
|
addSlotToContainer(new SlotFurnace(inventory.player, entity, 30, 116, 35));
|
||||||
|
|
||||||
|
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 void addCraftingToCrafters(ICrafting icrafting)
|
||||||
|
{
|
||||||
|
super.addCraftingToCrafters(icrafting);
|
||||||
|
icrafting.sendProgressBarUpdate(this, 0, robit.furnaceCookTime);
|
||||||
|
icrafting.sendProgressBarUpdate(this, 1, robit.furnaceBurnTime);
|
||||||
|
icrafting.sendProgressBarUpdate(this, 2, robit.currentItemBurnTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges()
|
||||||
|
{
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
|
||||||
|
for(int i = 0; i < crafters.size(); ++i)
|
||||||
|
{
|
||||||
|
ICrafting icrafting = (ICrafting)crafters.get(i);
|
||||||
|
|
||||||
|
if(lastCookTime != robit.furnaceCookTime)
|
||||||
|
{
|
||||||
|
icrafting.sendProgressBarUpdate(this, 0, robit.furnaceCookTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lastBurnTime != robit.furnaceBurnTime)
|
||||||
|
{
|
||||||
|
icrafting.sendProgressBarUpdate(this, 1, robit.furnaceBurnTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lastItemBurnTime != robit.currentItemBurnTime)
|
||||||
|
{
|
||||||
|
icrafting.sendProgressBarUpdate(this, 2, robit.currentItemBurnTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastCookTime = robit.furnaceCookTime;
|
||||||
|
lastBurnTime = robit.furnaceBurnTime;
|
||||||
|
lastItemBurnTime = robit.currentItemBurnTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProgressBar(int i, int j)
|
||||||
|
{
|
||||||
|
if(i == 0)
|
||||||
|
{
|
||||||
|
robit.furnaceCookTime = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == 1)
|
||||||
|
{
|
||||||
|
robit.furnaceBurnTime = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == 2)
|
||||||
|
{
|
||||||
|
robit.currentItemBurnTime = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 == 2)
|
||||||
|
{
|
||||||
|
if(!mergeItemStack(slotStack, 3, 39, true))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(slotID != 1 && slotID != 0)
|
||||||
|
{
|
||||||
|
if(FurnaceRecipes.smelting().getSmeltingResult(slotStack) != null)
|
||||||
|
{
|
||||||
|
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(TileEntityFurnace.isItemFuel(slotStack))
|
||||||
|
{
|
||||||
|
if(!mergeItemStack(slotStack, 1, 2, false))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(slotID >= 3 && slotID < 30)
|
||||||
|
{
|
||||||
|
if(!mergeItemStack(slotStack, 30, 39, false))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(slotID >= 30 && slotID < 39 && !mergeItemStack(slotStack, 3, 30, false))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!mergeItemStack(slotStack, 3, 39, false))
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,9 +2,10 @@ package mekanism.common;
|
||||||
|
|
||||||
import ic2.api.item.ElectricItem;
|
import ic2.api.item.ElectricItem;
|
||||||
import ic2.api.item.IElectricItem;
|
import ic2.api.item.IElectricItem;
|
||||||
import thermalexpansion.api.item.IChargeableItem;
|
|
||||||
import universalelectricity.core.item.ElectricItemHelper;
|
import java.math.BigDecimal;
|
||||||
import universalelectricity.core.item.IItemElectric;
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
import mekanism.api.EnergizedItemManager;
|
import mekanism.api.EnergizedItemManager;
|
||||||
import mekanism.api.IEnergizedItem;
|
import mekanism.api.IEnergizedItem;
|
||||||
import mekanism.api.Object3D;
|
import mekanism.api.Object3D;
|
||||||
|
@ -17,11 +18,16 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
|
import thermalexpansion.api.item.IChargeableItem;
|
||||||
|
import universalelectricity.core.item.ElectricItemHelper;
|
||||||
|
import universalelectricity.core.item.IItemElectric;
|
||||||
import codechicken.core.alg.MathHelper;
|
import codechicken.core.alg.MathHelper;
|
||||||
|
|
||||||
public class EntityRobit extends EntityCreature implements IInventory, ISustainedInventory
|
public class EntityRobit extends EntityCreature implements IInventory, ISustainedInventory
|
||||||
|
@ -30,14 +36,18 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
|
||||||
|
|
||||||
public Object3D homeLocation;
|
public Object3D homeLocation;
|
||||||
|
|
||||||
public ItemStack[] inventory = new ItemStack[28];
|
public ItemStack[] inventory = new ItemStack[31];
|
||||||
|
|
||||||
|
public int furnaceBurnTime = 0;
|
||||||
|
public int currentItemBurnTime = 0;
|
||||||
|
public int furnaceCookTime = 0;
|
||||||
|
|
||||||
public EntityRobit(World world)
|
public EntityRobit(World world)
|
||||||
{
|
{
|
||||||
super(world);
|
super(world);
|
||||||
|
|
||||||
setSize(1, 1);
|
setSize(1, 1);
|
||||||
moveSpeed = 0.2F;
|
moveSpeed = 0.35F;
|
||||||
texture = "/mods/mekanism/render/Robit.png";
|
texture = "/mods/mekanism/render/Robit.png";
|
||||||
|
|
||||||
getNavigator().setAvoidsWater(true);
|
getNavigator().setAvoidsWater(true);
|
||||||
|
@ -84,9 +94,22 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
|
||||||
dataWatcher.addObject(13, new Byte((byte)0)); /* Follow */
|
dataWatcher.addObject(13, new Byte((byte)0)); /* Follow */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getRoundedTravelEnergy()
|
||||||
|
{
|
||||||
|
return new BigDecimal(getDistance(prevPosX, prevPosY, prevPosZ)*1.5).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityUpdate()
|
public void onEntityUpdate()
|
||||||
{
|
{
|
||||||
|
if(!worldObj.isRemote)
|
||||||
|
{
|
||||||
|
if(getFollowing() && getOwner() != null && getDistanceSqToEntity(getOwner()) > 4 && !getNavigator().noPath() && getEnergy() > 0)
|
||||||
|
{
|
||||||
|
setEnergy(getEnergy() - getRoundedTravelEnergy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.onEntityUpdate();
|
super.onEntityUpdate();
|
||||||
|
|
||||||
if(!worldObj.isRemote)
|
if(!worldObj.isRemote)
|
||||||
|
@ -108,6 +131,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
|
||||||
|
|
||||||
if(getEnergy() == 0 && !isOnChargepad())
|
if(getEnergy() == 0 && !isOnChargepad())
|
||||||
{
|
{
|
||||||
|
setFollowing(false);
|
||||||
setPositionAndUpdate(homeLocation.xCoord+0.5, homeLocation.yCoord+0.3, homeLocation.zCoord+0.5);
|
setPositionAndUpdate(homeLocation.xCoord+0.5, homeLocation.yCoord+0.3, homeLocation.zCoord+0.5);
|
||||||
|
|
||||||
motionX = 0;
|
motionX = 0;
|
||||||
|
@ -157,8 +181,88 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(furnaceBurnTime > 0)
|
||||||
|
{
|
||||||
|
furnaceBurnTime--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!worldObj.isRemote)
|
||||||
|
{
|
||||||
|
if(furnaceBurnTime == 0 && canSmelt())
|
||||||
|
{
|
||||||
|
currentItemBurnTime = furnaceBurnTime = TileEntityFurnace.getItemBurnTime(inventory[29]);
|
||||||
|
|
||||||
|
if(furnaceBurnTime > 0)
|
||||||
|
{
|
||||||
|
if(inventory[29] != null)
|
||||||
|
{
|
||||||
|
inventory[29].stackSize--;
|
||||||
|
|
||||||
|
if(inventory[29].stackSize == 0)
|
||||||
|
{
|
||||||
|
inventory[29] = inventory[29].getItem().getContainerItemStack(inventory[29]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(furnaceBurnTime > 0 && canSmelt())
|
||||||
|
{
|
||||||
|
furnaceCookTime++;
|
||||||
|
|
||||||
|
if(furnaceCookTime == 200)
|
||||||
|
{
|
||||||
|
furnaceCookTime = 0;
|
||||||
|
smeltItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
furnaceCookTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean canSmelt()
|
||||||
|
{
|
||||||
|
if(inventory[28] == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[28]);
|
||||||
|
if(itemstack == null) return false;
|
||||||
|
if(inventory[30] == null) return true;
|
||||||
|
if(!inventory[30].isItemEqual(itemstack)) return false;
|
||||||
|
int result = inventory[30].stackSize + itemstack.stackSize;
|
||||||
|
return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void smeltItem()
|
||||||
|
{
|
||||||
|
if(canSmelt())
|
||||||
|
{
|
||||||
|
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[28]);
|
||||||
|
|
||||||
|
if(inventory[30] == null)
|
||||||
|
{
|
||||||
|
inventory[30] = itemstack.copy();
|
||||||
|
}
|
||||||
|
else if(inventory[30].isItemEqual(itemstack))
|
||||||
|
{
|
||||||
|
inventory[30].stackSize += itemstack.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
inventory[28].stackSize--;
|
||||||
|
|
||||||
|
if(inventory[28].stackSize <= 0)
|
||||||
|
{
|
||||||
|
inventory[28] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isOnChargepad()
|
public boolean isOnChargepad()
|
||||||
{
|
{
|
||||||
|
@ -498,4 +602,10 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
|
||||||
|
|
||||||
return tagList;
|
return tagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getShadowSize()
|
||||||
|
{
|
||||||
|
return 0.25F;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,6 +338,9 @@ public class Mekanism
|
||||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 14), new Object[] {
|
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()
|
"PPP", "SES", Character.valueOf('P'), Block.pressurePlateStone, Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), EnergyTablet.getUnchargedItem()
|
||||||
}));
|
}));
|
||||||
|
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(Robit.getUnchargedItem(), new Object[] {
|
||||||
|
" S ", "ECE", "OIO", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('C'), AtomicCore, Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('I'), new ItemStack(MachineBlock, 1, 13)
|
||||||
|
}));
|
||||||
|
|
||||||
//Factory Recipes
|
//Factory Recipes
|
||||||
CraftingManager.getInstance().getRecipeList().add(new FactoryRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, RecipeType.SMELTING), new Object[] {
|
CraftingManager.getInstance().getRecipeList().add(new FactoryRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, RecipeType.SMELTING), new Object[] {
|
||||||
|
@ -378,8 +381,6 @@ public class Mekanism
|
||||||
//Enrichment Chamber Recipes
|
//Enrichment Chamber Recipes
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreRedstone), new ItemStack(Item.redstone, 12));
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreRedstone), new ItemStack(Item.redstone, 12));
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(DirtyDust, 1, 6));
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(DirtyDust, 1, 6));
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Dust, 2, 0));
|
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Dust, 2, 1));
|
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Item.coal, 1, 0), new ItemStack(CompressedCarbon));
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Item.coal, 1, 0), new ItemStack(CompressedCarbon));
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Item.coal, 1, 1), new ItemStack(CompressedCarbon));
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Item.coal, 1, 1), new ItemStack(CompressedCarbon));
|
||||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreLapis), new ItemStack(Item.dyePowder, 12, 4));
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreLapis), new ItemStack(Item.dyePowder, 12, 4));
|
||||||
|
@ -409,10 +410,6 @@ public class Mekanism
|
||||||
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2));
|
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2));
|
||||||
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 3), new ItemStack(Block.stoneBrick, 1, 0));
|
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 3), new ItemStack(Block.stoneBrick, 1, 0));
|
||||||
|
|
||||||
//Purification Chamber Recipes
|
|
||||||
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Clump, 3, 0));
|
|
||||||
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Clump, 3, 1));
|
|
||||||
|
|
||||||
//Metallurgic Infuser Recipes
|
//Metallurgic Infuser Recipes
|
||||||
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfusionType.COAL, 10, new ItemStack(EnrichedIron)), new ItemStack(Dust, 1, 5));
|
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfusionType.COAL, 10, new ItemStack(EnrichedIron)), new ItemStack(Dust, 1, 5));
|
||||||
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfusionType.BIO, 10, new ItemStack(Block.cobblestone)), new ItemStack(Block.cobblestoneMossy));
|
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfusionType.BIO, 10, new ItemStack(Block.cobblestone)), new ItemStack(Block.cobblestoneMossy));
|
||||||
|
@ -799,6 +796,18 @@ public class Mekanism
|
||||||
RecipeHandler.addPurificationChamberRecipe(ore, new ItemStack(Clump, 3, 2));
|
RecipeHandler.addPurificationChamberRecipe(ore, new ItemStack(Clump, 3, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(ItemStack ore : OreDictionary.getOres("oreIron"))
|
||||||
|
{
|
||||||
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Dust, 2, 0));
|
||||||
|
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Clump, 3, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(ItemStack ore : OreDictionary.getOres("oreGold"))
|
||||||
|
{
|
||||||
|
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Dust, 2, 1));
|
||||||
|
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Clump, 3, 1));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for(ItemStack ore : OreDictionary.getOres("oreLead"))
|
for(ItemStack ore : OreDictionary.getOres("oreLead"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -486,6 +486,10 @@ public class PacketHandler implements IPacketHandler
|
||||||
{
|
{
|
||||||
entityplayer.openGui(Mekanism.instance, 23, entityplayer.worldObj, id, 0, 0);
|
entityplayer.openGui(Mekanism.instance, 23, entityplayer.worldObj, id, 0, 0);
|
||||||
}
|
}
|
||||||
|
else if(type == 3)
|
||||||
|
{
|
||||||
|
entityplayer.openGui(Mekanism.instance, 24, entityplayer.worldObj, id, 0, 0);
|
||||||
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
System.err.println("[Mekanism] Error while handling robit GUI packet.");
|
System.err.println("[Mekanism] Error while handling robit GUI packet.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -63,6 +63,10 @@ public class RobitAIFollow extends EntityAIBase
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if(theRobit.getEnergy() == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
theOwner = player;
|
theOwner = player;
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,7 +76,7 @@ public class RobitAIFollow extends EntityAIBase
|
||||||
@Override
|
@Override
|
||||||
public boolean continueExecuting()
|
public boolean continueExecuting()
|
||||||
{
|
{
|
||||||
return !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(theOwner) > (maxDist * maxDist) && theRobit.getFollowing();
|
return !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(theOwner) > (maxDist * maxDist) && theRobit.getFollowing() && theRobit.getEnergy() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -80,36 +80,21 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
|
||||||
|
|
||||||
for(ItemStack itemstack : player.inventory.mainInventory)
|
for(ItemStack itemstack : player.inventory.mainInventory)
|
||||||
{
|
{
|
||||||
if(itemstack != null)
|
chargeItemStack(itemstack);
|
||||||
|
|
||||||
|
if(prevEnergy != getEnergy())
|
||||||
{
|
{
|
||||||
if(itemstack.getItem() instanceof IEnergizedItem)
|
break;
|
||||||
{
|
}
|
||||||
setEnergy(getEnergy() - EnergizedItemManager.charge(itemstack, getEnergy()));
|
}
|
||||||
}
|
|
||||||
else if(itemstack.getItem() instanceof IItemElectric)
|
for(ItemStack itemstack : player.inventory.armorInventory)
|
||||||
{
|
{
|
||||||
setEnergy(getEnergy() - ElectricItemHelper.chargeItem(itemstack, getEnergy(), getVoltage()));
|
chargeItemStack(itemstack);
|
||||||
}
|
|
||||||
else if(Mekanism.hooks.IC2Loaded && itemstack.getItem() instanceof IElectricItem)
|
if(prevEnergy != getEnergy())
|
||||||
{
|
{
|
||||||
double sent = ElectricItem.charge(itemstack, (int)(getEnergy()*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,6 +117,36 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void chargeItemStack(ItemStack itemstack)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class GuiWindTurbine extends GuiContainer
|
||||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||||
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
|
||||||
fontRenderer.drawString("Power: " + tileEntity.GENERATION_RATE*tileEntity.getVolumeMultiplier(), 51, 35, 0x00CD00);
|
fontRenderer.drawString("Power: " + tileEntity.GENERATION_RATE*tileEntity.getMultiplier(), 51, 35, 0x00CD00);
|
||||||
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
|
||||||
|
|
||||||
int size = 44;
|
int size = 44;
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
|
||||||
{
|
{
|
||||||
for(int zPos=-1;zPos<=1;zPos++)
|
for(int zPos=-1;zPos<=1;zPos++)
|
||||||
{
|
{
|
||||||
if(world.getBlockId(x+xPos, y+2, z+zPos) != 0)
|
if(world.getBlockId(x+xPos, y+2, z+zPos) != 0 || y+2 > 255)
|
||||||
place = false;
|
place = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
|
||||||
|
|
||||||
for(int yPos = y+1; yPos <= y+4; yPos++)
|
for(int yPos = y+1; yPos <= y+4; yPos++)
|
||||||
{
|
{
|
||||||
if(world.getBlockId(x, yPos, z) != 0)
|
if(world.getBlockId(x, yPos, z) != 0 || yPos > 255)
|
||||||
place = false;
|
place = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
||||||
public float crushMatrix = 0;
|
public float crushMatrix = 0;
|
||||||
|
|
||||||
/** The amount of electricity this machine can produce with a unit of fuel. */
|
/** The amount of electricity this machine can produce with a unit of fuel. */
|
||||||
public final int GENERATION = 50;
|
public final int GENERATION = 120;
|
||||||
|
|
||||||
/** The LiquidSlot biofuel instance for this generator. */
|
/** The LiquidSlot biofuel instance for this generator. */
|
||||||
public LiquidSlot bioFuelSlot = new LiquidSlot(24000, Mekanism.hooks.ForestryBiofuelID);
|
public LiquidSlot bioFuelSlot = new LiquidSlot(24000, Mekanism.hooks.ForestryBiofuelID);
|
||||||
|
@ -48,7 +48,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
||||||
|
|
||||||
public TileEntityBioGenerator()
|
public TileEntityBioGenerator()
|
||||||
{
|
{
|
||||||
super("Bio-Generator", 160000, 100);
|
super("Bio-Generator", 160000, 240);
|
||||||
inventory = new ItemStack[2];
|
inventory = new ItemStack[2];
|
||||||
|
|
||||||
if(Mekanism.hooks.ForestryLoaded)
|
if(Mekanism.hooks.ForestryLoaded)
|
||||||
|
|
|
@ -97,9 +97,9 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
||||||
{
|
{
|
||||||
if(electricityStored >= output)
|
if(electricityStored >= output)
|
||||||
{
|
{
|
||||||
EnergyTileSourceEvent event = new EnergyTileSourceEvent(this, output);
|
EnergyTileSourceEvent event = new EnergyTileSourceEvent(this, (int)(output*Mekanism.TO_IC2));
|
||||||
MinecraftForge.EVENT_BUS.post(event);
|
MinecraftForge.EVENT_BUS.post(event);
|
||||||
setEnergy(electricityStored - (output - event.amount));
|
setEnergy(electricityStored - (output - (event.amount*Mekanism.FROM_IC2)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(isPowerReceptor(tileEntity) && Mekanism.hooks.BuildCraftLoaded)
|
else if(isPowerReceptor(tileEntity) && Mekanism.hooks.BuildCraftLoaded)
|
||||||
|
|
|
@ -29,11 +29,11 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
||||||
public LiquidTank lavaTank = new LiquidTank(24000);
|
public LiquidTank lavaTank = new LiquidTank(24000);
|
||||||
|
|
||||||
/** The amount of electricity this machine can produce with a unit of fuel. */
|
/** The amount of electricity this machine can produce with a unit of fuel. */
|
||||||
public final int GENERATION = 80;
|
public final int GENERATION = 100;
|
||||||
|
|
||||||
public TileEntityHeatGenerator()
|
public TileEntityHeatGenerator()
|
||||||
{
|
{
|
||||||
super("Heat Generator", 160000, 160);
|
super("Heat Generator", 160000, 200);
|
||||||
inventory = new ItemStack[2];
|
inventory = new ItemStack[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|