Added basic battery and fixed issues with Lithium Battery
This commit is contained in:
parent
047625389d
commit
f947ef37a4
9 changed files with 123 additions and 5 deletions
|
@ -13,11 +13,11 @@ import techreborn.tiles.TileIndustrialGrinder;
|
|||
import techreborn.tiles.teir1.TileCompressor;
|
||||
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);
|
||||
setUnlocalizedName("techreborn.compresser");
|
||||
setUnlocalizedName("techreborn.compressor");
|
||||
}
|
||||
|
||||
@Override
|
|
@ -14,7 +14,7 @@ import techreborn.blocks.storage.BlockAesu;
|
|||
import techreborn.blocks.storage.BlockIDSU;
|
||||
import techreborn.blocks.storage.BlockLesu;
|
||||
import techreborn.blocks.storage.BlockLesuStorage;
|
||||
import techreborn.blocks.teir1.BlockCompresser;
|
||||
import techreborn.blocks.teir1.BlockCompressor;
|
||||
import techreborn.blocks.teir1.BlockElectricFurnace;
|
||||
import techreborn.blocks.teir1.BlockExtractor;
|
||||
import techreborn.blocks.teir1.BlockGrinder;
|
||||
|
@ -270,7 +270,7 @@ public class ModBlocks {
|
|||
GameRegistry.registerBlock(Extractor, "techreborn.extractor");
|
||||
GameRegistry.registerTileEntity(TileExtractor.class, "TileExtractorTR");
|
||||
|
||||
Compressor = new BlockCompresser(Material.iron);
|
||||
Compressor = new BlockCompressor(Material.iron);
|
||||
GameRegistry.registerBlock(Compressor, "techreborn.compressor");
|
||||
GameRegistry.registerTileEntity(TileCompressor.class, "TileCompressorTR");
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ public class ModItems {
|
|||
public static Item bucketSodiumpersulfate;
|
||||
public static Item bucketTritium;
|
||||
public static Item bucketWolframium;
|
||||
public static Item reBattery;
|
||||
|
||||
public static Item upgrades;
|
||||
|
||||
|
@ -121,6 +122,8 @@ public class ModItems {
|
|||
GameRegistry.registerItem(manuel, "techmanuel");
|
||||
uuMatter = new ItemUUmatter();
|
||||
GameRegistry.registerItem(uuMatter, "uumatter");
|
||||
reBattery = PoweredItem.createItem(ItemReBattery.class);
|
||||
GameRegistry.registerItem(reBattery, "rebattery");
|
||||
|
||||
// upgrades = new ItemUpgrade();
|
||||
// GameRegistry.registerItem(upgrades, "upgrades");
|
||||
|
|
|
@ -40,6 +40,7 @@ public class RecipeCompact implements IRecipeCompact {
|
|||
recipes.put("rubberWood", new ItemStack(ModBlocks.rubberLog));
|
||||
recipes.put("resin", ItemParts.getPartByName("rubberSap"));
|
||||
recipes.put("carbonPlate", ItemPlates.getPlateByName("carbon"));
|
||||
recipes.put("reBattery", new ItemStack(ModItems.reBattery));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
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 ItemLithiumBattery extends ItemTextureBase implements IEnergyItemInfo {
|
||||
|
||||
|
@ -13,6 +20,30 @@ public class ItemLithiumBattery extends ItemTextureBase implements IEnergyItemIn
|
|||
setUnlocalizedName("techreborn.lithiumBattery");
|
||||
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
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
|
|
82
src/main/java/techreborn/items/ItemReBattery.java
Normal file
82
src/main/java/techreborn/items/ItemReBattery.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -378,6 +378,7 @@ item.techreborn.cell.sulfuricAcid.name=Sulfuric Acid Cell
|
|||
item.techreborn.cell.tritium.name=Tritium Cell
|
||||
item.techreborn.cell.wolframium.name=Wolframium Cell
|
||||
item.techreborn.cell.empty.name=Empty Cell
|
||||
item.techreborn.rebattery.name=Battery
|
||||
|
||||
#Gems
|
||||
item.techreborn.gem.ruby.name=Ruby
|
||||
|
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
Binary file not shown.
After Width: | Height: | Size: 241 B |
Loading…
Reference in a new issue