Added EnergyMeter
This commit is contained in:
parent
17d4acf389
commit
7df5888bd3
46
common/mekanism/common/ItemEnergyMeter.java
Normal file
46
common/mekanism/common/ItemEnergyMeter.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemEnergyMeter extends ItemEnergized
|
||||
{
|
||||
public static double ENERGY_PER_USE = 400;
|
||||
|
||||
public ItemEnergyMeter(int id)
|
||||
{
|
||||
super(id, 60000, 120);
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IUniversalCable)
|
||||
{
|
||||
if(getEnergy(stack) >= ENERGY_PER_USE)
|
||||
{
|
||||
setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE);
|
||||
|
||||
IUniversalCable cable = (IUniversalCable)tileEntity;
|
||||
|
||||
player.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------");
|
||||
player.sendChatToPlayer(EnumColor.GREY + " *Cables: " + EnumColor.DARK_GREY + cable.getNetwork().cables.size());
|
||||
player.sendChatToPlayer(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + cable.getNetwork().possibleAcceptors.size());
|
||||
player.sendChatToPlayer(EnumColor.GREY + " *Needed energy: " + EnumColor.DARK_GREY + cable.getNetwork().getEnergyNeeded(new ArrayList()) + "J");
|
||||
player.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -9,13 +9,13 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import mekanism.api.GasNetwork.GasTransferEvent;
|
||||
import mekanism.api.GasTransmission;
|
||||
import mekanism.api.InfuseObject;
|
||||
import mekanism.api.InfuseRegistry;
|
||||
import mekanism.api.InfuseType;
|
||||
import mekanism.api.InfusionInput;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.GasNetwork.GasTransferEvent;
|
||||
import mekanism.client.SoundHandler;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
import mekanism.common.LiquidNetwork.LiquidTransferEvent;
|
||||
|
@ -156,6 +156,7 @@ public class Mekanism
|
|||
public static Item PortableTeleporter;
|
||||
public static Item TeleportationCore;
|
||||
public static Item Configurator;
|
||||
public static Item EnergyMeter;
|
||||
|
||||
//Blocks
|
||||
public static Block BasicBlock;
|
||||
|
@ -486,6 +487,7 @@ public class Mekanism
|
|||
LanguageRegistry.addName(PortableTeleporter, "Portable Teleporter");
|
||||
LanguageRegistry.addName(TeleportationCore, "Teleportation Core");
|
||||
LanguageRegistry.addName(Configurator, "Configurator");
|
||||
LanguageRegistry.addName(EnergyMeter, "EnergyMeter");
|
||||
|
||||
//Localization for BasicBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.OsmiumBlock.name", "Osmium Block");
|
||||
|
@ -604,6 +606,7 @@ public class Mekanism
|
|||
Clump = new ItemClump(configuration.getItem("Clump", 11219).getInt()-256);
|
||||
DirtyDust = new ItemDirtyDust(configuration.getItem("DirtyDust", 11220).getInt()-256);
|
||||
Configurator = new ItemConfigurator(configuration.getItem("Configurator", 11221).getInt()).setUnlocalizedName("Configurator");
|
||||
EnergyMeter = new ItemEnergyMeter(configuration.getItem("EnergyMeter", 11222).getInt()).setUnlocalizedName("EnergyMeter");
|
||||
configuration.save();
|
||||
|
||||
//Registrations
|
||||
|
@ -633,6 +636,7 @@ public class Mekanism
|
|||
GameRegistry.registerItem(Clump, "Clump");
|
||||
GameRegistry.registerItem(DirtyDust, "DirtyDust");
|
||||
GameRegistry.registerItem(Configurator, "Configurator");
|
||||
GameRegistry.registerItem(EnergyMeter, "EnergyMeter");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
BIN
resources/mods/mekanism/textures/items/EnergyMeter.png
Normal file
BIN
resources/mods/mekanism/textures/items/EnergyMeter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
Loading…
Reference in a new issue