Added basic battery and fixed issues with Lithium Battery

This commit is contained in:
gigabit101 2016-02-20 03:35:20 +00:00
parent 047625389d
commit f947ef37a4
9 changed files with 123 additions and 5 deletions

View file

@ -13,11 +13,11 @@ import techreborn.tiles.TileIndustrialGrinder;
import techreborn.tiles.teir1.TileCompressor; import techreborn.tiles.teir1.TileCompressor;
import techreborn.tiles.teir1.TileGrinder; import techreborn.tiles.teir1.TileGrinder;
public class BlockCompresser extends BlockMachineBase implements IRotationTexture{ public class BlockCompressor extends BlockMachineBase implements IRotationTexture{
public BlockCompresser(Material material) { public BlockCompressor(Material material) {
super(material); super(material);
setUnlocalizedName("techreborn.compresser"); setUnlocalizedName("techreborn.compressor");
} }
@Override @Override

View file

@ -14,7 +14,7 @@ import techreborn.blocks.storage.BlockAesu;
import techreborn.blocks.storage.BlockIDSU; import techreborn.blocks.storage.BlockIDSU;
import techreborn.blocks.storage.BlockLesu; import techreborn.blocks.storage.BlockLesu;
import techreborn.blocks.storage.BlockLesuStorage; import techreborn.blocks.storage.BlockLesuStorage;
import techreborn.blocks.teir1.BlockCompresser; import techreborn.blocks.teir1.BlockCompressor;
import techreborn.blocks.teir1.BlockElectricFurnace; import techreborn.blocks.teir1.BlockElectricFurnace;
import techreborn.blocks.teir1.BlockExtractor; import techreborn.blocks.teir1.BlockExtractor;
import techreborn.blocks.teir1.BlockGrinder; import techreborn.blocks.teir1.BlockGrinder;
@ -270,7 +270,7 @@ public class ModBlocks {
GameRegistry.registerBlock(Extractor, "techreborn.extractor"); GameRegistry.registerBlock(Extractor, "techreborn.extractor");
GameRegistry.registerTileEntity(TileExtractor.class, "TileExtractorTR"); GameRegistry.registerTileEntity(TileExtractor.class, "TileExtractorTR");
Compressor = new BlockCompresser(Material.iron); Compressor = new BlockCompressor(Material.iron);
GameRegistry.registerBlock(Compressor, "techreborn.compressor"); GameRegistry.registerBlock(Compressor, "techreborn.compressor");
GameRegistry.registerTileEntity(TileCompressor.class, "TileCompressorTR"); GameRegistry.registerTileEntity(TileCompressor.class, "TileCompressorTR");

View file

@ -71,6 +71,7 @@ public class ModItems {
public static Item bucketSodiumpersulfate; public static Item bucketSodiumpersulfate;
public static Item bucketTritium; public static Item bucketTritium;
public static Item bucketWolframium; public static Item bucketWolframium;
public static Item reBattery;
public static Item upgrades; public static Item upgrades;
@ -121,6 +122,8 @@ public class ModItems {
GameRegistry.registerItem(manuel, "techmanuel"); GameRegistry.registerItem(manuel, "techmanuel");
uuMatter = new ItemUUmatter(); uuMatter = new ItemUUmatter();
GameRegistry.registerItem(uuMatter, "uumatter"); GameRegistry.registerItem(uuMatter, "uumatter");
reBattery = PoweredItem.createItem(ItemReBattery.class);
GameRegistry.registerItem(reBattery, "rebattery");
// upgrades = new ItemUpgrade(); // upgrades = new ItemUpgrade();
// GameRegistry.registerItem(upgrades, "upgrades"); // GameRegistry.registerItem(upgrades, "upgrades");

View file

@ -40,6 +40,7 @@ public class RecipeCompact implements IRecipeCompact {
recipes.put("rubberWood", new ItemStack(ModBlocks.rubberLog)); recipes.put("rubberWood", new ItemStack(ModBlocks.rubberLog));
recipes.put("resin", ItemParts.getPartByName("rubberSap")); recipes.put("resin", ItemParts.getPartByName("rubberSap"));
recipes.put("carbonPlate", ItemPlates.getPlateByName("carbon")); recipes.put("carbonPlate", ItemPlates.getPlateByName("carbon"));
recipes.put("reBattery", new ItemStack(ModItems.reBattery));
} }
@Override @Override

View file

@ -1,8 +1,15 @@
package techreborn.items; package techreborn.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import techreborn.api.power.IEnergyItemInfo; import techreborn.api.power.IEnergyItemInfo;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.powerSystem.PoweredItem;
public class ItemLithiumBattery extends ItemTextureBase implements IEnergyItemInfo { public class ItemLithiumBattery extends ItemTextureBase implements IEnergyItemInfo {
@ -14,6 +21,30 @@ public class ItemLithiumBattery extends ItemTextureBase implements IEnergyItemIn
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge;
}
@SuppressWarnings(
{"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
itemList.add(itemStack);
ItemStack charged = new ItemStack(this, 1);
PoweredItem.setEnergy(getMaxPower(charged), charged);
itemList.add(charged);
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return true;
}
@Override @Override
public double getMaxPower(ItemStack stack) { public double getMaxPower(ItemStack stack) {
return 100000; return 100000;

View file

@ -0,0 +1,82 @@
package techreborn.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import techreborn.api.power.IEnergyItemInfo;
import techreborn.client.TechRebornCreativeTab;
import techreborn.powerSystem.PoweredItem;
public class ItemReBattery extends ItemTextureBase implements IEnergyItemInfo {
public ItemReBattery() {
super();
setMaxStackSize(1);
setMaxDamage(1);
setUnlocalizedName("techreborn.rebattery");
setCreativeTab(TechRebornCreativeTab.instance);
}
@SuppressWarnings(
{"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
itemList.add(itemStack);
ItemStack charged = new ItemStack(this, 1);
PoweredItem.setEnergy(getMaxPower(charged), charged);
itemList.add(charged);
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return true;
}
@Override
public double getMaxPower(ItemStack stack) {
return 10000;
}
@Override
public boolean canAcceptEnergy(ItemStack stack) {
return true;
}
@Override
public boolean canProvideEnergy(ItemStack stack) {
return true;
}
@Override
public double getMaxTransfer(ItemStack stack) {
return 64;
}
@Override
public int getStackTeir(ItemStack stack) {
return 1;
}
@Override
public String getTextureName(int damage) {
return "techreborn:items/tool/rebattery";
}
@Override
public int getMaxMeta() {
return 1;
}
}

View file

@ -378,6 +378,7 @@ item.techreborn.cell.sulfuricAcid.name=Sulfuric Acid Cell
item.techreborn.cell.tritium.name=Tritium Cell item.techreborn.cell.tritium.name=Tritium Cell
item.techreborn.cell.wolframium.name=Wolframium Cell item.techreborn.cell.wolframium.name=Wolframium Cell
item.techreborn.cell.empty.name=Empty Cell item.techreborn.cell.empty.name=Empty Cell
item.techreborn.rebattery.name=Battery
#Gems #Gems
item.techreborn.gem.ruby.name=Ruby item.techreborn.gem.ruby.name=Ruby

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B