v5.5.5 Beta #4
*Updated UE API. *Reformatted packet management slightly. *Removed unused fields. *Minor cleanups. *Fixed Factory container.
This commit is contained in:
parent
44926c2621
commit
5133880b68
34 changed files with 152 additions and 128 deletions
|
@ -18,8 +18,6 @@ public class ObjectRenderer
|
||||||
public double maxX;
|
public double maxX;
|
||||||
public double maxY;
|
public double maxY;
|
||||||
public double maxZ;
|
public double maxZ;
|
||||||
|
|
||||||
public int lightValue;
|
|
||||||
|
|
||||||
public Block baseBlock = Block.sand;
|
public Block baseBlock = Block.sand;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
package mekanism.common;
|
package mekanism.common;
|
||||||
|
|
||||||
import static net.minecraftforge.common.ForgeDirection.UP;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mekanism.api.Object3D;
|
|
||||||
import mekanism.client.ClientProxy;
|
import mekanism.client.ClientProxy;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockStairs;
|
|
||||||
import net.minecraft.block.BlockStep;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
@ -22,7 +16,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||||
import net.minecraftforge.liquids.LiquidStack;
|
import net.minecraftforge.liquids.LiquidStack;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class ContainerAdvancedElectricMachine extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,12 +47,13 @@ public class ContainerAdvancedElectricMachine extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -47,10 +47,10 @@ public class ContainerDynamicTank extends Container
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class ContainerElectricChest extends Container
|
||||||
if(isBlock)
|
if(isBlock)
|
||||||
{
|
{
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemInventory.openChest();
|
itemInventory.openChest();
|
||||||
|
@ -80,6 +81,7 @@ public class ContainerElectricChest extends Container
|
||||||
if(isBlock)
|
if(isBlock)
|
||||||
{
|
{
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemInventory.closeChest();
|
itemInventory.closeChest();
|
||||||
|
@ -87,11 +89,11 @@ public class ContainerElectricChest extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
if(isBlock)
|
if(isBlock)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class ContainerElectricMachine extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,12 +46,13 @@ public class ContainerElectricMachine extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ContainerElectricPump extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,12 +45,13 @@ public class ContainerElectricPump extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class ContainerEnergyCube extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,12 +46,13 @@ public class ContainerEnergyCube extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class ContainerFactory extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,12 +99,13 @@ public class ContainerFactory extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -130,6 +132,13 @@ public class ContainerFactory extends Container
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if(slotID == 3)
|
||||||
|
{
|
||||||
|
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if((slotStack.getItem() instanceof IElectricItem && ((IElectricItem)slotStack.getItem()).canProvideEnergy(slotStack)) || (slotStack.getItem() instanceof IItemElectric && ((IItemElectric)slotStack.getItem()).getProvideRequest(slotStack).amperes != 0) || slotStack.itemID == Item.redstone.itemID)
|
else if((slotStack.getItem() instanceof IElectricItem && ((IElectricItem)slotStack.getItem()).canProvideEnergy(slotStack)) || (slotStack.getItem() instanceof IItemElectric && ((IItemElectric)slotStack.getItem()).getProvideRequest(slotStack).amperes != 0) || slotStack.itemID == Item.redstone.itemID)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +161,7 @@ public class ContainerFactory extends Container
|
||||||
{
|
{
|
||||||
if(!isInputSlot(slotID))
|
if(!isInputSlot(slotID))
|
||||||
{
|
{
|
||||||
if(!mergeItemStack(slotStack, 2, 2+tileEntity.tier.processes, false))
|
if(!mergeItemStack(slotStack, 4, 4+tileEntity.tier.processes, false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class ContainerGasTank extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,12 +42,13 @@ public class ContainerGasTank extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class ContainerMetallurgicInfuser extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,12 +50,13 @@ public class ContainerMetallurgicInfuser extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class ContainerTeleporter extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,12 +42,13 @@ public class ContainerTeleporter extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package mekanism.common;
|
package mekanism.common;
|
||||||
|
|
||||||
import universalelectricity.prefab.modifier.IModifier;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
public class ItemMachineUpgrade extends ItemMekanism
|
||||||
|
|
||||||
public class ItemMachineUpgrade extends ItemMekanism implements IModifier
|
|
||||||
{
|
{
|
||||||
public ItemMachineUpgrade(int id, int energyBoost, int tickReduction)
|
public ItemMachineUpgrade(int id, int energyBoost, int tickReduction)
|
||||||
{
|
{
|
||||||
|
@ -12,16 +9,4 @@ public class ItemMachineUpgrade extends ItemMekanism implements IModifier
|
||||||
setMaxStackSize(8);
|
setMaxStackSize(8);
|
||||||
setCreativeTab(Mekanism.tabMekanism);
|
setCreativeTab(Mekanism.tabMekanism);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(ItemStack itemstack)
|
|
||||||
{
|
|
||||||
return itemID == Mekanism.SpeedUpgrade.itemID ? "Speed" : "Capacity";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEffectiveness(ItemStack itemstack)
|
|
||||||
{
|
|
||||||
return itemID == Mekanism.SpeedUpgrade.itemID ? 150 : 1000;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import mekanism.api.EnumGas;
|
import mekanism.api.EnumGas;
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package mekanism.common;
|
package mekanism.common;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
|
||||||
|
|
||||||
import ic2.api.IWrenchable;
|
import ic2.api.IWrenchable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import universalelectricity.prefab.tile.TileEntityDisableable;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public abstract class TileEntityBasicBlock extends TileEntityDisableable implements IWrenchable, ITileNetwork
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
|
public abstract class TileEntityBasicBlock extends TileEntity implements IWrenchable, ITileNetwork
|
||||||
{
|
{
|
||||||
/** Whether or not this machine has initialized and registered with other mods. */
|
/** Whether or not this machine has initialized and registered with other mods. */
|
||||||
public boolean initialized;
|
public boolean initialized;
|
||||||
|
@ -19,8 +22,8 @@ public abstract class TileEntityBasicBlock extends TileEntityDisableable impleme
|
||||||
/** The direction this block is facing. */
|
/** The direction this block is facing. */
|
||||||
public int facing;
|
public int facing;
|
||||||
|
|
||||||
/** The amount of players using this block */
|
/** The players currently using this block. */
|
||||||
public int playersUsing = 0;
|
public Set<EntityPlayer> playersUsing = new HashSet<EntityPlayer>();
|
||||||
|
|
||||||
/** A timer used to send packets to clients. */
|
/** A timer used to send packets to clients. */
|
||||||
public int packetTick;
|
public int packetTick;
|
||||||
|
@ -28,13 +31,11 @@ public abstract class TileEntityBasicBlock extends TileEntityDisableable impleme
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void updateEntity()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
onUpdate();
|
onUpdate();
|
||||||
|
|
||||||
if(!worldObj.isRemote)
|
if(!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
if(playersUsing > 0)
|
if(playersUsing.size() > 0)
|
||||||
{
|
{
|
||||||
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
|
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,16 +163,10 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openChest()
|
public void openChest() {}
|
||||||
{
|
|
||||||
playersUsing++;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeChest()
|
public void closeChest() {}
|
||||||
{
|
|
||||||
playersUsing--;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInvNameLocalized()
|
public boolean isInvNameLocalized()
|
||||||
|
|
|
@ -24,8 +24,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class TileEntityDynamicTank extends TileEntityContainerBlock
|
public class TileEntityDynamicTank extends TileEntityContainerBlock
|
||||||
{
|
{
|
||||||
public Set<EntityPlayer> playersUsing = new HashSet<EntityPlayer>();
|
|
||||||
|
|
||||||
/** Unique inventory ID for the dynamic tank, serves as a way to retrieve cached inventories. */
|
/** Unique inventory ID for the dynamic tank, serves as a way to retrieve cached inventories. */
|
||||||
public int inventoryID = -1;
|
public int inventoryID = -1;
|
||||||
|
|
||||||
|
|
|
@ -43,16 +43,16 @@ public class TileEntityElectricChest extends TileEntityElectricBlock
|
||||||
prevLidAngle = lidAngle;
|
prevLidAngle = lidAngle;
|
||||||
float increment = 0.1F;
|
float increment = 0.1F;
|
||||||
|
|
||||||
if((playersUsing > 0) && (lidAngle == 0.0F))
|
if((playersUsing.size() > 0) && (lidAngle == 0.0F))
|
||||||
{
|
{
|
||||||
worldObj.playSoundEffect(xCoord + 0.5F, yCoord + 0.5D, zCoord + 0.5F, "random.chestopen", 0.5F, (worldObj.rand.nextFloat()*0.1F) + 0.9F);
|
worldObj.playSoundEffect(xCoord + 0.5F, yCoord + 0.5D, zCoord + 0.5F, "random.chestopen", 0.5F, (worldObj.rand.nextFloat()*0.1F) + 0.9F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((playersUsing == 0 && lidAngle > 0.0F) || (playersUsing > 0 && lidAngle < 1.0F))
|
if((playersUsing.size() == 0 && lidAngle > 0.0F) || (playersUsing.size() > 0 && lidAngle < 1.0F))
|
||||||
{
|
{
|
||||||
float angle = lidAngle;
|
float angle = lidAngle;
|
||||||
|
|
||||||
if(playersUsing > 0)
|
if(playersUsing.size() > 0)
|
||||||
{
|
{
|
||||||
lidAngle += increment;
|
lidAngle += increment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,12 +551,12 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
||||||
|
|
||||||
public int getInputSlot(int operation)
|
public int getInputSlot(int operation)
|
||||||
{
|
{
|
||||||
return operation+2;
|
return operation+4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOutputSlot(int operation)
|
public int getOutputSlot(int operation)
|
||||||
{
|
{
|
||||||
return tier.processes+2+operation;
|
return tier.processes+4+operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package mekanism.common;
|
package mekanism.common;
|
||||||
|
|
||||||
import ic2.api.Direction;
|
import ic2.api.Direction;
|
||||||
import ic2.api.ElectricItem;
|
|
||||||
import ic2.api.IElectricItem;
|
import ic2.api.IElectricItem;
|
||||||
import ic2.api.energy.tile.IEnergySink;
|
import ic2.api.energy.tile.IEnergySink;
|
||||||
|
|
||||||
|
@ -17,22 +16,16 @@ import mekanism.api.InfusionOutput;
|
||||||
import mekanism.api.InfusionType;
|
import mekanism.api.InfusionType;
|
||||||
import mekanism.api.SideData;
|
import mekanism.api.SideData;
|
||||||
import mekanism.client.IHasSound;
|
import mekanism.client.IHasSound;
|
||||||
import mekanism.common.IFactory.RecipeType;
|
|
||||||
import mekanism.common.RecipeHandler.Recipe;
|
import mekanism.common.RecipeHandler.Recipe;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import universalelectricity.core.item.ElectricItemHelper;
|
|
||||||
import universalelectricity.core.item.IItemElectric;
|
import universalelectricity.core.item.IItemElectric;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import dan200.computer.api.IComputerAccess;
|
import dan200.computer.api.IComputerAccess;
|
||||||
import dan200.computer.api.IPeripheral;
|
import dan200.computer.api.IPeripheral;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ContainerBioGenerator extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,12 +45,13 @@ public class ContainerBioGenerator extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class ContainerElectrolyticSeparator extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,12 +51,13 @@ public class ContainerElectrolyticSeparator extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ContainerHeatGenerator extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,12 +45,13 @@ public class ContainerHeatGenerator extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ContainerHydrogenGenerator extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,12 +45,13 @@ public class ContainerHydrogenGenerator extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class ContainerSolarGenerator extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,12 +43,13 @@ public class ContainerSolarGenerator extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class ContainerWindTurbine extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.openChest();
|
tileEntity.openChest();
|
||||||
|
tileEntity.playersUsing.add(inventory.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,12 +43,13 @@ public class ContainerWindTurbine extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiClosed(entityplayer);
|
super.onCraftGuiClosed(entityplayer);
|
||||||
tileEntity.closeChest();
|
tileEntity.closeChest();
|
||||||
|
tileEntity.playersUsing.remove(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||||
{
|
{
|
||||||
return tileEntity.isUseableByPlayer(par1EntityPlayer);
|
return tileEntity.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -168,7 +168,6 @@ public class MekanismGenerators implements IModule
|
||||||
GameRegistry.registerItem(BioFuel, "BioFuel");
|
GameRegistry.registerItem(BioFuel, "BioFuel");
|
||||||
GameRegistry.registerItem(ElectrolyticCore, "ElectrolyticCore");
|
GameRegistry.registerItem(ElectrolyticCore, "ElectrolyticCore");
|
||||||
|
|
||||||
|
|
||||||
//Ore Dictionary
|
//Ore Dictionary
|
||||||
OreDictionary.registerOre("itemBioFuel", new ItemStack(BioFuel));
|
OreDictionary.registerOre("itemBioFuel", new ItemStack(BioFuel));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,14 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import universalelectricity.core.block.IConductor;
|
import universalelectricity.core.block.IConductor;
|
||||||
import universalelectricity.core.block.IConnectionProvider;
|
import universalelectricity.core.block.IConnectionProvider;
|
||||||
import universalelectricity.core.block.INetworkProvider;
|
import universalelectricity.core.block.INetworkProvider;
|
||||||
import universalelectricity.core.path.Pathfinder;
|
import universalelectricity.core.path.Pathfinder;
|
||||||
import universalelectricity.core.path.PathfinderChecker;
|
import universalelectricity.core.path.PathfinderChecker;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
import universalelectricity.core.vector.VectorHelper;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,6 +417,21 @@ public class ElectricityNetwork implements IElectricityNetwork
|
||||||
{
|
{
|
||||||
this.getConductors().remove(splitPoint);
|
this.getConductors().remove(splitPoint);
|
||||||
|
|
||||||
|
for (ForgeDirection dir : ForgeDirection.values())
|
||||||
|
{
|
||||||
|
if (dir != ForgeDirection.UNKNOWN)
|
||||||
|
{
|
||||||
|
Vector3 splitVec = new Vector3((TileEntity) splitPoint);
|
||||||
|
TileEntity tileAroundSplit = VectorHelper.getTileEntityFromSide(((TileEntity) splitPoint).worldObj, splitVec, dir);
|
||||||
|
|
||||||
|
if (this.producers.containsKey(tileAroundSplit))
|
||||||
|
{
|
||||||
|
this.stopProducing(tileAroundSplit);
|
||||||
|
this.stopRequesting(tileAroundSplit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loop through the connected blocks and attempt to see if there are connections between
|
* Loop through the connected blocks and attempt to see if there are connections between
|
||||||
* the two points elsewhere.
|
* the two points elsewhere.
|
||||||
|
|
|
@ -96,9 +96,13 @@ public class ElectricityNetworkHelper
|
||||||
{
|
{
|
||||||
if (wattsPerSide > 0 && producingPack.getWatts() > 0)
|
if (wattsPerSide > 0 && producingPack.getWatts() > 0)
|
||||||
{
|
{
|
||||||
double amperes = wattsPerSide / voltage;
|
double amperes = Math.min(wattsPerSide / voltage, network.getRequest(tileEntity).amperes);
|
||||||
network.startProducing(tileEntity, amperes, voltage);
|
|
||||||
remainingElectricity.amperes -= amperes;
|
if (amperes > 0)
|
||||||
|
{
|
||||||
|
network.startProducing(tileEntity, amperes, voltage);
|
||||||
|
remainingElectricity.amperes -= amperes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ElectricItemHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decharge an electric item.
|
* Decharges an electric item.
|
||||||
*
|
*
|
||||||
* @param joules - The joules being withdrawn from the electric item
|
* @param joules - The joules being withdrawn from the electric item
|
||||||
* @param voltage - The voltage in which is used to decharge the electric item
|
* @param voltage - The voltage in which is used to decharge the electric item
|
||||||
|
|
|
@ -58,7 +58,7 @@ public abstract class ItemElectric extends Item implements IItemElectric
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(ItemStack itemStack, World par2World, EntityPlayer par3EntityPlayer)
|
public void onCreated(ItemStack itemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||||
{
|
{
|
||||||
itemStack = ElectricItemHelper.getUncharged(itemStack);
|
this.setJoules(0, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,12 +11,17 @@ import net.minecraft.item.ItemStack;
|
||||||
public interface IModifier
|
public interface IModifier
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return - The name of the modifier.
|
* @return - The type of the modifier.
|
||||||
*/
|
*/
|
||||||
public String getName(ItemStack itemstack);
|
public String getType(ItemStack itemstack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return - How much effect does this modifier have?
|
* @return - How much effect does this modifier have?
|
||||||
*/
|
*/
|
||||||
public int getEffectiveness(ItemStack itemstack);
|
public double getEffectiveness(ItemStack itemstack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return - What UE tier is the Modifier?
|
||||||
|
*/
|
||||||
|
public int getTier(ItemStack itemstack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.server.MinecraftServer;
|
||||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class ConnectionHandler implements IConnectionHandler
|
public class ConnectionHandler implements IConnectionHandler
|
||||||
{
|
{
|
||||||
private static final List<ISimpleConnectionHandler> simpleConnectionHandlers = new ArrayList<ISimpleConnectionHandler>();
|
private static final List<ISimpleConnectionHandler> simpleConnectionHandlers = new ArrayList<ISimpleConnectionHandler>();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package universalelectricity.prefab.network;
|
package universalelectricity.prefab.network;
|
||||||
|
|
||||||
import universalelectricity.prefab.network.ConnectionHandler.ConnectionType;
|
import universalelectricity.prefab.network.ConnectionHandler.ConnectionType;
|
||||||
|
@Deprecated
|
||||||
public interface ISimpleConnectionHandler
|
public interface ISimpleConnectionHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue