v5.2.2 Beta #1

*More javadocs.
*Fixed energy duplication with IC2 energy storage blocks.
*Made Universal Cable connect to IC2 energy outputters.
*Made machines have sustained inventories.
*Added option to configurator to empty a block's inventory contents.
*Added option to configurator to dump all a machine's upgrades.
*Tooltips now have colors associated with their values.
*Tooltips on blocks are now only shown when 'shift' is held down.
*Electric Bow now changes state when holding 'M' and shift.
*Configurator can change state by holding 'M' and shift.
*Updated IC2 API.
*Merged teleporter into BlockMachine.
*Added option to hide packet logs.
*Fixed Smelting Factory crash.
*Made IC2 machines output into Universal Cable regardless of it's
surroundings.
*Made teleporter sustain energy storage.
*Cleaned up code.
*Fixed crash if versionNumber or recentNews are null.
*Client-side player tick handler.
This commit is contained in:
Aidan Brady 2013-03-30 19:13:59 -04:00
parent 1fd0353225
commit 86696e696e
40 changed files with 850 additions and 492 deletions

View file

@ -5,7 +5,17 @@ import net.minecraft.item.ItemStack;
public interface IEnergyCube
{
public EnergyCubeTier getTier(ItemStack itemstack);
/**
* Gets the tier of this energy cube.
* @param itemstack - ItemStack to check
* @return tier
*/
public EnergyCubeTier getEnergyCubeTier(ItemStack itemstack);
public void setTier(ItemStack itemstack, EnergyCubeTier tier);
/**
* Sets the tier of this energy cube
* @param itemstack - ItemStack to set
* @param tier - tier to set
*/
public void setEnergyCubeTier(ItemStack itemstack, EnergyCubeTier tier);
}

View file

@ -29,4 +29,11 @@ public interface IUpgradeManagement
* @param data - ItemStack parameter if getting from an item
*/
public void setSpeedMultiplier(int multiplier, Object... data);
/**
* Whether or not this item or block supports upgrades.
* @param data - ItemStack parameter if getting from an item
* @return if the item or block supports upgrades
*/
public boolean supportsUpgrades(Object... data);
}

View file

@ -0,0 +1,89 @@
package mekanism.client;
import java.util.EnumSet;
import org.lwjgl.input.Keyboard;
import mekanism.api.EnumColor;
import mekanism.common.EnumPacketType;
import mekanism.common.ItemConfigurator;
import mekanism.common.ItemElectricBow;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public class ClientPlayerTickHandler implements ITickHandler
{
public boolean lastTickConfiguratorChange = false;
public boolean lastTickElectricBowChange = false;
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if(tickData[0] instanceof EntityPlayer)
{
EntityPlayer entityPlayer = (EntityPlayer)tickData[0];
if(entityPlayer.getCurrentEquippedItem() != null)
{
ItemStack stack = entityPlayer.getCurrentEquippedItem();
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemConfigurator)
{
ItemConfigurator item = (ItemConfigurator)entityPlayer.getCurrentEquippedItem().getItem();
if(entityPlayer.isSneaking() && Keyboard.isKeyDown(Keyboard.KEY_M))
{
if(!lastTickConfiguratorChange)
{
item.setState(stack, (byte)(item.getState(stack) == 0 ? 1 : (item.getState(stack) == 1 ? 2 : 0)));
PacketHandler.sendPacketDataInt(EnumPacketType.CONFIGURATOR_STATE, item.getState(stack));
entityPlayer.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Configure State: " + (item.getState(stack) == 0 ? (EnumColor.BRIGHT_GREEN + "modify") : (item.getState(stack) == 1 ? (EnumColor.AQUA + "empty") : (EnumColor.YELLOW + "upgrade dump"))));
lastTickConfiguratorChange = true;
}
}
else {
lastTickConfiguratorChange = false;
}
}
else if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemElectricBow)
{
ItemElectricBow item = (ItemElectricBow)entityPlayer.getCurrentEquippedItem().getItem();
if(entityPlayer.isSneaking() && Keyboard.isKeyDown(Keyboard.KEY_M))
{
if(!lastTickElectricBowChange)
{
item.setFireState(stack, !item.getFireState(stack));
PacketHandler.sendPacketDataInt(EnumPacketType.ELECTRIC_BOW_STATE, item.getFireState(stack) ? 1 : 0);
entityPlayer.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Fire Mode: " + (item.getFireState(stack) ? (EnumColor.DARK_GREEN + "ON") : (EnumColor.DARK_RED + "OFF")));
lastTickElectricBowChange = true;
}
}
else {
lastTickElectricBowChange = false;
}
}
}
}
}
@Override
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.PLAYER);
}
@Override
public String getLabel()
{
return "MekanismClientPlayer";
}
}

View file

@ -150,6 +150,7 @@ public class ClientProxy extends CommonProxy
super.loadTickHandler();
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(new ClientPlayerTickHandler(), Side.CLIENT);
}
@Override

View file

@ -30,7 +30,7 @@ public class ItemRenderingHandler implements IItemRenderer
{
if(item.getItem() instanceof IEnergyCube)
{
EnergyCubeTier tier = ((IEnergyCube)item.getItem()).getTier(item);
EnergyCubeTier tier = ((IEnergyCube)item.getItem()).getEnergyCubeTier(item);
if(type == ItemRenderType.EQUIPPED)
{

View file

@ -29,9 +29,8 @@ import net.minecraft.world.World;
* 4: Refined Glowstone
* 5: Steel Block
* 6: Control Panel
* 7: Teleporter
* 8: Teleporter Frame
* 9: Steel Casing
* 7: Teleporter Frame
* 8: Steel Casing
* @author AidanBrady
*
*/
@ -56,9 +55,8 @@ public class BlockBasic extends Block
icons[4] = register.registerIcon("mekanism:RefinedGlowstone");
icons[5] = register.registerIcon("mekanism:SteelBlock");
icons[6] = register.registerIcon("mekanism:ControlPanel");
icons[7] = register.registerIcon("mekanism:Teleporter");
icons[8] = register.registerIcon("mekanism:TeleporterFrame");
icons[9] = register.registerIcon("mekanism:SteelCasing");
icons[7] = register.registerIcon("mekanism:TeleporterFrame");
icons[8] = register.registerIcon("mekanism:SteelCasing");
}
@Override
@ -86,7 +84,6 @@ public class BlockBasic extends Block
//list.add(new ItemStack(i, 1, 6));
list.add(new ItemStack(i, 1, 7));
list.add(new ItemStack(i, 1, 8));
list.add(new ItemStack(i, 1, 9));
}
@Override
@ -110,23 +107,6 @@ public class BlockBasic extends Block
return true;
}
}
else if(metadata == 7)
{
if(entityplayer.isSneaking())
{
entityplayer.openGui(Mekanism.instance, 13, world, x, y, z);
return true;
}
if(!world.isRemote)
{
TileEntityTeleporter tileEntity = (TileEntityTeleporter)world.getBlockTileEntity(x, y, z);
if(tileEntity.canTeleport() == 1)
{
tileEntity.teleport();
}
}
}
return false;
}
@ -140,7 +120,7 @@ public class BlockBasic extends Block
return 8;
case 4:
return 15;
case 8:
case 7:
return 12;
}
return 0;
@ -149,7 +129,7 @@ public class BlockBasic extends Block
@Override
public boolean hasTileEntity(int metadata)
{
return metadata == 6 || metadata == 7;
return metadata == 6;
}
@Override
@ -159,8 +139,6 @@ public class BlockBasic extends Block
{
case 6:
return new TileEntityControlPanel();
case 7:
return new TileEntityTeleporter();
}
return null;
}
@ -171,54 +149,4 @@ public class BlockBasic extends Block
world.markBlockForRenderUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);
}
@Override
public void breakBlock(World world, int x, int y, int z, int i1, int i2)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityContainerBlock)
{
Random random = new Random();
TileEntityContainerBlock tileEntity = (TileEntityContainerBlock)tile;
for (int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
if (slotStack != null)
{
float xRandom = random.nextFloat() * 0.8F + 0.1F;
float yRandom = random.nextFloat() * 0.8F + 0.1F;
float zRandom = random.nextFloat() * 0.8F + 0.1F;
while (slotStack.stackSize > 0)
{
int j = random.nextInt(21) + 10;
if (j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, (double)((float)x + xRandom), (double)((float)y + yRandom), (double)((float)z + zRandom), new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if (slotStack.hasTagCompound())
{
item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = (double)((float)random.nextGaussian() * k);
item.motionY = (double)((float)random.nextGaussian() * k + 0.2F);
item.motionZ = (double)((float)random.nextGaussian() * k);
world.spawnEntityInWorld(item);
}
}
}
}
super.breakBlock(world, x, y, z, i1, i2);
}
}

View file

@ -127,53 +127,6 @@ public class BlockEnergyCube extends BlockContainer implements IDismantleable
return icons[tileEntity.tier.ordinal()][1];
}
}
@Override
public void breakBlock(World world, int x, int y, int z, int i1, int i2)
{
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
for (int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
if (slotStack != null)
{
float xRandom = powerRand.nextFloat() * 0.8F + 0.1F;
float yRandom = powerRand.nextFloat() * 0.8F + 0.1F;
float zRandom = powerRand.nextFloat() * 0.8F + 0.1F;
while (slotStack.stackSize > 0)
{
int j = powerRand.nextInt(21) + 10;
if (j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem entityItem = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if (slotStack.hasTagCompound())
{
entityItem.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float motion = 0.05F;
entityItem.motionX = powerRand.nextGaussian() * motion;
entityItem.motionY = powerRand.nextGaussian() * motion + 0.2F;
entityItem.motionZ = powerRand.nextGaussian() * motion;
world.spawnEntityInWorld(entityItem);
}
}
}
}
super.breakBlock(world, x, y, z, i1, i2);
}
@Override
public int quantityDropped(Random random)
@ -195,10 +148,10 @@ public class BlockEnergyCube extends BlockContainer implements IDismantleable
{
ItemStack discharged = new ItemStack(this);
discharged.setItemDamage(100);
((ItemBlockEnergyCube)discharged.getItem()).setTier(discharged, tier);
((ItemBlockEnergyCube)discharged.getItem()).setEnergyCubeTier(discharged, tier);
list.add(discharged);
ItemStack charged = new ItemStack(this);
((ItemBlockEnergyCube)charged.getItem()).setTier(charged, tier);
((ItemBlockEnergyCube)charged.getItem()).setEnergyCubeTier(charged, tier);
((ItemBlockEnergyCube)charged.getItem()).setJoules(tier.MAX_ELECTRICITY, charged);
list.add(charged);
};
@ -313,13 +266,7 @@ public class BlockEnergyCube extends BlockContainer implements IDismantleable
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, new ItemStack(Mekanism.EnergyCube));
IEnergyCube energyCube = (IEnergyCube)entityItem.getEntityItem().getItem();
energyCube.setTier(entityItem.getEntityItem(), tileEntity.tier);
IItemElectric electricItem = (IItemElectric)entityItem.getEntityItem().getItem();
electricItem.setJoules(tileEntity.electricityStored, entityItem.getEntityItem());
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z));
world.spawnEntityInWorld(entityItem);
}
@ -340,25 +287,21 @@ public class BlockEnergyCube extends BlockContainer implements IDismantleable
ItemStack itemStack = new ItemStack(Mekanism.EnergyCube);
IEnergyCube energyCube = (IEnergyCube)itemStack.getItem();
energyCube.setTier(itemStack, tileEntity.tier);
energyCube.setEnergyCubeTier(itemStack, tileEntity.tier);
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(tileEntity.electricityStored, itemStack);
ISustainedInventory inventory = (ISustainedInventory)itemStack.getItem();
inventory.setInventory(((ISustainedInventory)tileEntity).getInventory(), itemStack);
return itemStack;
}
@Override
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(Mekanism.EnergyCube);
IEnergyCube energyCube = (IEnergyCube)itemStack.getItem();
energyCube.setTier(itemStack, tileEntity.tier);
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(tileEntity.electricityStored, itemStack);
ItemStack itemStack = getPickBlock(null, world, x, y, z);
world.setBlockToAir(x, y, z);

View file

@ -46,6 +46,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* 8: Metallurgic Infuser
* 9: Purification Chamber
* 10: Energized Smelter
* 11: Teleporter
* @author AidanBrady
*
*/
@ -100,6 +101,7 @@ public class BlockMachine extends BlockContainer implements IDismantleable
icons[10][0] = register.registerIcon("mekanism:EnergizedSmelterFrontOff");
icons[10][1] = register.registerIcon("mekanism:EnergizedSmelterFrontOn");
icons[10][2] = register.registerIcon("mekanism:SteelCasing");
icons[11][0] = register.registerIcon("mekanism:Teleporter");
}
@Override
@ -130,7 +132,7 @@ public class BlockMachine extends BlockContainer implements IDismantleable
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
if (MekanismUtils.isActive(world, x, y, z))
if(MekanismUtils.isActive(world, x, y, z))
{
float xRandom = (float)x + 0.5F;
float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
@ -300,6 +302,10 @@ public class BlockMachine extends BlockContainer implements IDismantleable
return icons[10][2];
}
}
else if(meta == 11)
{
return icons[11][0];
}
return null;
}
@ -433,6 +439,10 @@ public class BlockMachine extends BlockContainer implements IDismantleable
return icons[10][2];
}
}
else if(metadata == 11)
{
return icons[11][0];
}
return null;
}
@ -470,55 +480,9 @@ public class BlockMachine extends BlockContainer implements IDismantleable
list.add(new ItemStack(i, 1, 8));
list.add(new ItemStack(i, 1, 9));
list.add(new ItemStack(i, 1, 10));
list.add(new ItemStack(i, 1, 11));
}
@Override
public void breakBlock(World world, int x, int y, int z, int i1, int i2)
{
TileEntityContainerBlock tileEntity = (TileEntityContainerBlock)world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
for (int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
if (slotStack != null)
{
float xRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float yRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float zRandom = machineRand.nextFloat() * 0.8F + 0.1F;
while (slotStack.stackSize > 0)
{
int j = machineRand.nextInt(21) + 10;
if (j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, (double)((float)x + xRandom), (double)((float)y + yRandom), (double)((float)z + zRandom), new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if (slotStack.hasTagCompound())
{
item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = (double)((float)machineRand.nextGaussian() * k);
item.motionY = (double)((float)machineRand.nextGaussian() * k + 0.2F);
item.motionZ = (double)((float)machineRand.nextGaussian() * k);
world.spawnEntityInWorld(item);
}
}
}
}
super.breakBlock(world, x, y, z, i1, i2);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ)
{
@ -594,10 +558,28 @@ public class BlockMachine extends BlockContainer implements IDismantleable
if (tileEntity != null)
{
if(!entityplayer.isSneaking())
if(metadata != MachineType.TELEPORTER.meta)
{
entityplayer.openGui(Mekanism.instance, MachineType.getFromMetadata(metadata).guiId, world, x, y, z);
return true;
if(!entityplayer.isSneaking())
{
entityplayer.openGui(Mekanism.instance, MachineType.getFromMetadata(metadata).guiId, world, x, y, z);
return true;
}
}
else {
if(entityplayer.isSneaking())
{
entityplayer.openGui(Mekanism.instance, 13, world, x, y, z);
return true;
}
TileEntityTeleporter teleporter = (TileEntityTeleporter)world.getBlockTileEntity(x, y, z);
if(teleporter.canTeleport() == 1)
{
teleporter.teleport();
return true;
}
}
}
return false;
@ -646,20 +628,7 @@ public class BlockMachine extends BlockContainer implements IDismantleable
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, new ItemStack(Mekanism.MachineBlock, 1, world.getBlockMetadata(x, y, z)));
IUpgradeManagement upgrade = (IUpgradeManagement)entityItem.getEntityItem().getItem();
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), entityItem.getEntityItem());
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), entityItem.getEntityItem());
IItemElectric electricItem = (IItemElectric)entityItem.getEntityItem().getItem();
electricItem.setJoules(tileEntity.electricityStored, entityItem.getEntityItem());
if(tileEntity instanceof TileEntityFactory)
{
IFactory factoryItem = (IFactory)entityItem.getEntityItem().getItem();
factoryItem.setRecipeType(((TileEntityFactory)tileEntity).recipeType, entityItem.getEntityItem());
}
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z));
world.spawnEntityInWorld(entityItem);
}
@ -679,13 +648,19 @@ public class BlockMachine extends BlockContainer implements IDismantleable
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(Mekanism.MachineBlock, 1, world.getBlockMetadata(x, y, z));
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), itemStack);
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
if(((IUpgradeManagement)itemStack.getItem()).supportsUpgrades(itemStack))
{
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), itemStack);
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
}
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(tileEntity.electricityStored, itemStack);
ISustainedInventory inventory = (ISustainedInventory)itemStack.getItem();
inventory.setInventory(((ISustainedInventory)tileEntity).getInventory(), itemStack);
if(tileEntity instanceof TileEntityFactory)
{
IFactory factoryItem = (IFactory)itemStack.getItem();
@ -698,21 +673,7 @@ public class BlockMachine extends BlockContainer implements IDismantleable
@Override
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(Mekanism.MachineBlock, 1, world.getBlockMetadata(x, y, z));
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), itemStack);
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(tileEntity.electricityStored, itemStack);
if(tileEntity instanceof TileEntityFactory)
{
IFactory factoryItem = (IFactory)itemStack.getItem();
factoryItem.setRecipeType(((TileEntityFactory)tileEntity).recipeType, itemStack);
}
ItemStack itemStack = getPickBlock(null, world, x, y, z);
world.setBlockToAir(x, y, z);
@ -749,7 +710,8 @@ public class BlockMachine extends BlockContainer implements IDismantleable
ELITE_FACTORY(7, 11, 14000, TileEntityEliteFactory.class, false),
METALLURGIC_INFUSER(8, 12, 2000, TileEntityMetallurgicInfuser.class, false),
PURIFICATION_CHAMBER(9, 15, 12000, TileEntityPurificationChamber.class, false),
ENERGIZED_SMELTER(10, 16, 2000, TileEntityEnergizedSmelter.class, false);
ENERGIZED_SMELTER(10, 16, 2000, TileEntityEnergizedSmelter.class, false),
TELEPORTER(11, 13, 10000000, TileEntityTeleporter.class, false);
public int meta;
public int guiId;

View file

@ -75,7 +75,7 @@ public final class CableUtils
{
TileEntity outputter = VectorHelper.getTileEntityFromSide(tileEntity.worldObj, new Vector3(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord), orientation);
if(outputter instanceof ICableOutputter && ((ICableOutputter)outputter).canOutputTo(orientation.getOpposite()))
if(outputter instanceof ICableOutputter && ((ICableOutputter)outputter).canOutputTo(orientation.getOpposite()) || outputter instanceof IEnergySource && ((IEnergySource)outputter).emitsEnergyTo(tileEntity, MekanismUtils.toIC2Direction(orientation.getOpposite())))
{
outputters[orientation.ordinal()] = outputter;
}
@ -104,7 +104,7 @@ public final class CableUtils
return true;
}
if(tileEntity instanceof IEnergyAcceptor && ((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(null, MekanismUtils.toIC2Direction(side).getInverse()))
if(tileEntity instanceof IEnergyAcceptor && ((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(tile, MekanismUtils.toIC2Direction(side).getInverse()))
{
return true;
}

View file

@ -70,6 +70,7 @@ public class CommonProxy
Mekanism.disableBCBronzeCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisableBCBronzeCrafting", false).getBoolean(true);
Mekanism.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(true);
Mekanism.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true);
Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(false);
Mekanism.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
Mekanism.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
Mekanism.FROM_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToEU", 10).getDouble(10);

View file

@ -27,8 +27,12 @@ public enum EnumPacketType
STATUS_UPDATE(7),
/** Used to request data from the server by tile entities. */
DATA_REQUEST(8),
/** Used to change a Configurator's state on the server side. */
CONFIGURATOR_STATE(9),
/** Used to change an Electric Bow's state on the server side. */
ELECTRIC_BOW_STATE(10),
/** A custom packet type. Handled in PacketHandler. */
CUSTOM(9);
CUSTOM(11);
/** The ID of the packet type */
public final int id;

View file

@ -23,11 +23,6 @@ public class IC2EnergyHandler
{
TileEntity tile = VectorHelper.getTileEntityFromSide(tileEntity.worldObj, new Vector3(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord), orientation);
if(tile instanceof IEnergyConductor)
{
return;
}
if(tile != null && tileEntity instanceof IEnergySource)
{
IEnergySource source = (IEnergySource)tileEntity;

View file

@ -38,16 +38,24 @@ public interface IFactory
public ItemStack getCopiedOutput(ItemStack input, boolean stackDecrease)
{
if(input == null)
{
return null;
}
if(this == SMELTING)
{
ItemStack toReturn = FurnaceRecipes.smelting().getSmeltingResult(input).copy();
if(stackDecrease)
if(FurnaceRecipes.smelting().getSmeltingResult(input) != null)
{
input.stackSize--;
ItemStack toReturn = FurnaceRecipes.smelting().getSmeltingResult(input).copy();
if(stackDecrease)
{
input.stackSize--;
}
return toReturn;
}
return toReturn;
}
else if(this == ENRICHING)
{

View file

@ -0,0 +1,11 @@
package mekanism.common;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public interface ISustainedInventory
{
public void setInventory(NBTTagList nbtTags, Object... data);
public NBTTagList getInventory(Object... data);
}

View file

@ -71,12 +71,9 @@ public class ItemBlockBasic extends ItemBlock
name = "ControlPanel";
break;
case 7:
name = "Teleporter";
break;
case 8:
name = "TeleporterFrame";
break;
case 9:
case 8:
name = "SteelCasing";
break;
default:

View file

@ -5,11 +5,17 @@ import ic2.api.ICustomElectricItem;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import universalelectricity.core.electricity.ElectricityDisplay;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
import universalelectricity.core.item.IItemElectric;
import mekanism.api.EnumColor;
import mekanism.api.IEnergyCube;
import mekanism.api.Tier.EnergyCubeTier;
import net.minecraft.block.Block;
@ -18,9 +24,10 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEnergyCube, ICustomElectricItem
public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEnergyCube, ICustomElectricItem, ISustainedInventory
{
public Block metaBlock;
@ -35,18 +42,24 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
double energy = getJoules(itemstack);
list.add("Stored Energy: " + ElectricityDisplay.getDisplayShort(energy, ElectricUnit.JOULES));
list.add("Voltage: " + getVoltage(itemstack) + "v");
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more details.");
}
else {
list.add(EnumColor.BRIGHT_GREEN + "Stored Energy: " + EnumColor.GREY + ElectricityDisplay.getDisplayShort(getJoules(itemstack), ElectricUnit.JOULES));
list.add(EnumColor.BRIGHT_GREEN + "Voltage: " + EnumColor.GREY + getVoltage(itemstack) + "v");
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagList != null && !getInventory(itemstack).tagList.isEmpty()));
}
}
public ItemStack getUnchargedItem(EnergyCubeTier tier)
{
ItemStack charged = new ItemStack(this);
setTier(charged, tier);
setEnergyCubeTier(charged, tier);
charged.setItemDamage(100);
return charged;
}
@ -54,23 +67,22 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
@Override
public double getJoules(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
if(itemStack.stackTagCompound == null)
{
return 0;
}
double electricityStored = 0;
if (itemStack.stackTagCompound.getTag("electricity") instanceof NBTTagFloat)
if(itemStack.stackTagCompound.getTag("electricity") instanceof NBTTagFloat)
{
electricityStored = itemStack.stackTagCompound.getFloat("electricity");
}
else
{
else {
electricityStored = itemStack.stackTagCompound.getDouble("electricity");
}
itemStack.setItemDamage((int)(Math.abs(((electricityStored/getTier(itemStack).MAX_ELECTRICITY)*100)-100)));
itemStack.setItemDamage((int)(Math.abs(((electricityStored/getEnergyCubeTier(itemStack).MAX_ELECTRICITY)*100)-100)));
return electricityStored;
}
@ -84,19 +96,19 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
double electricityStored = Math.max(Math.min(wattHours, getMaxJoules(itemStack)), 0);
itemStack.stackTagCompound.setDouble("electricity", electricityStored);
itemStack.setItemDamage((int)(Math.abs(((electricityStored/getTier(itemStack).MAX_ELECTRICITY)*100)-100)));
itemStack.setItemDamage((int)(Math.abs(((electricityStored/getEnergyCubeTier(itemStack).MAX_ELECTRICITY)*100)-100)));
}
@Override
public double getMaxJoules(ItemStack itemStack)
{
return getTier(itemStack).MAX_ELECTRICITY;
return getEnergyCubeTier(itemStack).MAX_ELECTRICITY;
}
@Override
public double getVoltage(ItemStack itemStack)
{
return getTier(itemStack).VOLTAGE;
return getEnergyCubeTier(itemStack).VOLTAGE;
}
@Override
@ -104,7 +116,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
{
double rejectedElectricity = Math.max((getJoules(itemStack) + electricityPack.getWatts()) - getMaxJoules(itemStack), 0);
double joulesToStore = electricityPack.getWatts() - rejectedElectricity;
this.setJoules(getJoules(itemStack) + joulesToStore, itemStack);
setJoules(getJoules(itemStack) + joulesToStore, itemStack);
return ElectricityPack.getFromWatts(joulesToStore, getVoltage(itemStack));
}
@ -136,7 +148,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
return getUnlocalizedName() + "." + getTier(itemstack).name;
return getUnlocalizedName() + "." + getEnergyCubeTier(itemstack).name;
}
@Override
@ -147,9 +159,11 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
if(place)
{
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getBlockTileEntity(x, y, z);
tileEntity.tier = ((IEnergyCube)stack.getItem()).getTier(stack);
tileEntity.tier = ((IEnergyCube)stack.getItem()).getEnergyCubeTier(stack);
tileEntity.electricityStored = getJoules(stack);
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
if(tileEntity.powerProvider != null)
{
tileEntity.powerProvider.configure(0, 0, 100, 0, (int)(tileEntity.tier.MAX_ELECTRICITY*Mekanism.TO_BC));
@ -165,7 +179,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
}
@Override
public EnergyCubeTier getTier(ItemStack itemstack)
public EnergyCubeTier getEnergyCubeTier(ItemStack itemstack)
{
if(itemstack.stackTagCompound == null)
{
@ -181,9 +195,9 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
}
@Override
public void setTier(ItemStack itemstack, EnergyCubeTier tier)
public void setEnergyCubeTier(ItemStack itemstack, EnergyCubeTier tier)
{
if (itemstack.stackTagCompound == null)
if(itemstack.stackTagCompound == null)
{
itemstack.setTagCompound(new NBTTagCompound());
}
@ -195,13 +209,19 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
public int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
double givenEnergy = amount*Mekanism.FROM_IC2;
double energyNeeded = getTier(itemStack).MAX_ELECTRICITY-getJoules(itemStack);
double energyToStore = Math.min(Math.min(amount, getTier(itemStack).MAX_ELECTRICITY*0.01), energyNeeded);
double energyNeeded = getEnergyCubeTier(itemStack).MAX_ELECTRICITY-getJoules(itemStack);
double energyToStore = Math.min(Math.min(amount, getEnergyCubeTier(itemStack).MAX_ELECTRICITY*0.01), energyNeeded);
if(!simulate)
{
setJoules(getJoules(itemStack) + energyToStore, itemStack);
}
if(energyToStore < 1)
{
return 1;
}
return (int)(energyToStore*Mekanism.TO_IC2);
}
@ -209,12 +229,18 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
public int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
double energyWanted = amount*Mekanism.FROM_IC2;
double energyToGive = Math.min(Math.min(energyWanted, getTier(itemStack).MAX_ELECTRICITY*0.01), getJoules(itemStack));
double energyToGive = Math.min(Math.min(energyWanted, getEnergyCubeTier(itemStack).MAX_ELECTRICITY*0.01), getJoules(itemStack));
if(!simulate)
{
setJoules(getJoules(itemStack) - energyToGive, itemStack);
}
if(energyWanted < 1)
{
return 1;
}
return (int)(energyToGive*Mekanism.TO_IC2);
}
@ -231,38 +257,72 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
}
@Override
public boolean canProvideEnergy()
public boolean canProvideEnergy(ItemStack itemStack)
{
return true;
}
@Override
public int getChargedItemId()
public int getChargedItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getEmptyItemId()
public int getEmptyItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getMaxCharge()
public int getMaxCharge(ItemStack itemStack)
{
return 0;
}
@Override
public int getTier()
public int getTier(ItemStack itemStack)
{
return 3;
}
@Override
public int getTransferLimit()
public int getTransferLimit(ItemStack itemStack)
{
return 0;
}
@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;
}
}

View file

@ -2,12 +2,18 @@ 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 universalelectricity.core.electricity.ElectricityDisplay;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
import universalelectricity.core.item.IItemElectric;
import ic2.api.ICustomElectricItem;
import mekanism.api.EnumColor;
import mekanism.api.IUpgradeManagement;
import mekanism.common.BlockMachine.MachineType;
import net.minecraft.block.Block;
@ -16,6 +22,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
/**
@ -31,10 +38,11 @@ import net.minecraft.world.World;
* 8: Metallurgic Infuser
* 9: Purification Chamber
* 10: Energized Smelter
* 11: Teleporter
* @author AidanBrady
*
*/
public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICustomElectricItem, IUpgradeManagement, IFactory
public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICustomElectricItem, IUpgradeManagement, IFactory, ISustainedInventory
{
public Block metaBlock;
@ -92,6 +100,9 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
case 10:
name = "EnergizedSmelter";
break;
case 11:
name = "Teleporter";
break;
default:
name = "Unknown";
break;
@ -100,18 +111,30 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
double energy = getJoules(itemstack);
if(isFactory(itemstack))
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Recipe Type: " + RecipeType.values()[getRecipeType(itemstack)].getName());
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more details.");
}
else {
if(isFactory(itemstack))
{
list.add(EnumColor.INDIGO + "Recipe Type: " + EnumColor.GREY + RecipeType.values()[getRecipeType(itemstack)].getName());
}
list.add(EnumColor.BRIGHT_GREEN + "Stored Energy: " + EnumColor.GREY + ElectricityDisplay.getDisplayShort(getJoules(itemstack), ElectricUnit.JOULES));
list.add(EnumColor.BRIGHT_GREEN + "Voltage: " + EnumColor.GREY + getVoltage(itemstack) + "v");
if(supportsUpgrades(itemstack))
{
list.add(EnumColor.PURPLE + "Energy: " + EnumColor.GREY + "x" + (getEnergyMultiplier(itemstack)+1));
list.add(EnumColor.PURPLE + "Speed: " + EnumColor.GREY + "x" + (getSpeedMultiplier(itemstack)+1));
}
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagList != null && !getInventory(itemstack).tagList.isEmpty()));
}
list.add("Stored Energy: " + ElectricityDisplay.getDisplayShort(energy, ElectricUnit.JOULES));
list.add("Energy: x" + (getEnergyMultiplier(itemstack)+1));
list.add("Speed: x" + (getSpeedMultiplier(itemstack)+1));
}
@Override
@ -171,9 +194,7 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
@Override
public ElectricityPack onProvide(ElectricityPack electricityPack, ItemStack itemStack)
{
double electricityToUse = Math.min(getJoules(itemStack), electricityPack.getWatts());
setJoules(getJoules(itemStack) - electricityToUse, itemStack);
return ElectricityPack.getFromWatts(electricityToUse, getVoltage(itemStack));
return new ElectricityPack();
}
@Override
@ -185,7 +206,7 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
@Override
public ElectricityPack getProvideRequest(ItemStack itemStack)
{
return ElectricityPack.getFromWatts(Math.min(getJoules(itemStack), getTransferRate(itemStack)), getVoltage(itemStack));
return new ElectricityPack();
}
public double getTransferRate(ItemStack itemStack)
@ -213,6 +234,8 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
((TileEntityFactory)tileEntity).recipeType = getRecipeType(stack);
}
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
tileEntity.electricityStored = getJoules(stack);
}
@ -230,20 +253,19 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
{
setJoules(getJoules(itemStack) + energyToStore, itemStack);
}
if(energyToStore < 1)
{
return 1;
}
return (int)(energyToStore*Mekanism.TO_IC2);
}
@Override
public int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
double energyWanted = amount*Mekanism.FROM_IC2;
double energyToGive = Math.min(Math.min(energyWanted, getMaxJoules(itemStack)*0.01), getJoules(itemStack));
if(!simulate)
{
setJoules(getJoules(itemStack) - energyToGive, itemStack);
}
return (int)(energyToGive*Mekanism.TO_IC2);
return amount;
}
@Override
@ -259,37 +281,37 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
}
@Override
public boolean canProvideEnergy()
public boolean canProvideEnergy(ItemStack itemStack)
{
return false;
}
@Override
public int getChargedItemId()
public int getChargedItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getEmptyItemId()
public int getEmptyItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getMaxCharge()
public int getMaxCharge(ItemStack itemStack)
{
return 0;
}
@Override
public int getTier()
public int getTier(ItemStack itemStack)
{
return 3;
}
@Override
public int getTransferLimit()
public int getTransferLimit(ItemStack itemStack)
{
return 0;
}
@ -301,7 +323,7 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
{
ItemStack itemStack = (ItemStack) data[0];
if (itemStack.stackTagCompound == null)
if(itemStack.stackTagCompound == null)
{
return 0;
}
@ -319,7 +341,7 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
{
ItemStack itemStack = (ItemStack)data[0];
if (itemStack.stackTagCompound == null)
if(itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
@ -361,6 +383,20 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
itemStack.stackTagCompound.setInteger("speedMultiplier", multiplier);
}
}
@Override
public boolean supportsUpgrades(Object... data)
{
if(data[0] instanceof ItemStack)
{
if(((ItemStack)data[0]).getItemDamage() != 11)
{
return true;
}
}
return false;
}
@Override
public int getRecipeType(ItemStack itemStack)
@ -389,4 +425,38 @@ public class ItemBlockMachine extends ItemBlock implements IItemElectric, ICusto
{
return itemStack.getItem() instanceof ItemBlockMachine && itemStack.getItemDamage() >= 5 && itemStack.getItemDamage() <= 7;
}
@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;
}
}

View file

@ -36,7 +36,7 @@ public class ItemBlockOre extends ItemBlock
{
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information.");
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for details.");
}
else {
if(itemstack.getItemDamage() == 0)

View file

@ -38,7 +38,7 @@ public class ItemBlockTransmitter extends ItemBlock
{
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information.");
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for details.");
}
else {
if(itemstack.getItemDamage() == 0)

View file

@ -1,49 +1,177 @@
package mekanism.common;
import java.util.List;
import java.util.Random;
import org.lwjgl.input.Keyboard;
import universalelectricity.core.electricity.ElectricityPack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.IUpgradeManagement;
public class ItemConfigurator extends ItemEnergized
{
public final int ENERGY_PER_USE = 400;
public final int ENERGY_PER_CONFIGURE = 400;
public final int ENERGY_PER_ITEM_DUMP = 8;
public ItemConfigurator(int id)
{
super(id, 60000, 120);
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
super.addInformation(itemstack, entityplayer, list, flag);
list.add(EnumColor.PINK + "State: " + EnumColor.GREY + (getState(itemstack) == 0 ? "modify" : (getState(itemstack) == 1 ? "empty" : "upgrade dump")));
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if(!world.isRemote)
{
if(world.getBlockTileEntity(x, y, z) instanceof IConfigurable)
if(getState(stack) == 0)
{
IConfigurable config = (IConfigurable)world.getBlockTileEntity(x, y, z);
if(!player.isSneaking())
if(world.getBlockTileEntity(x, y, z) instanceof IConfigurable)
{
IConfigurable config = (IConfigurable)world.getBlockTileEntity(x, y, z);
if(!player.isSneaking())
{
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Current color: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
return true;
}
else {
if(getJoules(stack) >= ENERGY_PER_CONFIGURE)
{
onProvide(new ElectricityPack(ENERGY_PER_CONFIGURE/120, 120), stack);
MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
return true;
}
}
}
}
else if(getState(stack) == 1)
{
if(world.getBlockTileEntity(x, y, z) instanceof TileEntityContainerBlock)
{
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Current color: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
return true;
int itemAmount = 0;
Random random = new Random();
TileEntityContainerBlock tileEntity = (TileEntityContainerBlock)world.getBlockTileEntity(x, y, z);
for(int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
itemAmount += slotStack != null ? slotStack.stackSize : 0;
if(slotStack != null)
{
float xRandom = random.nextFloat() * 0.8F + 0.1F;
float yRandom = random.nextFloat() * 0.8F + 0.1F;
float zRandom = random.nextFloat() * 0.8F + 0.1F;
while(slotStack.stackSize > 0)
{
int j = random.nextInt(21) + 10;
if(j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if(slotStack.hasTagCompound())
{
item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = random.nextGaussian() * k;
item.motionY = random.nextGaussian() * k + 0.2F;
item.motionZ = random.nextGaussian() * k;
world.spawnEntityInWorld(item);
}
}
}
tileEntity.inventory = new ItemStack[tileEntity.getSizeInventory()];
onProvide(new ElectricityPack((ENERGY_PER_ITEM_DUMP*itemAmount)/120, 120), stack);
return true;
}
else {
if(getJoules(stack) >= ENERGY_PER_USE)
}
else if(getState(stack) == 2)
{
if(world.getBlockTileEntity(x, y, z) instanceof IUpgradeManagement)
{
Random random = new Random();
IUpgradeManagement management = (IUpgradeManagement)world.getBlockTileEntity(x, y, z);
ItemStack[] upgradeStacks = new ItemStack[] {new ItemStack(Mekanism.SpeedUpgrade, management.getSpeedMultiplier()), new ItemStack(Mekanism.EnergyUpgrade, management.getEnergyMultiplier())};
for(ItemStack upgrade : upgradeStacks)
{
onProvide(new ElectricityPack(ENERGY_PER_USE/120, 120), stack);
MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
return true;
if(upgrade.stackSize > 0)
{
float xRandom = random.nextFloat() * 0.8F + 0.1F;
float yRandom = random.nextFloat() * 0.8F + 0.1F;
float zRandom = random.nextFloat() * 0.8F + 0.1F;
EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, upgrade);
float k = 0.05F;
item.motionX = random.nextGaussian() * k;
item.motionY = random.nextGaussian() * k + 0.2F;
item.motionZ = random.nextGaussian() * k;
world.spawnEntityInWorld(item);
}
}
management.setSpeedMultiplier(0);
management.setEnergyMultiplier(0);
return true;
}
}
}
return false;
}
public void setState(ItemStack itemstack, byte state)
{
if(itemstack.stackTagCompound == null)
{
itemstack.setTagCompound(new NBTTagCompound());
}
itemstack.stackTagCompound.setByte("state", state);
}
public byte getState(ItemStack itemstack)
{
if(itemstack.stackTagCompound == null)
{
return 0;
}
byte state = 0;
if(itemstack.stackTagCompound.getTag("state") != null)
{
state = itemstack.stackTagCompound.getByte("state");
}
return state;
}
@Override
public ElectricityPack getProvideRequest(ItemStack itemStack)
{

View file

@ -26,7 +26,7 @@ public class ItemElectricBow extends ItemEnergized
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
super.addInformation(itemstack, entityplayer, list, flag);
list.add("Fire Mode: " + (getFireState(itemstack) ? "ON" : "OFF"));
list.add(EnumColor.PINK + "Fire Mode: " + EnumColor.GREY + (getFireState(itemstack) ? "ON" : "OFF"));
}
@Override
@ -36,13 +36,13 @@ public class ItemElectricBow extends ItemEnergized
{
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemstack) > 0;
if (flag || player.inventory.hasItem(Item.arrow.itemID))
if(flag || player.inventory.hasItem(Item.arrow.itemID))
{
int maxItemUse = getMaxItemUseDuration(itemstack) - itemUseCount;
float f = (float)maxItemUse / 20F;
float f = maxItemUse / 20F;
f = (f * f + f * 2.0F) / 3F;
if ((double)f < 0.1D)
if(f < 0.1D)
{
return;
}
@ -54,7 +54,7 @@ public class ItemElectricBow extends ItemEnergized
EntityArrow entityarrow = new EntityArrow(world, player, f * 2.0F);
if (f == 1.0F)
if(f == 1.0F)
{
entityarrow.setIsCritical(true);
}
@ -66,16 +66,15 @@ public class ItemElectricBow extends ItemEnergized
world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag)
if(flag)
{
entityarrow.canBePickedUp = 2;
}
else
{
else {
player.inventory.consumeInventoryItem(Item.arrow.itemID);
}
if (!world.isRemote)
if(!world.isRemote)
{
world.spawnEntityInWorld(entityarrow);
entityarrow.setFire(getFireState(itemstack) ? 60 : 0);
@ -105,20 +104,11 @@ public class ItemElectricBow extends ItemEnergized
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if(!entityplayer.isSneaking())
{
if (entityplayer.capabilities.isCreativeMode || entityplayer.inventory.hasItem(Item.arrow.itemID))
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
}
}
else {
if(!world.isRemote)
{
setFireState(itemstack, !getFireState(itemstack));
entityplayer.addChatMessage(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Fire Mode: " + (getFireState(itemstack) ? (EnumColor.DARK_GREEN + "ON") : (EnumColor.DARK_RED + "OFF")));
}
}
if(entityplayer.capabilities.isCreativeMode || entityplayer.inventory.hasItem(Item.arrow.itemID))
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
}
return itemstack;
}

View file

@ -9,6 +9,7 @@ import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
import universalelectricity.core.item.IItemElectric;
import mekanism.api.EnumColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -38,9 +39,8 @@ public class ItemEnergized extends ItemMekanism implements IItemElectric, ICusto
@Override
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
double energy = getJoules(itemstack);
list.add("Stored Energy: " + ElectricityDisplay.getDisplayShort(energy, ElectricUnit.JOULES));
list.add(EnumColor.AQUA + "Stored Energy: " + EnumColor.GREY + ElectricityDisplay.getDisplayShort(getJoules(itemstack), ElectricUnit.JOULES));
list.add(EnumColor.AQUA + "Voltage: " + EnumColor.GREY + getVoltage(itemstack) + "v");
}
@Override
@ -160,6 +160,12 @@ public class ItemEnergized extends ItemMekanism implements IItemElectric, ICusto
{
setJoules(getJoules(itemStack) + energyToStore, itemStack);
}
if(energyToStore < 1)
{
return 1;
}
return (int)(energyToStore*Mekanism.TO_IC2);
}
@ -173,6 +179,12 @@ public class ItemEnergized extends ItemMekanism implements IItemElectric, ICusto
{
setJoules(getJoules(itemStack) - energyToGive, itemStack);
}
if(energyWanted < 1)
{
return 1;
}
return (int)(energyToGive*Mekanism.TO_IC2);
}
@ -189,37 +201,37 @@ public class ItemEnergized extends ItemMekanism implements IItemElectric, ICusto
}
@Override
public boolean canProvideEnergy()
public boolean canProvideEnergy(ItemStack itemStack)
{
return true;
}
@Override
public int getChargedItemId()
public int getChargedItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getEmptyItemId()
public int getEmptyItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getMaxCharge()
public int getMaxCharge(ItemStack itemStack)
{
return (int)(MAX_ELECTRICITY*Mekanism.TO_IC2);
return 0;
}
@Override
public int getTier()
public int getTier(ItemStack itemStack)
{
return 3;
}
@Override
public int getTransferLimit()
public int getTransferLimit(ItemStack itemStack)
{
return 0;
}

View file

@ -15,14 +15,6 @@ public class ItemPortableTeleporter extends ItemEnergized
super(id, 5000000, 120);
}
@Override
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
super.onUpdate(itemstack, world, entity, i, flag);
setStatus(itemstack, getStatus(itemstack));
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{

View file

@ -52,7 +52,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* @author AidanBrady
*
*/
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.5.1")
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.5.2")
@NetworkMod(channels = {"Mekanism"}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class Mekanism
{
@ -74,7 +74,7 @@ public class Mekanism
public static Configuration configuration;
/** Mekanism version number */
public static Version versionNumber = new Version(5, 5, 1);
public static Version versionNumber = new Version(5, 5, 2);
/** Map of Teleporters */
public static Map<Teleporter.Code, ArrayList<Teleporter.Coords>> teleporters = new HashMap<Teleporter.Code, ArrayList<Teleporter.Coords>>();
@ -159,6 +159,7 @@ public class Mekanism
public static boolean updateNotifications = true;
public static boolean enableSounds = true;
public static boolean controlCircuitOreDict = true;
public static boolean logPackets = false;
public static int obsidianTNTBlastRadius = 12;
public static int obsidianTNTDelay = 100;
public static double TO_IC2;
@ -287,7 +288,7 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PortableTeleporter), new Object[] {
" E ", "CTC", " E ", Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('C'), "basicCircuit", Character.valueOf('T'), TeleportationCore
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 7), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 11), new Object[] {
"COC", "OTO", "COC", Character.valueOf('C'), "basicCircuit", Character.valueOf('O'), new ItemStack(BasicBlock, 1, 8), Character.valueOf('T'), TeleportationCore
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 9), new Object[] {
@ -296,13 +297,13 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Configurator), new Object[] {
" L ", "AEA", " S ", Character.valueOf('L'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('S'), Item.stick
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 9, 8), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 9, 7), new Object[] {
"OOO", "OGO", "OOO", Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('G'), "ingotRefinedGlowstone"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Transmitter, 8, 0), new Object[] {
"OOO", "GGG", "OOO", Character.valueOf('O'), "ingotOsmium", Character.valueOf('G'), Block.glass
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 9), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 8), new Object[] {
" S ", "SPS", " S ", Character.valueOf('S'), "ingotSteel", Character.valueOf('P'), "ingotOsmium"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 10), new Object[] {
@ -428,7 +429,7 @@ public class Mekanism
LanguageRegistry.addName(TeleportationCore, "Teleportation Core");
LanguageRegistry.addName(Configurator, "Configurator");
//Localization for MultiBlock
//Localization for BasicBlock
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.OsmiumBlock.name", "Osmium Block");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.BronzeBlock.name", "Bronze Block");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.RefinedObsidian.name", "Refined Obsidian");
@ -436,7 +437,6 @@ public class Mekanism
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.RefinedGlowstone.name", "Refined Glowstone");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.SteelBlock.name", "Steel Block");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.ControlPanel.name", "Control Panel");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.Teleporter.name", "Teleporter");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.TeleporterFrame.name", "Teleporter Frame");
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.SteelCasing.name", "Steel Casing");
@ -452,6 +452,7 @@ public class Mekanism
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.MetallurgicInfuser.name", "Metallurgic Infuser");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.PurificationChamber.name", "Purification Chamber");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.EnergizedSmelter.name", "Energized Smelter");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Teleporter.name", "Teleporter");
//Localization for OreBlock
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.OsmiumOre.name", "Osmium Ore");

View file

@ -55,7 +55,7 @@ public final class MekanismUtils
*/
public static void checkForUpdates(EntityPlayer entityplayer)
{
if(Mekanism.updateNotifications)
if(Mekanism.updateNotifications && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null)
{
if(!Mekanism.latestVersionNumber.equals("null"))
{

View file

@ -87,8 +87,7 @@ public class PacketHandler implements IPacketHandler
{
((ITileNetwork)tileEntity).handlePacketData(dataStream);
}
} catch (Exception e)
{
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling tile entity packet.");
e.printStackTrace();
}
@ -124,8 +123,7 @@ public class PacketHandler implements IPacketHandler
}
entityplayer.openGui(instance, guiId, entityplayer.worldObj, x, y, z);
} catch (Exception e)
{
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling control panel packet.");
e.printStackTrace();
}
@ -143,8 +141,7 @@ public class PacketHandler implements IPacketHandler
entityplayer.worldObj.spawnParticle("portal", x + random.nextFloat(), y + random.nextFloat(), z + random.nextFloat(), 0.0F, 0.0F, 0.0F);
entityplayer.worldObj.spawnParticle("portal", x + random.nextFloat(), y + 1 + random.nextFloat(), z + random.nextFloat(), 0.0F, 0.0F, 0.0F);
}
} catch (Exception e)
{
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling portal FX packet.");
e.printStackTrace();
}
@ -162,8 +159,7 @@ public class PacketHandler implements IPacketHandler
ItemPortableTeleporter item = (ItemPortableTeleporter)currentStack.getItem();
item.setDigit(currentStack, index, digit);
}
} catch (Exception e)
{
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling digit update packet.");
e.printStackTrace();
}
@ -178,8 +174,7 @@ public class PacketHandler implements IPacketHandler
ItemPortableTeleporter item = (ItemPortableTeleporter)currentStack.getItem();
item.setStatus(currentStack, dataStream.readInt());
}
} catch (Exception e)
{
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling status update packet.");
e.printStackTrace();
}
@ -210,12 +205,11 @@ public class PacketHandler implements IPacketHandler
entityPlayerMP.playerNetServerHandler.setPlayerLocation(coords.xCoord+0.5, coords.yCoord, coords.zCoord+0.5, entityPlayerMP.rotationYaw, entityPlayerMP.rotationPitch);
entityplayer.worldObj.playSoundAtEntity(entityplayer, "mob.endermen.portal", 1.0F, 1.0F);
PacketHandler.sendPortalFX(coords.xCoord, coords.yCoord, coords.zCoord, coords.dimensionId);
sendPortalFX(coords.xCoord, coords.yCoord, coords.zCoord, coords.dimensionId);
}
}
}
} catch (Exception e)
{
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling portable teleport packet.");
e.printStackTrace();
}
@ -234,15 +228,46 @@ public class PacketHandler implements IPacketHandler
{
sendTileEntityPacketToClients(world.getBlockTileEntity(x, y, z), 0, ((ITileNetwork)world.getBlockTileEntity(x, y, z)).getNetworkedData(new ArrayList()));
}
} catch (Exception e)
{
} catch (Exception e) {
System.err.println("[Mekanism] Error while handling data request packet.");
e.printStackTrace();
}
}
}
catch (Exception e)
{
if(packetType == EnumPacketType.CONFIGURATOR_STATE.id)
{
try {
int state = dataStream.readInt();
EntityPlayerMP entityPlayerMP = (EntityPlayerMP)entityplayer;
ItemStack itemstack = entityPlayerMP.getCurrentEquippedItem();
if(itemstack != null && itemstack.getItem() instanceof ItemConfigurator)
{
((ItemConfigurator)itemstack.getItem()).setState(itemstack, (byte)state);
}
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling configurator state packet.");
e.printStackTrace();
}
}
if(packetType == EnumPacketType.ELECTRIC_BOW_STATE.id)
{
try {
boolean state = dataStream.readInt() == 1;
EntityPlayerMP entityPlayerMP = (EntityPlayerMP)entityplayer;
ItemStack itemstack = entityPlayerMP.getCurrentEquippedItem();
if(itemstack != null && itemstack.getItem() instanceof ItemElectricBow)
{
((ItemElectricBow)itemstack.getItem()).setFireState(itemstack, state);
}
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling configurator state packet.");
e.printStackTrace();
}
}
} catch(Exception e) {
System.err.println("[Mekanism] Error while handling packet.");
e.printStackTrace();
}
@ -419,7 +444,11 @@ public class PacketHandler implements IPacketHandler
packet.data = bytes.toByteArray();
packet.length = packet.data.length;
PacketDispatcher.sendPacketToServer(packet);
System.out.println("[Mekanism] Sent control panel packet to server.");
if(Mekanism.logPackets)
{
System.out.println("[Mekanism] Sent control panel packet to server.");
}
}
/**
@ -449,7 +478,11 @@ public class PacketHandler implements IPacketHandler
packet.data = bytes.toByteArray();
packet.length = packet.data.length;
PacketDispatcher.sendPacketToAllAround(x, y, z, 40, id, packet);
System.out.println("[Mekanism] Sent portal FX packet to clients.");
if(Mekanism.logPackets)
{
System.out.println("[Mekanism] Sent portal FX packet to clients.");
}
}
/**
@ -476,6 +509,11 @@ public class PacketHandler implements IPacketHandler
packet.data = bytes.toByteArray();
packet.length = packet.data.length;
PacketDispatcher.sendPacketToServer(packet);
if(Mekanism.logPackets)
{
System.out.println("[Mekanism] Sent digit update packet to server.");
}
}
/**
@ -501,6 +539,11 @@ public class PacketHandler implements IPacketHandler
packet.data = bytes.toByteArray();
packet.length = packet.data.length;
PacketDispatcher.sendPacketToPlayer(packet, (Player)entityplayer);
if(Mekanism.logPackets)
{
System.out.println("[Mekanism] Sent status update packet to " + entityplayer.username);
}
}
/**
@ -526,7 +569,11 @@ public class PacketHandler implements IPacketHandler
packet.data = bytes.toByteArray();
packet.length = packet.data.length;
PacketDispatcher.sendPacketToServer(packet);
System.out.println("[Mekanism] Sent data int packet '" + type.id + ":" + i + "' to server");
if(Mekanism.logPackets)
{
System.out.println("[Mekanism] Sent data int packet '" + type.id + ":" + i + "' to server");
}
}
/**
@ -555,5 +602,10 @@ public class PacketHandler implements IPacketHandler
packet.data = bytes.toByteArray();
packet.length = packet.data.length;
PacketDispatcher.sendPacketToServer(packet);
if(Mekanism.logPackets)
{
System.out.println("[Mekanism] Sent data request packet to server.");
}
}
}

View file

@ -82,7 +82,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
if(Mekanism.hooks.IC2Loaded && inventory[3].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[3].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[3]))
{
double gain = ElectricItem.discharge(inventory[3], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);

View file

@ -421,6 +421,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
speedMultiplier = multiplier;
}
@Override
public boolean supportsUpgrades(Object... data)
{
return true;
}
@Override
public Sound getSound()
{

View file

@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
public abstract class TileEntityContainerBlock extends TileEntityBasicBlock implements ISidedInventory, IInventory
public abstract class TileEntityContainerBlock extends TileEntityBasicBlock implements ISidedInventory, IInventory, ISustainedInventory
{
/** The inventory slot itemstacks used by this block. */
public ItemStack[] inventory;
@ -184,6 +184,47 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack)
{
return false;
return true;
}
@Override
public void setInventory(NBTTagList nbtTags, Object... data)
{
if(nbtTags == null || nbtTags.tagList == null || nbtTags.tagList.isEmpty())
{
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;
}
}

View file

@ -52,7 +52,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
if(Mekanism.hooks.IC2Loaded && inventory[1].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[1].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[1]))
{
double gain = ElectricItem.discharge(inventory[1], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);

View file

@ -3,6 +3,7 @@ package mekanism.common;
import ic2.api.Direction;
import ic2.api.ElectricItem;
import ic2.api.IElectricItem;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergyConductor;
import ic2.api.IEnergyStorage;
import ic2.api.energy.event.EnergyTileSourceEvent;
@ -80,7 +81,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
if(Mekanism.hooks.IC2Loaded && inventory[1].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[1].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[1]))
{
double gain = ElectricItem.discharge(inventory[1], (int)((tier.MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);
@ -106,7 +107,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
{
setJoules(electricityStored - (Math.min(electricityStored, tier.OUTPUT) - CableUtils.emitEnergyToNetwork(Math.min(electricityStored, tier.OUTPUT), this, ForgeDirection.getOrientation(facing))));
}
else if(tileEntity instanceof IEnergyConductor && Mekanism.hooks.IC2Loaded)
else if((tileEntity instanceof IEnergyConductor || tileEntity instanceof IEnergyAcceptor) && Mekanism.hooks.IC2Loaded)
{
if(electricityStored >= tier.OUTPUT)
{

View file

@ -136,7 +136,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
if(Mekanism.hooks.IC2Loaded && inventory[1].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[1].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[1]))
{
double gain = ElectricItem.discharge(inventory[1], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);
@ -674,6 +674,12 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
speedMultiplier = multiplier;
}
@Override
public boolean supportsUpgrades(Object... data)
{
return true;
}
@Override
public Sound getSound()
{

View file

@ -129,7 +129,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
if(Mekanism.hooks.IC2Loaded && inventory[4].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[4].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[4]))
{
double gain = ElectricItem.discharge(inventory[4], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);
@ -662,4 +662,10 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
{
speedMultiplier = multiplier;
}
@Override
public boolean supportsUpgrades(Object... data)
{
return true;
}
}

View file

@ -99,7 +99,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
if(Mekanism.hooks.IC2Loaded && inventory[0].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[0].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[0]))
{
double gain = ElectricItem.discharge(inventory[0], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);
@ -272,7 +272,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
public boolean isFrame(int x, int y, int z)
{
return worldObj.getBlockId(x, y, z) == Mekanism.basicBlockID && worldObj.getBlockMetadata(x, y, z) == 8;
return worldObj.getBlockId(x, y, z) == Mekanism.basicBlockID && worldObj.getBlockMetadata(x, y, z) == 7;
}
public int getScaledEnergyLevel(int i)

View file

@ -7,6 +7,7 @@ import buildcraft.api.tools.IToolWrench;
import mekanism.api.IActiveState;
import mekanism.common.IBoundingBlock;
import mekanism.common.ISustainedInventory;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityBasicBlock;
@ -328,48 +329,9 @@ public class BlockGenerator extends BlockContainer implements IDismantleable
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
if(tileEntity instanceof IBoundingBlock)
{
for (int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
if (slotStack != null)
{
float xRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float yRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float zRandom = machineRand.nextFloat() * 0.8F + 0.1F;
while (slotStack.stackSize > 0)
{
int j = machineRand.nextInt(21) + 10;
if (j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, (double)((float)x + xRandom), (double)((float)y + yRandom), (double)((float)z + zRandom), new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if (slotStack.hasTagCompound())
{
item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = (double)((float)machineRand.nextGaussian() * k);
item.motionY = (double)((float)machineRand.nextGaussian() * k + 0.2F);
item.motionZ = (double)((float)machineRand.nextGaussian() * k);
world.spawnEntityInWorld(item);
}
}
}
if(tileEntity instanceof IBoundingBlock)
{
((IBoundingBlock)tileEntity).onBreak();
}
((IBoundingBlock)tileEntity).onBreak();
}
super.breakBlock(world, x, y, z, i1, i2);
@ -537,10 +499,7 @@ public class BlockGenerator extends BlockContainer implements IDismantleable
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, new ItemStack(MekanismGenerators.Generator, 1, world.getBlockMetadata(x, y, z)));
IItemElectric electricItem = (IItemElectric)entityItem.getEntityItem().getItem();
electricItem.setJoules(tileEntity.electricityStored, entityItem.getEntityItem());
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z));
world.spawnEntityInWorld(entityItem);
}
@ -557,17 +516,16 @@ public class BlockGenerator extends BlockContainer implements IDismantleable
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(tileEntity.electricityStored, itemStack);
ISustainedInventory inventory = (ISustainedInventory)itemStack.getItem();
inventory.setInventory(((ISustainedInventory)tileEntity).getInventory(), itemStack);
return itemStack;
}
@Override
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(MekanismGenerators.Generator, 1, world.getBlockMetadata(x, y, z));
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(tileEntity.electricityStored, itemStack);
ItemStack itemStack = getPickBlock(null, world, x, y, z);
world.setBlockToAir(x, y, z);

View file

@ -2,11 +2,18 @@ package mekanism.generators.common;
import java.util.List;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.ICustomElectricItem;
import universalelectricity.core.electricity.ElectricityDisplay;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.item.IItemElectric;
import mekanism.api.EnumColor;
import mekanism.common.ISustainedInventory;
import mekanism.common.Mekanism;
import mekanism.common.TileEntityElectricBlock;
import mekanism.generators.common.BlockGenerator.GeneratorType;
@ -16,6 +23,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
@ -27,11 +35,10 @@ import net.minecraft.world.World;
* 3: Hydrogen Generator
* 4: Bio-Generator
* 5: Advanced Solar Generator
* 6: Hydro Generator
* @author AidanBrady
*
*/
public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICustomElectricItem
public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICustomElectricItem, ISustainedInventory
{
public Block metaBlock;
@ -79,9 +86,6 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
case 5:
name = "AdvancedSolarGenerator";
break;
case 6:
name = "HydroGenerator";
break;
default:
name = "Unknown";
break;
@ -90,11 +94,18 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
double energy = getJoules(itemstack);
list.add("Stored Energy: " + ElectricityDisplay.getDisplayShort(energy, ElectricUnit.JOULES));
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for details.");
}
else {
list.add(EnumColor.BRIGHT_GREEN + "Stored Energy: " + EnumColor.GREY + ElectricityDisplay.getDisplayShort(getJoules(itemstack), ElectricUnit.JOULES));
list.add(EnumColor.BRIGHT_GREEN + "Voltage: " + EnumColor.GREY + getVoltage(itemstack) + "v");
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagList != null && !getInventory(itemstack).tagList.isEmpty()));
}
}
@Override
@ -139,30 +150,40 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
@Override
public double getVoltage(ItemStack itemStack)
{
return 120;
return itemStack.getItemDamage() == 3 ? 240 : 120;
}
@Override
public ElectricityPack onReceive(ElectricityPack electricityPack, ItemStack itemStack)
{
double rejectedElectricity = Math.max((getJoules(itemStack) + electricityPack.getWatts()) - getMaxJoules(itemStack), 0);
double joulesToStore = electricityPack.getWatts() - rejectedElectricity;
this.setJoules(getJoules(itemStack) + joulesToStore, itemStack);
return ElectricityPack.getFromWatts(joulesToStore, getVoltage(itemStack));
if(itemStack.getItemDamage() == 2)
{
double rejectedElectricity = Math.max((getJoules(itemStack) + electricityPack.getWatts()) - getMaxJoules(itemStack), 0);
double joulesToStore = electricityPack.getWatts() - rejectedElectricity;
this.setJoules(getJoules(itemStack) + joulesToStore, itemStack);
return ElectricityPack.getFromWatts(joulesToStore, getVoltage(itemStack));
}
return new ElectricityPack();
}
@Override
public ElectricityPack onProvide(ElectricityPack electricityPack, ItemStack itemStack)
{
double electricityToUse = Math.min(getJoules(itemStack), electricityPack.getWatts());
setJoules(getJoules(itemStack) - electricityToUse, itemStack);
return ElectricityPack.getFromWatts(electricityToUse, getVoltage(itemStack));
if(itemStack.getItemDamage() != 2)
{
double electricityToUse = Math.min(getJoules(itemStack), electricityPack.getWatts());
setJoules(getJoules(itemStack) - electricityToUse, itemStack);
return ElectricityPack.getFromWatts(electricityToUse, getVoltage(itemStack));
}
return new ElectricityPack();
}
@Override
public ElectricityPack getReceiveRequest(ItemStack itemStack)
{
return ElectricityPack.getFromWatts(Math.min(getMaxJoules(itemStack) - getJoules(itemStack), getTransferRate(itemStack)), getVoltage(itemStack));
return itemStack.getItemDamage() == 2 ? ElectricityPack.getFromWatts(Math.min(getMaxJoules(itemStack) - getJoules(itemStack), getTransferRate(itemStack)), getVoltage(itemStack)) : new ElectricityPack();
}
@Override
@ -206,6 +227,7 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
tileEntity.electricityStored = getJoules(stack);
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
return true;
}
@ -215,28 +237,50 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
@Override
public int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
double givenEnergy = amount*Mekanism.FROM_IC2;
double energyNeeded = getMaxJoules(itemStack)-getJoules(itemStack);
double energyToStore = Math.min(Math.min(amount, getMaxJoules(itemStack)*0.01), energyNeeded);
if(!simulate)
if(itemStack.getItemDamage() == 2)
{
setJoules(getJoules(itemStack) + energyToStore, itemStack);
double givenEnergy = amount*Mekanism.FROM_IC2;
double energyNeeded = getMaxJoules(itemStack)-getJoules(itemStack);
double energyToStore = Math.min(Math.min(amount, getMaxJoules(itemStack)*0.01), energyNeeded);
if(!simulate)
{
setJoules(getJoules(itemStack) + energyToStore, itemStack);
}
if(energyToStore < 1)
{
return 1;
}
return (int)(energyToStore*Mekanism.TO_IC2);
}
return (int)(energyToStore*Mekanism.TO_IC2);
return 0;
}
@Override
public int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
double energyWanted = amount*Mekanism.FROM_IC2;
double energyToGive = Math.min(Math.min(energyWanted, getMaxJoules(itemStack)*0.01), getJoules(itemStack));
if(!simulate)
if(itemStack.getItemDamage() != 2)
{
setJoules(getJoules(itemStack) - energyToGive, itemStack);
double energyWanted = amount*Mekanism.FROM_IC2;
double energyToGive = Math.min(Math.min(energyWanted, getMaxJoules(itemStack)*0.01), getJoules(itemStack));
if(!simulate)
{
setJoules(getJoules(itemStack) - energyToGive, itemStack);
}
if(energyWanted < 1)
{
return 1;
}
return (int)(energyToGive*Mekanism.TO_IC2);
}
return (int)(energyToGive*Mekanism.TO_IC2);
return 0;
}
@Override
@ -252,38 +296,72 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
}
@Override
public boolean canProvideEnergy()
public boolean canProvideEnergy(ItemStack itemStack)
{
return true;
return itemStack.getItemDamage() != 2;
}
@Override
public int getChargedItemId()
public int getChargedItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getEmptyItemId()
public int getEmptyItemId(ItemStack itemStack)
{
return itemID;
}
@Override
public int getMaxCharge()
public int getMaxCharge(ItemStack itemStack)
{
return 0;
}
@Override
public int getTier()
public int getTier(ItemStack itemStack)
{
return 3;
}
@Override
public int getTransferLimit()
public int getTransferLimit(ItemStack itemStack)
{
return 0;
}
@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;
}
}

View file

@ -22,7 +22,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.1", dependencies = "required-after:Mekanism")
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "5.5.2", dependencies = "required-after:Mekanism")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MekanismGenerators
{

View file

@ -81,7 +81,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
if(Mekanism.hooks.IC2Loaded && inventory[3].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[3].getItem();
if(item.canProvideEnergy())
if(item.canProvideEnergy(inventory[3]))
{
double gain = ElectricItem.discharge(inventory[3], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);

View file

@ -1,6 +1,7 @@
package mekanism.generators.common;
import ic2.api.Direction;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergyConductor;
import ic2.api.IEnergyStorage;
import ic2.api.energy.event.EnergyTileSourceEvent;
@ -101,7 +102,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
{
setJoules(electricityStored - (Math.min(electricityStored, output) - CableUtils.emitEnergyToNetwork(Math.min(electricityStored, output), this, ForgeDirection.getOrientation(facing))));
}
else if(tileEntity instanceof IEnergyConductor && Mekanism.hooks.IC2Loaded)
else if((tileEntity instanceof IEnergyConductor || tileEntity instanceof IEnergyAcceptor) && Mekanism.hooks.IC2Loaded)
{
if(electricityStored >= output)
{

View file

@ -22,7 +22,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.5.1", dependencies = "required-after:Mekanism")
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.5.2", dependencies = "required-after:Mekanism")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MekanismTools
{