From 0540313e75c45340ae792862ad991a68a6de2de0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 1 Feb 2016 17:49:55 +0100 Subject: [PATCH] Cleanup ~ --- .../api/booklet/IBookletEntry.java | 4 +- .../actuallyadditions/api/lens/Lens.java | 3 +- .../mod/blocks/BlockAtomicReconstructor.java | 39 ++++--- .../mod/blocks/BlockBreaker.java | 12 +- .../mod/blocks/BlockCoalGenerator.java | 10 +- .../mod/blocks/BlockCoffeeMachine.java | 14 +-- .../mod/blocks/BlockColoredLamp.java | 29 +++-- .../mod/blocks/BlockCrystal.java | 26 ++--- .../mod/blocks/BlockDirectionalBreaker.java | 10 +- .../mod/blocks/BlockDropper.java | 9 +- .../mod/blocks/BlockFishingNet.java | 4 +- .../mod/blocks/BlockFluidCollector.java | 10 +- .../mod/blocks/BlockFurnaceDouble.java | 10 +- .../mod/blocks/BlockFurnaceSolar.java | 4 +- .../mod/blocks/BlockGreenhouseGlass.java | 30 ++--- .../mod/blocks/BlockGrinder.java | 12 +- .../mod/blocks/BlockLampPowerer.java | 10 +- .../mod/blocks/BlockLaserRelay.java | 14 +-- .../mod/blocks/BlockMisc.java | 26 ++--- .../mod/blocks/BlockOilGenerator.java | 10 +- .../mod/blocks/BlockPhantomBooster.java | 4 +- .../mod/blocks/BlockSlabs.java | 13 +-- .../mod/blocks/BlockSmileyCloud.java | 25 +++-- .../mod/blocks/BlockTreasureChest.java | 20 ++-- .../mod/blocks/BlockWildPlant.java | 56 ++++----- .../mod/blocks/BlockXPSolidifier.java | 10 +- .../mod/blocks/base/BlockBase.java | 18 +-- .../mod/blocks/base/BlockBushBase.java | 18 +-- .../mod/blocks/base/BlockContainerBase.java | 100 ++++++++--------- .../mod/blocks/base/BlockPlant.java | 106 +++++++++--------- .../mod/blocks/base/BlockStair.java | 8 +- .../mod/blocks/base/BlockWallAA.java | 58 +++++----- .../mod/booklet/GuiBooklet.java | 10 +- .../mod/booklet/InitBooklet.java | 2 +- .../mod/booklet/chapter/BookletChapter.java | 10 +- .../mod/booklet/entry/BookletEntry.java | 24 ++-- .../booklet/entry/BookletEntryAllSearch.java | 12 +- .../mod/booklet/page/BookletPageAA.java | 34 +++--- .../mod/booklet/page/PageCrafting.java | 18 +-- .../mod/booklet/page/PageCrusherRecipe.java | 10 +- .../mod/booklet/page/PageFurnace.java | 18 +-- .../mod/booklet/page/PageReconstructor.java | 28 ++--- .../mod/creative/CreativeTab.java | 2 +- .../mod/items/InitItems.java | 4 +- .../mod/items/ItemBooklet.java | 20 ++-- .../mod/items/ItemCrystal.java | 16 +-- .../mod/items/ItemDrill.java | 22 ++-- .../mod/items/ItemPhantomConnector.java | 16 +-- .../mod/items/base/ItemAllToolAA.java | 20 ++-- .../mod/items/base/ItemArmorAA.java | 16 +-- .../mod/items/base/ItemAxeAA.java | 8 +- .../mod/items/base/ItemBase.java | 8 +- .../mod/items/base/ItemBucketAA.java | 8 +- .../mod/items/base/ItemEnergy.java | 20 ++-- .../mod/items/base/ItemFoodBase.java | 8 +- .../mod/items/base/ItemHoeAA.java | 8 +- .../mod/items/base/ItemPickaxeAA.java | 8 +- .../mod/items/base/ItemSeed.java | 8 +- .../mod/items/base/ItemShovelAA.java | 8 +- .../mod/items/base/ItemSwordAA.java | 8 +- .../mod/jei/JEIActuallyAdditionsPlugin.java | 2 +- .../mod/jei/RecipeWrapperWithButton.java | 11 +- .../mod/jei/booklet/BookletRecipeWrapper.java | 10 +- .../coffee/CoffeeMachineRecipeWrapper.java | 10 +- .../mod/jei/crusher/CrusherRecipeWrapper.java | 10 +- .../ReconstructorRecipeCategory.java | 2 +- .../ReconstructorRecipeWrapper.java | 10 +- .../mod/ore/InitOreDict.java | 12 +- .../mod/proxy/ClientProxy.java | 46 ++++---- .../tile/TileEntityAtomicReconstructor.java | 92 +++++++-------- .../mod/tile/TileEntityBase.java | 40 +++---- .../mod/tile/TileEntityBreaker.java | 10 +- .../mod/tile/TileEntityCanolaPress.java | 10 +- .../mod/tile/TileEntityCoalGenerator.java | 8 +- .../mod/tile/TileEntityCoffeeMachine.java | 10 +- .../mod/tile/TileEntityCompost.java | 30 ++--- .../tile/TileEntityDirectionalBreaker.java | 32 +++--- .../mod/tile/TileEntityDropper.java | 10 +- .../mod/tile/TileEntityEnergizer.java | 8 +- .../mod/tile/TileEntityEnervator.java | 10 +- .../mod/tile/TileEntityFeeder.java | 10 +- .../mod/tile/TileEntityFermentingBarrel.java | 40 +++---- .../mod/tile/TileEntityFireworkBox.java | 24 ++-- .../mod/tile/TileEntityFishingNet.java | 24 ++-- .../mod/tile/TileEntityFluidCollector.java | 48 ++++---- .../mod/tile/TileEntityFurnaceDouble.java | 10 +- .../mod/tile/TileEntityFurnaceSolar.java | 24 ++-- .../mod/tile/TileEntityGreenhouseGlass.java | 24 ++-- .../mod/tile/TileEntityGrinder.java | 10 +- .../mod/tile/TileEntityHeatCollector.java | 24 ++-- .../mod/tile/TileEntityInputter.java | 8 +- .../mod/tile/TileEntityInventoryBase.java | 63 +++++------ .../mod/tile/TileEntityItemRepairer.java | 10 +- .../mod/tile/TileEntityLaserRelay.java | 58 +++++----- .../tile/TileEntityLavaFactoryController.java | 28 ++--- .../mod/tile/TileEntityLeafGenerator.java | 24 ++-- .../mod/tile/TileEntityMiner.java | 22 ++-- .../mod/tile/TileEntityOilGenerator.java | 8 +- .../mod/tile/TileEntityPhantomItemface.java | 58 +++++----- .../mod/tile/TileEntityPhantomPlacer.java | 52 ++++----- .../mod/tile/TileEntityPhantomface.java | 20 ++-- .../mod/tile/TileEntityRangedCollector.java | 28 ++--- .../mod/tile/TileEntitySmileyCloud.java | 22 ++-- .../mod/tile/TileEntityXPSolidifier.java | 9 +- .../actuallyadditions/mod/util/AssetUtil.java | 10 +- .../actuallyadditions/mod/util/PosUtil.java | 8 +- .../actuallyadditions/mod/util/WorldUtil.java | 16 +-- 107 files changed, 1075 insertions(+), 1076 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java index 65bfe09b3..c053dfa1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java @@ -16,14 +16,14 @@ public interface IBookletEntry{ List getChapters(); + void setChapters(List chapters); + String getUnlocalizedName(); String getLocalizedName(); String getLocalizedNameWithFormatting(); - void setChapters(List chapters); - void addChapter(IBookletChapter chapter); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java index 8c0bb48be..cf6693465 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index 65d86fd8e..e96154ccf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index 1077968f8..a09f346c6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index 7017e7e06..9bb60e771 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index 2e29e3185..7c49c7e23 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -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; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index 267c23653..44018f892 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -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 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 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{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java index 68cc30514..7b3104bc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java @@ -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 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{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java index 0082f798a..bbc3db8cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index 67e26bea4..44d0e2c50 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java index 174fa7841..e1edeea3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index 84fb63f54..431e0c54d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java index 1b44fe834..815b9fe56 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java index 09a6fe024..391bf1903 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index 4812e0bd0..b23451304 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -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); - - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java index fc2805758..bf4c3571b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java index 710afc2dd..73b9d2f89 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java @@ -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; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 17d9493be..2b02cccb3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -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(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java index df65d4e48..6bc48c865 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java @@ -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 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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index fe4a88625..8b72114ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java index 864dda1b0..eef04cd9d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java index 29d1da66f..4bc6355c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java index 5528a9822..dadc6f880 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java @@ -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; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java index d8eed6bc5..18e4745fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java @@ -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; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index ac790f06f..a76346f84 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -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 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 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 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 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{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index b9fc6797d..ab5dc92d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index b420cb2d6..9cefdf4b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index ded9017f7..e06ec6201 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 2090ac41c..abc4adbdf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -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 getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ ArrayList drops = new ArrayList(); @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index 03f9c8684..d38943865 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -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 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 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); - } + + + } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java index 0717d9014..6b1d3f824 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java @@ -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; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java index 64270b3b3..3b9ef2ed9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java @@ -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); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java index 75424b4d9..e1e4de69d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 397355d12..abc86dfdd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -50,7 +50,7 @@ public class InitBooklet{ ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc"); ActuallyAdditionsAPI.allAndSearch = new BookletEntryAllSearch("allAndSearch").setSpecial(); } - + public static void postInit(){ initChapters(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java index 62c0e29a9..3eb2144af 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index e28709ee5..74011bbc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -33,29 +33,19 @@ public class BookletEntry implements IBookletEntry{ this.color = EnumChatFormatting.RESET; } - @Override - public String getUnlocalizedName(){ - return this.unlocalizedName; - } - @Override public List getChapters(){ return this.chapters; } - @Override - public String getLocalizedNameWithFormatting(){ - return this.color+this.getLocalizedName(); - } - @Override public void setChapters(List 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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java index 89611c055..52599f884 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java @@ -23,16 +23,16 @@ public class BookletEntryAllSearch extends BookletEntry{ super(unlocalizedName); } + @Override + public void setChapters(List chapters){ + this.allChapters = (ArrayList)chapters; + this.chapters = (ArrayList)this.allChapters.clone(); + } + @SuppressWarnings("unchecked") @Override public void addChapter(IBookletChapter chapter){ this.allChapters.add(chapter); this.chapters = (ArrayList)this.allChapters.clone(); } - - @Override - public void setChapters(List chapters){ - this.allChapters = (ArrayList)chapters; - this.chapters = (ArrayList)this.allChapters.clone(); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java index 1e3a6af9a..4eef6f123 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java @@ -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)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index a731d02a6..f8fd72b89 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index efb564d88..288d874f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -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()]); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index e86abfee7..91cdb638a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -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(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index e61f7b7b8..d74c04856 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -43,20 +43,6 @@ public class PageReconstructor extends BookletPageAA{ this.addToPagesWithItemStackData(); } - @Override - public ItemStack[] getItemStacksForPage(){ - if(this.recipes != null){ - ArrayList stacks = new ArrayList(); - 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 stacks = new ArrayList(); + for(LensNoneRecipe recipe : this.recipes){ + if(recipe != null){ + stacks.addAll(recipe.getOutputs()); + } + } + return stacks.toArray(new ItemStack[stacks.size()]); + } + return null; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index 1c0dc34f6..fb9c016fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -191,7 +191,7 @@ public class CreativeTab extends CreativeTabs{ add(InitItems.itemPaxelCrystalGreen); add(InitItems.itemPaxelCrystalWhite); InitForeignPaxels.addToCreativeTab(); - + add(InitBlocks.blockCrystal); add(InitItems.itemCrystal); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java index 94b8deb70..6ccded60d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java @@ -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..."); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index 3d57e3ae7..f805811d6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java index 0dd4a3aa8..3640fd7e9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java @@ -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)); - } - } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 556d45123..6421dda39 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -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) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 3167d7bbd..e8bb77c13 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -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()); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java index 58f30faa6..8c794b77b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java @@ -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()); @@ -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)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index d622568c9..02c77af81 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java index 0d0aaac5f..88dcd4e7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java index c06a5fea5..f54470f57 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java @@ -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())); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java index db657d632..509c89a7c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index 01b3b36d0..129ebc385 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java index 963c357ed..a185c9f5d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java @@ -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())); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java index 15c227873..03ed69239 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java index ea8a11b27..a9d084248 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java index 6ade78b73..0a02f544d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java index eab2eed72..8fb0a68ea 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java index 6f19ca07c..90ec82529 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java @@ -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 getItemBlock(){ return ItemBlockBase.class; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java index 75dc4ac74..5639d7455 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java @@ -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)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java index df015a254..d55566354 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java @@ -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(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java index 8c58e3cd7..8c7f099c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java @@ -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; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java index 0d9683ca1..11086038f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java @@ -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)); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java index 33013a99b..7191d2ffe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java @@ -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)); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java index 04279d3c2..6608d1111 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java index a663225df..8813147f6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java @@ -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)); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java index ac79e6366..6d66e3be0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java @@ -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); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 86bb4a359..2c7e01d30 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -46,15 +46,13 @@ import java.util.Map; public class ClientProxy implements IProxy{ - private static Map modelLocationsForRegistering = new HashMap(); - private static Map modelVariantsForRegistering = new HashMap(); - public static boolean pumpkinBlurPumpkinBlur; public static boolean jingleAllTheWay; public static boolean bulletForMyValentine; - public static int bookletWordCount; public static int bookletCharCount; + private static Map modelLocationsForRegistering = new HashMap(); + private static Map modelVariantsForRegistering = new HashMap(); @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(); - } - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 74d65bdc2..c6bf6c649 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -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(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 4d50427eb..5ee48df56 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -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); - } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index d15f9e6d0..9c0510015 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index b7d038f50..9c3297dfe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -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)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index e8e5dc3cd..435a0e5fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -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 diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index e3f11b885..e893a73a4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java index 969678b18..6a66fea65 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java @@ -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; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index b450e7f4d..ebd6d63f2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java index 8fd2a6139..c6116f01d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index faed346ed..aaeb34d8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -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 diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index d02151c62..52518e7f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index a755d6f94..204bc0410 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index 9a4a2f8e4..4bfb1694f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -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))); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 7b1dd60b5..57707f626 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java index 79db068e3..e8cbcec01 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java @@ -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"); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index 510fb124d..ca810aac3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 0eca889d2..1e3d8f74e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index 356acf99f..213ec304e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java index 7d60df32c..5d0cb8ace 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java @@ -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); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index 2f6cc600d..9ba427066 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -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 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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 9f0dfb8d7..7f99db7ab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index a6751c5c5..5030cc83a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -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 diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index cf2f10a9d..672c98799 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -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 getCapability(Capability 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 getCapability(Capability capability, EnumFacing facing){ - if(facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){ - return (T)this.itemHandlers.get(facing); - } - else{ - return super.getCapability(capability, facing); - } - } + + } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java index 22f721bf7..5b1a5412d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index b19304d7f..976991cc0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -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); + } + } + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index 0396749c7..b0ff839a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -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[]{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index 713f48334..ed5a5bf1d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -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); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index d9e1b84ea..a155eabef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -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){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index 3434e2ec8..a1fed052f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -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 diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java index 8b81c3962..396341479 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java @@ -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 getCapability(Capability 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)); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 7d022dfd6..07bc698f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -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; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index 6fdecdc56..18b411e04 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -104,6 +104,16 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack){ + return false; + } + + @Override + public T getCapability(Capability capability, EnumFacing facing){ + return this.capabilities.getCapability(capability, facing); + } + public static int upgradeRange(int defaultRange, World world, BlockPos pos){ int newRange = defaultRange; for(int i = 0; i < 3; i++){ @@ -183,14 +193,4 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return false; } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ - return false; - } - - @Override - public T getCapability(Capability capability, EnumFacing facing){ - return this.capabilities.getCapability(capability, facing); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index 3ded41dec..bad0d1d95 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -32,6 +32,18 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement super(18, "rangedCollector"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setBoolean("Whitelist", this.isWhitelist); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.isWhitelist = compound.getBoolean("Whitelist"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -74,15 +86,8 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setBoolean("Whitelist", this.isWhitelist); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.isWhitelist = compound.getBoolean("Whitelist"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return false; } @Override @@ -90,11 +95,6 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement 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 slot < WHITELIST_START; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java index e3569d266..db120168a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java @@ -27,17 +27,6 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac public int flyHeight; private String nameBefore; - @Override - public void updateEntity(){ - super.updateEntity(); - if(!worldObj.isRemote){ - if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){ - this.nameBefore = this.name; - this.markDirty(); - } - } - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ super.writeSyncableNBT(compound, sync); @@ -52,6 +41,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac this.name = compound.getString("Name"); } + @Override + public void updateEntity(){ + super.updateEntity(); + if(!worldObj.isRemote){ + if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){ + this.nameBefore = this.name; + this.markDirty(); + } + } + } + @Override public void onTextReceived(String text, int textID, EntityPlayer player){ this.name = text; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index 8561761f6..89d008ee9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -66,13 +66,13 @@ public class TileEntityXPSolidifier 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 false; } @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return false; + public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ + return this.isItemValidForSlot(slot, stack); } @Override @@ -96,6 +96,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } //TODO Fix XP System to fit points needed in 1.8 (OpenBlocks?) + /** * Gets the Player's XP * (Excerpted from OpenBlocks' XP system with permission, thanks guys!) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 4b3593340..9babd4f7f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -43,6 +43,11 @@ public class AssetUtil{ font.drawString(localMachineName, xSize/2-font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE); } + @SideOnly(Side.CLIENT) + public static void renderBlockInWorld(Block block, int meta){ + renderItemInWorld(new ItemStack(block, 1, meta)); + } + @SideOnly(Side.CLIENT) public static void renderItemInWorld(ItemStack stack){ GlStateManager.pushMatrix(); @@ -56,11 +61,6 @@ public class AssetUtil{ GlStateManager.popMatrix(); } - @SideOnly(Side.CLIENT) - public static void renderBlockInWorld(Block block, int meta){ - renderItemInWorld(new ItemStack(block, 1, meta)); - } - @SideOnly(Side.CLIENT) public static void renderStackToGui(ItemStack stack, int x, int y, float scale){ GlStateManager.pushMatrix(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java index 2e97727b4..cf56f862d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java @@ -22,6 +22,10 @@ import net.minecraft.world.World; public class PosUtil{ + public static Material getMaterial(BlockPos pos, IBlockAccess world){ + return getBlock(pos, world).getMaterial(); + } + public static Block getBlock(BlockPos pos, IBlockAccess world){ if(pos != null){ IBlockState state = world.getBlockState(pos); @@ -32,10 +36,6 @@ public class PosUtil{ return null; } - public static Material getMaterial(BlockPos pos, IBlockAccess world){ - return getBlock(pos, world).getMaterial(); - } - public static int getMetadata(BlockPos pos, IBlockAccess world){ return getBlock(pos, world).getMetaFromState(world.getBlockState(pos)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index e28134d04..2f9e52d50 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -248,6 +248,14 @@ public class WorldUtil{ //TODO make this work for the stupid new system + public static boolean addToInventory(IInventory inventory, ArrayList stacks, boolean actuallyDo, boolean shouldAlwaysWork){ + return addToInventory(inventory, stacks, EnumFacing.UP, actuallyDo, shouldAlwaysWork); + } + + public static boolean addToInventory(IInventory inventory, ArrayList stacks, EnumFacing side, boolean actuallyDo, boolean shouldAlwaysWork){ + return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork); + } + /** * Add an ArrayList of ItemStacks to an Array of slots * @@ -300,14 +308,6 @@ public class WorldUtil{ return working >= stacks.size(); } - public static boolean addToInventory(IInventory inventory, ArrayList stacks, boolean actuallyDo, boolean shouldAlwaysWork){ - return addToInventory(inventory, stacks, EnumFacing.UP, actuallyDo, shouldAlwaysWork); - } - - public static boolean addToInventory(IInventory inventory, ArrayList stacks, EnumFacing side, boolean actuallyDo, boolean shouldAlwaysWork){ - return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork); - } - public static int findFirstFilledSlot(ItemStack[] slots){ for(int i = 0; i < slots.length; i++){ if(slots[i] != null){