Cleanup ~

This commit is contained in:
Ellpeck 2016-02-01 17:49:55 +01:00
parent c92aebfe0a
commit 0540313e75
107 changed files with 1075 additions and 1076 deletions

View file

@ -16,14 +16,14 @@ public interface IBookletEntry{
List<IBookletChapter> getChapters();
void setChapters(List<IBookletChapter> chapters);
String getUnlocalizedName();
String getLocalizedName();
String getLocalizedNameWithFormatting();
void setChapters(List<IBookletChapter> chapters);
void addChapter(IBookletChapter chapter);
}

View file

@ -28,8 +28,9 @@ public abstract class Lens{
/**
* Invokes the lens type's behavior on a block
*
* @param hitBlock The block that was hit
* @param tile The tile the lens was invoked from
* @param tile The tile the lens was invoked from
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
*/
public abstract boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile);

View file

@ -40,10 +40,9 @@ import java.util.List;
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public BlockAtomicReconstructor(String name){
super(Material.rock, name);
@ -53,24 +52,6 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public boolean isOpaqueCube(){
return false;
@ -139,6 +120,24 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{
private long lastSysTime;

View file

@ -31,8 +31,8 @@ import net.minecraft.world.World;
public class BlockBreaker extends BlockContainerBase{
private boolean isPlacer;
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
private boolean isPlacer;
public BlockBreaker(boolean isPlacer, String name){
super(Material.rock, name);
@ -43,11 +43,6 @@ public class BlockBreaker extends BlockContainerBase{
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker();
@ -81,6 +76,11 @@ public class BlockBreaker extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -46,11 +46,6 @@ public class BlockCoalGenerator extends BlockContainerBase{
this.setTickRandomly(true);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityCoalGenerator();
@ -85,6 +80,11 @@ public class BlockCoalGenerator extends BlockContainerBase{
return EnumRarity.RARE;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -44,17 +44,12 @@ public class BlockCoffeeMachine extends BlockContainerBase{
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public boolean isOpaqueCube(){
public boolean isFullCube(){
return false;
}
@Override
public boolean isFullCube(){
public boolean isOpaqueCube(){
return false;
}
@ -105,4 +100,9 @@ public class BlockCoffeeMachine extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
}

View file

@ -53,11 +53,6 @@ public class BlockColoredLamp extends BlockBase{
this.isOn = isOn;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int par3){
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
@ -128,16 +123,6 @@ public class BlockColoredLamp extends BlockBase{
return this.isOn ? 15 : 0;
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length];
@ -149,6 +134,20 @@ public class BlockColoredLamp extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{

View file

@ -42,11 +42,6 @@ public class BlockCrystal extends BlockBase{
this.setHarvestLevel("pickaxe", 1);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public int damageDropped(IBlockState state){
return this.getMetaFromState(state);
@ -60,6 +55,17 @@ public class BlockCrystal extends BlockBase{
}
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length];
for(int i = 0; i < allCrystals.length; i++){
String name = this.getBaseName()+allCrystals[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
@ -71,14 +77,8 @@ public class BlockCrystal extends BlockBase{
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length];
for(int i = 0; i < allCrystals.length; i++){
String name = this.getBaseName()+allCrystals[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{

View file

@ -41,11 +41,6 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityDirectionalBreaker();
@ -79,6 +74,11 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -39,10 +39,6 @@ public class BlockDropper extends BlockContainerBase{
this.setResistance(10.0F);
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
@ -77,6 +73,11 @@ public class BlockDropper extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -35,12 +35,12 @@ public class BlockFishingNet extends BlockContainerBase{
}
@Override
public boolean isOpaqueCube(){
public boolean isFullCube(){
return false;
}
@Override
public boolean isFullCube(){
public boolean isOpaqueCube(){
return false;
}

View file

@ -44,11 +44,6 @@ public class BlockFluidCollector extends BlockContainerBase{
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector();
@ -82,6 +77,11 @@ public class BlockFluidCollector extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -48,11 +48,6 @@ public class BlockFurnaceDouble extends BlockContainerBase{
this.setTickRandomly(true);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFurnaceDouble();
@ -135,6 +130,11 @@ public class BlockFurnaceDouble extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -35,12 +35,12 @@ public class BlockFurnaceSolar extends BlockContainerBase{
}
@Override
public boolean isOpaqueCube(){
public boolean isFullCube(){
return false;
}
@Override
public boolean isFullCube(){
public boolean isOpaqueCube(){
return false;
}

View file

@ -36,22 +36,31 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
this.setStepSound(soundTypeStone);
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer(){
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public boolean isFullCube(){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer(){
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
@ -61,13 +70,4 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGreenhouseGlass();
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side);
}
}

View file

@ -35,8 +35,8 @@ import java.util.Random;
public class BlockGrinder extends BlockContainerBase{
private final boolean isDouble;
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
private final boolean isDouble;
public BlockGrinder(boolean isDouble, String name){
super(Material.rock, name);
@ -48,11 +48,6 @@ public class BlockGrinder extends BlockContainerBase{
this.setTickRandomly(true);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder();
@ -95,6 +90,11 @@ public class BlockGrinder extends BlockContainerBase{
return EnumRarity.EPIC;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -37,11 +37,6 @@ public class BlockLampPowerer extends BlockBase{
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
this.updateLamp(world, pos);
@ -82,4 +77,9 @@ public class BlockLampPowerer extends BlockBase{
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
}

View file

@ -42,8 +42,8 @@ public class BlockLaserRelay extends BlockContainerBase{
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
public boolean isFullCube(){
return false;
}
@Override
@ -57,11 +57,6 @@ public class BlockLaserRelay extends BlockContainerBase{
return false;
}
@Override
public boolean isFullCube(){
return false;
}
@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
return this.getStateFromMeta(side.ordinal());
@ -97,6 +92,11 @@ public class BlockLaserRelay extends BlockContainerBase{
return EnumRarity.EPIC;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityLaserRelay();

View file

@ -42,16 +42,19 @@ public class BlockMisc extends BlockBase{
this.setHarvestLevel("pickaxe", 1);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public int damageDropped(IBlockState state){
return this.getMetaFromState(state);
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allMiscBlocks.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length];
@ -63,14 +66,6 @@ public class BlockMisc extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allMiscBlocks.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
@ -81,6 +76,11 @@ public class BlockMisc extends BlockBase{
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){

View file

@ -46,11 +46,6 @@ public class BlockOilGenerator extends BlockContainerBase{
this.setTickRandomly(true);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityOilGenerator();
@ -83,6 +78,11 @@ public class BlockOilGenerator extends BlockContainerBase{
return EnumRarity.RARE;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -32,12 +32,12 @@ public class BlockPhantomBooster extends BlockContainerBase{
}
@Override
public boolean isOpaqueCube(){
public boolean isFullCube(){
return false;
}
@Override
public boolean isFullCube(){
public boolean isOpaqueCube(){
return false;
}

View file

@ -31,6 +31,7 @@ import java.util.List;
public class BlockSlabs extends BlockBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
private Block fullBlock;
private int meta;
@ -38,8 +39,6 @@ public class BlockSlabs extends BlockBase{
this(name, fullBlock, 0);
}
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
public BlockSlabs(String name, Block fullBlock, int meta){
super(fullBlock.getMaterial(), name);
this.setHardness(1.5F);
@ -48,11 +47,6 @@ public class BlockSlabs extends BlockBase{
this.meta = meta;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
@ -98,6 +92,11 @@ public class BlockSlabs extends BlockBase{
return EnumRarity.COMMON;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){

View file

@ -47,18 +47,20 @@ public class BlockSmileyCloud extends BlockContainerBase{
this.setStepSound(soundTypeCloth);
this.setTickRandomly(true);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public boolean isOpaqueCube(){
public boolean isFullCube(){
return false;
}
@Override
public boolean isFullCube(){
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@ -88,12 +90,6 @@ public class BlockSmileyCloud extends BlockContainerBase{
return true;
}
@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world);
@ -148,4 +144,9 @@ public class BlockSmileyCloud extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
}

View file

@ -46,11 +46,6 @@ public class BlockTreasureChest extends BlockBase{
this.setTickRandomly(true);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
@ -80,11 +75,6 @@ public class BlockTreasureChest extends BlockBase{
return true;
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
@ -103,6 +93,11 @@ public class BlockTreasureChest extends BlockBase{
}
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
private void dropItems(World world, BlockPos pos){
for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot);
@ -129,4 +124,9 @@ public class BlockTreasureChest extends BlockBase{
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
}

View file

@ -48,37 +48,12 @@ public class BlockWildPlant extends BlockBushBase{
this.setStepSound(soundTypeGrass);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
BlockPos offset = PosUtil.offset(pos, 0, -1, 0);
return PosUtil.getMetadata(pos, world) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public boolean shouldAddCreative(){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public Item getItem(World world, BlockPos pos){
@ -94,6 +69,17 @@ public class BlockWildPlant extends BlockBushBase{
}
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
int metadata = state.getBlock().getMetaFromState(state);
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
return false;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length];
@ -106,9 +92,23 @@ public class BlockWildPlant extends BlockBushBase{
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
int metadata = state.getBlock().getMetaFromState(state);
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public boolean shouldAddCreative(){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
public static class TheItemBlock extends ItemBlockBase{

View file

@ -44,11 +44,6 @@ public class BlockXPSolidifier extends BlockContainerBase{
this.setStepSound(soundTypeStone);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityXPSolidifier();
@ -91,6 +86,11 @@ public class BlockXPSolidifier extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);

View file

@ -47,10 +47,6 @@ public class BlockBase extends Block{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -63,13 +59,12 @@ public class BlockBase extends Block{
return true;
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
@Override
@ -82,6 +77,11 @@ public class BlockBase extends Block{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){
return null;
}

View file

@ -46,10 +46,6 @@ public class BlockBushBase extends BlockBush{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -62,13 +58,12 @@ public class BlockBushBase extends BlockBush{
return true;
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
@Override
@ -81,6 +76,11 @@ public class BlockBushBase extends BlockBush{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){
return null;
}

View file

@ -65,10 +65,6 @@ public abstract class BlockContainerBase extends BlockContainer{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -81,6 +77,10 @@ public abstract class BlockContainerBase extends BlockContainer{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
@ -117,6 +117,45 @@ public abstract class BlockContainerBase extends BlockContainer{
}
}
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle){
if(!world.isRemote){
((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
tile.markDirty();
if(tile instanceof TileEntityBase){
((TileEntityBase)tile).sendUpdate();
}
}
return true;
}
}
return false;
}
@Override
public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
}
@Override
public int getMetaFromState(IBlockState state){
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
((IRedstoneToggle)tile).activateOnPulse();
}
}
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
this.updateRedstoneState(world, pos);
@ -142,13 +181,8 @@ public abstract class BlockContainerBase extends BlockContainer{
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
((IRedstoneToggle)tile).activateOnPulse();
}
}
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
this.updateRedstoneState(world, pos);
}
@Override
@ -203,6 +237,11 @@ public abstract class BlockContainerBase extends BlockContainer{
return 0;
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
@Override
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
@ -246,45 +285,6 @@ public abstract class BlockContainerBase extends BlockContainer{
return drops;
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
this.updateRedstoneState(world, pos);
}
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle){
if(!world.isRemote){
((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
tile.markDirty();
if(tile instanceof TileEntityBase){
((TileEntityBase)tile).sendUpdate();
}
}
return true;
}
}
return false;
}
@Override
protected BlockState createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
}
@Override
public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
}
@Override
public int getMetaFromState(IBlockState state){
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){
return null;
}

View file

@ -47,6 +47,49 @@ public class BlockPlant extends BlockCrops{
this.register();
}
private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering();
}
protected String getBaseName(){
return this.name;
}
protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class;
}
public boolean shouldAddCreative(){
return false;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
return EnumPlantType.Crop;
}
@Override
public int damageDropped(IBlockState state){
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){
if(getMetaFromState(state) >= 7){
@ -73,73 +116,30 @@ public class BlockPlant extends BlockCrops{
return true;
}
return false;
}
private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class;
}
public boolean shouldAddCreative(){
return false;
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
return EnumPlantType.Crop;
}
@Override
} @Override
public Item getSeed(){
return this.seedItem;
}
@Override
public int getDamageValue(World world, BlockPos pos){
return 0;
} @Override
public Item getCrop(){
return this.returnItem;
}
@Override
public int quantityDropped(IBlockState state, int fortune, Random random){
return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
} @Override
public Item getItemDropped(IBlockState state, Random rand, int par3){
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
}
@Override
public int damageDropped(IBlockState state){
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
}
@Override
public int getDamageValue(World world, BlockPos pos){
return 0;
}
@Override
public int quantityDropped(IBlockState state, int fortune, Random random){
return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
}
}

View file

@ -50,10 +50,6 @@ public class BlockStair extends BlockStairs{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -66,6 +62,10 @@ public class BlockStair extends BlockStairs{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}

View file

@ -49,16 +49,9 @@ public class BlockWallAA extends BlockBase{
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
}
@SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
list.add(new ItemStack(item, 1, 0));
}
@Override
public int damageDropped(IBlockState state){
return meta;
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west()));
}
@Override
@ -71,11 +64,29 @@ public class BlockWallAA extends BlockBase{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side);
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){
this.setBlockBoundsBasedOnState(worldIn, pos);
this.maxY = 1.5D;
return super.getCollisionBoundingBox(worldIn, pos, state);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
public int damageDropped(IBlockState state){
return meta;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){
boolean flag = this.canConnectTo(worldIn, pos.north());
@ -115,11 +126,11 @@ public class BlockWallAA extends BlockBase{
this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
}
@SuppressWarnings("unchecked")
@Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){
this.setBlockBoundsBasedOnState(worldIn, pos);
this.maxY = 1.5D;
return super.getCollisionBoundingBox(worldIn, pos, state);
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
list.add(new ItemStack(item, 1, 0));
}
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
@ -127,22 +138,6 @@ public class BlockWallAA extends BlockBase{
return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd));
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side);
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west()));
}
@Override
protected BlockState createBlockState(){
return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
}
@Override
public IBlockState getStateFromMeta(int meta){
return this.getDefaultState();
@ -152,4 +147,9 @@ public class BlockWallAA extends BlockBase{
public int getMetaFromState(IBlockState state){
return 0;
}
@Override
protected BlockState createBlockState(){
return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
}
}

View file

@ -91,11 +91,6 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
this.saveOnClose = saveOnClose;
}
@Override
public void drawHoveringText(List list, int x, int y){
super.drawHoveringText(list, x, y);
}
public FontRenderer getFontRenderer(){
return this.fontRendererObj;
}
@ -197,6 +192,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
}
}
@Override
public void drawHoveringText(List list, int x, int y){
super.drawHoveringText(list, x, y);
}
@Override
protected void mouseClicked(int par1, int par2, int par3) throws IOException{
this.searchField.mouseClicked(par1, par2, par3);

View file

@ -50,7 +50,7 @@ public class InitBooklet{
ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc");
ActuallyAdditionsAPI.allAndSearch = new BookletEntryAllSearch("allAndSearch").setSpecial();
}
public static void postInit(){
initChapters();
}

View file

@ -50,11 +50,6 @@ public class BookletChapter implements IBookletChapter{
return this.pages;
}
public BookletChapter setIncomplete(){
this.isIncomplete = true;
return this;
}
@Override
public String getUnlocalizedName(){
return this.unlocalizedName;
@ -80,6 +75,11 @@ public class BookletChapter implements IBookletChapter{
return this.displayStack;
}
public BookletChapter setIncomplete(){
this.isIncomplete = true;
return this;
}
public BookletChapter setImportant(){
this.color = EnumChatFormatting.DARK_GREEN;
return this;

View file

@ -33,29 +33,19 @@ public class BookletEntry implements IBookletEntry{
this.color = EnumChatFormatting.RESET;
}
@Override
public String getUnlocalizedName(){
return this.unlocalizedName;
}
@Override
public List<IBookletChapter> getChapters(){
return this.chapters;
}
@Override
public String getLocalizedNameWithFormatting(){
return this.color+this.getLocalizedName();
}
@Override
public void setChapters(List<IBookletChapter> chapters){
this.chapters = chapters;
}
@Override
public void addChapter(IBookletChapter chapter){
this.chapters.add(chapter);
public String getUnlocalizedName(){
return this.unlocalizedName;
}
@Override
@ -63,6 +53,16 @@ public class BookletEntry implements IBookletEntry{
return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".indexEntry."+this.unlocalizedName+".name");
}
@Override
public String getLocalizedNameWithFormatting(){
return this.color+this.getLocalizedName();
}
@Override
public void addChapter(IBookletChapter chapter){
this.chapters.add(chapter);
}
public BookletEntry setImportant(){
this.color = EnumChatFormatting.DARK_GREEN;
return this;

View file

@ -23,16 +23,16 @@ public class BookletEntryAllSearch extends BookletEntry{
super(unlocalizedName);
}
@Override
public void setChapters(List<IBookletChapter> chapters){
this.allChapters = (ArrayList<IBookletChapter>)chapters;
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
}
@SuppressWarnings("unchecked")
@Override
public void addChapter(IBookletChapter chapter){
this.allChapters.add(chapter);
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
}
@Override
public void setChapters(List<IBookletChapter> chapters){
this.allChapters = (ArrayList<IBookletChapter>)chapters;
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
}
}

View file

@ -32,26 +32,11 @@ public class BookletPageAA extends BookletPage{
this.localizationKey = localizationKey;
}
@Override
public ItemStack[] getItemStacksForPage(){
return null;
}
@Override
public String getClickToSeeRecipeString(){
return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe");
}
@Override
public int getID(){
return Util.arrayContains(this.chapter.getPages(), this)+1;
}
public BookletPage setNoText(){
this.hasNoText = true;
return this;
}
@Override
public final String getText(){
if(this.hasNoText){
@ -74,12 +59,12 @@ public class BookletPageAA extends BookletPage{
}
@Override
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
}
@Override
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
}
@ -88,6 +73,21 @@ public class BookletPageAA extends BookletPage{
}
@Override
public ItemStack[] getItemStacksForPage(){
return null;
}
@Override
public String getClickToSeeRecipeString(){
return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe");
}
public BookletPage setNoText(){
this.hasNoText = true;
return this;
}
public BookletPageAA addTextReplacement(String text, int replacement){
return this.addTextReplacement(text, Integer.toString(replacement));
}

View file

@ -72,15 +72,6 @@ public class PageCrafting extends BookletPageAA{
return null;
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
}
@SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
@ -175,6 +166,15 @@ public class PageCrafting extends BookletPageAA{
}
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
}
@Override
@SideOnly(Side.CLIENT)
public void updateScreen(int ticksElapsed){

View file

@ -39,11 +39,6 @@ public class PageCrusherRecipe extends BookletPageAA{
this.addToPagesWithItemStackData();
}
@Override
public ItemStack[] getItemStacksForPage(){
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
@ -129,4 +124,9 @@ public class PageCrusherRecipe extends BookletPageAA{
}
}
}
@Override
public ItemStack[] getItemStacksForPage(){
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
}
}

View file

@ -47,15 +47,6 @@ public class PageFurnace extends BookletPageAA{
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
}
@SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
@ -98,6 +89,15 @@ public class PageFurnace extends BookletPageAA{
}
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
}
private ItemStack getInputForOutput(ItemStack output){
for(Map.Entry o : FurnaceRecipes.instance().getSmeltingList().entrySet()){
ItemStack stack = (ItemStack)(o).getValue();

View file

@ -43,20 +43,6 @@ public class PageReconstructor extends BookletPageAA{
this.addToPagesWithItemStackData();
}
@Override
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
for(LensNoneRecipe recipe : this.recipes){
if(recipe != null){
stacks.addAll(recipe.getOutputs());
}
}
return stacks.toArray(new ItemStack[stacks.size()]);
}
return null;
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
@ -125,4 +111,18 @@ public class PageReconstructor extends BookletPageAA{
}
}
}
@Override
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
for(LensNoneRecipe recipe : this.recipes){
if(recipe != null){
stacks.addAll(recipe.getOutputs());
}
}
return stacks.toArray(new ItemStack[stacks.size()]);
}
return null;
}
}

View file

@ -191,7 +191,7 @@ public class CreativeTab extends CreativeTabs{
add(InitItems.itemPaxelCrystalGreen);
add(InitItems.itemPaxelCrystalWhite);
InitForeignPaxels.addToCreativeTab();
add(InitBlocks.blockCrystal);
add(InitItems.itemCrystal);

View file

@ -171,7 +171,7 @@ public class InitItems{
public static Item itemPantsCrystalLightBlue;
public static Item itemBootsCrystalLightBlue;
public static Item itemPaxelCrystalLightBlue;
public static Item itemPickaxeCrystalBlack;
public static Item itemAxeCrystalBlack;
public static Item itemShovelCrystalBlack;
@ -204,7 +204,7 @@ public class InitItems{
public static Item itemPantsCrystalWhite;
public static Item itemBootsCrystalWhite;
public static Item itemPaxelCrystalWhite;
public static void init(){
ModUtil.LOGGER.info("Initializing Items...");

View file

@ -52,16 +52,6 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
this.setMaxDamage(0);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote){
player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach);
}
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){
if(player.isSneaking()){
@ -81,6 +71,16 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote){
player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach);
}
return stack;
}
@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){

View file

@ -48,6 +48,14 @@ public class ItemCrystal extends ItemBase{
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.COMMON : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for(int j = 0; j < BlockCrystal.allCrystals.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[BlockCrystal.allCrystals.length];
@ -58,12 +66,4 @@ public class ItemCrystal extends ItemBase{
}
ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for(int j = 0; j < BlockCrystal.allCrystals.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
}

View file

@ -107,17 +107,6 @@ public class ItemDrill extends ItemEnergy{
return false;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[16];
for(int i = 0; i < 16; i++){
String name = this.getBaseName()+TheColoredLampColors.values()[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
/**
* Checks if a certain Upgrade is installed and returns it as an ItemStack
*
@ -342,6 +331,17 @@ public class ItemDrill extends ItemEnergy{
return this.getHasUpgradeAsStack(stack, upgrade) != null;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[16];
for(int i = 0; i < 16; i++){
String name = this.getBaseName()+TheColoredLampColors.values()[i].name;
resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
}
ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)

View file

@ -79,6 +79,14 @@ public class ItemPhantomConnector extends ItemBase{
}
}
public static World getStoredWorld(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
}
return null;
}
public static BlockPos getStoredPosition(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
@ -92,14 +100,6 @@ public class ItemPhantomConnector extends ItemBase{
return null;
}
public static World getStoredWorld(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
}
return null;
}
public static void clearStorage(ItemStack stack){
stack.setTagCompound(new NBTTagCompound());
}

View file

@ -47,6 +47,11 @@ public class ItemAllToolAA extends ItemTool{
private ItemStack repairItem;
private String repairOredict;
public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){
this(toolMat, (ItemStack)null, unlocalizedName, rarity, color);
this.repairOredict = repairItem;
}
public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){
super(4.0F, toolMat, new HashSet<Block>());
@ -60,11 +65,6 @@ public class ItemAllToolAA extends ItemTool{
this.register();
}
public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){
this(toolMat, (ItemStack)null, unlocalizedName, rarity, color);
this.repairOredict = repairItem;
}
private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerItem(this, this.getBaseName());
@ -79,11 +79,6 @@ public class ItemAllToolAA extends ItemTool{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
}
protected String getBaseName(){
return this.name;
}
@ -92,6 +87,11 @@ public class ItemAllToolAA extends ItemTool{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
if(!playerIn.canPlayerEdit(pos.offset(side), side, stack)){

View file

@ -26,6 +26,10 @@ public class ItemArmorAA extends ItemArmor{
private String name;
private EnumRarity rarity;
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){
this(name, material, type, repairItem, textureBase, EnumRarity.RARE);
}
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase, EnumRarity rarity){
super(material, 0, type);
this.repairItem = repairItem;
@ -35,10 +39,6 @@ public class ItemArmorAA extends ItemArmor{
this.register();
}
public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){
this(name, material, type, repairItem, textureBase, EnumRarity.RARE);
}
private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
GameRegistry.registerItem(this, this.getBaseName());
@ -52,10 +52,6 @@ public class ItemArmorAA extends ItemArmor{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -64,6 +60,10 @@ public class ItemArmorAA extends ItemArmor{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;

View file

@ -49,10 +49,6 @@ public class ItemAxeAA extends ItemAxe{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -61,6 +57,10 @@ public class ItemAxeAA extends ItemAxe{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return ItemUtil.areItemsEqual(this.repairItem, stack, false);

View file

@ -42,10 +42,6 @@ public class ItemBase extends Item{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -53,4 +49,8 @@ public class ItemBase extends Item{
public boolean shouldAddCreative(){
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
}

View file

@ -46,10 +46,6 @@ public class ItemBucketAA extends ItemBucket{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -58,6 +54,10 @@ public class ItemBucketAA extends ItemBucket{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.UNCOMMON;

View file

@ -53,10 +53,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -65,6 +61,10 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public boolean getShareTag(){
return true;
@ -81,6 +81,12 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF");
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack){
return false;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@ -106,12 +112,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
return energyDif/maxAmount;
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack){
return false;
}
public void setEnergy(ItemStack stack, int energy){
NBTTagCompound compound = stack.getTagCompound();
if(compound == null){

View file

@ -43,10 +43,6 @@ public class ItemFoodBase extends ItemFood{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -54,4 +50,8 @@ public class ItemFoodBase extends ItemFood{
public boolean shouldAddCreative(){
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
}

View file

@ -50,10 +50,6 @@ public class ItemHoeAA extends ItemHoe{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -62,6 +58,10 @@ public class ItemHoeAA extends ItemHoe{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;

View file

@ -49,10 +49,6 @@ public class ItemPickaxeAA extends ItemPickaxe{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -61,6 +57,10 @@ public class ItemPickaxeAA extends ItemPickaxe{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return ItemUtil.areItemsEqual(this.repairItem, stack, false);

View file

@ -57,10 +57,6 @@ public class ItemSeed extends ItemSeeds{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -69,6 +65,10 @@ public class ItemSeed extends ItemSeeds{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;

View file

@ -50,10 +50,6 @@ public class ItemShovelAA extends ItemSpade{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -62,6 +58,10 @@ public class ItemShovelAA extends ItemSpade{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return ItemUtil.areItemsEqual(this.repairItem, stack, false);

View file

@ -50,10 +50,6 @@ public class ItemSwordAA extends ItemSword{
this.registerRendering();
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected String getBaseName(){
return this.name;
}
@ -62,6 +58,10 @@ public class ItemSwordAA extends ItemSword{
return true;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
}
protected Class<? extends ItemBlockBase> getItemBlock(){
return ItemBlockBase.class;
}

View file

@ -72,7 +72,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
ignoreList.ignoreNbtTagNames(InitItems.itemBatteryTriple, "Energy");
ignoreList.ignoreNbtTagNames(InitItems.itemBatteryQuadruple, "Energy");
ignoreList.ignoreNbtTagNames(InitItems.itemBatteryQuintuple, "Energy");
IItemBlacklist blacklist = this.helpers.getItemBlacklist();
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockRice));
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockCanola));

View file

@ -36,6 +36,10 @@ public abstract class RecipeWrapperWithButton{
};
}
public abstract int getButtonX();
public abstract int getButtonY();
public boolean handleClick(Minecraft mc, int mouseX, int mouseY){
if(this.theButton.mousePressed(mc, mouseX, mouseY)){
this.theButton.playPressSound(mc.getSoundHandler());
@ -52,12 +56,9 @@ public abstract class RecipeWrapperWithButton{
return false;
}
public abstract BookletPage getPage();
public void updateButton(Minecraft mc, int mouseX, int mouseY){
this.theButton.drawButton(mc, mouseX, mouseY);
}
public abstract BookletPage getPage();
public abstract int getButtonX();
public abstract int getButtonY();
}

View file

@ -96,11 +96,6 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
return this.handleClick(minecraft, mouseX, mouseY);
}
@Override
public BookletPage getPage(){
return this.thePage;
}
@Override
public int getButtonX(){
return 0;
@ -110,4 +105,9 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
public int getButtonY(){
return 84;
}
@Override
public BookletPage getPage(){
return this.thePage;
}
}

View file

@ -104,11 +104,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
return this.handleClick(minecraft, mouseX, mouseY);
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
}
@Override
public int getButtonX(){
return 0;
@ -118,4 +113,9 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen
public int getButtonY(){
return 70;
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
}
}

View file

@ -93,11 +93,6 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
return this.handleClick(minecraft, mouseX, mouseY);
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
}
@Override
public int getButtonX(){
return -5;
@ -107,4 +102,9 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe
public int getButtonY(){
return 26;
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
}
}

View file

@ -26,8 +26,8 @@ import javax.annotation.Nonnull;
public class ReconstructorRecipeCategory implements IRecipeCategory{
private IDrawable background;
private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor);
private IDrawable background;
public ReconstructorRecipeCategory(IGuiHelper helper){
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60);

View file

@ -79,11 +79,6 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen
return this.handleClick(minecraft, mouseX, mouseY);
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
}
@Override
public int getButtonX(){
return 3;
@ -93,4 +88,9 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen
public int getButtonY(){
return 40;
}
@Override
public BookletPage getPage(){
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
}
}

View file

@ -64,10 +64,6 @@ public class InitOreDict{
addOre(InitItems.itemCrystal, TheCrystals.REDSTONE.ordinal(), "actAddCrystalRed");
}
private static void addOre(ItemStack stack, String name){
OreDictionary.registerOre(name, stack);
}
private static void addOre(Item item, int meta, String name){
addOre(new ItemStack(item, 1, meta), name);
}
@ -76,11 +72,15 @@ public class InitOreDict{
addOre(item, 0, name);
}
private static void addOre(Block block, String name){
addOre(block, 0, name);
}
private static void addOre(Block block, int meta, String name){
addOre(new ItemStack(block, 1, meta), name);
}
private static void addOre(Block block, String name){
addOre(block, 0, name);
private static void addOre(ItemStack stack, String name){
OreDictionary.registerOre(name, stack);
}
}

View file

@ -46,15 +46,13 @@ import java.util.Map;
public class ClientProxy implements IProxy{
private static Map<ItemStack, ResourceLocation> modelLocationsForRegistering = new HashMap<ItemStack, ResourceLocation>();
private static Map<Item, ResourceLocation[]> modelVariantsForRegistering = new HashMap<Item, ResourceLocation[]>();
public static boolean pumpkinBlurPumpkinBlur;
public static boolean jingleAllTheWay;
public static boolean bulletForMyValentine;
public static int bookletWordCount;
public static int bookletCharCount;
private static Map<ItemStack, ResourceLocation> modelLocationsForRegistering = new HashMap<ItemStack, ResourceLocation>();
private static Map<Item, ResourceLocation[]> modelVariantsForRegistering = new HashMap<Item, ResourceLocation[]>();
@Override
public void preInit(FMLPreInitializationEvent event){
@ -101,6 +99,26 @@ public class ClientProxy implements IProxy{
ModelLoader.setCustomStateMapper(block, mapper);
}
private static void countBookletWords(){
bookletWordCount = 0;
bookletCharCount = 0;
for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){
for(IBookletChapter chapter : entry.getChapters()){
for(BookletPage page : chapter.getPages()){
if(page.getText() != null){
bookletWordCount += page.getText().split(" ").length;
bookletCharCount += page.getText().length();
}
}
bookletWordCount += chapter.getLocalizedName().split(" ").length;
bookletCharCount += chapter.getLocalizedName().length();
}
bookletWordCount += entry.getLocalizedName().split(" ").length;
bookletCharCount += entry.getLocalizedName().length();
}
}
@Override
public void init(FMLInitializationEvent event){
ModUtil.LOGGER.info("Initializing ClientProxy...");
@ -144,24 +162,4 @@ public class ClientProxy implements IProxy{
public void addRenderVariant(Item item, ResourceLocation... location){
modelVariantsForRegistering.put(item, location);
}
private static void countBookletWords(){
bookletWordCount = 0;
bookletCharCount = 0;
for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){
for(IBookletChapter chapter : entry.getChapters()){
for(BookletPage page : chapter.getPages()){
if(page.getText() != null){
bookletWordCount += page.getText().split(" ").length;
bookletCharCount += page.getText().length();
}
}
bookletWordCount += chapter.getLocalizedName().split(" ").length;
bookletCharCount += chapter.getLocalizedName().length();
}
bookletWordCount += entry.getLocalizedName().split(" ").length;
bookletCharCount += entry.getLocalizedName().length();
}
}
}

View file

@ -43,6 +43,25 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
super(1, "reconstructor");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.storage.writeToNBT(compound);
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.storage.readFromNBT(compound);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -107,10 +126,33 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.storage.writeToNBT(compound);
public int getX(){
return this.getPos().getX();
}
@Override
public int getY(){
return this.getPos().getY();
}
@Override
public int getZ(){
return this.getPos().getZ();
}
@Override
public World getWorldObject(){
return this.getWorld();
}
@Override
public void extractEnergy(int amount){
this.storage.extractEnergy(amount, false);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return stack != null && stack.getItem() instanceof ILensItem;
}
@Override
@ -119,18 +161,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
this.sendUpdate();
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.storage.readFromNBT(compound);
}
@Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);
@ -156,41 +186,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return stack != null && stack.getItem() instanceof ILensItem;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true;
}
@Override
public int getX(){
return this.getPos().getX();
}
@Override
public int getY(){
return this.getPos().getY();
}
@Override
public int getZ(){
return this.getPos().getZ();
}
@Override
public World getWorldObject(){
return this.getWorld();
}
@Override
public void extractEnergy(int amount){
this.storage.extractEnergy(amount, false);
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();

View file

@ -28,8 +28,8 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public abstract class TileEntityBase extends TileEntity implements ITickable{
protected int ticksElapsed;
public boolean isRedstonePowered;
protected int ticksElapsed;
public static void init(){
ModUtil.LOGGER.info("Registering TileEntities...");
@ -91,15 +91,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
this.writeSyncableNBT(compound, false);
}
@Override
public final void update(){
this.updateEntity();
}
public void updateEntity(){
this.ticksElapsed++;
}
@Override
public final Packet getDescriptionPacket(){
NBTTagCompound compound = this.getSyncCompound();
@ -123,6 +114,16 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
return !(oldState.getBlock().isAssociatedBlock(newState.getBlock()));
}
public void receiveSyncCompound(NBTTagCompound compound){
this.readSyncableNBT(compound, true);
}
public NBTTagCompound getSyncCompound(){
NBTTagCompound tag = new NBTTagCompound();
this.writeSyncableNBT(tag, true);
return tag;
}
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
if(this instanceof IRedstoneToggle){
compound.setBoolean("IsPulseMode", ((IRedstoneToggle)this).isPulseMode());
@ -135,6 +136,15 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
}
}
@Override
public final void update(){
this.updateEntity();
}
public void updateEntity(){
this.ticksElapsed++;
}
public final void setRedstonePowered(boolean powered){
this.isRedstonePowered = powered;
this.markDirty();
@ -153,14 +163,4 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
public final void sendUpdate(){
PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64));
}
public NBTTagCompound getSyncCompound(){
NBTTagCompound tag = new NBTTagCompound();
this.writeSyncableNBT(tag, true);
return tag;
}
public void receiveSyncCompound(NBTTagCompound compound){
this.readSyncableNBT(compound, true);
}
}

View file

@ -69,6 +69,11 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;
}
private void doWork(){
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(this.pos, worldObj));
@ -104,11 +109,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true;

View file

@ -117,6 +117,11 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
}
public boolean isCanola(int slot){
return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal();
}
@ -126,11 +131,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == 2 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME));

View file

@ -110,13 +110,13 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
public boolean isItemValidForSlot(int i, ItemStack stack){
return TileEntityFurnace.getItemBurnTime(stack) > 0;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return TileEntityFurnace.getItemBurnTime(stack) > 0;
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override

View file

@ -110,6 +110,11 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
this.brewTime = compound.getInteger("Time");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1)));
}
public void storeCoffee(){
if(this.slots[SLOT_COFFEE_BEANS] != null && this.slots[SLOT_COFFEE_BEANS].getItem() == InitItems.itemCoffeeBean){
int toAdd = 2;
@ -172,11 +177,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1)));
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT || (slot >= 3 && slot < this.slots.length-2 && ItemCoffee.getIngredientFromStack(stack) == null) || slot == SLOT_WATER_OUTPUT;

View file

@ -45,17 +45,17 @@ public class TileEntityCompost extends TileEntityInventoryBase{
}
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("ConversionTime", this.conversionTime);
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
@ -67,24 +67,24 @@ public class TileEntityCompost extends TileEntityInventoryBase{
return AMOUNT;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal();
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return stack.getItem() instanceof ItemFertilizer;
}
@Override
public void markDirty(){
super.markDirty();
this.sendUpdate();
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return stack.getItem() instanceof ItemFertilizer;
}
}

View file

@ -39,6 +39,20 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
super(9, "directionalBreaker");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -90,17 +104,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentTime = compound.getInteger("CurrentTime");
public boolean isItemValidForSlot(int i, ItemStack stack){
return false;
}
@SideOnly(Side.CLIENT)
@ -113,11 +118,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return false;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true;

View file

@ -56,6 +56,11 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
private void doWork(){
if(this.removeFromInventory(false) != null){
ItemStack stack = this.removeFromInventory(true);
@ -85,11 +90,6 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return true;

View file

@ -66,13 +66,13 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override

View file

@ -70,6 +70,11 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){
return this.storage.extractEnergy(maxExtract, simulate);
@ -100,11 +105,6 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == 1;

View file

@ -109,6 +109,11 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
}
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
public void feedAnimal(EntityAnimal animal){
animal.setInLove(null);
for(int i = 0; i < 7; i++){
@ -124,11 +129,6 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return false;

View file

@ -34,6 +34,24 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
super(4, "fermentingBarrel");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("ProcessTime", this.currentProcessTime);
this.canolaTank.writeToNBT(compound);
NBTTagCompound tag = new NBTTagCompound();
this.oilTank.writeToNBT(tag);
compound.setTag("OilTank", tag);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.canolaTank.readFromNBT(compound);
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
super.readSyncableNBT(compound, sync);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -76,21 +94,8 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("ProcessTime", this.currentProcessTime);
this.canolaTank.writeToNBT(compound);
NBTTagCompound tag = new NBTTagCompound();
this.oilTank.writeToNBT(tag);
compound.setTag("OilTank", tag);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.canolaTank.readFromNBT(compound);
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
super.readSyncableNBT(compound, sync);
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
}
@SideOnly(Side.CLIENT)
@ -113,11 +118,6 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)));

View file

@ -32,6 +32,18 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
private boolean activateOnceWithSignal;
private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
public void updateEntity(){
if(!this.worldObj.isRemote){
@ -113,18 +125,6 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
return compound;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);

View file

@ -29,6 +29,18 @@ public class TileEntityFishingNet extends TileEntityBase{
public int timeUntilNextDrop;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
}
@Override
public void updateEntity(){
super.updateEntity();
@ -60,16 +72,4 @@ public class TileEntityFishingNet extends TileEntityBase{
}
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
}
}

View file

@ -131,6 +131,20 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
return new FluidTankInfo[]{this.tank.getInfo()};
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.tank.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.tank.readFromNBT(compound);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -171,30 +185,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
this.tank.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
this.tank.readFromNBT(compound);
}
@SideOnly(Side.CLIENT)
public int getTankScaled(int i){
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
if(i == 0){
@ -208,6 +198,16 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
return false;
}
@SideOnly(Side.CLIENT)
public int getTankScaled(int i){
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == 1;

View file

@ -116,6 +116,11 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
this.storage.readFromNBT(compound);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null;
}
public boolean canSmeltOn(int theInput, int theOutput){
if(this.slots[theInput] != null){
ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.slots[theInput]);
@ -165,11 +170,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;

View file

@ -46,6 +46,18 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
return from != EnumFacing.UP;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -67,18 +79,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
public boolean hasBlockAbove(){
for(int y = 1; y <= worldObj.getHeight(); y++){
BlockPos offset = PosUtil.offset(this.pos, 0, y, 0);

View file

@ -24,6 +24,18 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
private int timeUntilNextFert;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.timeUntilNextFert = compound.getInteger("Time");
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
compound.setInteger("Time", this.timeUntilNextFert);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -66,16 +78,4 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
}
return null;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.timeUntilNextFert = compound.getInteger("Time");
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
compound.setInteger("Time", this.timeUntilNextFert);
}
}

View file

@ -165,6 +165,11 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
}
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){
if(this.slots[theInput] != null){
List<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
@ -258,11 +263,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;

View file

@ -32,6 +32,18 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
public EnergyStorage storage = new EnergyStorage(30000);
private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
this.storage.readFromNBT(compound);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -69,18 +81,6 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readSyncableNBT(compound, isForSync);
this.storage.readFromNBT(compound);
}
@Override
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){
return this.storage.extractEnergy(maxExtract, simulate);

View file

@ -447,13 +447,13 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0;
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override

View file

@ -48,11 +48,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
this.slots = new ItemStack[itemAmount];
}
@Override
public void updateEntity(){
super.updateEntity();
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.writeSyncableNBT(compound, isForSync);
@ -94,17 +89,44 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
}
@Override
public void updateEntity(){
super.updateEntity();
}
@Override
public int[] getSlotsForFace(EnumFacing side){
if(this.slots.length > 0){
int[] theInt = new int[slots.length];
for(int i = 0; i < theInt.length; i++){
theInt[i] = i;
}
return theInt;
}
else{
return new int[0];
}
} @Override
public int getInventoryStackLimit(){
return 64;
}
@Override
public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing){
return this.getCapability(capability, facing) != null;
} @Override
public boolean isUseableByPlayer(EntityPlayer player){
return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.worldObj.getTileEntity(this.pos) == this;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
return (T)this.itemHandlers.get(facing);
}
else{
return super.getCapability(capability, facing);
}
} @Override
public void openInventory(EntityPlayer player){
}
@ -187,19 +209,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return stack;
}
@Override
public int[] getSlotsForFace(EnumFacing side){
if(this.slots.length > 0){
int[] theInt = new int[slots.length];
for(int i = 0; i < theInt.length; i++){
theInt[i] = i;
}
return theInt;
}
else{
return new int[0];
}
}
@Override
public String getName(){
@ -216,19 +226,8 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return new ChatComponentText(StringUtil.localize(this.getName()));
}
@Override
public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing){
return this.getCapability(capability, facing) != null;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
return (T)this.itemHandlers.get(facing);
}
else{
return super.getCapability(capability, facing);
}
}
}

View file

@ -77,6 +77,11 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
this.storage.readFromNBT(compound);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_INPUT;
}
public static boolean canBeRepaired(ItemStack stack){
return stack != null && stack.getItem().isRepairable();
}
@ -99,11 +104,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_INPUT;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return slot == SLOT_OUTPUT;

View file

@ -32,26 +32,20 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
private static final float[] COLOR = new float[]{1F, 0F, 0F};
@Override
public void updateEntity(){
super.updateEntity();
if(this.worldObj.isRemote){
this.renderParticles();
}
}
public void receiveSyncCompound(NBTTagCompound compound){
BlockPos thisPos = this.pos;
if(compound != null){
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
@SideOnly(Side.CLIENT)
public void renderParticles(){
if(Util.RANDOM.nextInt(ConfigValues.lessParticles ? 15 : 8) == 0){
BlockPos thisPos = this.pos;
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos);
if(network != null){
for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){
if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){
PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigValues.lessParticles ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, COLOR, 1F);
}
}
NBTTagList list = compound.getTagList("Connections", 10);
for(int i = 0; i < list.tagCount(); i++){
LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i));
LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay);
}
}
else{
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
}
}
@Override
@ -73,19 +67,25 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
}
@Override
public void receiveSyncCompound(NBTTagCompound compound){
BlockPos thisPos = this.pos;
if(compound != null){
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
NBTTagList list = compound.getTagList("Connections", 10);
for(int i = 0; i < list.tagCount(); i++){
LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i));
LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay);
}
public void updateEntity(){
super.updateEntity();
if(this.worldObj.isRemote){
this.renderParticles();
}
else{
LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos);
}
@SideOnly(Side.CLIENT)
public void renderParticles(){
if(Util.RANDOM.nextInt(ConfigValues.lessParticles ? 15 : 8) == 0){
BlockPos thisPos = this.pos;
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos);
if(network != null){
for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){
if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){
PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigValues.lessParticles ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, COLOR, 1F);
}
}
}
}
}

View file

@ -33,6 +33,20 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
private int currentWorkTime;
private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("WorkTime", this.currentWorkTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentWorkTime = compound.getInteger("WorkTime");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -56,20 +70,6 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("WorkTime", this.currentWorkTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.currentWorkTime = compound.getInteger("WorkTime");
}
public int isMultiblock(){
BlockPos thisPos = this.pos;
BlockPos[] positions = new BlockPos[]{

View file

@ -36,6 +36,18 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
private int nextUseCounter;
private int oldEnergy;
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -94,18 +106,6 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
public int extractEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.extractEnergy(maxReceive, simulate);

View file

@ -136,6 +136,12 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return false;
}
private void shootParticles(int endX, int endY, int endZ){
if(!ConfigValues.lessParticles){
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96));
}
}
private boolean isBlacklisted(Block block){
String reg = block.getRegistryName();
if(reg != null && !reg.isEmpty()){
@ -148,12 +154,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return false;
}
private void shootParticles(int endX, int endY, int endZ){
if(!ConfigValues.lessParticles){
PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96));
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
@ -170,6 +170,11 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
this.onlyMineOres = compound.getBoolean("OnlyOres");
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;
}
@Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);
@ -200,11 +205,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return true;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;
}
@Override
public void onButtonPressed(int buttonID, EntityPlayer player){
if(buttonID == 0){

View file

@ -116,13 +116,13 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
public boolean isItemValidForSlot(int i, ItemStack stack){
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isItemValidForSlot(slot, stack);
}
@Override

View file

@ -47,6 +47,13 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0;
}
@Override
public void clear(){
if(this.isBoundThingInRange()){
this.getInventory().clear();
}
}
@Override
public void setInventorySlotContents(int i, ItemStack stack){
if(this.isBoundThingInRange()){
@ -71,13 +78,16 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
}
@Override
public String getName(){
return this.name;
public ItemStack removeStackFromSlot(int index){
if(this.isBoundThingInRange()){
return this.getInventory().removeStackFromSlot(index);
}
return null;
}
@Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory;
public String getName(){
return this.name;
}
public ISidedInventory getSided(){
@ -94,36 +104,11 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
return null;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
}
@Override
public ItemStack removeStackFromSlot(int index){
if(this.isBoundThingInRange()){
return this.getInventory().removeStackFromSlot(index);
}
return null;
}
@Override
public void clear(){
if(this.isBoundThingInRange()){
this.getInventory().clear();
}
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(this.isBoundThingInRange()){
@ -134,4 +119,19 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
}
return super.getCapability(capability, facing);
}
@Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
}
}

View file

@ -48,6 +48,30 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
this.isBreaker = false;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Range", this.range);
if(this.boundPosition != null){
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored");
this.range = compound.getInteger("Range");
if(!(x == 0 && y == 0 && z == 0)){
this.boundPosition = new BlockPos(x, y, z);
this.markDirty();
}
}
@Override
public void updateEntity(){
super.updateEntity();
@ -168,27 +192,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Range", this.range);
if(this.boundPosition != null){
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored");
this.range = compound.getInteger("Range");
if(!(x == 0 && y == 0 && z == 0)){
this.boundPosition = new BlockPos(x, y, z);
this.markDirty();
}
public boolean isItemValidForSlot(int i, ItemStack stack){
return !this.isBreaker;
}
@Override
@ -196,11 +201,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return !this.isBreaker;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
return this.isBreaker;

Some files were not shown because too many files have changed in this diff Show more