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;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.init.ModBlocks;
|
|
||||||
import techreborn.tiles.transformers.TileHVTransformer;
|
import techreborn.tiles.transformers.TileHVTransformer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 16/03/2016.
|
* Created by modmuss50 on 16/03/2016.
|
||||||
*/
|
*/
|
||||||
public class BlockHVTransformer extends BlockTransformer
|
public class BlockHVTransformer extends BlockTransformer {
|
||||||
{
|
|
||||||
|
|
||||||
public BlockHVTransformer()
|
public BlockHVTransformer() {
|
||||||
{
|
super("hvtransformer");
|
||||||
super("hvtransformer");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
|
return new TileHVTransformer();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,21 @@
|
||||||
package techreborn.blocks.transformers;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.tiles.transformers.TileLVTransformer;
|
import techreborn.tiles.transformers.TileLVTransformer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 16/03/2016.
|
* Created by modmuss50 on 16/03/2016.
|
||||||
*/
|
*/
|
||||||
public class BlockLVTransformer extends BlockTransformer
|
public class BlockLVTransformer extends BlockTransformer {
|
||||||
{
|
|
||||||
|
|
||||||
public BlockLVTransformer()
|
public BlockLVTransformer() {
|
||||||
{
|
super("lvtransformer");
|
||||||
super("lvtransformer");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
{
|
return new TileLVTransformer();
|
||||||
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;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.init.ModBlocks;
|
|
||||||
import techreborn.tiles.transformers.TileMVTransformer;
|
import techreborn.tiles.transformers.TileMVTransformer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 16/03/2016.
|
* Created by modmuss50 on 16/03/2016.
|
||||||
*/
|
*/
|
||||||
public class BlockMVTransformer extends BlockTransformer
|
public class BlockMVTransformer extends BlockTransformer {
|
||||||
{
|
|
||||||
|
|
||||||
public BlockMVTransformer()
|
public BlockMVTransformer() {
|
||||||
{
|
super("mvtransformer");
|
||||||
super("mvtransformer");
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||||
|
return new TileMVTransformer();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
|
||||||
{
|
|
||||||
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,292 +32,239 @@ import java.util.Random;
|
||||||
/**
|
/**
|
||||||
* Created by Rushmead
|
* 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);
|
||||||
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
|
protected final String prefix = "techreborn:blocks/machine/storage/";
|
||||||
protected final String prefix = "techreborn:blocks/machine/storage/";
|
public String name;
|
||||||
public String name;
|
|
||||||
|
|
||||||
public BlockTransformer(String name)
|
public BlockTransformer(String name) {
|
||||||
{
|
super(Material.ROCK);
|
||||||
super(Material.ROCK);
|
setHardness(2f);
|
||||||
setHardness(2f);
|
setUnlocalizedName("techreborn." + name.toLowerCase());
|
||||||
setUnlocalizedName("techreborn." + name.toLowerCase());
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
this.name = name;
|
||||||
this.name = name;
|
}
|
||||||
}
|
|
||||||
protected BlockStateContainer createBlockState()
|
|
||||||
{
|
|
||||||
FACING = PropertyDirection.create("facing", Facings.ALL);
|
|
||||||
return new BlockStateContainer(this, FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
protected BlockStateContainer createBlockState() {
|
||||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||||
{
|
return new BlockStateContainer(this, FACING);
|
||||||
super.onBlockAdded(worldIn, pos, state);
|
}
|
||||||
this.setDefaultFacing(worldIn, pos, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
|
@Override
|
||||||
{
|
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||||
if (!worldIn.isRemote)
|
super.onBlockAdded(worldIn, pos, state);
|
||||||
{
|
this.setDefaultFacing(worldIn, pos, state);
|
||||||
IBlockState sate = worldIn.getBlockState(pos.north());
|
}
|
||||||
Block block = sate.getBlock();
|
|
||||||
IBlockState state1 = worldIn.getBlockState(pos.south());
|
|
||||||
Block block1 = state1.getBlock();
|
|
||||||
IBlockState state2 = worldIn.getBlockState(pos.west());
|
|
||||||
Block block2 = state2.getBlock();
|
|
||||||
IBlockState state3 = worldIn.getBlockState(pos.east());
|
|
||||||
Block block3 = state3.getBlock();
|
|
||||||
EnumFacing enumfacing = state.getValue(FACING);
|
|
||||||
|
|
||||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1))
|
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) {
|
||||||
{
|
if (!worldIn.isRemote) {
|
||||||
enumfacing = EnumFacing.SOUTH;
|
IBlockState sate = worldIn.getBlockState(pos.north());
|
||||||
} else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock(state1) && !block.isFullBlock(state))
|
Block block = sate.getBlock();
|
||||||
{
|
IBlockState state1 = worldIn.getBlockState(pos.south());
|
||||||
enumfacing = EnumFacing.NORTH;
|
Block block1 = state1.getBlock();
|
||||||
} else if (enumfacing == EnumFacing.WEST && block2.isFullBlock(state2) && !block3.isFullBlock(state2))
|
IBlockState state2 = worldIn.getBlockState(pos.west());
|
||||||
{
|
Block block2 = state2.getBlock();
|
||||||
enumfacing = EnumFacing.EAST;
|
IBlockState state3 = worldIn.getBlockState(pos.east());
|
||||||
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2))
|
Block block3 = state3.getBlock();
|
||||||
{
|
EnumFacing enumfacing = state.getValue(FACING);
|
||||||
enumfacing = EnumFacing.WEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
|
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1)) {
|
||||||
}
|
enumfacing = EnumFacing.SOUTH;
|
||||||
}
|
} 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)) {
|
||||||
|
enumfacing = EnumFacing.EAST;
|
||||||
|
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2)) {
|
||||||
|
enumfacing = EnumFacing.WEST;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
|
||||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
}
|
||||||
ItemStack stack)
|
}
|
||||||
{
|
|
||||||
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
@Override
|
||||||
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
|
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
||||||
if (placer.rotationPitch < -50)
|
ItemStack stack) {
|
||||||
{
|
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
||||||
facing = EnumFacing.DOWN;
|
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
|
||||||
} else if (placer.rotationPitch > 50)
|
if (placer.rotationPitch < -50) {
|
||||||
{
|
facing = EnumFacing.DOWN;
|
||||||
facing = EnumFacing.UP;
|
} else if (placer.rotationPitch > 50) {
|
||||||
}
|
facing = EnumFacing.UP;
|
||||||
setFacing(facing, worldIn, pos);
|
}
|
||||||
}
|
setFacing(facing, worldIn, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop) {
|
||||||
|
TileEntity tileEntity = world.getTileEntity(pos);
|
||||||
|
|
||||||
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop)
|
if (tileEntity == null) {
|
||||||
{
|
System.out.print("Null");
|
||||||
TileEntity tileEntity = world.getTileEntity(pos);
|
return null;
|
||||||
|
}
|
||||||
|
if (!(tileEntity instanceof IInventory)) {
|
||||||
|
|
||||||
if (tileEntity == null)
|
System.out.print("Not Instance");
|
||||||
{
|
return null;
|
||||||
System.out.print("Null");
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!(tileEntity instanceof IInventory))
|
|
||||||
{
|
|
||||||
|
|
||||||
System.out.print("Not INstance");
|
IInventory inventory = (IInventory) tileEntity;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IInventory inventory = (IInventory) tileEntity;
|
List<ItemStack> items = new ArrayList<>();
|
||||||
|
|
||||||
List<ItemStack> items = new ArrayList<>();
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
|
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||||
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
if (itemStack == null) {
|
||||||
{
|
continue;
|
||||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
}
|
||||||
|
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) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items.add(itemStack.copy());
|
||||||
|
}
|
||||||
|
items.add(itemToDrop.copy());
|
||||||
|
return items;
|
||||||
|
|
||||||
if (itemStack == null)
|
}
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
items.add(itemStack.copy());
|
|
||||||
}
|
|
||||||
items.add(itemToDrop.copy());
|
|
||||||
return items;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state) {
|
||||||
{
|
int facingInt = getSideFromEnum(state.getValue(FACING));
|
||||||
int facingInt = getSideFromEnum(state.getValue(FACING));
|
return facingInt;
|
||||||
return facingInt;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
{
|
boolean active = false;
|
||||||
boolean active = false;
|
EnumFacing facing = getSideFromint(meta);
|
||||||
EnumFacing facing = getSideFromint(meta);
|
return this.getDefaultState().withProperty(FACING, facing);
|
||||||
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));
|
||||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public EnumFacing getSideFromint(int i)
|
public EnumFacing getSideFromint(int i) {
|
||||||
{
|
if (i == 0) {
|
||||||
if (i == 0)
|
return EnumFacing.NORTH;
|
||||||
{
|
} else if (i == 1) {
|
||||||
return EnumFacing.NORTH;
|
return EnumFacing.SOUTH;
|
||||||
} else if (i == 1)
|
} else if (i == 2) {
|
||||||
{
|
return EnumFacing.EAST;
|
||||||
return EnumFacing.SOUTH;
|
} else if (i == 3) {
|
||||||
} else if (i == 2)
|
return EnumFacing.WEST;
|
||||||
{
|
} else if (i == 4) {
|
||||||
return EnumFacing.EAST;
|
return EnumFacing.UP;
|
||||||
} else if (i == 3)
|
} else if (i == 5) {
|
||||||
{
|
return EnumFacing.DOWN;
|
||||||
return EnumFacing.WEST;
|
}
|
||||||
} else if (i == 4)
|
return EnumFacing.NORTH;
|
||||||
{
|
}
|
||||||
return EnumFacing.UP;
|
|
||||||
} else if (i == 5)
|
|
||||||
{
|
|
||||||
return EnumFacing.DOWN;
|
|
||||||
}
|
|
||||||
return EnumFacing.NORTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSideFromEnum(EnumFacing facing)
|
public int getSideFromEnum(EnumFacing facing) {
|
||||||
{
|
if (facing == EnumFacing.NORTH) {
|
||||||
if (facing == EnumFacing.NORTH)
|
return 0;
|
||||||
{
|
} else if (facing == EnumFacing.SOUTH) {
|
||||||
return 0;
|
return 1;
|
||||||
} else if (facing == EnumFacing.SOUTH)
|
} else if (facing == EnumFacing.EAST) {
|
||||||
{
|
return 2;
|
||||||
return 1;
|
} else if (facing == EnumFacing.WEST) {
|
||||||
} else if (facing == EnumFacing.EAST)
|
return 3;
|
||||||
{
|
} else if (facing == EnumFacing.UP) {
|
||||||
return 2;
|
return 4;
|
||||||
} else if (facing == EnumFacing.WEST)
|
} else if (facing == EnumFacing.DOWN) {
|
||||||
{
|
return 5;
|
||||||
return 3;
|
}
|
||||||
} else if (facing == EnumFacing.UP)
|
return 0;
|
||||||
{
|
}
|
||||||
return 4;
|
|
||||||
} else if (facing == EnumFacing.DOWN)
|
|
||||||
{
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFrontOff()
|
public String getFrontOff() {
|
||||||
{
|
return prefix + name.toLowerCase() + "_front";
|
||||||
return prefix + name.toLowerCase() + "_front";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFrontOn()
|
public String getFrontOn() {
|
||||||
{
|
return prefix + name.toLowerCase() + "_front";
|
||||||
return prefix + name.toLowerCase() + "_front";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSide()
|
public String getSide() {
|
||||||
{
|
return prefix + name.toLowerCase() + "_side";
|
||||||
return prefix + name.toLowerCase() + "_side";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTop()
|
public String getTop() {
|
||||||
{
|
return prefix + name.toLowerCase() + "_side";
|
||||||
return prefix + name.toLowerCase() + "_side";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBottom()
|
public String getBottom() {
|
||||||
{
|
return prefix + name.toLowerCase() + "_side";
|
||||||
return prefix + name.toLowerCase() + "_side";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing)
|
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||||
{
|
if (this instanceof IRotationTexture) {
|
||||||
if (this instanceof IRotationTexture)
|
IRotationTexture rotationTexture = this;
|
||||||
{
|
if (getFacing(blockState) == facing) {
|
||||||
IRotationTexture rotationTexture = this;
|
return rotationTexture.getFrontOff();
|
||||||
if (getFacing(blockState) == facing)
|
}
|
||||||
{
|
if (facing == EnumFacing.UP) {
|
||||||
return rotationTexture.getFrontOff();
|
return rotationTexture.getTop();
|
||||||
}
|
}
|
||||||
if (facing == EnumFacing.UP)
|
if (facing == EnumFacing.DOWN) {
|
||||||
{
|
return rotationTexture.getBottom();
|
||||||
return rotationTexture.getTop();
|
}
|
||||||
}
|
return rotationTexture.getSide();
|
||||||
if (facing == EnumFacing.DOWN)
|
}
|
||||||
{
|
return "techreborn:blocks/machine/machine_side";
|
||||||
return rotationTexture.getBottom();
|
}
|
||||||
}
|
|
||||||
return rotationTexture.getSide();
|
|
||||||
}
|
|
||||||
return "techreborn:blocks/machine/machine_side";
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumFacing getFacing(IBlockState state)
|
public EnumFacing getFacing(IBlockState state) {
|
||||||
{
|
return state.getValue(FACING);
|
||||||
return state.getValue(FACING);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int amountOfStates()
|
public int amountOfStates() {
|
||||||
{
|
return 6;
|
||||||
return 6;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
public enum Facings implements Predicate<EnumFacing>, Iterable<EnumFacing> {
|
||||||
|
ALL;
|
||||||
|
|
||||||
public enum Facings implements Predicate<EnumFacing>,Iterable<EnumFacing>
|
public EnumFacing[] facings() {
|
||||||
{
|
return new EnumFacing[]{
|
||||||
ALL;
|
EnumFacing.NORTH, EnumFacing.EAST,
|
||||||
|
EnumFacing.SOUTH, EnumFacing.WEST,
|
||||||
|
EnumFacing.UP, EnumFacing.DOWN};
|
||||||
|
}
|
||||||
|
|
||||||
public EnumFacing[] facings()
|
public EnumFacing random(Random rand) {
|
||||||
{
|
EnumFacing[] aenumfacing = this.facings();
|
||||||
return new EnumFacing[] { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST,
|
return aenumfacing[rand.nextInt(aenumfacing.length)];
|
||||||
EnumFacing.UP, EnumFacing.DOWN };
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public EnumFacing random(Random rand)
|
public boolean apply(EnumFacing facing) {
|
||||||
{
|
return facing != null;
|
||||||
EnumFacing[] aenumfacing = this.facings();
|
}
|
||||||
return aenumfacing[rand.nextInt(aenumfacing.length)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean apply(EnumFacing p_apply_1_)
|
public Iterator<EnumFacing> iterator() {
|
||||||
{
|
return Iterators.forArray(this.facings());
|
||||||
return p_apply_1_ != null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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 org.lwjgl.input.Keyboard;
|
||||||
import reborncore.api.IListInfoProvider;
|
import reborncore.api.IListInfoProvider;
|
||||||
import reborncore.api.power.IEnergyInterfaceItem;
|
import reborncore.api.power.IEnergyInterfaceItem;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import reborncore.common.util.Color;
|
import reborncore.common.util.Color;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
|
|
||||||
|
@ -43,16 +43,16 @@ public class StackToolTipEvent
|
||||||
color = TextFormatting.YELLOW;
|
color = TextFormatting.YELLOW;
|
||||||
}
|
}
|
||||||
event.getToolTip().add(color + ""
|
event.getToolTip().add(color + ""
|
||||||
+ PowerSystem.getLocalizedPower(
|
+ PowerLocalization.getLocalizedPower(
|
||||||
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getEnergy(event.getItemStack()))
|
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getEnergy(event.getItemStack()))
|
||||||
+ TextFormatting.LIGHT_PURPLE + " stored");
|
+ TextFormatting.LIGHT_PURPLE + " stored");
|
||||||
event.getToolTip().add(Color.GREEN + ""
|
event.getToolTip().add(Color.GREEN + ""
|
||||||
+ PowerSystem.getLocalizedPower(
|
+ PowerLocalization.getLocalizedPower(
|
||||||
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getMaxPower(event.getItemStack()))
|
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getMaxPower(event.getItemStack()))
|
||||||
+ TextFormatting.LIGHT_PURPLE + " max");
|
+ TextFormatting.LIGHT_PURPLE + " max");
|
||||||
event.getToolTip()
|
event.getToolTip()
|
||||||
.add(TextFormatting.GREEN + "" + percentage + "%" + TextFormatting.LIGHT_PURPLE + " charged");
|
.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()))
|
(int) ((IEnergyInterfaceItem) event.getItemStack().getItem()).getMaxTransfer(event.getItemStack()))
|
||||||
+ TextFormatting.LIGHT_PURPLE + " /tick in/out");
|
+ 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.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.packets.PacketHandler;
|
import reborncore.common.packets.PacketHandler;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerAESU;
|
import techreborn.client.container.ContainerAESU;
|
||||||
import techreborn.packets.PacketAesu;
|
import techreborn.packets.PacketAesu;
|
||||||
import techreborn.tiles.TileAesu;
|
import techreborn.tiles.TileAesu;
|
||||||
|
@ -60,11 +60,11 @@ public class GuiAESU extends GuiContainer
|
||||||
{
|
{
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10,
|
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10,
|
||||||
Color.WHITE.getRGB());
|
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());
|
Color.WHITE.getRGB());
|
||||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerAesu.storedEu) + " ", 10, 30,
|
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerAesu.storedEu) + " ", 10, 30,
|
||||||
Color.WHITE.getRGB());
|
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());
|
Color.WHITE.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerBatbox;
|
import techreborn.client.container.ContainerBatbox;
|
||||||
import techreborn.tiles.storage.TileBatBox;
|
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.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||||
this.ySize - 96 + 2, 4210752);
|
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);
|
4210752);
|
||||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
||||||
4210752);
|
4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerDieselGenerator;
|
import techreborn.client.container.ContainerDieselGenerator;
|
||||||
import techreborn.tiles.generator.TileDieselGenerator;
|
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(containerDieselGenerator.fluid + "", 10, 30, 16448255);
|
||||||
|
|
||||||
this.fontRendererObj.drawString("Power Amount", 10, 40, 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);
|
16448255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.api.reactor.FusionReactorRecipe;
|
|
||||||
import techreborn.client.container.ContainerFusionReactor;
|
import techreborn.client.container.ContainerFusionReactor;
|
||||||
import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ public class GuiFusionReactor extends GuiContainer
|
||||||
this.fontRendererObj.drawString(name, 87, 6, 4210752);
|
this.fontRendererObj.drawString(name, 87, 6, 4210752);
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8, this.ySize - 96 + 2, 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);
|
this.fontRendererObj.drawString("Coils: " + (containerFusionReactor.hasCoils ? "Yes" : "No"), 11, 16, 16448255);
|
||||||
|
|
||||||
if(containerFusionReactor.tickTime != -1) {
|
if(containerFusionReactor.tickTime != -1) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerGenerator;
|
import techreborn.client.container.ContainerGenerator;
|
||||||
import techreborn.tiles.generator.TileGenerator;
|
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.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||||
this.ySize - 96 + 2, 4210752);
|
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);
|
4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.packets.PacketHandler;
|
import reborncore.common.packets.PacketHandler;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerIDSU;
|
import techreborn.client.container.ContainerIDSU;
|
||||||
import techreborn.packets.PacketIdsu;
|
import techreborn.packets.PacketIdsu;
|
||||||
import techreborn.tiles.idsu.TileIDSU;
|
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,
|
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.idsu.name"), 75, 10,
|
||||||
Color.WHITE.getRGB());
|
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());
|
Color.WHITE.getRGB());
|
||||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerIDSU.storedEu), 10, 32,
|
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerIDSU.storedEu), 10, 32,
|
||||||
Color.WHITE.getRGB());
|
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());
|
Color.WHITE.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerLESU;
|
import techreborn.client.container.ContainerLESU;
|
||||||
import techreborn.tiles.lesu.TileLesu;
|
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,
|
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.lesu.name"), 40, 10,
|
||||||
Color.WHITE.getRGB());
|
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());
|
Color.WHITE.getRGB());
|
||||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerLesu.storedEu), 10, 30,
|
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerLesu.storedEu), 10, 30,
|
||||||
Color.WHITE.getRGB());
|
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());
|
Color.WHITE.getRGB());
|
||||||
this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, 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());
|
Color.WHITE.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerMFE;
|
import techreborn.client.container.ContainerMFE;
|
||||||
import techreborn.tiles.storage.TileMFE;
|
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.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), this.xSize - 60,
|
||||||
this.ySize - 96 + 2, 4210752);
|
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);
|
4210752);
|
||||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||||
4210752);
|
4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.container.ContainerMFSU;
|
import techreborn.client.container.ContainerMFSU;
|
||||||
import techreborn.tiles.storage.TileMFSU;
|
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.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), this.xSize - 60,
|
||||||
this.ySize - 96 + 2, 4210752);
|
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);
|
4210752);
|
||||||
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
this.fontRendererObj.drawString(PowerLocalization.getLocalizedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||||
4210752);
|
4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import reborncore.api.power.IEnergyInterfaceItem;
|
import reborncore.api.power.IEnergyInterfaceItem;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import reborncore.common.util.Color;
|
import reborncore.common.util.Color;
|
||||||
import techreborn.client.keybindings.KeyBindings;
|
import techreborn.client.keybindings.KeyBindings;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
@ -80,8 +80,8 @@ public class ChargeHud
|
||||||
{
|
{
|
||||||
color = Color.DARK_RED;
|
color = Color.DARK_RED;
|
||||||
}
|
}
|
||||||
mc.fontRendererObj.drawString(color + PowerSystem.getLocalizedPower(CurrentCharge) + "/"
|
mc.fontRendererObj.drawString(color + PowerLocalization.getLocalizedPower(CurrentCharge) + "/"
|
||||||
+ PowerSystem.getLocalizedPower(MaxCharge), 20, y, 0);
|
+ PowerLocalization.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||||
y += 20;
|
y += 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ public class ChargeHud
|
||||||
{
|
{
|
||||||
color = Color.DARK_RED;
|
color = Color.DARK_RED;
|
||||||
}
|
}
|
||||||
mc.fontRendererObj.drawString(color + PowerSystem.getLocalizedPower(CurrentCharge) + "/"
|
mc.fontRendererObj.drawString(color + PowerLocalization.getLocalizedPower(CurrentCharge) + "/"
|
||||||
+ PowerSystem.getLocalizedPower(MaxCharge), 20, y, 0);
|
+ PowerLocalization.getLocalizedPower(MaxCharge), 20, y, 0);
|
||||||
y += 20;
|
y += 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class ChargeHud
|
||||||
{
|
{
|
||||||
color = Color.DARK_RED;
|
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);
|
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.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Mark on 04/06/2016.
|
* 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.BlockExtractor;
|
||||||
import techreborn.blocks.tier1.BlockGrinder;
|
import techreborn.blocks.tier1.BlockGrinder;
|
||||||
import techreborn.blocks.tier1.BlockRecycler;
|
import techreborn.blocks.tier1.BlockRecycler;
|
||||||
|
import techreborn.blocks.transformers.BlockEVTransformer;
|
||||||
import techreborn.blocks.transformers.BlockHVTransformer;
|
import techreborn.blocks.transformers.BlockHVTransformer;
|
||||||
import techreborn.blocks.transformers.BlockLVTransformer;
|
import techreborn.blocks.transformers.BlockLVTransformer;
|
||||||
import techreborn.blocks.transformers.BlockMVTransformer;
|
import techreborn.blocks.transformers.BlockMVTransformer;
|
||||||
|
@ -85,6 +86,7 @@ import techreborn.tiles.teir1.TileElectricFurnace;
|
||||||
import techreborn.tiles.teir1.TileExtractor;
|
import techreborn.tiles.teir1.TileExtractor;
|
||||||
import techreborn.tiles.teir1.TileGrinder;
|
import techreborn.tiles.teir1.TileGrinder;
|
||||||
import techreborn.tiles.teir1.TileRecycler;
|
import techreborn.tiles.teir1.TileRecycler;
|
||||||
|
import techreborn.tiles.transformers.TileEVTransformer;
|
||||||
import techreborn.tiles.transformers.TileHVTransformer;
|
import techreborn.tiles.transformers.TileHVTransformer;
|
||||||
import techreborn.tiles.transformers.TileLVTransformer;
|
import techreborn.tiles.transformers.TileLVTransformer;
|
||||||
import techreborn.tiles.transformers.TileMVTransformer;
|
import techreborn.tiles.transformers.TileMVTransformer;
|
||||||
|
@ -147,10 +149,12 @@ public class ModBlocks
|
||||||
public static Block mfe;
|
public static Block mfe;
|
||||||
public static Block mfsu;
|
public static Block mfsu;
|
||||||
public static Block scrapboxinator;
|
public static Block scrapboxinator;
|
||||||
|
public static Block pump;
|
||||||
|
|
||||||
public static Block lvt;
|
public static Block lvt;
|
||||||
public static Block mvt;
|
public static Block mvt;
|
||||||
public static Block hvt;
|
public static Block hvt;
|
||||||
public static Block pump;
|
public static Block evt;
|
||||||
|
|
||||||
public static BlockOre ore;
|
public static BlockOre ore;
|
||||||
public static BlockOre2 ore2;
|
public static BlockOre2 ore2;
|
||||||
|
@ -437,7 +441,11 @@ public class ModBlocks
|
||||||
distributor = new BlockDistributor();
|
distributor = new BlockDistributor();
|
||||||
registerBlock(distributor, "distributor");
|
registerBlock(distributor, "distributor");
|
||||||
|
|
||||||
registerOreDict();
|
evt = new BlockEVTransformer();
|
||||||
|
registerBlock(evt, "evt");
|
||||||
|
GameRegistry.registerTileEntity(TileEVTransformer.class, "TileEVTransformer");
|
||||||
|
|
||||||
|
registerOreDict();
|
||||||
Core.logHelper.info("TechReborns Blocks Loaded");
|
Core.logHelper.info("TechReborns Blocks Loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
package techreborn.init;
|
package techreborn.init;
|
||||||
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.util.BucketHandler;
|
import reborncore.common.util.BucketHandler;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.blocks.BlockMachineFrame;
|
import techreborn.blocks.BlockMachineFrame;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.events.OreUnifier;
|
|
||||||
import techreborn.items.*;
|
import techreborn.items.*;
|
||||||
import techreborn.items.armor.ItemLapotronPack;
|
import techreborn.items.armor.ItemLapotronPack;
|
||||||
import techreborn.items.armor.ItemLithiumBatpack;
|
import techreborn.items.armor.ItemLithiumBatpack;
|
||||||
|
@ -141,51 +136,51 @@ public class ModItems
|
||||||
parts = new ItemParts();
|
parts = new ItemParts();
|
||||||
registerItem(parts, "part");
|
registerItem(parts, "part");
|
||||||
|
|
||||||
rockCutter = PoweredItem.createItem(ItemRockCutter.class);
|
rockCutter = new ItemRockCutter();
|
||||||
registerItem(rockCutter, "rockCutter");
|
registerItem(rockCutter, "rockCutter");
|
||||||
lithiumBatpack = PoweredItem.createItem(ItemLithiumBatpack.class);
|
lithiumBatpack = new ItemLithiumBatpack();
|
||||||
registerItem(lithiumBatpack, "lithiumBatpack");
|
registerItem(lithiumBatpack, "lithiumBatpack");
|
||||||
lapotronpack = PoweredItem.createItem(ItemLapotronPack.class);
|
lapotronpack = new ItemLapotronPack();
|
||||||
registerItem(lapotronpack, "lapotronPack");
|
registerItem(lapotronpack, "lapotronPack");
|
||||||
lithiumBattery = PoweredItem.createItem(ItemLithiumBattery.class);
|
lithiumBattery = new ItemLithiumBattery();
|
||||||
registerItem(lithiumBattery, "lithiumBattery");
|
registerItem(lithiumBattery, "lithiumBattery");
|
||||||
lapotronicOrb = PoweredItem.createItem(ItemLapotronicOrb.class);
|
lapotronicOrb = new ItemLapotronicOrb();
|
||||||
registerItem(lapotronicOrb, "lapotronicOrb");
|
registerItem(lapotronicOrb, "lapotronicOrb");
|
||||||
omniTool = PoweredItem.createItem(ItemOmniTool.class);
|
omniTool = new ItemOmniTool();
|
||||||
registerItem(omniTool, "omniTool");
|
registerItem(omniTool, "omniTool");
|
||||||
energyCrystal = PoweredItem.createItem(ItemEnergyCrystal.class);
|
energyCrystal = new ItemEnergyCrystal();
|
||||||
registerItem(energyCrystal, "energycrystal");
|
registerItem(energyCrystal, "energycrystal");
|
||||||
lapotronCrystal = PoweredItem.createItem(ItemLapotronCrystal.class);
|
lapotronCrystal = new ItemLapotronCrystal();
|
||||||
registerItem(lapotronCrystal, "lapotroncrystal");
|
registerItem(lapotronCrystal, "lapotroncrystal");
|
||||||
|
|
||||||
manual = new ItemTechManual();
|
manual = new ItemTechManual();
|
||||||
registerItem(manual, "techmanuel");
|
registerItem(manual, "techmanuel");
|
||||||
uuMatter = new ItemUUmatter();
|
uuMatter = new ItemUUmatter();
|
||||||
registerItem(uuMatter, "uumatter");
|
registerItem(uuMatter, "uumatter");
|
||||||
reBattery = PoweredItem.createItem(ItemReBattery.class);
|
reBattery = new ItemReBattery();
|
||||||
registerItem(reBattery, "rebattery");
|
registerItem(reBattery, "rebattery");
|
||||||
treeTap = new ItemTreeTap();
|
treeTap = new ItemTreeTap();
|
||||||
registerItem(treeTap, "treetap");
|
registerItem(treeTap, "treetap");
|
||||||
|
|
||||||
ironDrill = PoweredItem.createItem(ItemSteelDrill.class);
|
ironDrill = new ItemSteelDrill();
|
||||||
registerItem(ironDrill, "irondrill");
|
registerItem(ironDrill, "irondrill");
|
||||||
diamondDrill = PoweredItem.createItem(ItemDiamondDrill.class);
|
diamondDrill = new ItemDiamondDrill();
|
||||||
registerItem(diamondDrill, "diamonddrill");
|
registerItem(diamondDrill, "diamonddrill");
|
||||||
advancedDrill = PoweredItem.createItem(ItemAdvancedDrill.class);
|
advancedDrill = new ItemAdvancedDrill();
|
||||||
registerItem(advancedDrill, "advanceddrill");
|
registerItem(advancedDrill, "advanceddrill");
|
||||||
|
|
||||||
ironChainsaw = PoweredItem.createItem(ItemSteelChainsaw.class);
|
ironChainsaw = new ItemSteelChainsaw();
|
||||||
registerItem(ironChainsaw, "ironchainsaw");
|
registerItem(ironChainsaw, "ironchainsaw");
|
||||||
diamondChainsaw = PoweredItem.createItem(ItemDiamondChainsaw.class);
|
diamondChainsaw = new ItemDiamondChainsaw();
|
||||||
registerItem(diamondChainsaw, "diamondchainsaw");
|
registerItem(diamondChainsaw, "diamondchainsaw");
|
||||||
advancedChainsaw = PoweredItem.createItem(ItemAdvancedChainsaw.class);
|
advancedChainsaw = new ItemAdvancedChainsaw();
|
||||||
registerItem(advancedChainsaw, "advancedchainsaw");
|
registerItem(advancedChainsaw, "advancedchainsaw");
|
||||||
|
|
||||||
steelJackhammer = PoweredItem.createItem(ItemSteelJackhammer.class);
|
steelJackhammer = new ItemSteelJackhammer();
|
||||||
registerItem(steelJackhammer, "steeljackhammer");
|
registerItem(steelJackhammer, "steeljackhammer");
|
||||||
diamondJackhammer = PoweredItem.createItem(ItemDiamondJackhammer.class);
|
diamondJackhammer = new ItemDiamondJackhammer();
|
||||||
registerItem(diamondJackhammer, "diamondjackhammer");
|
registerItem(diamondJackhammer, "diamondjackhammer");
|
||||||
advancedJackhammer = PoweredItem.createItem(ItemAdvancedJackhammer.class);
|
advancedJackhammer = new ItemAdvancedJackhammer();
|
||||||
registerItem(advancedJackhammer, "ironjackhammer");
|
registerItem(advancedJackhammer, "ironjackhammer");
|
||||||
|
|
||||||
if(ConfigTechReborn.enableGemArmorAndTools){
|
if(ConfigTechReborn.enableGemArmorAndTools){
|
||||||
|
@ -274,7 +269,7 @@ public class ModItems
|
||||||
wrench = new ItemWrench();
|
wrench = new ItemWrench();
|
||||||
registerItem(wrench, "wrench");
|
registerItem(wrench, "wrench");
|
||||||
|
|
||||||
nanosaber = PoweredItem.createItem(ItemNanosaber.class);
|
nanosaber = new ItemNanosaber();
|
||||||
registerItem(nanosaber, "nanosaber");
|
registerItem(nanosaber, "nanosaber");
|
||||||
|
|
||||||
scrapBox = new ItemScrapBox();
|
scrapBox = new ItemScrapBox();
|
||||||
|
@ -286,7 +281,7 @@ public class ModItems
|
||||||
upgrades = new ItemUpgrades();
|
upgrades = new ItemUpgrades();
|
||||||
registerItem(upgrades, "upgrades");
|
registerItem(upgrades, "upgrades");
|
||||||
|
|
||||||
cloakingDevice = PoweredItem.createItem(ItemCloakingDevice.class);
|
cloakingDevice = new ItemCloakingDevice();
|
||||||
registerItem(cloakingDevice, "cloakingdevice");
|
registerItem(cloakingDevice, "cloakingdevice");
|
||||||
|
|
||||||
missingRecipe = new ItemMissingRecipe().setUnlocalizedName("missingRecipe");
|
missingRecipe = new ItemMissingRecipe().setUnlocalizedName("missingRecipe");
|
||||||
|
|
|
@ -15,9 +15,8 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.tiles.TileAesu;
|
|
||||||
|
|
||||||
public class ItemBlockAesu extends ItemBlock
|
public class ItemBlockAesu extends ItemBlock
|
||||||
{
|
{
|
||||||
|
@ -35,7 +34,7 @@ public class ItemBlockAesu extends ItemBlock
|
||||||
if (stack != null && stack.hasTagCompound())
|
if (stack != null && stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
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,61 +5,53 @@ import reborncore.api.power.IEnergyItemInfo;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
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 maxCharge = ConfigTechReborn.LapotronicOrbMaxCharge;
|
||||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||||
public double transferLimit = 10000;
|
public double transferLimit = 10000;
|
||||||
|
|
||||||
public ItemLapotronicOrb()
|
public ItemLapotronicOrb() {
|
||||||
{
|
super();
|
||||||
super();
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setMaxDamage(13);
|
||||||
setMaxDamage(13);
|
setUnlocalizedName("techreborn.lapotronicorb");
|
||||||
setUnlocalizedName("techreborn.lapotronicorb");
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public double getMaxPower(ItemStack stack) {
|
||||||
{
|
return maxCharge;
|
||||||
return maxCharge;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack stack)
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
{
|
return transferLimit;
|
||||||
return transferLimit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTier(ItemStack stack)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return tier;
|
||||||
return tier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/lapotronicEnergyOrb";
|
||||||
return "techreborn:items/tool/lapotronicEnergyOrb";
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxMeta()
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package techreborn.items.armor;
|
package techreborn.items.armor;
|
||||||
|
|
||||||
|
import cofh.api.energy.IEnergyContainerItem;
|
||||||
|
import ic2.api.item.IElectricItem;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
|
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -13,128 +16,137 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
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.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
|
|
||||||
import java.util.List;
|
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 MAX_CHARGE = ConfigTechReborn.LapotronPackCharge;
|
||||||
public static final int tier = ConfigTechReborn.LapotronPackTier;
|
public static final int TIER = ConfigTechReborn.LapotronPackTier;
|
||||||
public double transferLimit = 100000;
|
public static final double TRANSFER_LIMIT = 100000;
|
||||||
|
|
||||||
public ItemLapotronPack()
|
public ItemLapotronPack() {
|
||||||
{
|
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setUnlocalizedName("techreborn.lapotronpack");
|
||||||
setUnlocalizedName("techreborn.lapotronpack");
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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";
|
||||||
return "techreborn:" + "textures/models/lapotronpack.png";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public double getMaxPower(ItemStack stack) {
|
||||||
{
|
return MAX_CHARGE;
|
||||||
return maxCharge;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
{
|
return TRANSFER_LIMIT;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack itemStack)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return TIER;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return transferLimit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTier(ItemStack stack)
|
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||||
{
|
return true;
|
||||||
return tier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SideOnly(Side.CLIENT)
|
||||||
@SideOnly(Side.CLIENT)
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
{
|
itemList.add(itemStack);
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
{
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
return 1 - charge;
|
||||||
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
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||||
{
|
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||||
return true;
|
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
|
@Override
|
||||||
public String getTextureName(int damage)
|
public void setEnergy(double energy) {
|
||||||
{
|
EnergyItem.setEnergy(energy, itemStack);
|
||||||
return "techreborn:items/tool/lapotronicPack";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public double getMaxPower() {
|
||||||
{
|
return MAX_CHARGE;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public EnumPowerTier getTier() {
|
||||||
|
return EnumPowerTier.EXTREME;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/lapotronicPack";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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");
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package techreborn.items.armor;
|
package techreborn.items.armor;
|
||||||
|
|
||||||
|
import cofh.api.energy.IEnergyContainerItem;
|
||||||
|
import ic2.api.item.IElectricItem;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
|
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
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.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
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.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
|
|
||||||
import java.util.List;
|
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 maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||||
public double transferLimit = 10000;
|
public double transferLimit = 10000;
|
||||||
|
|
||||||
public ItemLithiumBatpack()
|
public ItemLithiumBatpack() {
|
||||||
{
|
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setUnlocalizedName("techreborn.lithiumbatpack");
|
||||||
setUnlocalizedName("techreborn.lithiumbatpack");
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||||
{
|
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||||
return maxCharge;
|
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
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public void setEnergy(double energy) {
|
||||||
{
|
EnergyItem.setEnergy(energy, itemStack);
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack stack)
|
public double getMaxPower() {
|
||||||
{
|
return maxCharge;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.MEDIUM;
|
||||||
return transferLimit;
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTier(ItemStack stack)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||||
return tier;
|
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public double getMaxPower(ItemStack stack) {
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
return maxCharge;
|
||||||
{
|
}
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
@Override
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
itemList.add(charged);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
}
|
||||||
return 1 - charge;
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
|
return transferLimit;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return tier;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public String getTextureName(int damage)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
return "techreborn:items/tool/lithiumBatpack";
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
}
|
itemList.add(itemStack);
|
||||||
|
|
||||||
@Override
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
public int getMaxMeta()
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
{
|
itemList.add(charged);
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
{
|
return 1 - charge;
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/lithiumBatpack";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||||
|
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,51 +16,52 @@ import techreborn.lib.ModInfo;
|
||||||
*/
|
*/
|
||||||
public class ItemTRArmour extends ItemArmor implements ITexturedItem {
|
public class ItemTRArmour extends ItemArmor implements ITexturedItem {
|
||||||
|
|
||||||
private ArmorMaterial material = ArmorMaterial.LEATHER;
|
private ArmorMaterial material = ArmorMaterial.LEATHER;
|
||||||
private EntityEquipmentSlot slot = EntityEquipmentSlot.HEAD;
|
private EntityEquipmentSlot slot = EntityEquipmentSlot.HEAD;
|
||||||
|
|
||||||
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
|
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
|
||||||
super(material, material.getDamageReductionAmount(slot), slot);
|
super(material, material.getDamageReductionAmount(slot), slot);
|
||||||
if (slot == EntityEquipmentSlot.HEAD)
|
if (slot == EntityEquipmentSlot.HEAD)
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Helmet");
|
setUnlocalizedName(material.name().toLowerCase() + "Helmet");
|
||||||
if (slot == EntityEquipmentSlot.CHEST)
|
if (slot == EntityEquipmentSlot.CHEST)
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Chestplate");
|
setUnlocalizedName(material.name().toLowerCase() + "Chestplate");
|
||||||
if (slot == EntityEquipmentSlot.LEGS)
|
if (slot == EntityEquipmentSlot.LEGS)
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Leggings");
|
setUnlocalizedName(material.name().toLowerCase() + "Leggings");
|
||||||
if (slot == EntityEquipmentSlot.FEET)
|
if (slot == EntityEquipmentSlot.FEET)
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Boots");
|
setUnlocalizedName(material.name().toLowerCase() + "Boots");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage) {
|
public String getTextureName(int damage) {
|
||||||
if (slot == EntityEquipmentSlot.HEAD)
|
if (slot == EntityEquipmentSlot.HEAD)
|
||||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_helmet";
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_helmet";
|
||||||
if (slot == EntityEquipmentSlot.CHEST)
|
if (slot == EntityEquipmentSlot.CHEST)
|
||||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_chestplate";
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_chestplate";
|
||||||
if (slot == EntityEquipmentSlot.LEGS)
|
if (slot == EntityEquipmentSlot.LEGS)
|
||||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_leggings";
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_leggings";
|
||||||
if (slot == EntityEquipmentSlot.FEET)
|
if (slot == EntityEquipmentSlot.FEET)
|
||||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_boots";
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_boots";
|
||||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_error";
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta() {
|
public int getMaxMeta() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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");
|
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean isFull3D() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,105 +2,99 @@ package techreborn.items.battery;
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
import net.minecraft.item.IItemPropertyGetter;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.items.ItemTRNoDestroy;
|
import techreborn.items.ItemTRNoDestroy;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
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 maxEnergy = 0;
|
int maxTransfer = 0;
|
||||||
int maxTransfer = 0;
|
int tier = 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();
|
||||||
super();
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setMaxDamage(1);
|
||||||
setMaxDamage(1);
|
setUnlocalizedName("techreborn." + name);
|
||||||
setUnlocalizedName("techreborn."+name);
|
this.maxEnergy = maxEnergy;
|
||||||
this.name=name;
|
this.maxTransfer = maxTransfer;
|
||||||
this.maxEnergy=maxEnergy;
|
this.tier = tier;
|
||||||
this.maxTransfer=maxTransfer;
|
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
|
||||||
this.tier=tier;
|
@SideOnly(Side.CLIENT)
|
||||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter()
|
public float apply(ItemStack stack, @Nullable World worldIn,
|
||||||
{
|
@Nullable EntityLivingBase entityIn) {
|
||||||
@SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn,
|
if (stack != null && EnergyItem.getEnergy(stack) == 0.0) {
|
||||||
@Nullable EntityLivingBase entityIn)
|
return 1.0F;
|
||||||
{
|
}
|
||||||
if (stack != null && PoweredItem.getEnergy(stack) == 0.0)
|
return 0.0F;
|
||||||
{
|
}
|
||||||
return 1.0F;
|
});
|
||||||
}
|
}
|
||||||
return 0.0F;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SideOnly(Side.CLIENT)
|
||||||
@SideOnly(Side.CLIENT)
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
{
|
itemList.add(itemStack);
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
{
|
String max = PowerLocalization.getLocalizedPower(getMaxPower(stack));
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
String energy = PowerLocalization.getLocalizedPower(EnergyItem.getEnergy(stack));
|
||||||
return 1 - charge;
|
tooltip.add(TextFormatting.GRAY + energy + " / " + max);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
{
|
return 1 - (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public double getMaxPower(ItemStack stack) {
|
||||||
{
|
return maxEnergy;
|
||||||
return maxEnergy;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
{
|
return maxTransfer;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack stack)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return tier;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return maxTransfer;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStackTier(ItemStack stack)
|
|
||||||
{
|
|
||||||
return tier;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,5 @@ public class ItemEnergyCrystal extends ItemBattery {
|
||||||
public ItemEnergyCrystal() {
|
public ItemEnergyCrystal() {
|
||||||
super("energyCrystal", 100000, 512, 1);
|
super("energyCrystal", 100000, 512, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,5 @@ public class ItemLapotronCrystal extends ItemBattery {
|
||||||
public ItemLapotronCrystal() {
|
public ItemLapotronCrystal() {
|
||||||
super("lapotronCrystal", 1000000, 512, 2);
|
super("lapotronCrystal", 1000000, 512, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,6 @@ public class ItemLithiumBattery extends ItemBattery {
|
||||||
public ItemLithiumBattery() {
|
public ItemLithiumBattery() {
|
||||||
super("lithiumBattery", 100000, 512, 1);
|
super("lithiumBattery", 100000, 512, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package techreborn.items.battery;
|
package techreborn.items.battery;
|
||||||
|
|
||||||
public class ItemReBattery extends ItemBattery
|
public class ItemReBattery extends ItemBattery {
|
||||||
{
|
|
||||||
|
|
||||||
public ItemReBattery()
|
public ItemReBattery() {
|
||||||
{
|
|
||||||
super("rebattery", 10000, 64, 1);
|
super("rebattery", 10000, 64, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,13 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.util.TorchHelper;
|
import reborncore.common.util.TorchHelper;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
import net.minecraft.item.Item.ToolMaterial;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
|
|
||||||
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -137,14 +138,14 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
||||||
itemList.add(itemStack);
|
itemList.add(itemStack);
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
public double getDurabilityForDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
return 1 - charge;
|
return 1 - charge;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,117 +12,100 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.items.ItemTextureBase;
|
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 Teir = ConfigTechReborn.CloakingDeviceTier;
|
public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge;
|
||||||
public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge;
|
public static int Limit = 100;
|
||||||
public static int Limit = 100;
|
public static boolean isActive;
|
||||||
public static boolean isActive;
|
private int armorType = 1;
|
||||||
private int armorType = 1;
|
|
||||||
|
|
||||||
public ItemCloakingDevice()
|
public ItemCloakingDevice() {
|
||||||
{
|
setUnlocalizedName("techreborn.cloakingdevice");
|
||||||
setUnlocalizedName("techreborn.cloakingdevice");
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||||
{
|
if (EnergyItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack)) {
|
||||||
if (PoweredItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack))
|
EnergyItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
||||||
{
|
player.setInvisible(true);
|
||||||
PoweredItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
} else {
|
||||||
player.setInvisible(true);
|
if (!player.isPotionActive(MobEffects.INVISIBILITY)) {
|
||||||
} else
|
player.setInvisible(false);
|
||||||
{
|
}
|
||||||
if (!player.isPotionActive(MobEffects.INVISIBILITY))
|
}
|
||||||
{
|
}
|
||||||
player.setInvisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public double getMaxPower(ItemStack stack) {
|
||||||
{
|
return MaxCharge;
|
||||||
return MaxCharge;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack itemStack)
|
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
{
|
return Limit;
|
||||||
return Limit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTier(ItemStack stack)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return Teir;
|
||||||
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);
|
||||||
ItemStack itemstack1 = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
|
||||||
|
|
||||||
if (itemstack1 == null)
|
if (itemstack1 == null) {
|
||||||
{
|
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
|
||||||
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
|
itemStack.stackSize = 0;
|
||||||
itemStack.stackSize = 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@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);
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
itemList.add(itemStack);
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
{
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
return 1 - charge;
|
||||||
return 1 - charge;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/cloakingDevice";
|
||||||
return "techreborn:items/tool/cloakingDevice";
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxMeta()
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,49 +12,42 @@ import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.items.ItemTextureBase;
|
import techreborn.items.ItemTextureBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Mark on 20/03/2016.
|
* 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);
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setUnlocalizedName("techreborn.debug");
|
||||||
setUnlocalizedName("techreborn.debug");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/misc/debug";
|
||||||
return "techreborn:items/misc/debug";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||||
|
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
|
||||||
|
+ PowerLocalization.getLocalizedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||||
|
}
|
||||||
|
return EnumActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
return EnumActionResult.FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
|
||||||
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())));
|
|
||||||
}
|
|
||||||
return EnumActionResult.SUCCESS;
|
|
||||||
}
|
|
||||||
return EnumActionResult.FAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,5 @@ public class ItemDiamondChainsaw extends ItemChainsaw
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,5 @@ public class ItemDiamondDrill extends ItemDrill
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,5 @@ public class ItemDiamondJackhammer extends ItemJackhammer
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.util.TorchHelper;
|
import reborncore.common.util.TorchHelper;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
@ -31,134 +30,130 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
import net.minecraft.item.Item.ToolMaterial;
|
||||||
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
import techreborn.power.EnergyItem;
|
||||||
{
|
|
||||||
|
|
||||||
public static int tier = 1;
|
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld {
|
||||||
public int maxCharge = 1;
|
|
||||||
public int cost = 250;
|
|
||||||
public float unpoweredSpeed = 2.0F;
|
|
||||||
public double transferLimit = 100;
|
|
||||||
|
|
||||||
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial)
|
public static int tier = 1;
|
||||||
{
|
public int maxCharge = 1;
|
||||||
super(material);
|
public int cost = 250;
|
||||||
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
|
public float unpoweredSpeed = 2.0F;
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
public double transferLimit = 100;
|
||||||
setMaxStackSize(1);
|
|
||||||
setMaxDamage(240);
|
|
||||||
setUnlocalizedName(unlocalizedName);
|
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
|
||||||
this.maxCharge = energyCapacity;
|
|
||||||
this.tier = tier;
|
|
||||||
this.unpoweredSpeed = unpoweredSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial) {
|
||||||
EntityLivingBase entityLiving)
|
super(material);
|
||||||
{
|
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
|
||||||
Random rand = new Random();
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
|
setMaxStackSize(1);
|
||||||
{
|
setMaxDamage(240);
|
||||||
PoweredItem.useEnergy(cost, stack);
|
setUnlocalizedName(unlocalizedName);
|
||||||
}
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
return true;
|
this.maxCharge = energyCapacity;
|
||||||
}
|
this.tier = tier;
|
||||||
|
this.unpoweredSpeed = unpoweredSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
|
@Override
|
||||||
{
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||||
if (!PoweredItem.canUseEnergy(cost, stack))
|
EntityLivingBase entityLiving) {
|
||||||
{
|
Random rand = new Random();
|
||||||
return unpoweredSpeed;
|
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0) {
|
||||||
}
|
EnergyItem.useEnergy(cost, stack);
|
||||||
if (Items.WOODEN_PICKAXE.getStrVsBlock(stack, state) > 1.0F
|
}
|
||||||
|| Items.WOODEN_SHOVEL.getStrVsBlock(stack, state) > 1.0F)
|
return true;
|
||||||
{
|
}
|
||||||
return efficiencyOnProperMaterial;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return super.getStrVsBlock(stack, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
@Override
|
||||||
EntityLivingBase entityliving1)
|
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||||
{
|
if (!EnergyItem.canUseEnergy(cost, stack)) {
|
||||||
return true;
|
return unpoweredSpeed;
|
||||||
}
|
}
|
||||||
|
if (Items.WOODEN_PICKAXE.getStrVsBlock(stack, state) > 1.0F
|
||||||
|
|| Items.WOODEN_SHOVEL.getStrVsBlock(stack, state) > 1.0F) {
|
||||||
|
return efficiencyOnProperMaterial;
|
||||||
|
} else {
|
||||||
|
return super.getStrVsBlock(stack, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
@Override
|
||||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||||
{
|
return true;
|
||||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isRepairable()
|
@Override
|
||||||
{
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||||
return false;
|
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
}
|
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override public double getMaxPower(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean isRepairable() {
|
||||||
return maxCharge;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
@Override
|
||||||
{
|
public double getMaxPower(ItemStack stack) {
|
||||||
return true;
|
return maxCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxTransfer(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
return transferLimit;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getStackTier(ItemStack stack)
|
@Override
|
||||||
{
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
return tier;
|
return transferLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
@Override
|
||||||
CreativeTabs par2CreativeTabs, List itemList)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return tier;
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
}
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
@SideOnly(Side.CLIENT)
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
public void getSubItems(Item item,
|
||||||
itemList.add(charged);
|
CreativeTabs tab, List<ItemStack> itemList) {
|
||||||
}
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
|
itemList.add(itemStack);
|
||||||
|
|
||||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
{
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
itemList.add(charged);
|
||||||
return 1 - charge;
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
|
return 1 - charge;
|
||||||
|
|
||||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
}
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getTextureName(int damage)
|
@Override
|
||||||
{
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
return "techreborn:items/tool/nullDrill";
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getMaxMeta()
|
@Override
|
||||||
{
|
public String getTextureName(int damage) {
|
||||||
return 1;
|
return "techreborn:items/tool/nullDrill";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
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 ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
|
||||||
int useRemaining)
|
|
||||||
{
|
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,160 +21,140 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.util.TorchHelper;
|
import reborncore.common.util.TorchHelper;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
import techreborn.utils.OreDictUtils;
|
import techreborn.utils.OreDictUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
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 static int tier = 1;
|
||||||
public int maxCharge = 1;
|
public int maxCharge = 1;
|
||||||
public int cost = 250;
|
public int cost = 250;
|
||||||
public double transferLimit = 100;
|
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);
|
||||||
super(material);
|
efficiencyOnProperMaterial = 20F;
|
||||||
efficiencyOnProperMaterial = 20F;
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setMaxDamage(240);
|
||||||
setMaxDamage(240);
|
setUnlocalizedName(unlocalizedName);
|
||||||
setUnlocalizedName(unlocalizedName);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
this.maxCharge = energyCapacity;
|
||||||
this.maxCharge = energyCapacity;
|
ItemJackhammer.tier = tier;
|
||||||
this.tier = tier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
@Override
|
||||||
EntityLivingBase entityLiving)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||||
{
|
EntityLivingBase entityLiving) {
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
|
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0) {
|
||||||
{
|
EnergyItem.useEnergy(cost, stack);
|
||||||
PoweredItem.useEnergy(cost, stack);
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(IBlockState state)
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
{
|
return OreDictUtils.isOre(state, "stone");
|
||||||
// TODO needs // FIXME: 13/03/2016
|
}
|
||||||
return OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||||
if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost,
|
if (OreDictUtils.isOre(state, "stone") && EnergyItem.canUseEnergy(cost, stack)) {
|
||||||
stack)) {
|
return efficiencyOnProperMaterial;
|
||||||
return efficiencyOnProperMaterial;
|
} else {
|
||||||
} else {
|
return 0.5F;
|
||||||
return 0.5F;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
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);
|
||||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepairable()
|
public boolean isRepairable() {
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public double getMaxPower(ItemStack stack) {
|
||||||
{
|
return maxCharge;
|
||||||
return maxCharge;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack stack)
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
{
|
return transferLimit;
|
||||||
return transferLimit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTier(ItemStack stack)
|
public int getStackTier(ItemStack stack) {
|
||||||
{
|
return tier;
|
||||||
return tier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@SideOnly(Side.CLIENT)
|
@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);
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
itemList.add(itemStack);
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
{
|
if (EnergyItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
|
return 0;
|
||||||
{
|
}
|
||||||
return 0;
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
}
|
return 1 - charge;
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
|
||||||
return 1 - charge;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/nullJackhammer";
|
||||||
return "techreborn:items/tool/nullJackhammer";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
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 ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
|
||||||
{
|
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,186 +24,172 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.util.ChatUtils;
|
import reborncore.common.util.ChatUtils;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModItems;
|
import techreborn.init.ModItems;
|
||||||
import techreborn.lib.MessageIDs;
|
import techreborn.lib.MessageIDs;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
||||||
{
|
public int cost = 250;
|
||||||
public int cost = 250;
|
|
||||||
|
|
||||||
public ItemNanosaber()
|
public ItemNanosaber() {
|
||||||
{
|
super(ToolMaterial.DIAMOND);
|
||||||
super(ToolMaterial.DIAMOND);
|
setNoRepair();
|
||||||
setNoRepair();
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setMaxDamage(1);
|
||||||
setMaxDamage(1);
|
setUnlocalizedName("techreborn.nanosaber");
|
||||||
setUnlocalizedName("techreborn.nanosaber");
|
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
|
||||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter()
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public float apply(ItemStack stack, @Nullable World worldIn,
|
||||||
@SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn,
|
@Nullable EntityLivingBase entityIn) {
|
||||||
@Nullable EntityLivingBase entityIn)
|
if (stack != null && stack.getTagCompound().getBoolean("isActive")) {
|
||||||
{
|
return 1.0F;
|
||||||
if (stack != null && stack.getTagCompound().getBoolean("isActive"))
|
}
|
||||||
{
|
return 0.0F;
|
||||||
return 1.0F;
|
}
|
||||||
}
|
});
|
||||||
return 0.0F;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,
|
@Override
|
||||||
ItemStack stack)
|
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,
|
||||||
{
|
ItemStack stack) {
|
||||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||||
int modifier = 0;
|
int modifier = 0;
|
||||||
if (stack.getTagCompound().getBoolean("isActive"))
|
if (stack.getTagCompound().getBoolean("isActive"))
|
||||||
modifier = 9;
|
modifier = 9;
|
||||||
|
|
||||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||||
{
|
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(),
|
||||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(),
|
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0));
|
||||||
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0));
|
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(),
|
||||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(),
|
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
|
||||||
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
|
}
|
||||||
}
|
return multimap;
|
||||||
return multimap;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
@Override
|
||||||
EntityLivingBase entityliving1)
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||||
{
|
EntityLivingBase entityliving1) {
|
||||||
if (PoweredItem.canUseEnergy(cost, itemstack))
|
if (EnergyItem.canUseEnergy(cost, itemstack)) {
|
||||||
{
|
EnergyItem.useEnergy(cost, itemstack);
|
||||||
PoweredItem.useEnergy(cost, itemstack);
|
return true;
|
||||||
return true;
|
} else {
|
||||||
} else
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
CreativeTabs par2CreativeTabs, List itemList)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public void getSubItems(Item item,
|
||||||
ItemStack inactiveUncharged = new ItemStack(ModItems.nanosaber);
|
CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
inactiveUncharged.setTagCompound(new NBTTagCompound());
|
ItemStack inactiveUncharged = new ItemStack(ModItems.nanosaber);
|
||||||
inactiveUncharged.getTagCompound().setBoolean("isActive", false);
|
inactiveUncharged.setTagCompound(new NBTTagCompound());
|
||||||
|
inactiveUncharged.getTagCompound().setBoolean("isActive", false);
|
||||||
|
|
||||||
ItemStack inactiveCharged = new ItemStack(ModItems.nanosaber);
|
ItemStack inactiveCharged = new ItemStack(ModItems.nanosaber);
|
||||||
inactiveCharged.setTagCompound(new NBTTagCompound());
|
inactiveCharged.setTagCompound(new NBTTagCompound());
|
||||||
inactiveCharged.getTagCompound().setBoolean("isActive", false);
|
inactiveCharged.getTagCompound().setBoolean("isActive", false);
|
||||||
PoweredItem.setEnergy(getMaxPower(inactiveCharged), inactiveCharged);
|
EnergyItem.setEnergy(getMaxPower(inactiveCharged), inactiveCharged);
|
||||||
|
|
||||||
ItemStack activeUncharged = new ItemStack(ModItems.nanosaber);
|
ItemStack activeUncharged = new ItemStack(ModItems.nanosaber);
|
||||||
activeUncharged.setTagCompound(new NBTTagCompound());
|
activeUncharged.setTagCompound(new NBTTagCompound());
|
||||||
activeUncharged.getTagCompound().setBoolean("isActive", true);
|
activeUncharged.getTagCompound().setBoolean("isActive", true);
|
||||||
|
|
||||||
ItemStack activeCharged = new ItemStack(ModItems.nanosaber);
|
ItemStack activeCharged = new ItemStack(ModItems.nanosaber);
|
||||||
activeCharged.setTagCompound(new NBTTagCompound());
|
activeCharged.setTagCompound(new NBTTagCompound());
|
||||||
activeCharged.getTagCompound().setBoolean("isActive", true);
|
activeCharged.getTagCompound().setBoolean("isActive", true);
|
||||||
PoweredItem.setEnergy(getMaxPower(activeCharged), activeCharged);
|
EnergyItem.setEnergy(getMaxPower(activeCharged), activeCharged);
|
||||||
|
|
||||||
itemList.add(inactiveUncharged);
|
itemList.add(inactiveUncharged);
|
||||||
itemList.add(inactiveCharged);
|
itemList.add(inactiveCharged);
|
||||||
itemList.add(activeUncharged);
|
itemList.add(activeUncharged);
|
||||||
itemList.add(activeCharged);
|
itemList.add(activeCharged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||||
{
|
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive"))
|
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberInactive"));
|
||||||
{
|
} else {
|
||||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberInactive"));
|
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberActive"));
|
||||||
} else
|
}
|
||||||
{
|
}
|
||||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberActive"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
@Override
|
||||||
EnumHand hand)
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||||
{
|
EnumHand hand) {
|
||||||
if (player.isSneaking())
|
if (player.isSneaking()) {
|
||||||
{
|
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive"))
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
{
|
stack.getTagCompound().setBoolean("isActive", true);
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||||
stack.getTagCompound().setBoolean("isActive", true);
|
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat)
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||||
{
|
+ TextFormatting.GOLD + I18n
|
||||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
.translateToLocal("techreborn.message.nanosaberActive")));
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
}
|
||||||
+ TextFormatting.GOLD + I18n
|
} else {
|
||||||
.translateToLocal("techreborn.message.nanosaberActive")));
|
stack.getTagCompound().setBoolean("isActive", false);
|
||||||
}
|
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||||
} else
|
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||||
{
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||||
stack.getTagCompound().setBoolean("isActive", false);
|
+ TextFormatting.GOLD + I18n
|
||||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat)
|
.translateToLocal("techreborn.message.nanosaberInactive")));
|
||||||
{
|
}
|
||||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
}
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
}
|
||||||
+ TextFormatting.GOLD + I18n
|
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||||
.translateToLocal("techreborn.message.nanosaberInactive")));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
@Override
|
||||||
{
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
|
if (EnergyItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||||
{
|
return 0;
|
||||||
return 0;
|
}
|
||||||
}
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
return 1 - charge;
|
||||||
return 1 - charge;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean isRepairable()
|
@Override
|
||||||
{
|
public boolean isRepairable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxPower(ItemStack stack)
|
@Override
|
||||||
{
|
public double getMaxPower(ItemStack stack) {
|
||||||
return 100000;
|
return 100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxTransfer(ItemStack stack)
|
@Override
|
||||||
{
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
return 512;
|
return 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStackTier(ItemStack stack) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override public int getStackTier(ItemStack stack)
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,168 +23,147 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.util.TorchHelper;
|
import reborncore.common.util.TorchHelper;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
import techreborn.power.EnergyItem;
|
||||||
public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
|
|
||||||
{
|
|
||||||
|
|
||||||
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||||
public static final int tier = ConfigTechReborn.OmniToolTier;
|
|
||||||
public int cost = 100;
|
|
||||||
public int hitCost = 125;
|
|
||||||
|
|
||||||
public ItemOmniTool()
|
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
||||||
{
|
public static final int tier = ConfigTechReborn.OmniToolTier;
|
||||||
super(ToolMaterial.DIAMOND);
|
public int cost = 100;
|
||||||
efficiencyOnProperMaterial = 13F;
|
public int hitCost = 125;
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
|
||||||
setMaxStackSize(1);
|
|
||||||
setMaxDamage(200);
|
|
||||||
setUnlocalizedName("techreborn.omniTool");
|
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemOmniTool() {
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
super(ToolMaterial.DIAMOND);
|
||||||
EntityLivingBase entityLiving)
|
efficiencyOnProperMaterial = 13F;
|
||||||
{
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
PoweredItem.useEnergy(cost, stack);
|
setMaxStackSize(1);
|
||||||
return true;
|
setMaxDamage(200);
|
||||||
}
|
setUnlocalizedName("techreborn.omniTool");
|
||||||
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(IBlockState state)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||||
{
|
EnergyItem.useEnergy(cost, stack);
|
||||||
return Items.DIAMOND_AXE.canHarvestBlock(state) || Items.DIAMOND_SWORD.canHarvestBlock(state)
|
return true;
|
||||||
|| Items.DIAMOND_PICKAXE.canHarvestBlock(state) || Items.DIAMOND_SHOVEL.canHarvestBlock(state)
|
}
|
||||||
|| Items.SHEARS.canHarvestBlock(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
// if (PoweredItem.canUseEnergy(cost, stack)) {
|
return Items.DIAMOND_AXE.canHarvestBlock(state) || Items.DIAMOND_SWORD.canHarvestBlock(state)
|
||||||
// PoweredItem.useEnergy(cost, stack);
|
|| Items.DIAMOND_PICKAXE.canHarvestBlock(state) || Items.DIAMOND_SHOVEL.canHarvestBlock(state)
|
||||||
// return 5.0F;
|
|| Items.SHEARS.canHarvestBlock(state);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F
|
|
||||||
// || Items.wooden_sword.getDigSpeed(stack, state) > 1.0F
|
|
||||||
// || Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F
|
|
||||||
// || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F
|
|
||||||
// || Items.shears.getDigSpeed(stack, state) > 1.0F) {
|
|
||||||
// return efficiencyOnProperMaterial;
|
|
||||||
// } else {
|
|
||||||
// return super.getDigSpeed(stack, state);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker)
|
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
{
|
// if (PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
if (PoweredItem.canUseEnergy(hitCost, itemstack))
|
// PoweredItem.useEnergy(cost, stack);
|
||||||
{
|
// return 5.0F;
|
||||||
PoweredItem.useEnergy(hitCost, itemstack);
|
// }
|
||||||
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
|
//
|
||||||
}
|
// if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F
|
||||||
return false;
|
// || Items.wooden_sword.getDigSpeed(stack, state) > 1.0F
|
||||||
}
|
// || Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F
|
||||||
|
// || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F
|
||||||
|
// || Items.shears.getDigSpeed(stack, state) > 1.0F) {
|
||||||
|
// return efficiencyOnProperMaterial;
|
||||||
|
// } else {
|
||||||
|
// return super.getDigSpeed(stack, state);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
|
||||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
if (EnergyItem.canUseEnergy(hitCost, itemstack)) {
|
||||||
{
|
EnergyItem.useEnergy(hitCost, itemstack);
|
||||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepairable()
|
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);
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack)
|
public boolean isRepairable() {
|
||||||
{
|
return false;
|
||||||
return maxCharge;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(ItemStack stack)
|
public double getMaxPower(ItemStack stack) {
|
||||||
{
|
return maxCharge;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(ItemStack itemStack)
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxTransfer(ItemStack stack)
|
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||||
{
|
return false;
|
||||||
return 200;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTier(ItemStack stack)
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
{
|
return 200;
|
||||||
return 2;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int getStackTier(ItemStack stack) {
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
return 2;
|
||||||
{
|
}
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
@SideOnly(Side.CLIENT)
|
||||||
itemList.add(charged);
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
}
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
|
itemList.add(itemStack);
|
||||||
|
|
||||||
@Override
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
public double getDurabilityForDisplay(ItemStack stack)
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
{
|
itemList.add(charged);
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
}
|
||||||
return 1 - charge;
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
|
return 1 - charge;
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
{
|
return true;
|
||||||
return "techreborn:items/tool/omnitool";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/omnitool";
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int getMaxMeta() {
|
||||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
return 1;
|
||||||
{
|
}
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
|
||||||
}
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
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) {
|
||||||
|
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
|
||||||
{
|
|
||||||
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,146 +19,139 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
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 maxCharge = ConfigTechReborn.RockCutterCharge;
|
||||||
public static final int tier = ConfigTechReborn.RockCutterTier;
|
public static final int tier = ConfigTechReborn.RockCutterTier;
|
||||||
public int cost = 500;
|
public int cost = 500;
|
||||||
|
|
||||||
public ItemRockCutter()
|
public ItemRockCutter() {
|
||||||
{
|
super(ToolMaterial.DIAMOND);
|
||||||
super(ToolMaterial.DIAMOND);
|
setUnlocalizedName("techreborn.rockcutter");
|
||||||
setUnlocalizedName("techreborn.rockcutter");
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
efficiencyOnProperMaterial = 16F;
|
||||||
efficiencyOnProperMaterial = 16F;
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
@Override
|
||||||
EntityLivingBase entityLiving)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||||
{
|
EntityLivingBase entityLiving) {
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack) + 1) == 0)
|
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||||
{
|
EnergyItem.useEnergy(cost, stack);
|
||||||
PoweredItem.useEnergy(cost, stack);
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean canHarvestBlock(IBlockState state)
|
@Override
|
||||||
{
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
if (Items.DIAMOND_PICKAXE.canHarvestBlock(state))
|
if (Items.DIAMOND_PICKAXE.canHarvestBlock(state)) {
|
||||||
{
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
return false;
|
||||||
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);
|
||||||
stack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return super.getHarvestLevel(stack, toolClass);
|
return super.getHarvestLevel(stack, toolClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
|
@Override
|
||||||
{
|
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||||
if (!PoweredItem.canUseEnergy(cost, stack))
|
if (!EnergyItem.canUseEnergy(cost, stack)) {
|
||||||
{
|
return 2F;
|
||||||
return 2F;
|
} else {
|
||||||
}else{
|
return Items.DIAMOND_PICKAXE.getStrVsBlock(stack, state);
|
||||||
return Items.DIAMOND_PICKAXE.getStrVsBlock(stack, state);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean isRepairable()
|
@Override
|
||||||
{
|
public boolean isRepairable() {
|
||||||
return false;
|
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);
|
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxPower(ItemStack stack)
|
@Override
|
||||||
{
|
public double getMaxPower(ItemStack stack) {
|
||||||
return maxCharge;
|
return maxCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean canAcceptEnergy(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean canProvideEnergy(ItemStack stack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxTransfer(ItemStack stack)
|
@Override
|
||||||
{
|
public double getMaxTransfer(ItemStack stack) {
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getStackTier(ItemStack stack)
|
@Override
|
||||||
{
|
public int getStackTier(ItemStack stack) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
@SideOnly(Side.CLIENT)
|
||||||
CreativeTabs par2CreativeTabs, List itemList)
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
||||||
{
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
itemStack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||||
itemStack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
itemList.add(itemStack);
|
||||||
itemList.add(itemStack);
|
|
||||||
|
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
charged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
charged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||||
PoweredItem.setEnergy(getMaxPower(charged), charged);
|
EnergyItem.setEnergy(getMaxPower(charged), charged);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
@Override
|
||||||
{
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
double charge = (EnergyItem.getEnergy(stack) / getMaxPower(stack));
|
||||||
return 1 - charge;
|
return 1 - charge;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
@Override
|
||||||
{
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getTextureName(int damage)
|
@Override
|
||||||
{
|
public String getTextureName(int damage) {
|
||||||
return "techreborn:items/tool/rockcutter";
|
return "techreborn:items/tool/rockcutter";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getMaxMeta()
|
@Override
|
||||||
{
|
public int getMaxMeta() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
@Override
|
||||||
int useRemaining)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
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.block.state.IBlockState;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
public class ItemSteelChainsaw extends ItemChainsaw
|
|
||||||
{
|
|
||||||
|
|
||||||
public ItemSteelChainsaw()
|
public class ItemSteelChainsaw extends ItemChainsaw {
|
||||||
{
|
|
||||||
super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge,
|
|
||||||
ConfigTechReborn.IronChainsawTier, 2.0F);
|
|
||||||
this.cost = 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemSteelChainsaw() {
|
||||||
public boolean canHarvestBlock(IBlockState state)
|
super(ToolMaterial.IRON, "techreborn.ironChainsaw",
|
||||||
{
|
ConfigTechReborn.IronChainsawCharge,
|
||||||
return Items.IRON_AXE.canHarvestBlock(state);
|
ConfigTechReborn.IronChainsawTier, 2.0F);
|
||||||
}
|
this.cost = 50;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
{
|
return Items.IRON_AXE.canHarvestBlock(state);
|
||||||
return "techreborn:items/tool/steelChainsaw";
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/steelChainsaw";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxMeta()
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,31 +3,27 @@ package techreborn.items.tools;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import techreborn.config.ConfigTechReborn;
|
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,
|
||||||
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge,
|
ConfigTechReborn.IronDrillTier, 0.5F, 10F);
|
||||||
ConfigTechReborn.IronDrillTier, 0.5F, 10F);
|
this.cost = 50;
|
||||||
this.cost = 50;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(IBlockState state)
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
{
|
return Items.IRON_PICKAXE.canHarvestBlock(state) || Items.IRON_SHOVEL.canHarvestBlock(state);
|
||||||
return Items.IRON_PICKAXE.canHarvestBlock(state) || Items.IRON_SHOVEL.canHarvestBlock(state);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/steelDrill";
|
||||||
return "techreborn:items/tool/steelDrill";
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxMeta()
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
package techreborn.items.tools;
|
package techreborn.items.tools;
|
||||||
|
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
public class ItemSteelJackhammer extends ItemJackhammer
|
|
||||||
{
|
|
||||||
|
|
||||||
public ItemSteelJackhammer()
|
public class ItemSteelJackhammer extends ItemJackhammer {
|
||||||
{
|
|
||||||
super(ToolMaterial.DIAMOND, "techreborn.steelJackhammer", ConfigTechReborn.SteelJackhammerCharge,
|
|
||||||
ConfigTechReborn.SteelJackhammerTier);
|
|
||||||
this.cost = 50;
|
|
||||||
this.efficiencyOnProperMaterial = 12F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemSteelJackhammer() {
|
||||||
public String getTextureName(int damage)
|
super(ToolMaterial.DIAMOND, "techreborn.steelJackhammer",
|
||||||
{
|
ConfigTechReborn.SteelJackhammerCharge,
|
||||||
return "techreborn:items/tool/steelJackhammer";
|
ConfigTechReborn.SteelJackhammerTier);
|
||||||
}
|
this.cost = 50;
|
||||||
|
this.efficiencyOnProperMaterial = 12F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextureName(int damage) {
|
||||||
|
return "techreborn:items/tool/steelJackhammer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxMeta() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxMeta()
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package techreborn.items.tools;
|
package techreborn.items.tools;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import me.modmuss50.jsonDestroyer.api.IHandHeld;
|
import me.modmuss50.jsonDestroyer.api.IHandHeld;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -20,48 +17,52 @@ import reborncore.RebornCore;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ItemTRAxe extends ItemTool implements ITexturedItem , IHandHeld {
|
public class ItemTRAxe extends ItemTool implements ITexturedItem , IHandHeld {
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
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.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) {
|
public ItemTRAxe(ToolMaterial material) {
|
||||||
super(material, EFFECTIVE_ON);
|
super(material, EFFECTIVE_ON);
|
||||||
this.damageVsEntity = material.getDamageVsEntity() + 5.75F;
|
this.damageVsEntity = material.getDamageVsEntity() + 5.75F;
|
||||||
this.attackSpeed = (material.getDamageVsEntity() + 6.75F) * -0.344444F;
|
this.attackSpeed = (material.getDamageVsEntity() + 6.75F) * -0.344444F;
|
||||||
setUnlocalizedName(material.name().toLowerCase() + "Axe");
|
setUnlocalizedName(material.name().toLowerCase() + "Axe");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.material = material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||||
Material material = state.getMaterial();
|
Material material = state.getMaterial();
|
||||||
return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE
|
return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE
|
||||||
? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage) {
|
public String getTextureName(int damage) {
|
||||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_axe";
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_axe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta() {
|
public int getMaxMeta() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
@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() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,40 +13,37 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
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;
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRHoe(ToolMaterial material) {
|
public ItemTRHoe(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Hoe");
|
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.material=material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_hoe";
|
||||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_hoe";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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");
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
}
|
||||||
}
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean isFull3D()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,40 +13,36 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
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;
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRPickaxe(ToolMaterial material) {
|
public ItemTRPickaxe(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Pickaxe");
|
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.material=material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_pickaxe";
|
||||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_pickaxe";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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");
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
}
|
||||||
}
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean isFull3D()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,40 +13,36 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
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;
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRSpade(ToolMaterial material) {
|
public ItemTRSpade(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Spade");
|
setUnlocalizedName(material.name().toLowerCase() + "Spade");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.material=material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_shovel";
|
||||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_shovel";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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");
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
}
|
||||||
}
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean isFull3D()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,40 +13,36 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
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;
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRSword(ToolMaterial material) {
|
public ItemTRSword(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase()+"Sword");
|
setUnlocalizedName(material.name().toLowerCase() + "Sword");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.material=material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_sword";
|
||||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_sword";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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");
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
}
|
||||||
}
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean isFull3D()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,40 +16,29 @@ import techreborn.client.GuiHandler;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.items.ItemTextureBase;
|
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);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setUnlocalizedName("techreborn.manual");
|
||||||
setUnlocalizedName("techreborn.manual");
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World world, EntityPlayer player,
|
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World world, EntityPlayer player,
|
||||||
EnumHand hand)
|
EnumHand hand) {
|
||||||
{
|
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||||
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY,
|
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
|
||||||
(int) player.posY);
|
}
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/manual";
|
||||||
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,40 +11,41 @@ import reborncore.RebornCore;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
public class ItemTreeTap extends Item implements ITexturedItem
|
public class ItemTreeTap extends Item implements ITexturedItem {
|
||||||
{
|
|
||||||
|
|
||||||
public ItemTreeTap()
|
public ItemTreeTap() {
|
||||||
{
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
setMaxDamage(20);
|
||||||
setMaxDamage(20);
|
setUnlocalizedName("techreborn.treetap");
|
||||||
setUnlocalizedName("techreborn.treetap");
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack stack)
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
{
|
return stack.getMetadata() != 0;
|
||||||
return stack.getMetadata() != 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
public String getTextureName(int damage) {
|
||||||
{
|
return "techreborn:items/tool/treetap";
|
||||||
return "techreborn:items/tool/treetap";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta() {
|
||||||
{
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
|
||||||
{
|
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,159 +37,135 @@ import java.util.Random;
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 26/02/2016.
|
* 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);
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setUnlocalizedName("techreborn.wrench");
|
||||||
setUnlocalizedName("techreborn.wrench");
|
setMaxStackSize(1);
|
||||||
setMaxStackSize(1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
@Override
|
||||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
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)) {
|
||||||
if (world.isAirBlock(pos))
|
return EnumActionResult.FAIL;
|
||||||
{
|
}
|
||||||
return EnumActionResult.FAIL;
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
}
|
if (tile == null) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
return EnumActionResult.FAIL;
|
||||||
if (tile == null)
|
}
|
||||||
{
|
|
||||||
return EnumActionResult.FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.isSneaking() && !player.worldObj.isRemote)
|
if (!player.isSneaking() && !player.worldObj.isRemote) {
|
||||||
{
|
if (tile instanceof TileMachineBase) {
|
||||||
if (tile instanceof TileMachineBase)
|
if (side != EnumFacing.DOWN && side != EnumFacing.UP) {
|
||||||
{
|
((TileMachineBase) tile).setFacing(side);
|
||||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP)
|
return EnumActionResult.SUCCESS;
|
||||||
{
|
}
|
||||||
((TileMachineBase) tile).setFacing(side);
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
}
|
||||||
}
|
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
@Override
|
||||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
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;
|
||||||
return EnumActionResult.FAIL;
|
}
|
||||||
}
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
if (tile == null) {
|
||||||
if (tile == null)
|
return EnumActionResult.FAIL;
|
||||||
{
|
}
|
||||||
return EnumActionResult.FAIL;
|
if (!world.isRemote) {
|
||||||
}
|
if (player.isSneaking()) {
|
||||||
if (!world.isRemote)
|
List<ItemStack> items = new ArrayList<>();
|
||||||
{
|
if (tile instanceof IInventory) {
|
||||||
if (player.isSneaking())
|
IInventory inventory = (IInventory) tile;
|
||||||
{
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
List<ItemStack> items = new ArrayList<>();
|
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||||
if (tile instanceof IInventory)
|
|
||||||
{
|
|
||||||
IInventory inventory = (IInventory) tile;
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
|
||||||
{
|
|
||||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
|
||||||
|
|
||||||
if (itemStack != null)
|
if (itemStack != null) {
|
||||||
{
|
if (itemStack.stackSize > 0) {
|
||||||
if (itemStack.stackSize > 0)
|
if (itemStack.getItem() instanceof ItemBlock)
|
||||||
{
|
|
||||||
if (itemStack.getItem() instanceof ItemBlock)
|
|
||||||
|
|
||||||
if (!(((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid)
|
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());
|
||||||
items.add(itemStack.copy());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (tile instanceof IWrenchable) {
|
||||||
if (tile instanceof IWrenchable)
|
if (((IWrenchable) tile).wrenchCanRemove(player)) {
|
||||||
{
|
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||||
if (((IWrenchable) tile).wrenchCanRemove(player))
|
if (itemStack == null) {
|
||||||
{
|
return EnumActionResult.FAIL;
|
||||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
}
|
||||||
if (itemStack == null)
|
items.add(itemStack);
|
||||||
{
|
}
|
||||||
return EnumActionResult.FAIL;
|
if (!items.isEmpty()) {
|
||||||
}
|
for (ItemStack itemStack : items) {
|
||||||
items.add(itemStack);
|
|
||||||
}
|
|
||||||
if (!items.isEmpty())
|
|
||||||
{
|
|
||||||
for (ItemStack itemStack : items)
|
|
||||||
{
|
|
||||||
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY,
|
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY,
|
||||||
pos.getZ() + dZ, itemStack.copy());
|
pos.getZ() + dZ, itemStack.copy());
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
if (itemStack.hasTagCompound()) {
|
||||||
{
|
entityItem.getEntityItem()
|
||||||
entityItem.getEntityItem()
|
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||||
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
entityItem.motionX = rand.nextGaussian() * factor;
|
entityItem.motionX = rand.nextGaussian() * factor;
|
||||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||||
if (!world.isRemote)
|
if (!world.isRemote) {
|
||||||
{
|
world.spawnEntityInWorld(entityItem);
|
||||||
world.spawnEntityInWorld(entityItem);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
world.playSound(null, player.posX, player.posY,
|
||||||
world.playSound(null, player.posX, player.posY,
|
player.posZ, ModSounds.dismantle,
|
||||||
player.posZ, ModSounds.dismantle,
|
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||||
{
|
}
|
||||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}else{
|
} else {
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getTextureName(int damage)
|
@Override
|
||||||
{
|
public String getTextureName(int damage) {
|
||||||
return "techreborn:items/tool/wrench";
|
return "techreborn:items/tool/wrench";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getMaxMeta()
|
@Override
|
||||||
{
|
public int getMaxMeta() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
@Override
|
||||||
int useRemaining)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@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.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
|
||||||
import reborncore.api.power.tile.IEnergyReceiverTile;
|
import reborncore.api.power.tile.IEnergyReceiverTile;
|
||||||
import reborncore.common.RebornCoreConfig;
|
import reborncore.common.RebornCoreConfig;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.mcmultipart.block.TileMultipartContainer;
|
import reborncore.mcmultipart.block.TileMultipartContainer;
|
||||||
import reborncore.mcmultipart.multipart.ISlottedPart;
|
import reborncore.mcmultipart.multipart.ISlottedPart;
|
||||||
import reborncore.mcmultipart.multipart.PartSlot;
|
import reborncore.mcmultipart.multipart.PartSlot;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IContainerProvider;
|
import reborncore.api.tile.IContainerProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.container.RebornContainer;
|
import reborncore.common.container.RebornContainer;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
import reborncore.common.tile.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
|
@ -50,18 +49,6 @@ public class TileCentrifuge extends TilePowerAcceptor implements IWrenchable,IIn
|
||||||
super.update();
|
super.update();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
// charge(6); TODO
|
// 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
|
@Override
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.util.PowerLocalization;
|
||||||
import reborncore.common.tile.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
@ -41,7 +41,7 @@ public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
||||||
public void addInfo(List<String> info, boolean isRealTile) {
|
public void addInfo(List<String> info, boolean isRealTile) {
|
||||||
super.addInfo(info, isRealTile);
|
super.addInfo(info, isRealTile);
|
||||||
info.add(TextFormatting.LIGHT_PURPLE + "Eu per extract " + TextFormatting.GREEN
|
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
|
info.add(TextFormatting.LIGHT_PURPLE + "Speed: " + TextFormatting.GREEN
|
||||||
+ "1000mb/5 sec");
|
+ "1000mb/5 sec");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.fuel.FluidPowerManager;
|
import reborncore.api.fuel.FluidPowerManager;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.tile.TilePowerProducer;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -8,7 +7,7 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.tile.TilePowerProducer;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
|
|
@ -8,15 +8,13 @@ import net.minecraft.util.ITickable;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.IListInfoProvider;
|
import reborncore.api.IListInfoProvider;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
|
||||||
import reborncore.api.power.tile.IEnergyProducerTile;
|
import reborncore.api.power.tile.IEnergyProducerTile;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
|
||||||
import reborncore.common.tile.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.tile.TilePowerAcceptorProducer;
|
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||||
|
import techreborn.power.EnergyItem;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -64,31 +62,12 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IEnergyProdu
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
if (inventory.getStackInSlot(0) != null) {
|
if (inventory.getStackInSlot(0) != null) {
|
||||||
ItemStack stack = inventory.getStackInSlot(0);
|
EnergyItem.charge(inventory.getStackInSlot(0), this);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (inventory.getStackInSlot(1) != null) {
|
if (inventory.getStackInSlot(1) != null) {
|
||||||
ItemStack stack = inventory.getStackInSlot(1);
|
EnergyItem.discharge(inventory.getStackInSlot(1), this);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
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()
|
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 class TileLVTransformer extends TileTransformer
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileLVTransformer()
|
public TileLVTransformer() {
|
||||||
{
|
super("LVTransformer", ModBlocks.lvt, EnumPowerTier.MEDIUM, 128, 32, 128);
|
||||||
super("LVTransformer", ModBlocks.lvt, EnumPowerTier.LOW, ConfigTechReborn.LVTransformerMaxInput, ConfigTechReborn.LVTransformerMaxOutput, ConfigTechReborn.LVTransformerMaxInput*2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,29 +7,10 @@ import techreborn.init.ModBlocks;
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 16/03/2016.
|
* Created by modmuss50 on 16/03/2016.
|
||||||
*/
|
*/
|
||||||
public class TileMVTransformer extends TileTransformer
|
public class TileMVTransformer extends TileTransformer {
|
||||||
{
|
|
||||||
|
|
||||||
public TileMVTransformer()
|
public TileMVTransformer() {
|
||||||
{
|
super("MVTransformer", ModBlocks.mvt, EnumPowerTier.HIGH, 512, 128, 512);
|
||||||
super("MVTransformer", ModBlocks.mvt, EnumPowerTier.HIGH, ConfigTechReborn.MVTransformerMaxInput, ConfigTechReborn.MVTransformerMaxOutput, ConfigTechReborn.LVTransformerMaxInput*2);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 512;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.HIGH;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,101 +7,105 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import techreborn.blocks.transformers.BlockTransformer;
|
import techreborn.blocks.transformers.BlockTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Rushmead
|
* 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 String name;
|
||||||
public Block wrenchDrop;
|
public Block wrenchDrop;
|
||||||
public EnumPowerTier tier;
|
public EnumPowerTier tier;
|
||||||
public int maxInput;
|
public int maxInput;
|
||||||
public int maxOutput;
|
public int maxOutput;
|
||||||
public int maxStorage;
|
public int maxStorage;
|
||||||
|
|
||||||
public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage)
|
public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||||
{
|
this.wrenchDrop = wrenchDrop;
|
||||||
super(1);
|
this.tier = tier;
|
||||||
this.wrenchDrop = wrenchDrop;
|
this.name = name;
|
||||||
this.tier = tier;
|
this.maxInput = maxInput;
|
||||||
this.name = name;
|
this.maxOutput = maxOuput;
|
||||||
this.maxInput = maxInput;
|
this.maxStorage = maxStorage;
|
||||||
this.maxOutput = maxOuput;
|
}
|
||||||
this.maxStorage = maxStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean wrenchCanSetFacing(EntityPlayer p0, EnumFacing p1)
|
@Override
|
||||||
{
|
public boolean wrenchCanSetFacing(EntityPlayer p0, EnumFacing p1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public EnumFacing getFacing()
|
@Override
|
||||||
{
|
public EnumFacing getFacing() {
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
@Override
|
||||||
{
|
public void setFacing(EnumFacing facing) {
|
||||||
return entityPlayer.isSneaking();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public float getWrenchDropRate()
|
}
|
||||||
{
|
|
||||||
return 1.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public ItemStack getWrenchDrop(EntityPlayer p0)
|
@Override
|
||||||
{
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
return new ItemStack(wrenchDrop);
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxPower()
|
@Override
|
||||||
{
|
public float getWrenchDropRate() {
|
||||||
return maxStorage;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canAcceptEnergy(EnumFacing direction)
|
@Override
|
||||||
{
|
public ItemStack getWrenchDrop(EntityPlayer p0) {
|
||||||
|
return new ItemStack(wrenchDrop);
|
||||||
|
}
|
||||||
|
|
||||||
return getFacingEnum() != direction;
|
@Override
|
||||||
}
|
public double getMaxPower() {
|
||||||
|
return maxStorage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override public EnumFacing getFacingEnum()
|
@Override
|
||||||
{
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
Block block = worldObj.getBlockState(pos).getBlock();
|
|
||||||
if (block instanceof BlockTransformer)
|
|
||||||
{
|
|
||||||
return ((BlockTransformer) block).getFacing(worldObj.getBlockState(pos));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean canProvideEnergy(EnumFacing direction)
|
return getFacingEnum() != direction;
|
||||||
{
|
}
|
||||||
return getFacing() == direction;
|
|
||||||
}
|
@Override
|
||||||
|
public EnumFacing getFacingEnum() {
|
||||||
|
Block block = worldObj.getBlockState(pos).getBlock();
|
||||||
|
if (block instanceof BlockTransformer) {
|
||||||
|
return ((BlockTransformer) block).getFacing(worldObj.getBlockState(pos));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
|
return getFacing() == direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override public double getMaxOutput()
|
@Override
|
||||||
{
|
public double getMaxOutput() {
|
||||||
return maxOutput;
|
return maxOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public double getMaxInput()
|
@Override
|
||||||
{
|
public double getMaxInput() {
|
||||||
return maxInput;
|
return maxInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumPowerTier getTier() {
|
||||||
|
return tier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return tier;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue