Energy storages item charging fixes, transformers fixes, electric items fixes.
This commit is contained in:
parent
b42b5274b5
commit
be4f10b975
63 changed files with 2154 additions and 2123 deletions
|
@ -0,0 +1,18 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.tiles.transformers.TileEVTransformer;
|
||||
|
||||
public class BlockEVTransformer extends BlockTransformer {
|
||||
|
||||
public BlockEVTransformer() {
|
||||
super("evtransformer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileEVTransformer();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +1,21 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.transformers.TileHVTransformer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
public class BlockHVTransformer extends BlockTransformer
|
||||
{
|
||||
public class BlockHVTransformer extends BlockTransformer {
|
||||
|
||||
public BlockHVTransformer()
|
||||
{
|
||||
public BlockHVTransformer() {
|
||||
super("hvtransformer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileHVTransformer();
|
||||
}
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1 , 7));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,40 +1,21 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.tiles.transformers.TileLVTransformer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
public class BlockLVTransformer extends BlockTransformer
|
||||
{
|
||||
public class BlockLVTransformer extends BlockTransformer {
|
||||
|
||||
public BlockLVTransformer()
|
||||
{
|
||||
public BlockLVTransformer() {
|
||||
super("lvtransformer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileLVTransformer();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(this, 1 , 0));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,22 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.transformers.TileMVTransformer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
public class BlockMVTransformer extends BlockTransformer
|
||||
{
|
||||
public class BlockMVTransformer extends BlockTransformer {
|
||||
|
||||
public BlockMVTransformer()
|
||||
{
|
||||
public BlockMVTransformer() {
|
||||
super("mvtransformer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileMVTransformer();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1 , 6));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,14 +32,12 @@ import java.util.Random;
|
|||
/**
|
||||
* Created by Rushmead
|
||||
*/
|
||||
public abstract class BlockTransformer extends BaseTileBlock implements IRotationTexture, ITexturedBlock
|
||||
{
|
||||
public abstract class BlockTransformer extends BaseTileBlock implements IRotationTexture, ITexturedBlock {
|
||||
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
protected final String prefix = "techreborn:blocks/machine/storage/";
|
||||
public String name;
|
||||
|
||||
public BlockTransformer(String name)
|
||||
{
|
||||
public BlockTransformer(String name) {
|
||||
super(Material.ROCK);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn." + name.toLowerCase());
|
||||
|
@ -47,23 +45,20 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
this.name = name;
|
||||
}
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
|
||||
protected BlockStateContainer createBlockState() {
|
||||
FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
this.setDefaultFacing(worldIn, pos, state);
|
||||
}
|
||||
|
||||
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) {
|
||||
if (!worldIn.isRemote) {
|
||||
IBlockState sate = worldIn.getBlockState(pos.north());
|
||||
Block block = sate.getBlock();
|
||||
IBlockState state1 = worldIn.getBlockState(pos.south());
|
||||
|
@ -74,17 +69,13 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
Block block3 = state3.getBlock();
|
||||
EnumFacing enumfacing = state.getValue(FACING);
|
||||
|
||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1))
|
||||
{
|
||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1)) {
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
} else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock(state1) && !block.isFullBlock(state))
|
||||
{
|
||||
} else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock(state1) && !block.isFullBlock(state)) {
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
} else if (enumfacing == EnumFacing.WEST && block2.isFullBlock(state2) && !block3.isFullBlock(state2))
|
||||
{
|
||||
} else if (enumfacing == EnumFacing.WEST && block2.isFullBlock(state2) && !block3.isFullBlock(state2)) {
|
||||
enumfacing = EnumFacing.EAST;
|
||||
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2))
|
||||
{
|
||||
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2)) {
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
|
||||
|
@ -94,35 +85,28 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
||||
ItemStack stack)
|
||||
{
|
||||
ItemStack stack) {
|
||||
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
||||
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
|
||||
if (placer.rotationPitch < -50)
|
||||
{
|
||||
if (placer.rotationPitch < -50) {
|
||||
facing = EnumFacing.DOWN;
|
||||
} else if (placer.rotationPitch > 50)
|
||||
{
|
||||
} else if (placer.rotationPitch > 50) {
|
||||
facing = EnumFacing.UP;
|
||||
}
|
||||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop)
|
||||
{
|
||||
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop) {
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
if (tileEntity == null) {
|
||||
System.out.print("Null");
|
||||
return null;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
|
||||
System.out.print("Not INstance");
|
||||
System.out.print("Not Instance");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -130,22 +114,17 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
if (itemStack == null) {
|
||||
continue;
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (itemStack != null && itemStack.stackSize > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)
|
||||
{
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -159,68 +138,51 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int facingInt = getSideFromEnum(state.getValue(FACING));
|
||||
return facingInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
boolean active = false;
|
||||
EnumFacing facing = getSideFromint(meta);
|
||||
return this.getDefaultState().withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
public void setFacing(EnumFacing facing, World world, BlockPos pos)
|
||||
{
|
||||
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
|
||||
public EnumFacing getSideFromint(int i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
public EnumFacing getSideFromint(int i) {
|
||||
if (i == 0) {
|
||||
return EnumFacing.NORTH;
|
||||
} else if (i == 1)
|
||||
{
|
||||
} else if (i == 1) {
|
||||
return EnumFacing.SOUTH;
|
||||
} else if (i == 2)
|
||||
{
|
||||
} else if (i == 2) {
|
||||
return EnumFacing.EAST;
|
||||
} else if (i == 3)
|
||||
{
|
||||
} else if (i == 3) {
|
||||
return EnumFacing.WEST;
|
||||
} else if (i == 4)
|
||||
{
|
||||
} else if (i == 4) {
|
||||
return EnumFacing.UP;
|
||||
} else if (i == 5)
|
||||
{
|
||||
} else if (i == 5) {
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
public int getSideFromEnum(EnumFacing facing)
|
||||
{
|
||||
if (facing == EnumFacing.NORTH)
|
||||
{
|
||||
public int getSideFromEnum(EnumFacing facing) {
|
||||
if (facing == EnumFacing.NORTH) {
|
||||
return 0;
|
||||
} else if (facing == EnumFacing.SOUTH)
|
||||
{
|
||||
} else if (facing == EnumFacing.SOUTH) {
|
||||
return 1;
|
||||
} else if (facing == EnumFacing.EAST)
|
||||
{
|
||||
} else if (facing == EnumFacing.EAST) {
|
||||
return 2;
|
||||
} else if (facing == EnumFacing.WEST)
|
||||
{
|
||||
} else if (facing == EnumFacing.WEST) {
|
||||
return 3;
|
||||
} else if (facing == EnumFacing.UP)
|
||||
{
|
||||
} else if (facing == EnumFacing.UP) {
|
||||
return 4;
|
||||
} else if (facing == EnumFacing.DOWN)
|
||||
{
|
||||
} else if (facing == EnumFacing.DOWN) {
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
|
@ -228,51 +190,41 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + name.toLowerCase() + "_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + name.toLowerCase() + "_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + name.toLowerCase() + "_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + name.toLowerCase() + "_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + name.toLowerCase() + "_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing)
|
||||
{
|
||||
if (this instanceof IRotationTexture)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||
if (this instanceof IRotationTexture) {
|
||||
IRotationTexture rotationTexture = this;
|
||||
if (getFacing(blockState) == facing)
|
||||
{
|
||||
if (getFacing(blockState) == facing) {
|
||||
return rotationTexture.getFrontOff();
|
||||
}
|
||||
if (facing == EnumFacing.UP)
|
||||
{
|
||||
if (facing == EnumFacing.UP) {
|
||||
return rotationTexture.getTop();
|
||||
}
|
||||
if (facing == EnumFacing.DOWN)
|
||||
{
|
||||
if (facing == EnumFacing.DOWN) {
|
||||
return rotationTexture.getBottom();
|
||||
}
|
||||
return rotationTexture.getSide();
|
||||
|
@ -280,44 +232,39 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
return "techreborn:blocks/machine/machine_side";
|
||||
}
|
||||
|
||||
public EnumFacing getFacing(IBlockState state)
|
||||
{
|
||||
public EnumFacing getFacing(IBlockState state) {
|
||||
return state.getValue(FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum Facings implements Predicate<EnumFacing>,Iterable<EnumFacing>
|
||||
{
|
||||
public enum Facings implements Predicate<EnumFacing>, Iterable<EnumFacing> {
|
||||
ALL;
|
||||
|
||||
public EnumFacing[] facings()
|
||||
{
|
||||
return new EnumFacing[] { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST,
|
||||
EnumFacing.UP, EnumFacing.DOWN };
|
||||
public EnumFacing[] facings() {
|
||||
return new EnumFacing[]{
|
||||
EnumFacing.NORTH, EnumFacing.EAST,
|
||||
EnumFacing.SOUTH, EnumFacing.WEST,
|
||||
EnumFacing.UP, EnumFacing.DOWN};
|
||||
}
|
||||
|
||||
public EnumFacing random(Random rand)
|
||||
{
|
||||
public EnumFacing random(Random rand) {
|
||||
EnumFacing[] aenumfacing = this.facings();
|
||||
return aenumfacing[rand.nextInt(aenumfacing.length)];
|
||||
}
|
||||
|
||||
public boolean apply(EnumFacing p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != null;
|
||||
public boolean apply(EnumFacing facing) {
|
||||
return facing != null;
|
||||
}
|
||||
|
||||
public Iterator<EnumFacing> iterator()
|
||||
{
|
||||
public Iterator<EnumFacing> iterator() {
|
||||
return Iterators.forArray(this.facings());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
import org.lwjgl.input.Keyboard;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.Core;
|
||||
|
||||
|
@ -43,16 +43,16 @@ public class StackToolTipEvent
|
|||
color = TextFormatting.YELLOW;
|
||||
}
|
||||
event.getToolTip().add(color + ""
|
||||
+ PowerSystem.getLocalizedPower(
|
||||
+ PowerLocalization.getLocalizedPower(
|
||||
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getEnergy(event.getItemStack()))
|
||||
+ TextFormatting.LIGHT_PURPLE + " stored");
|
||||
event.getToolTip().add(Color.GREEN + ""
|
||||
+ PowerSystem.getLocalizedPower(
|
||||
+ PowerLocalization.getLocalizedPower(
|
||||
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getMaxPower(event.getItemStack()))
|
||||
+ TextFormatting.LIGHT_PURPLE + " max");
|
||||
event.getToolTip()
|
||||
.add(TextFormatting.GREEN + "" + percentage + "%" + TextFormatting.LIGHT_PURPLE + " charged");
|
||||
event.getToolTip().add(Color.GREEN + "" + PowerSystem.getLocalizedPower(
|
||||
event.getToolTip().add(Color.GREEN + "" + PowerLocalization.getLocalizedPower(
|
||||
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getMaxTransfer(event.getItemStack()))
|
||||
+ TextFormatting.LIGHT_PURPLE + " /tick in/out");
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.packets.PacketHandler;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerAESU;
|
||||
import techreborn.packets.PacketAesu;
|
||||
import techreborn.tiles.TileAesu;
|
||||
|
@ -60,11 +60,11 @@ public class GuiAESU extends GuiContainer
|
|||
{
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerAesu.euOut) + " /tick", 10, 20,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerAesu.euOut) + " /tick", 10, 20,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerAesu.storedEu) + " ", 10, 30,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerAesu.storedEu) + " ", 10, 30,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerAesu.euChange) + " change", 10, 40,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerAesu.euChange) + " change", 10, 40,
|
||||
Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerBatbox;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
|
@ -64,9 +64,9 @@ public class GuiBatbox extends GuiContainer
|
|||
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(generator.getMaxPower()), 25, this.ySize - 140,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(generator.getMaxPower()), 25, this.ySize - 140,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
||||
4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerDieselGenerator;
|
||||
import techreborn.tiles.generator.TileDieselGenerator;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class GuiDieselGenerator extends GuiContainer
|
|||
this.fontRendererObj.drawString(containerDieselGenerator.fluid + "", 10, 30, 16448255);
|
||||
|
||||
this.fontRendererObj.drawString("Power Amount", 10, 40, 16448255);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerDieselGenerator.energy) + "", 10, 50,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerDieselGenerator.energy) + "", 10, 50,
|
||||
16448255);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.api.reactor.FusionReactorRecipe;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerFusionReactor;
|
||||
import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
||||
|
||||
|
@ -30,7 +29,7 @@ public class GuiFusionReactor extends GuiContainer
|
|||
this.fontRendererObj.drawString(name, 87, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerFusionReactor.energy), 11, 8, 16448255);
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerFusionReactor.energy), 11, 8, 16448255);
|
||||
this.fontRendererObj.drawString("Coils: " + (containerFusionReactor.hasCoils ? "Yes" : "No"), 11, 16, 16448255);
|
||||
|
||||
if(containerFusionReactor.tickTime != -1) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerGenerator;
|
||||
import techreborn.tiles.generator.TileGenerator;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class GuiGenerator extends GuiContainer
|
|||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
||||
4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.packets.PacketHandler;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerIDSU;
|
||||
import techreborn.packets.PacketIdsu;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
|
@ -85,11 +85,11 @@ public class GuiIDSU extends GuiContainer
|
|||
{
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.idsu.name"), 75, 10,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerIDSU.euOut) + "/tick", 10, 22,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerIDSU.euOut) + "/tick", 10, 22,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerIDSU.storedEu), 10, 32,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerIDSU.storedEu), 10, 32,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerIDSU.euChange) + " change", 10, 42,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerIDSU.euChange) + " change", 10, 42,
|
||||
Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerLESU;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
||||
|
@ -43,14 +43,14 @@ public class GuiLESU extends GuiContainer
|
|||
{
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.lesu.name"), 40, 10,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerLesu.euOut) + "/t", 10, 20,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerLesu.euOut) + "/t", 10, 20,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerLesu.storedEu), 10, 30,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerLesu.storedEu), 10, 30,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerLesu.euChange) + " change", 10, 40,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerLesu.euChange) + " change", 10, 40,
|
||||
Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerLesu.euStorage) + " max", 10, 60,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerLesu.euStorage) + " max", 10, 60,
|
||||
Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerMFE;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
|
||||
|
@ -66,9 +66,9 @@ public class GuiMFE extends GuiContainer
|
|||
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), this.xSize - 60,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(generator.getMaxPower()), 110, this.ySize - 150,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(generator.getMaxPower()), 110, this.ySize - 150,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||
4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.container.ContainerMFSU;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
|
||||
|
@ -66,9 +66,9 @@ public class GuiMFSU extends GuiContainer
|
|||
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), this.xSize - 60,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(generator.getMaxPower()), 110, this.ySize - 150,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(generator.getMaxPower()), 110, this.ySize - 150,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||
4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.client.keybindings.KeyBindings;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -80,8 +80,8 @@ public class ChargeHud
|
|||
{
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRendererObj.drawString(color + PowerSystem.getLocalizedPower(CurrentCharge) + "/"
|
||||
+ PowerSystem.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||
mc.fontRendererObj.drawString(color + PowerLocalization.getLocalizedPower(CurrentCharge) + "/"
|
||||
+ PowerLocalization.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,8 @@ public class ChargeHud
|
|||
{
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRendererObj.drawString(color + PowerSystem.getLocalizedPower(CurrentCharge) + "/"
|
||||
+ PowerSystem.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||
mc.fontRendererObj.drawString(color + PowerLocalization.getLocalizedPower(CurrentCharge) + "/"
|
||||
+ PowerLocalization.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||
y += 20;
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class ChargeHud
|
|||
{
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRendererObj.drawString(color + PowerSystem.getLocalizedPower(CurrentCharge) + "/" + PowerSystem.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||
mc.fontRendererObj.drawString(color + PowerLocalization.getLocalizedPower(CurrentCharge) + "/" + PowerLocalization.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||
}
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
|
||||
/**
|
||||
* Created by Mark on 04/06/2016.
|
||||
|
|
|
@ -55,6 +55,7 @@ import techreborn.blocks.tier1.BlockElectricFurnace;
|
|||
import techreborn.blocks.tier1.BlockExtractor;
|
||||
import techreborn.blocks.tier1.BlockGrinder;
|
||||
import techreborn.blocks.tier1.BlockRecycler;
|
||||
import techreborn.blocks.transformers.BlockEVTransformer;
|
||||
import techreborn.blocks.transformers.BlockHVTransformer;
|
||||
import techreborn.blocks.transformers.BlockLVTransformer;
|
||||
import techreborn.blocks.transformers.BlockMVTransformer;
|
||||
|
@ -85,6 +86,7 @@ import techreborn.tiles.teir1.TileElectricFurnace;
|
|||
import techreborn.tiles.teir1.TileExtractor;
|
||||
import techreborn.tiles.teir1.TileGrinder;
|
||||
import techreborn.tiles.teir1.TileRecycler;
|
||||
import techreborn.tiles.transformers.TileEVTransformer;
|
||||
import techreborn.tiles.transformers.TileHVTransformer;
|
||||
import techreborn.tiles.transformers.TileLVTransformer;
|
||||
import techreborn.tiles.transformers.TileMVTransformer;
|
||||
|
@ -147,10 +149,12 @@ public class ModBlocks
|
|||
public static Block mfe;
|
||||
public static Block mfsu;
|
||||
public static Block scrapboxinator;
|
||||
public static Block pump;
|
||||
|
||||
public static Block lvt;
|
||||
public static Block mvt;
|
||||
public static Block hvt;
|
||||
public static Block pump;
|
||||
public static Block evt;
|
||||
|
||||
public static BlockOre ore;
|
||||
public static BlockOre2 ore2;
|
||||
|
@ -437,6 +441,10 @@ public class ModBlocks
|
|||
distributor = new BlockDistributor();
|
||||
registerBlock(distributor, "distributor");
|
||||
|
||||
evt = new BlockEVTransformer();
|
||||
registerBlock(evt, "evt");
|
||||
GameRegistry.registerTileEntity(TileEVTransformer.class, "TileEVTransformer");
|
||||
|
||||
registerOreDict();
|
||||
Core.logHelper.info("TechReborns Blocks Loaded");
|
||||
}
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
package techreborn.init;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.BucketHandler;
|
||||
import techreborn.Core;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.blocks.BlockMachineFrame;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.events.OreUnifier;
|
||||
import techreborn.items.*;
|
||||
import techreborn.items.armor.ItemLapotronPack;
|
||||
import techreborn.items.armor.ItemLithiumBatpack;
|
||||
|
@ -141,51 +136,51 @@ public class ModItems
|
|||
parts = new ItemParts();
|
||||
registerItem(parts, "part");
|
||||
|
||||
rockCutter = PoweredItem.createItem(ItemRockCutter.class);
|
||||
rockCutter = new ItemRockCutter();
|
||||
registerItem(rockCutter, "rockCutter");
|
||||
lithiumBatpack = PoweredItem.createItem(ItemLithiumBatpack.class);
|
||||
lithiumBatpack = new ItemLithiumBatpack();
|
||||
registerItem(lithiumBatpack, "lithiumBatpack");
|
||||
lapotronpack = PoweredItem.createItem(ItemLapotronPack.class);
|
||||
lapotronpack = new ItemLapotronPack();
|
||||
registerItem(lapotronpack, "lapotronPack");
|
||||
lithiumBattery = PoweredItem.createItem(ItemLithiumBattery.class);
|
||||
lithiumBattery = new ItemLithiumBattery();
|
||||
registerItem(lithiumBattery, "lithiumBattery");
|
||||
lapotronicOrb = PoweredItem.createItem(ItemLapotronicOrb.class);
|
||||
lapotronicOrb = new ItemLapotronicOrb();
|
||||
registerItem(lapotronicOrb, "lapotronicOrb");
|
||||
omniTool = PoweredItem.createItem(ItemOmniTool.class);
|
||||
omniTool = new ItemOmniTool();
|
||||
registerItem(omniTool, "omniTool");
|
||||
energyCrystal = PoweredItem.createItem(ItemEnergyCrystal.class);
|
||||
energyCrystal = new ItemEnergyCrystal();
|
||||
registerItem(energyCrystal, "energycrystal");
|
||||
lapotronCrystal = PoweredItem.createItem(ItemLapotronCrystal.class);
|
||||
lapotronCrystal = new ItemLapotronCrystal();
|
||||
registerItem(lapotronCrystal, "lapotroncrystal");
|
||||
|
||||
manual = new ItemTechManual();
|
||||
registerItem(manual, "techmanuel");
|
||||
uuMatter = new ItemUUmatter();
|
||||
registerItem(uuMatter, "uumatter");
|
||||
reBattery = PoweredItem.createItem(ItemReBattery.class);
|
||||
reBattery = new ItemReBattery();
|
||||
registerItem(reBattery, "rebattery");
|
||||
treeTap = new ItemTreeTap();
|
||||
registerItem(treeTap, "treetap");
|
||||
|
||||
ironDrill = PoweredItem.createItem(ItemSteelDrill.class);
|
||||
ironDrill = new ItemSteelDrill();
|
||||
registerItem(ironDrill, "irondrill");
|
||||
diamondDrill = PoweredItem.createItem(ItemDiamondDrill.class);
|
||||
diamondDrill = new ItemDiamondDrill();
|
||||
registerItem(diamondDrill, "diamonddrill");
|
||||
advancedDrill = PoweredItem.createItem(ItemAdvancedDrill.class);
|
||||
advancedDrill = new ItemAdvancedDrill();
|
||||
registerItem(advancedDrill, "advanceddrill");
|
||||
|
||||
ironChainsaw = PoweredItem.createItem(ItemSteelChainsaw.class);
|
||||
ironChainsaw = new ItemSteelChainsaw();
|
||||
registerItem(ironChainsaw, "ironchainsaw");
|
||||
diamondChainsaw = PoweredItem.createItem(ItemDiamondChainsaw.class);
|
||||
diamondChainsaw = new ItemDiamondChainsaw();
|
||||
registerItem(diamondChainsaw, "diamondchainsaw");
|
||||
advancedChainsaw = PoweredItem.createItem(ItemAdvancedChainsaw.class);
|
||||
advancedChainsaw = new ItemAdvancedChainsaw();
|
||||
registerItem(advancedChainsaw, "advancedchainsaw");
|
||||
|
||||
steelJackhammer = PoweredItem.createItem(ItemSteelJackhammer.class);
|
||||
steelJackhammer = new ItemSteelJackhammer();
|
||||
registerItem(steelJackhammer, "steeljackhammer");
|
||||
diamondJackhammer = PoweredItem.createItem(ItemDiamondJackhammer.class);
|
||||
diamondJackhammer = new ItemDiamondJackhammer();
|
||||
registerItem(diamondJackhammer, "diamondjackhammer");
|
||||
advancedJackhammer = PoweredItem.createItem(ItemAdvancedJackhammer.class);
|
||||
advancedJackhammer = new ItemAdvancedJackhammer();
|
||||
registerItem(advancedJackhammer, "ironjackhammer");
|
||||
|
||||
if(ConfigTechReborn.enableGemArmorAndTools){
|
||||
|
@ -274,7 +269,7 @@ public class ModItems
|
|||
wrench = new ItemWrench();
|
||||
registerItem(wrench, "wrench");
|
||||
|
||||
nanosaber = PoweredItem.createItem(ItemNanosaber.class);
|
||||
nanosaber = new ItemNanosaber();
|
||||
registerItem(nanosaber, "nanosaber");
|
||||
|
||||
scrapBox = new ItemScrapBox();
|
||||
|
@ -286,7 +281,7 @@ public class ModItems
|
|||
upgrades = new ItemUpgrades();
|
||||
registerItem(upgrades, "upgrades");
|
||||
|
||||
cloakingDevice = PoweredItem.createItem(ItemCloakingDevice.class);
|
||||
cloakingDevice = new ItemCloakingDevice();
|
||||
registerItem(cloakingDevice, "cloakingdevice");
|
||||
|
||||
missingRecipe = new ItemMissingRecipe().setUnlocalizedName("missingRecipe");
|
||||
|
|
|
@ -15,9 +15,8 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileAesu;
|
||||
|
||||
public class ItemBlockAesu extends ItemBlock
|
||||
{
|
||||
|
@ -35,7 +34,7 @@ public class ItemBlockAesu extends ItemBlock
|
|||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
||||
list.add(PowerSystem.getLocalizedPower(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("energy")));
|
||||
list.add(PowerLocalization.getLocalizedPower(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("energy")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,13 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInfo {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronicOrbMaxCharge;
|
||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||
public double transferLimit = 10000;
|
||||
|
||||
public ItemLapotronicOrb()
|
||||
{
|
||||
public ItemLapotronicOrb() {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(13);
|
||||
|
@ -22,44 +20,38 @@ public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInf
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/lapotronicEnergyOrb";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package techreborn.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -13,23 +16,24 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
|
||||
public static final int tier = ConfigTechReborn.LapotronPackTier;
|
||||
public double transferLimit = 100000;
|
||||
public static final int MAX_CHARGE = ConfigTechReborn.LapotronPackCharge;
|
||||
public static final int TIER = ConfigTechReborn.LapotronPackTier;
|
||||
public static final double TRANSFER_LIMIT = 100000;
|
||||
|
||||
public ItemLapotronPack()
|
||||
{
|
||||
public ItemLapotronPack() {
|
||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.lapotronpack");
|
||||
|
@ -39,72 +43,84 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return "techreborn:" + "textures/models/lapotronpack.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
return maxCharge;
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return MAX_CHARGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return TRANSFER_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return TIER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||
if(player.inventory.getStackInSlot(i) != null){
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if(item.getItem() instanceof IEnergyItemInfo){
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item.getItem();
|
||||
if(energyItemInfo.getMaxPower(item) != PoweredItem.getEnergy(item)){
|
||||
if(PoweredItem.canUseEnergy(energyItemInfo.getMaxPower(item), itemStack)){
|
||||
PoweredItem.useEnergy(energyItemInfo.getMaxTransfer(item), itemStack);
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(item) + energyItemInfo.getMaxTransfer(item), item);
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null) {
|
||||
ItemStack itemStack1 = player.inventory.getStackInSlot(i);
|
||||
if (itemStack1 != null) {
|
||||
Item item1 = itemStack1.getItem();
|
||||
if (item1 instanceof IEnergyInterfaceItem ||
|
||||
item1 instanceof IEnergyContainerItem ||
|
||||
item1 instanceof IElectricItem ||
|
||||
itemStack1.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, null)) {
|
||||
EnergyItem.charge(itemStack1, new IEnergyInterfaceTile() {
|
||||
@Override
|
||||
public double getEnergy() {
|
||||
return EnergyItem.getEnergy(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(double energy) {
|
||||
EnergyItem.setEnergy(energy, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return MAX_CHARGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.EXTREME;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,28 +128,24 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/lapotronicPack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package techreborn.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -13,127 +16,135 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||
public double transferLimit = 10000;
|
||||
|
||||
public ItemLithiumBatpack()
|
||||
{
|
||||
public ItemLithiumBatpack() {
|
||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("techreborn.lithiumbatpack");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||
if(player.inventory.getStackInSlot(i) != null){
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if(item.getItem() instanceof IEnergyItemInfo){
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item.getItem();
|
||||
if(energyItemInfo.getMaxPower(item) != PoweredItem.getEnergy(item)){
|
||||
if(PoweredItem.canUseEnergy(energyItemInfo.getMaxPower(item), itemStack)){
|
||||
PoweredItem.useEnergy(energyItemInfo.getMaxTransfer(item), itemStack);
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(item) + energyItemInfo.getMaxTransfer(item), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
|
||||
{
|
||||
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null) {
|
||||
ItemStack itemStack1 = player.inventory.getStackInSlot(i);
|
||||
Item item1 = itemStack1.getItem();
|
||||
if (item1 instanceof IEnergyInterfaceItem ||
|
||||
item1 instanceof IEnergyContainerItem ||
|
||||
item1 instanceof IElectricItem ||
|
||||
itemStack1.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, null)) {
|
||||
EnergyItem.charge(itemStack1, new IEnergyInterfaceTile() {
|
||||
@Override
|
||||
public double getEnergy() {
|
||||
return EnergyItem.getEnergy(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public void setEnergy(double energy) {
|
||||
EnergyItem.setEnergy(energy, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.MEDIUM;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
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);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/lithiumBatpack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ public class ItemTRArmour extends ItemArmor implements ITexturedItem {
|
|||
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
|
||||
super(material, material.getDamageReductionAmount(slot), slot);
|
||||
if (slot == EntityEquipmentSlot.HEAD)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Helmet");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Helmet");
|
||||
if (slot == EntityEquipmentSlot.CHEST)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Chestplate");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Chestplate");
|
||||
if (slot == EntityEquipmentSlot.LEGS)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Leggings");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Leggings");
|
||||
if (slot == EntityEquipmentSlot.FEET)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Boots");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Boots");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material = material;
|
||||
|
@ -63,4 +63,5 @@ public class ItemTRArmour extends ItemArmor implements ITexturedItem {
|
|||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,45 +2,42 @@ package techreborn.items.battery;
|
|||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.items.ItemTRNoDestroy;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo {
|
||||
|
||||
String name = "null";
|
||||
int maxEnergy = 0;
|
||||
int maxTransfer = 0;
|
||||
int tier = 0;
|
||||
|
||||
public ItemBattery(String name, int maxEnergy, int maxTransfer, int tier)
|
||||
{
|
||||
public ItemBattery(String name, int maxEnergy, int maxTransfer, int tier) {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
setUnlocalizedName("techreborn."+name);
|
||||
this.name=name;
|
||||
this.maxEnergy=maxEnergy;
|
||||
this.maxTransfer=maxTransfer;
|
||||
this.tier=tier;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn,
|
||||
@Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (stack != null && PoweredItem.getEnergy(stack) == 0.0)
|
||||
{
|
||||
setUnlocalizedName("techreborn." + name);
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.tier = tier;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn,
|
||||
@Nullable EntityLivingBase entityIn) {
|
||||
if (stack != null && EnergyItem.getEnergy(stack) == 0.0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
|
@ -48,59 +45,56 @@ public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
String max = PowerLocalization.getLocalizedPower(getMaxPower(stack));
|
||||
String energy = PowerLocalization.getLocalizedPower(EnergyItem.getEnergy(stack));
|
||||
tooltip.add(TextFormatting.GRAY + energy + " / " + max);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
return 1 - (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return maxTransfer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@ public class ItemEnergyCrystal extends ItemBattery {
|
|||
public ItemEnergyCrystal() {
|
||||
super("energyCrystal", 100000, 512, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
public ItemLapotronCrystal() {
|
||||
super("lapotronCrystal", 1000000, 512, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,5 +5,6 @@ public class ItemLithiumBattery extends ItemBattery {
|
|||
public ItemLithiumBattery() {
|
||||
super("lithiumBattery", 100000, 512, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package techreborn.items.battery;
|
||||
|
||||
public class ItemReBattery extends ItemBattery
|
||||
{
|
||||
public class ItemReBattery extends ItemBattery {
|
||||
|
||||
public ItemReBattery()
|
||||
{
|
||||
public ItemReBattery() {
|
||||
super("rebattery", 10000, 64, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,12 +20,13 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||
{
|
||||
|
||||
|
@ -137,14 +138,14 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
|
|
@ -12,78 +12,65 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.items.ItemTextureBase;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemInfo {
|
||||
public static int Teir = ConfigTechReborn.CloakingDeviceTier;
|
||||
public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge;
|
||||
public static int Limit = 100;
|
||||
public static boolean isActive;
|
||||
private int armorType = 1;
|
||||
|
||||
public ItemCloakingDevice()
|
||||
{
|
||||
public ItemCloakingDevice() {
|
||||
setUnlocalizedName("techreborn.cloakingdevice");
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
if (PoweredItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack))
|
||||
{
|
||||
PoweredItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (EnergyItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack)) {
|
||||
EnergyItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
||||
player.setInvisible(true);
|
||||
} else
|
||||
{
|
||||
if (!player.isPotionActive(MobEffects.INVISIBILITY))
|
||||
{
|
||||
} else {
|
||||
if (!player.isPotionActive(MobEffects.INVISIBILITY)) {
|
||||
player.setInvisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return MaxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return Limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return Teir;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
ItemStack itemstack1 = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack1 == null)
|
||||
{
|
||||
if (itemstack1 == null) {
|
||||
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
|
@ -92,37 +79,33 @@ public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemIn
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
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);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/cloakingDevice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,49 +12,42 @@ import net.minecraft.util.text.TextComponentString;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.items.ItemTextureBase;
|
||||
|
||||
/**
|
||||
* Created by Mark on 20/03/2016.
|
||||
*/
|
||||
public class ItemDebugTool extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemDebugTool extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemDebugTool()
|
||||
{
|
||||
public ItemDebugTool() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.debug");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/misc/debug";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof IEnergyInterfaceTile)
|
||||
{
|
||||
if (!tile.getWorld().isRemote)
|
||||
{
|
||||
playerIn.addChatComponentMessage(
|
||||
new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
|
||||
+ PowerSystem.getLocalizedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||
if (tile instanceof IEnergyInterfaceTile) {
|
||||
if (!tile.getWorld().isRemote) {
|
||||
playerIn.addChatComponentMessage(new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
|
||||
+ PowerLocalization.getLocalizedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,4 +32,5 @@ public class ItemDiamondChainsaw extends ItemChainsaw
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,4 +32,5 @@ public class ItemDiamondDrill extends ItemDrill
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,4 +23,5 @@ public class ItemDiamondJackhammer extends ItemJackhammer
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
@ -31,8 +30,9 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||
{
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld {
|
||||
|
||||
public static int tier = 1;
|
||||
public int maxCharge = 1;
|
||||
|
@ -40,8 +40,7 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
public float unpoweredSpeed = 2.0F;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial)
|
||||
{
|
||||
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial) {
|
||||
super(material);
|
||||
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -54,111 +53,107 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
this.unpoweredSpeed = unpoweredSpeed;
|
||||
}
|
||||
|
||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
|
||||
{
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0) {
|
||||
EnergyItem.useEnergy(cost, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
if (!PoweredItem.canUseEnergy(cost, stack))
|
||||
{
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if (!EnergyItem.canUseEnergy(cost, stack)) {
|
||||
return unpoweredSpeed;
|
||||
}
|
||||
if (Items.WOODEN_PICKAXE.getStrVsBlock(stack, state) > 1.0F
|
||||
|| Items.WOODEN_SHOVEL.getStrVsBlock(stack, state) > 1.0F)
|
||||
{
|
||||
|| Items.WOODEN_SHOVEL.getStrVsBlock(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return super.getStrVsBlock(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1)
|
||||
{
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override public boolean isRepairable()
|
||||
{
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override public int getStackTier(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item,
|
||||
CreativeTabs tab, List<ItemStack> itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/nullDrill";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,26 +21,24 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.power.EnergyItem;
|
||||
import techreborn.utils.OreDictUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld {
|
||||
|
||||
public static int tier = 1;
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemJackhammer(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier)
|
||||
{
|
||||
public ItemJackhammer(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier) {
|
||||
super(material);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -49,31 +47,27 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
setUnlocalizedName(unlocalizedName);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.maxCharge = energyCapacity;
|
||||
this.tier = tier;
|
||||
ItemJackhammer.tier = tier;
|
||||
}
|
||||
|
||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
|
||||
{
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0) {
|
||||
EnergyItem.useEnergy(cost, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
// TODO needs // FIXME: 13/03/2016
|
||||
return OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, null);
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return OreDictUtils.isOre(state, "stone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost,
|
||||
stack)) {
|
||||
if (OreDictUtils.isOre(state, "stone") && EnergyItem.canUseEnergy(cost, stack)) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return 0.5F;
|
||||
|
@ -81,100 +75,86 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)
|
||||
{
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
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);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
if (EnergyItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||
return 0;
|
||||
}
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/nullJackhammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,35 +24,31 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.MessageIDs;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
||||
public int cost = 250;
|
||||
|
||||
public ItemNanosaber()
|
||||
{
|
||||
public ItemNanosaber() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
setUnlocalizedName("techreborn.nanosaber");
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn,
|
||||
@Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (stack != null && stack.getTagCompound().getBoolean("isActive"))
|
||||
{
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn,
|
||||
@Nullable EntityLivingBase entityIn) {
|
||||
if (stack != null && stack.getTagCompound().getBoolean("isActive")) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
|
@ -60,16 +56,15 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
});
|
||||
}
|
||||
|
||||
@Override public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,
|
||||
ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,
|
||||
ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
int modifier = 0;
|
||||
if (stack.getTagCompound().getBoolean("isActive"))
|
||||
modifier = 9;
|
||||
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(),
|
||||
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(),
|
||||
|
@ -78,22 +73,21 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
return multimap;
|
||||
}
|
||||
|
||||
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1)
|
||||
{
|
||||
if (PoweredItem.canUseEnergy(cost, itemstack))
|
||||
{
|
||||
PoweredItem.useEnergy(cost, itemstack);
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1) {
|
||||
if (EnergyItem.canUseEnergy(cost, itemstack)) {
|
||||
EnergyItem.useEnergy(cost, itemstack);
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack inactiveUncharged = new ItemStack(ModItems.nanosaber);
|
||||
inactiveUncharged.setTagCompound(new NBTTagCompound());
|
||||
inactiveUncharged.getTagCompound().setBoolean("isActive", false);
|
||||
|
@ -101,7 +95,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
ItemStack inactiveCharged = new ItemStack(ModItems.nanosaber);
|
||||
inactiveCharged.setTagCompound(new NBTTagCompound());
|
||||
inactiveCharged.getTagCompound().setBoolean("isActive", false);
|
||||
PoweredItem.setEnergy(getMaxPower(inactiveCharged), inactiveCharged);
|
||||
EnergyItem.setEnergy(getMaxPower(inactiveCharged), inactiveCharged);
|
||||
|
||||
ItemStack activeUncharged = new ItemStack(ModItems.nanosaber);
|
||||
activeUncharged.setTagCompound(new NBTTagCompound());
|
||||
|
@ -110,7 +104,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
ItemStack activeCharged = new ItemStack(ModItems.nanosaber);
|
||||
activeCharged.setTagCompound(new NBTTagCompound());
|
||||
activeCharged.getTagCompound().setBoolean("isActive", true);
|
||||
PoweredItem.setEnergy(getMaxPower(activeCharged), activeCharged);
|
||||
EnergyItem.setEnergy(getMaxPower(activeCharged), activeCharged);
|
||||
|
||||
itemList.add(inactiveUncharged);
|
||||
itemList.add(inactiveCharged);
|
||||
|
@ -118,43 +112,35 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
itemList.add(activeCharged);
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive"))
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberInactive"));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberActive"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive"))
|
||||
{
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||
EnumHand hand) {
|
||||
if (player.isSneaking()) {
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setBoolean("isActive", true);
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat)
|
||||
{
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
.translateToLocal("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
stack.getTagCompound().setBoolean("isActive", false);
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat)
|
||||
{
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
|
@ -165,45 +151,45 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
|
||||
{
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
if (EnergyItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||
return 0;
|
||||
}
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean isRepairable()
|
||||
{
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return 100000;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override public int getStackTier(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,23 +23,21 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
||||
public static final int tier = ConfigTechReborn.OmniToolTier;
|
||||
public int cost = 100;
|
||||
public int hitCost = 125;
|
||||
|
||||
public ItemOmniTool()
|
||||
{
|
||||
public ItemOmniTool() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
efficiencyOnProperMaterial = 13F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -50,16 +48,13 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||
EnergyItem.useEnergy(cost, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.DIAMOND_AXE.canHarvestBlock(state) || Items.DIAMOND_SWORD.canHarvestBlock(state)
|
||||
|| Items.DIAMOND_PICKAXE.canHarvestBlock(state) || Items.DIAMOND_SHOVEL.canHarvestBlock(state)
|
||||
|| Items.SHEARS.canHarvestBlock(state);
|
||||
|
@ -84,107 +79,91 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
// }
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker)
|
||||
{
|
||||
if (PoweredItem.canUseEnergy(hitCost, itemstack))
|
||||
{
|
||||
PoweredItem.useEnergy(hitCost, itemstack);
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
|
||||
if (EnergyItem.canUseEnergy(hitCost, itemstack)) {
|
||||
EnergyItem.useEnergy(hitCost, itemstack);
|
||||
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
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);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/omnitool";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,23 +19,21 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.power.EnergyItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.RockCutterCharge;
|
||||
public static final int tier = ConfigTechReborn.RockCutterTier;
|
||||
public int cost = 500;
|
||||
|
||||
public ItemRockCutter()
|
||||
{
|
||||
public ItemRockCutter() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setUnlocalizedName("techreborn.rockcutter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -44,120 +42,115 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack) + 1) == 0)
|
||||
{
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
EnergyItem.useEnergy(cost, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
if (Items.DIAMOND_PICKAXE.canHarvestBlock(state))
|
||||
{
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
if (Items.DIAMOND_PICKAXE.canHarvestBlock(state)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public int getHarvestLevel(ItemStack stack, String toolClass)
|
||||
{
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
|
||||
if (!stack.isItemEnchanted())
|
||||
{
|
||||
if (!stack.isItemEnchanted()) {
|
||||
stack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
|
||||
return super.getHarvestLevel(stack, toolClass);
|
||||
}
|
||||
|
||||
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
if (!PoweredItem.canUseEnergy(cost, stack))
|
||||
{
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if (!EnergyItem.canUseEnergy(cost, stack)) {
|
||||
return 2F;
|
||||
}else{
|
||||
} else {
|
||||
return Items.DIAMOND_PICKAXE.getStrVsBlock(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean isRepairable()
|
||||
{
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn)
|
||||
{
|
||||
@Override
|
||||
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) {
|
||||
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
}
|
||||
|
||||
@Override public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override public int getStackTier(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemStack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
charged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
||||
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/rockcutter";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,31 +3,29 @@ package techreborn.items.tools;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemSteelChainsaw extends ItemChainsaw
|
||||
{
|
||||
|
||||
public ItemSteelChainsaw()
|
||||
{
|
||||
super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge,
|
||||
public class ItemSteelChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemSteelChainsaw() {
|
||||
super(ToolMaterial.IRON, "techreborn.ironChainsaw",
|
||||
ConfigTechReborn.IronChainsawCharge,
|
||||
ConfigTechReborn.IronChainsawTier, 2.0F);
|
||||
this.cost = 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.IRON_AXE.canHarvestBlock(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/steelChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,31 +3,27 @@ package techreborn.items.tools;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemSteelDrill extends ItemDrill
|
||||
{
|
||||
public class ItemSteelDrill extends ItemDrill {
|
||||
|
||||
public ItemSteelDrill()
|
||||
{
|
||||
public ItemSteelDrill() {
|
||||
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge,
|
||||
ConfigTechReborn.IronDrillTier, 0.5F, 10F);
|
||||
this.cost = 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.IRON_PICKAXE.canHarvestBlock(state) || Items.IRON_SHOVEL.canHarvestBlock(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/steelDrill";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemSteelJackhammer extends ItemJackhammer
|
||||
{
|
||||
|
||||
public ItemSteelJackhammer()
|
||||
{
|
||||
super(ToolMaterial.DIAMOND, "techreborn.steelJackhammer", ConfigTechReborn.SteelJackhammerCharge,
|
||||
public class ItemSteelJackhammer extends ItemJackhammer {
|
||||
|
||||
public ItemSteelJackhammer() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.steelJackhammer",
|
||||
ConfigTechReborn.SteelJackhammerCharge,
|
||||
ConfigTechReborn.SteelJackhammerTier);
|
||||
this.cost = 50;
|
||||
this.efficiencyOnProperMaterial = 12F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/steelJackhammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.IHandHeld;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -20,13 +17,14 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemTRAxe extends ItemTool implements ITexturedItem , IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.PLANKS, Blocks.BOOKSHELF,
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF,
|
||||
Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK,
|
||||
Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE });
|
||||
Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);
|
||||
|
||||
public ItemTRAxe(ToolMaterial material) {
|
||||
super(material, EFFECTIVE_ON);
|
||||
|
@ -60,8 +58,11 @@ public class ItemTRAxe extends ItemTool implements ITexturedItem , IHandHeld {
|
|||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,40 +13,37 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRHoe extends ItemHoe implements ITexturedItem, IHandHeld
|
||||
{
|
||||
public class ItemTRHoe extends ItemHoe implements ITexturedItem, IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
public ItemTRHoe(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Hoe");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_hoe";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_hoe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,40 +13,36 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem , IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
public ItemTRPickaxe(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Pickaxe");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_pickaxe";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_pickaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,40 +13,36 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRSpade extends ItemSpade implements ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemTRSpade extends ItemSpade implements ITexturedItem , IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
public ItemTRSpade(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Spade");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Spade");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_shovel";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_shovel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,40 +13,36 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRSword extends ItemSword implements ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemTRSword extends ItemSword implements ITexturedItem , IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
public ItemTRSword(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Sword");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Sword");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_sword";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_sword";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,9 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.items.ItemTextureBase;
|
||||
|
||||
public class ItemTechManual extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemTechManual extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemTechManual()
|
||||
{
|
||||
public ItemTechManual() {
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.manual");
|
||||
setMaxStackSize(1);
|
||||
|
@ -28,28 +26,19 @@ public class ItemTechManual extends ItemTextureBase implements ITexturedItem
|
|||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY,
|
||||
(int) player.posY);
|
||||
EnumHand hand) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/manual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.wip"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,9 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public class ItemTreeTap extends Item implements ITexturedItem
|
||||
{
|
||||
public class ItemTreeTap extends Item implements ITexturedItem {
|
||||
|
||||
public ItemTreeTap()
|
||||
{
|
||||
public ItemTreeTap() {
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(20);
|
||||
setUnlocalizedName("techreborn.treetap");
|
||||
|
@ -24,27 +22,30 @@ public class ItemTreeTap extends Item implements ITexturedItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return stack.getMetadata() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/treetap";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,35 +37,27 @@ import java.util.Random;
|
|||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class ItemWrench extends ItemTR implements ITexturedItem
|
||||
{
|
||||
public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||
|
||||
public ItemWrench()
|
||||
{
|
||||
public ItemWrench() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.wrench");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
{
|
||||
if (world.isAirBlock(pos))
|
||||
{
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
if (world.isAirBlock(pos)) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile == null)
|
||||
{
|
||||
if (tile == null) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (!player.isSneaking() && !player.worldObj.isRemote)
|
||||
{
|
||||
if (tile instanceof TileMachineBase)
|
||||
{
|
||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP)
|
||||
{
|
||||
if (!player.isSneaking() && !player.worldObj.isRemote) {
|
||||
if (tile instanceof TileMachineBase) {
|
||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP) {
|
||||
((TileMachineBase) tile).setFacing(side);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
@ -74,60 +66,46 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if (world.isAirBlock(pos))
|
||||
{
|
||||
if (world.isAirBlock(pos)) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile == null)
|
||||
{
|
||||
if (tile == null) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
if (tile instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) tile;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.stackSize > 0)
|
||||
{
|
||||
if (itemStack != null) {
|
||||
if (itemStack.stackSize > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
|
||||
if (!(((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid)
|
||||
|| !(((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid))
|
||||
{
|
||||
|| !(((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)) {
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile instanceof IWrenchable)
|
||||
{
|
||||
if (((IWrenchable) tile).wrenchCanRemove(player))
|
||||
{
|
||||
if (tile instanceof IWrenchable) {
|
||||
if (((IWrenchable) tile).wrenchCanRemove(player)) {
|
||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||
if (itemStack == null)
|
||||
{
|
||||
if (itemStack == null) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
items.add(itemStack);
|
||||
}
|
||||
if (!items.isEmpty())
|
||||
{
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
if (!items.isEmpty()) {
|
||||
for (ItemStack itemStack : items) {
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
|
@ -138,8 +116,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY,
|
||||
pos.getZ() + dZ, itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
if (itemStack.hasTagCompound()) {
|
||||
entityItem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
@ -148,8 +125,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
|
@ -157,8 +133,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
world.playSound(null, player.posX, player.posY,
|
||||
player.posZ, ModSounds.dismantle,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
@ -167,29 +142,30 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
}
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}else{
|
||||
} else {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/wrench";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) public boolean isFull3D()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
295
src/main/java/techreborn/power/EnergyItem.java
Normal file
295
src/main/java/techreborn/power/EnergyItem.java
Normal file
|
@ -0,0 +1,295 @@
|
|||
package techreborn.power;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
||||
public class EnergyItem {
|
||||
|
||||
public static void discharge(ItemStack itemStack, IEnergyInterfaceTile tile) {
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
if(item instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo energyInterfaceItem = (IEnergyItemInfo) item;
|
||||
if(energyInterfaceItem.canProvideEnergy(itemStack) && getEnergy(itemStack) > 0) {
|
||||
double extractEnergy = tile.getMaxPower() - tile.getEnergy();
|
||||
double input = extractEnergy > tile.getMaxInput() ? tile.getMaxInput() : extractEnergy;
|
||||
double transferLimit = energyInterfaceItem.getMaxTransfer(itemStack);
|
||||
double remove = input > transferLimit ? transferLimit : input;
|
||||
System.out.println(remove);
|
||||
double extracted = useEnergy(remove, itemStack);
|
||||
if(extracted != 0) {
|
||||
tile.addEnergy(extracted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(item instanceof IEnergyInterfaceItem) {
|
||||
IEnergyInterfaceItem energyInterfaceItem = (IEnergyInterfaceItem) item;
|
||||
if(energyInterfaceItem.canProvideEnergy(itemStack) && energyInterfaceItem.getEnergy(itemStack) > 0) {
|
||||
double extractEnergy = tile.getMaxPower() - tile.getEnergy();
|
||||
double input = extractEnergy > tile.getMaxInput() ? tile.getMaxInput() : extractEnergy;
|
||||
double transferLimit = energyInterfaceItem.getMaxTransfer(itemStack);
|
||||
double remove = input > transferLimit ? transferLimit : input;
|
||||
double extracted = energyInterfaceItem.useEnergy(remove, itemStack);
|
||||
if(extracted != 0) {
|
||||
tile.addEnergy(extracted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(RebornCoreConfig.getRebornPower().rf() &&
|
||||
item instanceof IEnergyContainerItem) {
|
||||
double extractEnergy = tile.getMaxPower() - tile.getEnergy();
|
||||
double input = extractEnergy > tile.getMaxInput() ? tile.getMaxInput() : extractEnergy;
|
||||
int extractRF = (int) (input * RebornCoreConfig.euPerRF);
|
||||
IEnergyContainerItem energyContainer = (IEnergyContainerItem) item;
|
||||
if(energyContainer.getEnergyStored(itemStack) > 0) {
|
||||
int extractedRF = energyContainer.extractEnergy(itemStack, extractRF, false);
|
||||
if (extractedRF != 0) {
|
||||
float extractedEU = extractedRF / (RebornCoreConfig.euPerRF * 1F);
|
||||
tile.addEnergy(extractedEU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("IC2") &&
|
||||
RebornCoreConfig.getRebornPower().eu() &&
|
||||
item instanceof IElectricItem) {
|
||||
IElectricItem electricItem = (IElectricItem) item;
|
||||
if(electricItem.canProvideEnergy(itemStack) && ElectricItem.manager.getCharge(itemStack) > 0) {
|
||||
double extractEnergy = tile.getMaxPower() - tile.getEnergy();
|
||||
double input = extractEnergy > tile.getMaxInput() ? tile.getMaxInput() : extractEnergy;
|
||||
double extracted = ElectricItem.manager.discharge(itemStack, input, electricItem.getTier(itemStack), false, true, false);
|
||||
if(extracted != 0) {
|
||||
tile.addEnergy(extracted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("Tesla") &&
|
||||
RebornCoreConfig.getRebornPower().tesla() &&
|
||||
itemStack.hasCapability(TeslaCapabilities.CAPABILITY_PRODUCER, null)) {
|
||||
ITeslaProducer producer = itemStack.getCapability(TeslaCapabilities.CAPABILITY_PRODUCER, null);
|
||||
double extractEnergy = tile.getMaxPower() - tile.getEnergy();
|
||||
double input = extractEnergy > tile.getMaxInput() ? tile.getMaxInput() : extractEnergy;
|
||||
long extractRF = (long) (input * RebornCoreConfig.euPerRF);
|
||||
long extractedRF = producer.takePower(extractRF, false);
|
||||
if(extractedRF != 0) {
|
||||
float extractedEU = extractedRF / (RebornCoreConfig.euPerRF * 1F);
|
||||
tile.addEnergy(extractedEU);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void charge(ItemStack itemStack, IEnergyInterfaceTile tile) {
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
|
||||
if(item instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item;
|
||||
if(energyItemInfo.canAcceptEnergy(itemStack) &&
|
||||
getEnergy(itemStack) < energyItemInfo.getMaxPower(itemStack)) {
|
||||
double storedEnergy = tile.getEnergy();
|
||||
double output = storedEnergy > tile.getMaxOutput() ? tile.getMaxOutput() : storedEnergy;
|
||||
double transferLimit = energyItemInfo.getMaxTransfer(itemStack);
|
||||
double add = output > transferLimit ? transferLimit : output;
|
||||
double addedEnergy = addEnergy(add, itemStack);
|
||||
if(addedEnergy != 0) {
|
||||
tile.useEnergy(addedEnergy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(item instanceof IEnergyInterfaceItem) {
|
||||
IEnergyInterfaceItem energyItem = (IEnergyInterfaceItem) item;
|
||||
if(energyItem.canAcceptEnergy(itemStack) &&
|
||||
energyItem.getEnergy(itemStack) < energyItem.getMaxPower(itemStack)) {
|
||||
double storedEnergy = tile.getEnergy();
|
||||
double output = storedEnergy > tile.getMaxOutput() ? tile.getMaxOutput() : storedEnergy;
|
||||
double transferLimit = energyItem.getMaxTransfer(itemStack);
|
||||
double add = output > transferLimit ? transferLimit : output;
|
||||
double addedEnergy = energyItem.addEnergy(add, itemStack);
|
||||
if(addedEnergy != 0) {
|
||||
tile.useEnergy(addedEnergy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(RebornCoreConfig.getRebornPower().rf() &&
|
||||
item instanceof IEnergyContainerItem) {
|
||||
double storedEnergy = tile.getEnergy();
|
||||
double output = storedEnergy > tile.getMaxOutput() ? tile.getMaxOutput() : storedEnergy;
|
||||
int insertRF = (int) (output * RebornCoreConfig.euPerRF);
|
||||
IEnergyContainerItem energyContainer = (IEnergyContainerItem) item;
|
||||
if(energyContainer.getEnergyStored(itemStack) < energyContainer.getMaxEnergyStored(itemStack)) {
|
||||
int addedRF = energyContainer.receiveEnergy(itemStack, insertRF, false);
|
||||
if (addedRF != 0) {
|
||||
float addedEU = addedRF / (RebornCoreConfig.euPerRF * 1F);
|
||||
tile.useEnergy(addedEU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("IC2") &&
|
||||
RebornCoreConfig.getRebornPower().eu() &&
|
||||
item instanceof IElectricItem) {
|
||||
IElectricItem electricItem = (IElectricItem) item;
|
||||
if(ElectricItem.manager.getCharge(itemStack) < electricItem.getMaxCharge(itemStack)) {
|
||||
double storedEnergy = tile.getEnergy();
|
||||
double output = storedEnergy > tile.getMaxOutput() ? tile.getMaxOutput() : storedEnergy;
|
||||
double added = ElectricItem.manager.charge(itemStack, output, electricItem.getTier(itemStack), false, false);
|
||||
if(added != 0) {
|
||||
tile.useEnergy(added);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("Tesla") &&
|
||||
RebornCoreConfig.getRebornPower().tesla() &&
|
||||
itemStack.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, null)) {
|
||||
ITeslaConsumer consumer = itemStack.getCapability(TeslaCapabilities.CAPABILITY_CONSUMER, null);
|
||||
double storedEnergy = tile.getEnergy();
|
||||
double output = storedEnergy > tile.getMaxOutput() ? tile.getMaxOutput() : storedEnergy;
|
||||
long extractRF = (long) (output * RebornCoreConfig.euPerRF);
|
||||
long addedRF = consumer.givePower(extractRF, false);
|
||||
if(addedRF != 0) {
|
||||
float addedEU = addedRF / (RebornCoreConfig.euPerRF * 1F);
|
||||
tile.useEnergy(addedEU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setEnergy(double energy, ItemStack stack) {
|
||||
NBTTagCompound energyItem = new NBTTagCompound();
|
||||
energyItem.setDouble("energy", energy);
|
||||
if(stack.hasTagCompound()) {
|
||||
stack.getTagCompound().setTag("EnergyItem", energyItem);
|
||||
} else {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setTag("EnergyItem", energyItem);
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
}
|
||||
|
||||
public static double getEnergy(ItemStack stack) {
|
||||
if(stack.getItem() instanceof IEnergyInterfaceItem) {
|
||||
return ((IEnergyInterfaceItem) stack.getItem()).getEnergy(stack);
|
||||
}
|
||||
|
||||
if(stack.hasTagCompound()) {
|
||||
NBTTagCompound energyItem = stack.getTagCompound().getCompoundTag("EnergyItem");
|
||||
return energyItem.getDouble("energy");
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static double getMaxPower(ItemStack itemStack) {
|
||||
if(itemStack.getItem() instanceof IEnergyItemInfo)
|
||||
return ((IEnergyItemInfo) itemStack.getItem()).getMaxPower(itemStack);
|
||||
return 0F;
|
||||
}
|
||||
|
||||
public static boolean canAddEnergy(double energy, ItemStack stack) {
|
||||
return getMaxPower(stack) - getEnergy(stack) >= energy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will try add add the full amount of energy.
|
||||
*
|
||||
* @param energy
|
||||
* amount to add
|
||||
* @param stack
|
||||
* The {@link ItemStack} that contains the power
|
||||
* @return The amount of energy that was added.
|
||||
*/
|
||||
public static double addEnergy(double energy, ItemStack stack) {
|
||||
return addEnergy(energy, false, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will try add add the full amount of energy, if simulate is true it wont
|
||||
* add the energy
|
||||
*
|
||||
* @param energy
|
||||
* amount to add
|
||||
* @param stack
|
||||
* The {@link ItemStack} that contains the power
|
||||
* @return The amount of energy that was added.
|
||||
*/
|
||||
public static double addEnergy(double energy, boolean simulate, ItemStack stack) {
|
||||
double canStore = getMaxPower(stack) - getEnergy(stack);
|
||||
if(canStore >= energy) {
|
||||
if(!simulate)
|
||||
setEnergy(getEnergy(stack) + energy, stack);
|
||||
return energy;
|
||||
}
|
||||
if(!simulate)
|
||||
setEnergy(getEnergy(stack) + canStore, stack);
|
||||
return canStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if it can use the full amount of energy
|
||||
*
|
||||
* @param energy
|
||||
* amount of energy to use from the tile.
|
||||
* @param stack
|
||||
* The {@link ItemStack} that contains the power
|
||||
* @return if all the energy can be used.
|
||||
*/
|
||||
public static boolean canUseEnergy(double energy, ItemStack stack) {
|
||||
return getEnergy(stack) >= energy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will try and use the full amount of energy
|
||||
*
|
||||
* @param energy
|
||||
* energy to use
|
||||
* @param stack
|
||||
* The {@link ItemStack} that contains the power
|
||||
* @return the amount of energy used
|
||||
*/
|
||||
public static double useEnergy(double energy, ItemStack stack) {
|
||||
return useEnergy(energy, false, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will try and use the full amount of energy, if simulate is true it wont
|
||||
* add the energy
|
||||
*
|
||||
* @param energy
|
||||
* energy to use
|
||||
* @param simulate
|
||||
* if true it will not use the item, it will only simulate it.
|
||||
* @param stack
|
||||
* The {@link ItemStack} that contains the power
|
||||
* @return the amount of energy used
|
||||
*/
|
||||
public static double useEnergy(double energy, boolean simulate, ItemStack stack) {
|
||||
double energyStored = getEnergy(stack);
|
||||
if(energyStored >= energy) {
|
||||
if(!simulate)
|
||||
setEnergy(energyStored - energy, stack);
|
||||
return energy;
|
||||
}
|
||||
if(!simulate)
|
||||
setEnergy(0, stack);
|
||||
return energyStored;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,10 +10,9 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.api.power.tile.IEnergyReceiverTile;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
import reborncore.mcmultipart.block.TileMultipartContainer;
|
||||
import reborncore.mcmultipart.multipart.ISlottedPart;
|
||||
import reborncore.mcmultipart.multipart.PartSlot;
|
||||
|
|
|
@ -12,7 +12,6 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
|
|||
import reborncore.api.tile.IContainerProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -50,18 +49,6 @@ public class TileCentrifuge extends TilePowerAcceptor implements IWrenchable,IIn
|
|||
super.update();
|
||||
crafter.updateEntity();
|
||||
// charge(6); TODO
|
||||
if (inventory.getStackInSlot(6) != null) {
|
||||
ItemStack stack = inventory.getStackInSlot(6);
|
||||
if (stack.getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||
if (item.canProvideEnergy(stack)) {
|
||||
if (getEnergy() != getMaxPower()) {
|
||||
addEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.util.text.TextFormatting;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.PowerLocalization;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
@ -41,7 +41,7 @@ public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
|||
public void addInfo(List<String> info, boolean isRealTile) {
|
||||
super.addInfo(info, isRealTile);
|
||||
info.add(TextFormatting.LIGHT_PURPLE + "Eu per extract " + TextFormatting.GREEN
|
||||
+ PowerSystem.getLocalizedPower(ConfigTechReborn.pumpExtractEU));
|
||||
+ PowerLocalization.getLocalizedPower(ConfigTechReborn.pumpExtractEU));
|
||||
info.add(TextFormatting.LIGHT_PURPLE + "Speed: " + TextFormatting.GREEN
|
||||
+ "1000mb/5 sec");
|
||||
}
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import reborncore.api.fuel.FluidPowerManager;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.tile.TilePowerProducer;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -8,7 +7,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.tile.TilePowerProducer;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
|
|
@ -8,15 +8,13 @@ import net.minecraft.util.ITickable;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.tile.IEnergyProducerTile;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||
import techreborn.power.EnergyItem;
|
||||
import techreborn.power.EnergyUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -64,31 +62,12 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IEnergyProdu
|
|||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (inventory.getStackInSlot(0) != null) {
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
||||
return;
|
||||
}
|
||||
IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem();
|
||||
if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) {
|
||||
if (canUseEnergy(item.getMaxTransfer(stack))) {
|
||||
useEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
EnergyItem.charge(inventory.getStackInSlot(0), this);
|
||||
}
|
||||
if (inventory.getStackInSlot(1) != null) {
|
||||
ItemStack stack = inventory.getStackInSlot(1);
|
||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
||||
return;
|
||||
}
|
||||
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||
if (item.canProvideEnergy(stack)) {
|
||||
if (getEnergy() != getMaxPower()) {
|
||||
addEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
EnergyItem.discharge(inventory.getStackInSlot(1), this);
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package techreborn.tiles.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileEVTransformer extends TileTransformer {
|
||||
|
||||
public TileEVTransformer() {
|
||||
super("EVTransformer", ModBlocks.evt, EnumPowerTier.EXTREME, 8192, 2048, 8192);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,7 +12,7 @@ public class TileHVTransformer extends TileTransformer
|
|||
|
||||
public TileHVTransformer()
|
||||
{
|
||||
super("HVTransformer", ModBlocks.hvt, EnumPowerTier.EXTREME, ConfigTechReborn.HVTransformerMaxInput, ConfigTechReborn.HVTransformerMaxOutput, ConfigTechReborn.HVTransformerMaxInput*2);
|
||||
super("HVTransformer", ModBlocks.hvt, EnumPowerTier.HIGH, 2048, 512, 2048);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,9 +10,8 @@ import techreborn.init.ModBlocks;
|
|||
public class TileLVTransformer extends TileTransformer
|
||||
{
|
||||
|
||||
public TileLVTransformer()
|
||||
{
|
||||
super("LVTransformer", ModBlocks.lvt, EnumPowerTier.LOW, ConfigTechReborn.LVTransformerMaxInput, ConfigTechReborn.LVTransformerMaxOutput, ConfigTechReborn.LVTransformerMaxInput*2);
|
||||
public TileLVTransformer() {
|
||||
super("LVTransformer", ModBlocks.lvt, EnumPowerTier.MEDIUM, 128, 32, 128);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,29 +7,10 @@ import techreborn.init.ModBlocks;
|
|||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
public class TileMVTransformer extends TileTransformer
|
||||
{
|
||||
public class TileMVTransformer extends TileTransformer {
|
||||
|
||||
public TileMVTransformer()
|
||||
{
|
||||
super("MVTransformer", ModBlocks.mvt, EnumPowerTier.HIGH, ConfigTechReborn.MVTransformerMaxInput, ConfigTechReborn.MVTransformerMaxOutput, ConfigTechReborn.LVTransformerMaxInput*2);
|
||||
public TileMVTransformer() {
|
||||
super("MVTransformer", ModBlocks.mvt, EnumPowerTier.HIGH, 512, 128, 512);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
return EnumPowerTier.HIGH;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,14 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
import techreborn.blocks.transformers.BlockTransformer;
|
||||
|
||||
/**
|
||||
* Created by Rushmead
|
||||
*
|
||||
* @deprecated ? If wires limited to transfer rate and doesn't burn out, what's use of the transformers?
|
||||
* TODO: Rewrite, find use or remove
|
||||
*/
|
||||
@Deprecated
|
||||
public class TileTransformer extends TilePowerAcceptor implements IWrenchable, ITickable
|
||||
{
|
||||
public class TileTransformer extends TilePowerAcceptor implements IWrenchable, ITickable {
|
||||
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
|
@ -27,9 +23,7 @@ public class TileTransformer extends TilePowerAcceptor implements IWrenchable, I
|
|||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage)
|
||||
{
|
||||
super(1);
|
||||
public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
this.tier = tier;
|
||||
this.name = name;
|
||||
|
@ -38,70 +32,80 @@ public class TileTransformer extends TilePowerAcceptor implements IWrenchable, I
|
|||
this.maxStorage = maxStorage;
|
||||
}
|
||||
|
||||
@Override public boolean wrenchCanSetFacing(EntityPlayer p0, EnumFacing p1)
|
||||
{
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer p0, EnumFacing p1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public EnumFacing getFacing()
|
||||
{
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
@Override
|
||||
public void setFacing(EnumFacing facing) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override public float getWrenchDropRate()
|
||||
{
|
||||
@Override
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override public ItemStack getWrenchDrop(EntityPlayer p0)
|
||||
{
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer p0) {
|
||||
return new ItemStack(wrenchDrop);
|
||||
}
|
||||
|
||||
@Override public double getMaxPower()
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return maxStorage;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
|
||||
return getFacingEnum() != direction;
|
||||
}
|
||||
|
||||
@Override public EnumFacing getFacingEnum()
|
||||
{
|
||||
@Override
|
||||
public EnumFacing getFacingEnum() {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockTransformer)
|
||||
{
|
||||
if (block instanceof BlockTransformer) {
|
||||
return ((BlockTransformer) block).getFacing(worldObj.getBlockState(pos));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return getFacing() == direction;
|
||||
}
|
||||
|
||||
|
||||
@Override public double getMaxOutput()
|
||||
{
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
return maxOutput;
|
||||
}
|
||||
|
||||
@Override public double getMaxInput()
|
||||
{
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
@Override public EnumPowerTier getTier()
|
||||
{
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue