mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +00:00
The Great Reformat; moving to google-java-style w/ 4 space indent and 120 column line wrap
This commit is contained in:
1 parent
c632cc6af9
commit
e0b7ea62a4
933 files changed
+95734
-108818
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Range4D;
|
||||
@@ -42,327 +42,269 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple metal block IDs.
|
||||
* 0:0: Osmium Block
|
||||
* 0:1: Bronze Block
|
||||
* 0:2: Refined Obsidian
|
||||
* 0:3: Charcoal Block
|
||||
* 0:4: Refined Glowstone
|
||||
* 0:5: Steel Block
|
||||
* 0:6: Bin
|
||||
* 0:7: Teleporter Frame
|
||||
* 0:8: Steel Casing
|
||||
* 0:9: Dynamic Tank
|
||||
* 0:10: Structural Glass
|
||||
* 0:11: Dynamic Valve
|
||||
* 0:12: Copper Block
|
||||
* 0:13: Tin Block
|
||||
* 0:14: Thermal Evaporation Controller
|
||||
* 0:15: Thermal Evaporation Valve
|
||||
* 1:0: Thermal Evaporation Block
|
||||
* 1:1: Induction Casing
|
||||
* 1:2: Induction Port
|
||||
* 1:3: Induction Cell
|
||||
* 1:4: Induction Provider
|
||||
* 1:5: Superheating Element
|
||||
* 1:6: Pressure Disperser
|
||||
* 1:7: Boiler Casing
|
||||
* 1:8: Boiler Valve
|
||||
* 1:9: Security Desk
|
||||
* @author AidanBrady
|
||||
* Item class for handling multiple metal block IDs. 0:0: Osmium Block 0:1: Bronze Block 0:2: Refined Obsidian 0:3:
|
||||
* Charcoal Block 0:4: Refined Glowstone 0:5: Steel Block 0:6: Bin 0:7: Teleporter Frame 0:8: Steel Casing 0:9: Dynamic
|
||||
* Tank 0:10: Structural Glass 0:11: Dynamic Valve 0:12: Copper Block 0:13: Tin Block 0:14: Thermal Evaporation
|
||||
* Controller 0:15: Thermal Evaporation Valve 1:0: Thermal Evaporation Block 1:1: Induction Casing 1:2: Induction Port
|
||||
* 1:3: Induction Cell 1:4: Induction Provider 1:5: Superheating Element 1:6: Pressure Disperser 1:7: Boiler Casing 1:8:
|
||||
* Boiler Valve 1:9: Security Desk
|
||||
*
|
||||
* @author AidanBrady
|
||||
*/
|
||||
public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierItem
|
||||
{
|
||||
public Block metaBlock;
|
||||
public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierItem {
|
||||
|
||||
public ItemBlockBasic(Block block)
|
||||
{
|
||||
super(block);
|
||||
metaBlock = block;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack)
|
||||
{
|
||||
if(BasicBlockType.get(stack) == BasicBlockType.BIN)
|
||||
{
|
||||
return 1; // Temporary no stacking due to #
|
||||
}
|
||||
|
||||
return super.getItemStackLimit(stack);
|
||||
public Block metaBlock;
|
||||
|
||||
public ItemBlockBasic(Block block) {
|
||||
super(block);
|
||||
metaBlock = block;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public ItemStack getUnchargedCell(InductionCellTier tier)
|
||||
{
|
||||
ItemStack stack = new ItemStack(MekanismBlocks.BasicBlock2, 1, 3);
|
||||
setBaseTier(stack, tier.getBaseTier());
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemStack getUnchargedProvider(InductionProviderTier tier)
|
||||
{
|
||||
ItemStack stack = new ItemStack(MekanismBlocks.BasicBlock2, 1, 4);
|
||||
setBaseTier(stack, tier.getBaseTier());
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseTier getBaseTier(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
return BaseTier.BASIC;
|
||||
}
|
||||
|
||||
return BaseTier.values()[itemstack.getTagCompound().getInteger("tier")];
|
||||
}
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack) {
|
||||
if (BasicBlockType.get(stack) == BasicBlockType.BIN) {
|
||||
return 1; // Temporary no stacking due to #
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBaseTier(ItemStack itemstack, BaseTier tier)
|
||||
{
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
return super.getItemStackLimit(stack);
|
||||
}
|
||||
|
||||
itemstack.getTagCompound().setInteger("tier", tier.ordinal());
|
||||
}
|
||||
public ItemStack getUnchargedCell(InductionCellTier tier) {
|
||||
ItemStack stack = new ItemStack(MekanismBlocks.BasicBlock2, 1, 3);
|
||||
setBaseTier(stack, tier.getBaseTier());
|
||||
|
||||
@Override
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(@Nonnull ItemStack itemstack, World world, @Nonnull List<String> list, @Nonnull ITooltipFlag flag)
|
||||
{
|
||||
BasicBlockType type = BasicBlockType.get(itemstack);
|
||||
|
||||
if(type != null && type.hasDescription)
|
||||
{
|
||||
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
|
||||
{
|
||||
if(type == BasicBlockType.BIN)
|
||||
{
|
||||
InventoryBin inv = new InventoryBin(itemstack);
|
||||
|
||||
if(inv.getItemCount() > 0)
|
||||
{
|
||||
list.add(EnumColor.BRIGHT_GREEN + inv.getItemType().getDisplayName());
|
||||
String amountStr = inv.getItemCount() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : "" + inv.getItemCount();
|
||||
list.add(EnumColor.PURPLE + LangUtils.localize("tooltip.itemAmount") + ": " + EnumColor.GREY + amountStr);
|
||||
}
|
||||
else {
|
||||
list.add(EnumColor.DARK_RED + LangUtils.localize("gui.empty"));
|
||||
}
|
||||
|
||||
int cap = BinTier.values()[getBaseTier(itemstack).ordinal()].storage;
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + (cap == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : cap) + " " + LangUtils.localize("transmission.Items"));
|
||||
}
|
||||
else if(type == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
InductionCellTier tier = InductionCellTier.values()[getBaseTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.maxEnergy));
|
||||
}
|
||||
else if(type == BasicBlockType.INDUCTION_PROVIDER)
|
||||
{
|
||||
InductionProviderTier tier = InductionProviderTier.values()[getBaseTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.outputRate") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.output));
|
||||
}
|
||||
|
||||
if(getMaxEnergy(itemstack) > 0)
|
||||
{
|
||||
list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
|
||||
}
|
||||
|
||||
list.add(LangUtils.localize("tooltip.hold") + " " + EnumColor.INDIGO + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.forDetails") + ".");
|
||||
}
|
||||
else {
|
||||
list.addAll(MekanismUtils.splitTooltip(type.getDescription(), itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
public ItemStack getUnchargedProvider(InductionProviderTier tier) {
|
||||
ItemStack stack = new ItemStack(MekanismBlocks.BasicBlock2, 1, 4);
|
||||
setBaseTier(stack, tier.getBaseTier());
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack)
|
||||
{
|
||||
return BasicBlockType.get(stack) == BasicBlockType.BIN && ItemDataUtils.hasData(stack, "newCount");
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getContainerItem(@Nonnull ItemStack stack)
|
||||
{
|
||||
if(BasicBlockType.get(stack) == BasicBlockType.BIN)
|
||||
{
|
||||
if(!ItemDataUtils.hasData(stack, "newCount"))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
int newCount = ItemDataUtils.getInt(stack, "newCount");
|
||||
ItemDataUtils.removeData(stack, "newCount");
|
||||
@Override
|
||||
public BaseTier getBaseTier(ItemStack itemstack) {
|
||||
if (itemstack.getTagCompound() == null) {
|
||||
return BaseTier.BASIC;
|
||||
}
|
||||
|
||||
return BaseTier.values()[itemstack.getTagCompound().getInteger("tier")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBaseTier(ItemStack itemstack, BaseTier tier) {
|
||||
if (itemstack.getTagCompound() == null) {
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemstack.getTagCompound().setInteger("tier", tier.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(@Nonnull ItemStack itemstack, World world, @Nonnull List<String> list,
|
||||
@Nonnull ITooltipFlag flag) {
|
||||
BasicBlockType type = BasicBlockType.get(itemstack);
|
||||
|
||||
if (type != null && type.hasDescription) {
|
||||
if (!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey)) {
|
||||
if (type == BasicBlockType.BIN) {
|
||||
InventoryBin inv = new InventoryBin(itemstack);
|
||||
|
||||
if (inv.getItemCount() > 0) {
|
||||
list.add(EnumColor.BRIGHT_GREEN + inv.getItemType().getDisplayName());
|
||||
String amountStr = inv.getItemCount() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite")
|
||||
: "" + inv.getItemCount();
|
||||
list.add(EnumColor.PURPLE + LangUtils.localize("tooltip.itemAmount") + ": " + EnumColor.GREY
|
||||
+ amountStr);
|
||||
} else {
|
||||
list.add(EnumColor.DARK_RED + LangUtils.localize("gui.empty"));
|
||||
}
|
||||
|
||||
int cap = BinTier.values()[getBaseTier(itemstack).ordinal()].storage;
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + (
|
||||
cap == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : cap) + " " + LangUtils
|
||||
.localize("transmission.Items"));
|
||||
} else if (type == BasicBlockType.INDUCTION_CELL) {
|
||||
InductionCellTier tier = InductionCellTier.values()[getBaseTier(itemstack).ordinal()];
|
||||
|
||||
list.add(
|
||||
tier.getBaseTier().getColor() + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY
|
||||
+ MekanismUtils.getEnergyDisplay(tier.maxEnergy));
|
||||
} else if (type == BasicBlockType.INDUCTION_PROVIDER) {
|
||||
InductionProviderTier tier = InductionProviderTier.values()[getBaseTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.outputRate") + ": "
|
||||
+ EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.output));
|
||||
}
|
||||
|
||||
if (getMaxEnergy(itemstack) > 0) {
|
||||
list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY
|
||||
+ MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
|
||||
}
|
||||
|
||||
list.add(LangUtils.localize("tooltip.hold") + " " + EnumColor.INDIGO + GameSettings
|
||||
.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils
|
||||
.localize("tooltip.forDetails") + ".");
|
||||
} else {
|
||||
list.addAll(MekanismUtils.splitTooltip(type.getDescription(), itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack) {
|
||||
return BasicBlockType.get(stack) == BasicBlockType.BIN && ItemDataUtils.hasData(stack, "newCount");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getContainerItem(@Nonnull ItemStack stack) {
|
||||
if (BasicBlockType.get(stack) == BasicBlockType.BIN) {
|
||||
if (!ItemDataUtils.hasData(stack, "newCount")) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
int newCount = ItemDataUtils.getInt(stack, "newCount");
|
||||
ItemDataUtils.removeData(stack, "newCount");
|
||||
|
||||
ItemStack ret = stack.copy();
|
||||
ItemDataUtils.setInt(ret, "itemCount", newCount);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState state)
|
||||
{
|
||||
boolean place = true;
|
||||
|
||||
BasicBlockType type = BasicBlockType.get(stack);
|
||||
|
||||
if(type == BasicBlockType.SECURITY_DESK)
|
||||
{
|
||||
if(world.isOutsideBuildHeight(pos.up()) || !world.getBlockState(pos.up()).getBlock().isReplaceable(world, pos.up()))
|
||||
{
|
||||
place = false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, World world,
|
||||
@Nonnull BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState state) {
|
||||
boolean place = true;
|
||||
|
||||
if(place && super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state))
|
||||
{
|
||||
if(type == BasicBlockType.BIN && stack.getTagCompound() != null)
|
||||
{
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(pos);
|
||||
InventoryBin inv = new InventoryBin(stack);
|
||||
|
||||
tileEntity.tier = BinTier.values()[getBaseTier(stack).ordinal()];
|
||||
BasicBlockType type = BasicBlockType.get(stack);
|
||||
|
||||
if(!inv.getItemType().isEmpty())
|
||||
{
|
||||
tileEntity.setItemType(inv.getItemType());
|
||||
}
|
||||
if (type == BasicBlockType.SECURITY_DESK) {
|
||||
if (world.isOutsideBuildHeight(pos.up()) || !world.getBlockState(pos.up()).getBlock()
|
||||
.isReplaceable(world, pos.up())) {
|
||||
place = false;
|
||||
}
|
||||
}
|
||||
|
||||
tileEntity.setItemCount(inv.getItemCount());
|
||||
}
|
||||
else if(type == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(pos);
|
||||
tileEntity.tier = InductionCellTier.values()[getBaseTier(stack).ordinal()];
|
||||
if (place && super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state)) {
|
||||
if (type == BasicBlockType.BIN && stack.getTagCompound() != null) {
|
||||
TileEntityBin tileEntity = (TileEntityBin) world.getTileEntity(pos);
|
||||
InventoryBin inv = new InventoryBin(stack);
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new TileNetworkList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
}
|
||||
else if(type == BasicBlockType.INDUCTION_PROVIDER)
|
||||
{
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(pos);
|
||||
tileEntity.tier = InductionProviderTier.values()[getBaseTier(stack).ordinal()];
|
||||
tileEntity.tier = BinTier.values()[getBaseTier(stack).ordinal()];
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new TileNetworkList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
}
|
||||
if (!inv.getItemType().isEmpty()) {
|
||||
tileEntity.setItemType(inv.getItemType());
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
tileEntity.setItemCount(inv.getItemCount());
|
||||
} else if (type == BasicBlockType.INDUCTION_CELL) {
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell) world.getTileEntity(pos);
|
||||
tileEntity.tier = InductionCellTier.values()[getBaseTier(stack).ordinal()];
|
||||
|
||||
if(tileEntity instanceof IStrictEnergyStorage && !(tileEntity instanceof TileEntityMultiblock<?>))
|
||||
{
|
||||
((IStrictEnergyStorage)tileEntity).setEnergy(getEnergy(stack));
|
||||
}
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity),
|
||||
tileEntity.getNetworkedData(new TileNetworkList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
} else if (type == BasicBlockType.INDUCTION_PROVIDER) {
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider) world.getTileEntity(pos);
|
||||
tileEntity.tier = InductionProviderTier.values()[getBaseTier(stack).ordinal()];
|
||||
|
||||
return place;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity),
|
||||
tileEntity.getNetworkedData(new TileNetworkList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack itemstack)
|
||||
{
|
||||
BasicBlockType type = BasicBlockType.get(itemstack);
|
||||
|
||||
if(type != null)
|
||||
{
|
||||
String name = getTranslationKey() + "." + type.name;
|
||||
|
||||
if(type == BasicBlockType.BIN || type == BasicBlockType.INDUCTION_CELL || type == BasicBlockType.INDUCTION_PROVIDER)
|
||||
{
|
||||
name += getBaseTier(itemstack).getSimpleName();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
return "Invalid Basic Block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergy(ItemStack itemStack)
|
||||
{
|
||||
if(BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
return ItemDataUtils.getDouble(itemStack, "energyStored");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (tileEntity instanceof IStrictEnergyStorage && !(tileEntity instanceof TileEntityMultiblock<?>)) {
|
||||
((IStrictEnergyStorage) tileEntity).setEnergy(getEnergy(stack));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(ItemStack itemStack, double amount)
|
||||
{
|
||||
if(BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
ItemDataUtils.setDouble(itemStack, "energyStored", Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0));
|
||||
}
|
||||
}
|
||||
return place;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy(ItemStack itemStack)
|
||||
{
|
||||
if(BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL)
|
||||
{
|
||||
return InductionCellTier.values()[getBaseTier(itemStack).ordinal()].maxEnergy;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack itemstack) {
|
||||
BasicBlockType type = BasicBlockType.get(itemstack);
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack itemStack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (type != null) {
|
||||
String name = getTranslationKey() + "." + type.name;
|
||||
|
||||
@Override
|
||||
public boolean canReceive(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (type == BasicBlockType.BIN || type == BasicBlockType.INDUCTION_CELL
|
||||
|| type == BasicBlockType.INDUCTION_PROVIDER) {
|
||||
name += getBaseTier(itemstack).getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSend(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
// If this is a block of charcoal, set burn time to 16000 ticks (per Minecraft standard)
|
||||
if (this.metaBlock == MekanismBlocks.BasicBlock && itemStack.getMetadata() == 3) {
|
||||
return 16000; // ticks
|
||||
} else {
|
||||
return super.getItemBurnTime(itemStack);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
return "Invalid Basic Block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergy(ItemStack itemStack) {
|
||||
if (BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL) {
|
||||
return ItemDataUtils.getDouble(itemStack, "energyStored");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(ItemStack itemStack, double amount) {
|
||||
if (BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL) {
|
||||
ItemDataUtils.setDouble(itemStack, "energyStored", Math.max(Math.min(amount, getMaxEnergy(itemStack)), 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy(ItemStack itemStack) {
|
||||
if (BasicBlockType.get(itemStack) == BasicBlockType.INDUCTION_CELL) {
|
||||
return InductionCellTier.values()[getBaseTier(itemStack).ordinal()].maxEnergy;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack itemStack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSend(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
// If this is a block of charcoal, set burn time to 16000 ticks (per Minecraft standard)
|
||||
if (this.metaBlock == MekanismBlocks.BasicBlock && itemStack.getMetadata() == 3) {
|
||||
return 16000; // ticks
|
||||
} else {
|
||||
return super.getItemBurnTime(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user