Merge branch '1.9' of https://github.com/TechReborn/TechReborn into 1.9
This commit is contained in:
commit
0e4983a0f1
33 changed files with 2093 additions and 1279 deletions
|
@ -75,7 +75,7 @@ dependencies {
|
|||
if(!f.exists()){
|
||||
f.mkdir()
|
||||
}
|
||||
compile 'RebornCore:RebornCore-1.9:2.0.2.+:dev'
|
||||
compile 'RebornCore:RebornCore-1.9:2.0.3.+:dev'
|
||||
deobfCompile "mezz.jei:jei_1.9:3.1.+"
|
||||
deobfCompile 'MCMultiPart:MCMultiPart-experimental:1.1.0_55:universal'
|
||||
}
|
||||
|
|
|
@ -4,14 +4,28 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.Core;
|
||||
|
||||
public class ScrapboxList
|
||||
{
|
||||
|
||||
public static List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
public static List<ItemStack> stacks = new ArrayList<>();
|
||||
|
||||
public static void addItemStackToList(ItemStack stack)
|
||||
{
|
||||
stacks.add(stack);
|
||||
if (!hasItems(stack))
|
||||
{
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasItems(ItemStack stack)
|
||||
{
|
||||
for (ItemStack s : stacks)
|
||||
{
|
||||
if (stack.getDisplayName().equals(s.getDisplayName()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package techreborn.blocks.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.blocks.IRotationTexture;
|
||||
|
@ -46,14 +39,6 @@ public class BlockGenerator extends BlockMachineBase implements IRotationTexture
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
|
|
|
@ -73,12 +73,17 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock
|
|||
@Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
if(worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering()
|
||||
&& worldIn.isDaytime()){
|
||||
return this.getDefaultState().withProperty(ACTIVE, true);
|
||||
if(!worldIn.isRemote)
|
||||
{
|
||||
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering() && worldIn.isDaytime())
|
||||
{
|
||||
return this.getDefaultState().withProperty(ACTIVE, true);
|
||||
|
||||
}else{
|
||||
return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
} else
|
||||
{
|
||||
return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
}
|
||||
}else{return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
|
@ -20,5 +30,37 @@ public class BlockBatBox extends BlockEnergyStorage
|
|||
{
|
||||
return new TileBatBox();
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
ArrayList<ItemStack> items = (ArrayList<ItemStack>) dropInventory(worldIn, pos, new ItemStack(this));
|
||||
for(ItemStack itemStack : items){
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
EntityItem entityItem = new EntityItem(worldIn, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
worldIn.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,10 @@ import net.minecraft.block.properties.PropertyDirection;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
|
@ -28,7 +26,6 @@ import reborncore.common.BaseTileBlock;
|
|||
import reborncore.common.blocks.IRotationTexture;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -48,6 +45,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
public BlockEnergyStorage(String name, int guiID)
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn." + name.toLowerCase());
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
|
@ -125,24 +123,22 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropInventory(worldIn, pos);
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
protected void dropInventory(World world, BlockPos pos)
|
||||
|
||||
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
return;
|
||||
System.out.print("Null");
|
||||
return null;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
|
||||
System.out.print("Not INstance");
|
||||
return null;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
@ -171,30 +167,9 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
}
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
items.add(itemToDrop.copy());
|
||||
return items;
|
||||
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = 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, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -266,13 +241,6 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
items.add(new ItemStack(ModBlocks.machineframe));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
|
@ -20,5 +31,37 @@ public class BlockMFE extends BlockEnergyStorage
|
|||
{
|
||||
return new TileMFE();
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
ArrayList<ItemStack> items = (ArrayList<ItemStack>) dropInventory(worldIn, pos, new ItemStack(ModBlocks.machineframe, 1 , 6));
|
||||
for(ItemStack itemStack : items){
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
EntityItem entityItem = new EntityItem(worldIn, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
worldIn.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
|
@ -13,6 +24,7 @@ public class BlockMFSU extends BlockEnergyStorage
|
|||
public BlockMFSU()
|
||||
{
|
||||
super("MFSU", GuiHandler.mfsuID);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,4 +33,37 @@ public class BlockMFSU extends BlockEnergyStorage
|
|||
return new TileMFSU();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
ArrayList<ItemStack> items = (ArrayList<ItemStack>) dropInventory(worldIn, pos, new ItemStack(ModBlocks.machineframe, 1 , 7));
|
||||
for(ItemStack itemStack : items){
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
EntityItem entityItem = new EntityItem(worldIn, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
worldIn.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,4 +63,5 @@ public class BlockGrinder extends BlockMachineBase implements IAdvancedRotationT
|
|||
{
|
||||
return prefix + "tier1_machine_bottom";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.transformers.TileHVTransformer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
|
@ -53,5 +61,31 @@ public class BlockHVTransformer extends BlockLVTransformer
|
|||
{
|
||||
return prefix + "hv_transformer_bottom";
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(ModBlocks.machineframe, 1 ,7);
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = 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, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.blocks.storage.BlockBatBox;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.transformers.TileLVTransformer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
|
@ -54,4 +61,30 @@ public class BlockLVTransformer extends BlockBatBox
|
|||
{
|
||||
return prefix + "lv_transformer_side";
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = 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, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.transformers.TileMVTransformer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
*/
|
||||
|
@ -53,4 +61,31 @@ public class BlockMVTransformer extends BlockLVTransformer
|
|||
{
|
||||
return prefix + "mv_transformer_side";
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(ModBlocks.machineframe);
|
||||
itemStack.setItemDamage(6);
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = 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, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import techreborn.tiles.generator.*;
|
|||
import techreborn.tiles.idsu.TileIDSU;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
import techreborn.tiles.teir1.*;
|
||||
|
||||
|
@ -186,6 +187,8 @@ public class GuiHandler implements IGuiHandler
|
|||
return new ContainerBatbox((TileBatBox) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
}else if (ID == mfsuID){
|
||||
return new ContainerMFSU((TileMFSU) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
}else if (ID == mfeID){
|
||||
return new ContainerMFE((TileMFE) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -313,6 +316,10 @@ public class GuiHandler implements IGuiHandler
|
|||
{
|
||||
return new GuiMFSU(player, (TileMFSU) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
}
|
||||
else if (ID == mfeID)
|
||||
{
|
||||
return new GuiMFE(player, (TileMFE) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
package techreborn.client;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.Core;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
|
||||
public class StackToolTipEvent
|
||||
{
|
||||
|
||||
|
@ -63,8 +61,8 @@ public class StackToolTipEvent
|
|||
try
|
||||
{
|
||||
Block block = Block.getBlockFromItem(event.getItemStack().getItem());
|
||||
if (block != null && block instanceof BlockContainer
|
||||
&& block.getClass().getCanonicalName().startsWith("techreborn."))
|
||||
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
|
||||
&& Block.blockRegistry.getNameForObject(block).getResourceDomain().contains("techreborn"))
|
||||
{
|
||||
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().theWorld,
|
||||
block.getDefaultState());
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.inventory.ICrafting;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotCharge;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
|
@ -39,8 +40,8 @@ public class ContainerBatbox extends RebornContainer
|
|||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
// this.addSlotToContainer(new SlotCharge(tile.inventory, 0, 80, 17));
|
||||
// this.addSlotToContainer(new SlotCharge(tile.inventory, 1, 80, 53));
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 1, 80, 53));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
115
src/main/java/techreborn/client/container/ContainerMFE.java
Normal file
115
src/main/java/techreborn/client/container/ContainerMFE.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
/**
|
||||
* Created by Rushmead
|
||||
*/
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotCharge;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
|
||||
|
||||
public class ContainerMFE extends RebornContainer
|
||||
{
|
||||
|
||||
public int burnTime = 0;
|
||||
public int totalBurnTime = 0;
|
||||
public int energy;
|
||||
public int tickTime;
|
||||
EntityPlayer player;
|
||||
TileMFE tile;
|
||||
private static final EntityEquipmentSlot[] equipmentSlots = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
|
||||
public ContainerMFE(TileMFE tile, EntityPlayer player)
|
||||
{
|
||||
super();
|
||||
this.tile = tile;
|
||||
this.player = player;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
final EntityEquipmentSlot slot = equipmentSlots[k];
|
||||
addSlotToContainer(new Slot(player.inventory, player.inventory.getSizeInventory() - 2 - k, 44, 6 + k * 19)
|
||||
{
|
||||
@Override
|
||||
public int getSlotStackLimit() { return 1; }
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return stack != null && stack.getItem().isValidArmor(stack, slot, player);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 1, 80, 53));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.energy != (int) tile.getEnergy())
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
this.burnTime = value;
|
||||
} else if (id == 1)
|
||||
{
|
||||
this.totalBurnTime = value;
|
||||
} else if (id == 2)
|
||||
{
|
||||
this.energy = value;
|
||||
}
|
||||
this.tile.setEnergy(energy);
|
||||
}
|
||||
|
||||
public int getScaledBurnTime(int i)
|
||||
{
|
||||
return (int) (((float) burnTime / (float) totalBurnTime) * i);
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import net.minecraft.inventory.Slot;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotCharge;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
|
||||
|
@ -54,8 +55,8 @@ public class ContainerMFSU extends RebornContainer
|
|||
}
|
||||
});
|
||||
}
|
||||
// this.addSlotToContainer(new SlotCharge(tile.inventory, 0, 80, 17));
|
||||
// this.addSlotToContainer(new SlotCharge(tile.inventory, 1, 80, 53));
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 1, 80, 53));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ public class GuiBatbox extends GuiContainer
|
|||
|
||||
int j = 0;
|
||||
|
||||
j = generator.getEnergyScaled(12);
|
||||
j = generator.getEnergyScaled(24);
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||
|
|
77
src/main/java/techreborn/client/gui/GuiMFE.java
Normal file
77
src/main/java/techreborn/client/gui/GuiMFE.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.client.container.ContainerMFE;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
|
||||
/**
|
||||
* Created by Rushmead
|
||||
*/
|
||||
public class GuiMFE extends GuiContainer
|
||||
{
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/mfe.png");
|
||||
|
||||
TileMFE generator;
|
||||
|
||||
ContainerMFE containerGenerator;
|
||||
|
||||
public GuiMFE(EntityPlayer player, TileMFE generator)
|
||||
{
|
||||
super(new ContainerMFE(generator, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.generator = generator;
|
||||
this.containerGenerator = (ContainerMFE) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
j = generator.getEnergyScaled(24);
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||
}
|
||||
//
|
||||
// if (containerGenerator.burnTime != 0)
|
||||
// {
|
||||
// j = containerGenerator.getScaledBurnTime(13);
|
||||
// this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14,
|
||||
// j + 1);
|
||||
// }
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||
{
|
||||
String name = I18n.translateToLocal("tile.techreborn.mfe.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), this.xSize - 60,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(generator.getMaxPower()), 110, this.ySize - 150,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||
4210752);
|
||||
}
|
||||
}
|
|
@ -14,50 +14,11 @@ import reborncore.common.util.BucketHandler;
|
|||
import techreborn.Core;
|
||||
import techreborn.blocks.BlockMachineFrame;
|
||||
import techreborn.events.OreUnifier;
|
||||
import techreborn.items.ItemCells;
|
||||
import techreborn.items.ItemCrushedOre;
|
||||
import techreborn.items.ItemDusts;
|
||||
import techreborn.items.ItemDustsSmall;
|
||||
import techreborn.items.ItemEnergyCrystal;
|
||||
import techreborn.items.ItemGems;
|
||||
import techreborn.items.ItemIngots;
|
||||
import techreborn.items.ItemLapotronCrystal;
|
||||
import techreborn.items.ItemLapotronicOrb;
|
||||
import techreborn.items.ItemLithiumBattery;
|
||||
import techreborn.items.ItemMissingRecipe;
|
||||
import techreborn.items.ItemNuggets;
|
||||
import techreborn.items.ItemParts;
|
||||
import techreborn.items.ItemPlates;
|
||||
import techreborn.items.ItemReBattery;
|
||||
import techreborn.items.ItemScrapBox;
|
||||
import techreborn.items.ItemUUmatter;
|
||||
import techreborn.items.*;
|
||||
import techreborn.items.armor.ItemLapotronPack;
|
||||
import techreborn.items.armor.ItemLithiumBatpack;
|
||||
import techreborn.items.armor.ItemTRArmour;
|
||||
import techreborn.items.tools.ItemAdvancedChainsaw;
|
||||
import techreborn.items.tools.ItemAdvancedDrill;
|
||||
import techreborn.items.tools.ItemCloakingDevice;
|
||||
import techreborn.items.tools.ItemDebugTool;
|
||||
import techreborn.items.tools.ItemDiamondChainsaw;
|
||||
import techreborn.items.tools.ItemDiamondDrill;
|
||||
import techreborn.items.tools.ItemDiamondJackhammer;
|
||||
import techreborn.items.tools.ItemFluidbucket;
|
||||
import techreborn.items.tools.ItemHammer;
|
||||
import techreborn.items.tools.ItemIronChainsaw;
|
||||
import techreborn.items.tools.ItemIronDrill;
|
||||
import techreborn.items.tools.ItemIronJackhammer;
|
||||
import techreborn.items.tools.ItemNanosaber;
|
||||
import techreborn.items.tools.ItemOmniTool;
|
||||
import techreborn.items.tools.ItemRockCutter;
|
||||
import techreborn.items.tools.ItemSteelJackhammer;
|
||||
import techreborn.items.tools.ItemTRAxe;
|
||||
import techreborn.items.tools.ItemTRHoe;
|
||||
import techreborn.items.tools.ItemTRPickaxe;
|
||||
import techreborn.items.tools.ItemTRSpade;
|
||||
import techreborn.items.tools.ItemTRSword;
|
||||
import techreborn.items.tools.ItemTechManual;
|
||||
import techreborn.items.tools.ItemTreeTap;
|
||||
import techreborn.items.tools.ItemWrench;
|
||||
import techreborn.items.tools.*;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class ModItems
|
||||
|
@ -209,7 +170,12 @@ public class ModItems
|
|||
{
|
||||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluid("fluid" + ItemCells.types[i].toLowerCase()),
|
||||
ItemCells.getCellByName(ItemCells.types[i]));
|
||||
ItemCells.getCellByName(ItemCells.types[i]), ItemCells.getCellByName("empty"));
|
||||
}else if(FluidRegistry.getFluid(ItemCells.types[i].toLowerCase()) != null){
|
||||
|
||||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluid(ItemCells.types[i].toLowerCase()),
|
||||
ItemCells.getCellByName(ItemCells.types[i]), ItemCells.getCellByName("empty"));
|
||||
}
|
||||
}
|
||||
rockCutter = PoweredItem.createItem(ItemRockCutter.class);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,12 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemAdvancedChainsaw extends ItemChainsaw
|
||||
|
@ -31,4 +36,10 @@ public class ItemAdvancedChainsaw extends ItemChainsaw
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemAdvancedDrill extends ItemDrill
|
||||
|
@ -31,4 +36,10 @@ public class ItemAdvancedDrill extends ItemDrill
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.util.EnumActionResult;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -179,5 +180,10 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,18 +18,19 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import techreborn.blocks.fluid.BlockFluidBase;
|
||||
import techreborn.blocks.storage.BlockBatBox;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.items.ItemTR;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
|
@ -44,8 +45,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
@Override public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
{
|
||||
if (world.isAirBlock(pos))
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -56,13 +58,17 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if(!player.isSneaking()){
|
||||
if(tile instanceof TileBatBox){
|
||||
tile.getWorld().setBlockState(tile.getPos(), tile.getWorld().getBlockState(pos).withProperty(BlockBatBox.FACING, side.getOpposite()));
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
if (tile instanceof TileBatBox)
|
||||
{
|
||||
tile.getWorld().setBlockState(tile.getPos(),
|
||||
tile.getWorld().getBlockState(pos).withProperty(BlockBatBox.FACING, side.getOpposite()));
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else
|
||||
if(tile instanceof TileMachineBase){
|
||||
if(side != EnumFacing.DOWN && side != EnumFacing.UP){
|
||||
} else if (tile instanceof TileMachineBase)
|
||||
{
|
||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP)
|
||||
{
|
||||
((TileMachineBase) tile).setFacing(side);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
@ -71,10 +77,10 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand,
|
||||
EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
|
||||
if (world.isAirBlock(pos))
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -84,113 +90,109 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (player.isSneaking())
|
||||
if (!world.isRemote)
|
||||
{
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
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>();
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
IInventory inventory = (IInventory) tile;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)
|
||||
if (itemStack.stackSize > 0)
|
||||
{
|
||||
continue;
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
|
||||
if (!(((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid)
|
||||
|| !(((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid))
|
||||
{
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
if (tile instanceof IWrenchable)
|
||||
{
|
||||
if (((IWrenchable) tile).wrenchCanRemove(player))
|
||||
{
|
||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||
if (itemStack == null)
|
||||
if (tile instanceof IWrenchable)
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
items.add(itemStack);
|
||||
}
|
||||
if (!items.isEmpty())
|
||||
{
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = 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, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
if (((IWrenchable) tile).wrenchCanRemove(player))
|
||||
{
|
||||
entityItem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||
if (itemStack == null)
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
items.add(itemStack);
|
||||
}
|
||||
if (!items.isEmpty())
|
||||
{
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = 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,
|
||||
pos.getZ() + dZ, itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
// TODO 1.9 sounds
|
||||
// world.playSoundAtEntity(player, "techreborn:block_dismantle",
|
||||
// 0.8F, 1F);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
world.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 1.9 sounds
|
||||
// world.playSoundAtEntity(player, "techreborn:block_dismantle",
|
||||
// 0.8F, 1F);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return EnumActionResult.FAIL;
|
||||
}else{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/wrench";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
@SideOnly(Side.CLIENT) public boolean isFull3D()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.Reference;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileCentrifuge extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventory, ISidedInventory, IListInfoProvider
|
||||
implements IWrenchable, IInventory, IListInfoProvider
|
||||
{
|
||||
|
||||
public int tickTime;
|
||||
|
@ -51,6 +52,19 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
charge(6);
|
||||
if (inventory.getStackInSlot(6) != null)
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot(6);
|
||||
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
|
||||
|
@ -163,26 +177,26 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
{
|
||||
if (slotIndex >= 2)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
{
|
||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||
}
|
||||
// // ISidedInventory
|
||||
// @Override
|
||||
// public int[] getSlotsForFace(EnumFacing side)
|
||||
// {
|
||||
// return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
// {
|
||||
// if (slotIndex >= 2)
|
||||
// return false;
|
||||
// return isItemValidForSlot(slotIndex, itemStack);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
// {
|
||||
// return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||
// }
|
||||
|
||||
public int getProgressScaled(int scale)
|
||||
{
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.blocks.generator.BlockSolarPanel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class TileSolarPanel extends TilePowerAcceptor
|
||||
public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
||||
{
|
||||
|
||||
boolean shouldMakePower = false;
|
||||
|
@ -26,9 +28,11 @@ public class TileSolarPanel extends TilePowerAcceptor
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
if (worldObj.getTotalWorldTime() % 60 == 0)
|
||||
{
|
||||
shouldMakePower = isSunOut();
|
||||
|
||||
}
|
||||
if (shouldMakePower)
|
||||
{
|
||||
|
@ -38,6 +42,10 @@ public class TileSolarPanel extends TilePowerAcceptor
|
|||
{
|
||||
powerToAdd = 0;
|
||||
}
|
||||
|
||||
worldObj.setBlockState(getPos(),
|
||||
worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +63,7 @@ public class TileSolarPanel extends TilePowerAcceptor
|
|||
|
||||
public boolean isSunOut()
|
||||
{
|
||||
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
|
||||
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
|
||||
&& worldObj.isDaytime();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,111 +1,23 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.init.ModBlocks;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class TileBatBox extends TilePowerAcceptor implements IWrenchable
|
||||
public class TileBatBox extends TileEnergyStorage implements IListInfoProvider
|
||||
{
|
||||
|
||||
public Inventory inventory = new Inventory(2, "TileBatBox", 64, this);
|
||||
public TileBatBox()
|
||||
{
|
||||
super(1);
|
||||
super("BatBox", 2, ModBlocks.batBox, EnumPowerTier.LOW, 32, 32, 4000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
@Override public void addInfo(List<String> info, boolean isRealTile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (entityPlayer.isSneaking())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
return new ItemStack(ModBlocks.batBox);
|
||||
}
|
||||
|
||||
public boolean isComplete()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
return 40000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
return getFacingEnum() != direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
return getFacingEnum() == direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
inventory.writeToNBT(tagCompound);
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readFromNBT(nbttagcompound);
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
info.add("Batbox");
|
||||
}
|
||||
}
|
240
src/main/java/techreborn/tiles/storage/TileEnergyStorage.java
Normal file
240
src/main/java/techreborn/tiles/storage/TileEnergyStorage.java
Normal file
|
@ -0,0 +1,240 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||
|
||||
/**
|
||||
* Created by Rushmead
|
||||
*/
|
||||
public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable, ITickable, IInventory
|
||||
{
|
||||
|
||||
public Inventory inventory;
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
public EnumPowerTier tier;
|
||||
public int maxInput;
|
||||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
public TileEnergyStorage(String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage)
|
||||
{
|
||||
super(1);
|
||||
inventory = new Inventory(invSize, "Tile" + name, 64, this);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
this.tier = tier;
|
||||
this.name = name;
|
||||
this.maxInput = maxInput;
|
||||
this.maxOutput = maxOuput;
|
||||
this.maxStorage = maxStorage;
|
||||
}
|
||||
|
||||
@Override public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public EnumFacing getFacing()
|
||||
{
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (entityPlayer.isSneaking())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public void updateEntity()
|
||||
{
|
||||
if (inventory.getStackInSlot(0) != null)
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
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)
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot(1);
|
||||
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 public float getWrenchDropRate()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
return new ItemStack(wrenchDrop);
|
||||
}
|
||||
|
||||
@Override public double getMaxPower()
|
||||
{
|
||||
return maxStorage;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
|
||||
return getFacingEnum() != direction;
|
||||
}
|
||||
|
||||
@Override public EnumFacing getFacingEnum()
|
||||
{
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockEnergyStorage)
|
||||
{
|
||||
return ((BlockEnergyStorage) block).getFacing(worldObj.getBlockState(pos));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
return getFacing() == direction;
|
||||
}
|
||||
|
||||
@Override public double getMaxOutput()
|
||||
{
|
||||
return maxOutput;
|
||||
}
|
||||
|
||||
@Override public double getMaxInput()
|
||||
{
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
@Override public EnumPowerTier getTier()
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override public void writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
inventory.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readFromNBT(nbttagcompound);
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override public int getSizeInventory()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override public ItemStack getStackInSlot(int index)
|
||||
{
|
||||
return inventory.getStackInSlot(index);
|
||||
}
|
||||
|
||||
@Override public ItemStack decrStackSize(int index, int count)
|
||||
{
|
||||
return inventory.decrStackSize(index, count);
|
||||
}
|
||||
|
||||
@Override public ItemStack removeStackFromSlot(int index)
|
||||
{
|
||||
return inventory.removeStackFromSlot(index);
|
||||
}
|
||||
|
||||
@Override public void setInventorySlotContents(int index, ItemStack stack)
|
||||
{
|
||||
inventory.setInventorySlotContents(index, stack);
|
||||
}
|
||||
|
||||
@Override public int getInventoryStackLimit()
|
||||
{
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override public void openInventory(EntityPlayer player)
|
||||
{
|
||||
inventory.openInventory(player);
|
||||
}
|
||||
|
||||
@Override public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
inventory.closeInventory(player);
|
||||
}
|
||||
|
||||
@Override public boolean isItemValidForSlot(int index, ItemStack stack)
|
||||
{
|
||||
return inventory.isItemValidForSlot(index, stack);
|
||||
}
|
||||
|
||||
@Override public int getField(int id)
|
||||
{
|
||||
return inventory.getField(id);
|
||||
}
|
||||
|
||||
@Override public void setField(int id, int value)
|
||||
{
|
||||
inventory.setField(id, value);
|
||||
}
|
||||
|
||||
@Override public int getFieldCount()
|
||||
{
|
||||
return inventory.getFieldCount();
|
||||
}
|
||||
|
||||
@Override public void clear()
|
||||
{
|
||||
inventory.clear();
|
||||
}
|
||||
|
||||
@Override public String getName()
|
||||
{
|
||||
return inventory.getName();
|
||||
}
|
||||
|
||||
@Override public boolean hasCustomName()
|
||||
{
|
||||
return inventory.hasCustomName();
|
||||
}
|
||||
|
||||
@Override public ITextComponent getDisplayName()
|
||||
{
|
||||
return inventory.getDisplayName();
|
||||
}
|
||||
}
|
|
@ -1,43 +1,17 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class TileMFE extends TileBatBox
|
||||
public class TileMFE extends TileEnergyStorage
|
||||
{
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
public TileMFE()
|
||||
{
|
||||
return new ItemStack(ModBlocks.mfe);
|
||||
super("MFE", 2, ModBlocks.mfe, EnumPowerTier.MEDIUM, 512, 512, 4000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
return 4000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
return EnumPowerTier.MEDIUM;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +1,16 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class TileMFSU extends TileBatBox
|
||||
public class TileMFSU extends TileEnergyStorage
|
||||
{
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
public TileMFSU()
|
||||
{
|
||||
return new ItemStack(ModBlocks.mfsu);
|
||||
super("MFSU", 2, ModBlocks.mfsu, EnumPowerTier.HIGH, 2048, 2048, 40000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
return 40000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
return 2048;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
return 2048;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
return EnumPowerTier.HIGH;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -15,7 +16,10 @@ import techreborn.init.ModBlocks;
|
|||
import techreborn.lib.Reference;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
|
||||
public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory
|
||||
import java.util.List;
|
||||
|
||||
public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory,
|
||||
IListInfoProvider
|
||||
{
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
|
@ -262,4 +266,9 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInve
|
|||
{
|
||||
return inventory.getDisplayName();
|
||||
}
|
||||
|
||||
@Override public void addInfo(List<String> info, boolean isRealTile)
|
||||
{
|
||||
info.add("Macerator");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import techreborn.init.ModBlocks;
|
|||
*/
|
||||
public class StackWIPHandler
|
||||
{
|
||||
|
||||
ArrayList<Block> wipBlocks = new ArrayList<>();
|
||||
public static ArrayList<ItemStack> devHeads = new ArrayList<>();
|
||||
|
||||
|
@ -28,6 +27,9 @@ public class StackWIPHandler
|
|||
wipBlocks.add(ModBlocks.ChunkLoader);
|
||||
wipBlocks.add(ModBlocks.ElectricCraftingTable);
|
||||
wipBlocks.add(ModBlocks.playerDetector);
|
||||
wipBlocks.add(ModBlocks.chargeBench);
|
||||
wipBlocks.add(ModBlocks.playerDetector);
|
||||
wipBlocks.add(ModBlocks.Magicenergeyconverter);
|
||||
|
||||
addHead("modmuss50");
|
||||
addHead("Gigabit101");
|
||||
|
@ -51,9 +53,9 @@ public class StackWIPHandler
|
|||
event.getToolTip().add(TextFormatting.RED + "WIP Coming Soon");
|
||||
}
|
||||
|
||||
if(devHeads.contains(event.getItemStack())){
|
||||
if(devHeads.contains(event.getItemStack()))
|
||||
{
|
||||
event.getToolTip().add(TextFormatting.GOLD + "TechReborn Developer");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue