diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java index f40e3afa1..c481e6c45 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java @@ -51,7 +51,9 @@ public enum TheAchievements{ TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){ this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore); - if(hasToHaveBefore == null) this.ach.initIndependentStat(); + if(hasToHaveBefore == null){ + this.ach.initIndependentStat(); + } this.ach.registerStat(); this.type = type; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java index 453f947a5..d132c754d 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java @@ -60,16 +60,24 @@ public class BlockBreaker extends BlockContainerBase implements IActAddItemOrBlo @Override public IIcon getIcon(int side, int meta){ - if(side == 0 || side == 1) return this.topIcon; - if(side == 3) return this.frontIcon; + if(side == 0 || side == 1){ + return this.topIcon; + } + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side != meta && (side == 0 || side == 1)) return this.topIcon; - if(side == meta) return this.frontIcon; + if(side != meta && (side == 0 || side == 1)){ + return this.topIcon; + } + if(side == meta){ + return this.frontIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java index 20e495dc7..c7c1410e4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java @@ -48,10 +48,18 @@ public class BlockCoffeeMachine extends BlockContainerBase implements IActAddIte public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; - if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 0); - if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 3); - if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 3, 3); + if(rotation == 0){ + world.setBlockMetadataWithNotify(x, y, z, 2, 0); + } + if(rotation == 1){ + world.setBlockMetadataWithNotify(x, y, z, 1, 3); + } + if(rotation == 2){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + if(rotation == 3){ + world.setBlockMetadataWithNotify(x, y, z, 3, 3); + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java index a7dd1015e..c452e0aed 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java @@ -36,10 +36,8 @@ import java.util.Random; public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values(); - - private IIcon[] textures = new IIcon[allLampTypes.length]; - public boolean isOn; + private IIcon[] textures = new IIcon[allLampTypes.length]; public BlockColoredLamp(boolean isOn){ super(Material.redstoneLight); @@ -162,7 +160,9 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ @Override public String getItemStackDisplayName(ItemStack stack){ - if(stack.getItemDamage() >= allLampTypes.length) return null; + if(stack.getItemDamage() >= allLampTypes.length){ + return null; + } return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.theBlock).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : ""); } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java index e0f4505a5..f93597f71 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java @@ -60,7 +60,9 @@ public class BlockCompost extends BlockContainerBase implements IActAddItemOrBlo else{ tile.slots[0].stackSize++; } - if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--; + if(!player.capabilities.isCreativeMode){ + player.inventory.getCurrentItem().stackSize--; + } } //Add Fertilizer to player's inventory diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java index af03a234a..53e2304bc 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java @@ -71,7 +71,9 @@ public abstract class BlockContainerBase extends BlockContainer{ @Override public int getComparatorInputOverride(World world, int x, int y, int z, int meta){ TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof IInventory) return Container.calcRedstoneFromInventory((IInventory)tile); + if(tile instanceof IInventory){ + return Container.calcRedstoneFromInventory((IInventory)tile); + } return 0; } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java index 0efb596a8..71f62229f 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java @@ -57,16 +57,24 @@ public class BlockDropper extends BlockContainerBase implements IActAddItemOrBlo @Override public IIcon getIcon(int side, int meta){ - if(side == 0 || side == 1) return this.topIcon; - if(side == 3) return this.frontIcon; + if(side == 0 || side == 1){ + return this.topIcon; + } + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side != meta && (side == 0 || side == 1)) return this.topIcon; - if(side == meta) return this.frontIcon; + if(side != meta && (side == 0 || side == 1)){ + return this.topIcon; + } + if(side == meta){ + return this.frontIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java index c848e44ef..86512af57 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java @@ -60,16 +60,24 @@ public class BlockFluidCollector extends BlockContainerBase implements IActAddIt @Override public IIcon getIcon(int side, int meta){ - if(side == 0 || side == 1) return this.topIcon; - if(side == 3) return this.frontIcon; + if(side == 0 || side == 1){ + return this.topIcon; + } + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side != meta && (side == 0 || side == 1)) return this.topIcon; - if(side == meta) return this.frontIcon; + if(side != meta && (side == 0 || side == 1)){ + return this.topIcon; + } + if(side == meta){ + return this.frontIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java index 1a997511b..3ca4d4952 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java @@ -28,10 +28,9 @@ import net.minecraftforge.fluids.Fluid; public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemOrBlock{ - private String name; - public IIcon stillIcon; public IIcon flowingIcon; + private String name; public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){ super(fluid, material); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java index f2efe0d79..e21679deb 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -52,10 +52,18 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; - if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); - if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); - if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); + if(rotation == 0){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + if(rotation == 1){ + world.setBlockMetadataWithNotify(x, y, z, 3, 2); + } + if(rotation == 2){ + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + } + if(rotation == 3){ + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + } } @Override @@ -70,19 +78,27 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte @Override public IIcon getIcon(int side, int meta){ - if(side == 1) return this.topIcon; - if(side == 3) return this.frontIcon; + if(side == 1){ + return this.topIcon; + } + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side == 1) return this.topIcon; + if(side == 1){ + return this.topIcon; + } if(side == meta+2 && meta <= 3){ return this.frontIcon; } - else if(side == meta-2 && meta > 3) return this.onIcon; + else if(side == meta-2 && meta > 3){ + return this.onIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index 98c327546..e5cc429f0 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -33,12 +33,11 @@ import java.util.Random; public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlock{ + private final boolean isDouble; private IIcon topIcon; private IIcon onIcon; private IIcon bottomIcon; - private final boolean isDouble; - public BlockGrinder(boolean isDouble){ super(Material.rock); this.isDouble = isDouble; @@ -61,9 +60,15 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo @Override public IIcon getIcon(int side, int meta){ - if(side == 1 && meta != 1) return this.topIcon; - if(side == 1) return this.onIcon; - if(side == 0) return this.bottomIcon; + if(side == 1 && meta != 1){ + return this.topIcon; + } + if(side == 1){ + return this.onIcon; + } + if(side == 0){ + return this.bottomIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java index 6a3a59617..d564e18f4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -55,8 +55,12 @@ public class BlockItemRepairer extends BlockContainerBase implements IActAddItem @Override public IIcon getIcon(int side, int meta){ - if(side == 1) return this.topIcon; - if(side == 0) return this.bottomIcon; + if(side == 1){ + return this.topIcon; + } + if(side == 0){ + return this.bottomIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java index 4880f30b5..43c72772a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java @@ -54,14 +54,18 @@ public class BlockLampPowerer extends Block implements IActAddItemOrBlock{ @Override public IIcon getIcon(int side, int meta){ - if(side == 3) return this.frontIcon; + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side == meta) return this.frontIcon; + if(side == meta){ + return this.frontIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java index b8c6b42fe..8c62876cd 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java @@ -36,17 +36,8 @@ import net.minecraft.world.World; public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlock{ - public enum Type{ - FACE, - PLACER, - BREAKER, - LIQUIFACE, - ENERGYFACE - } - public Type type; public int range; - public BlockPhantom(Type type){ super(Material.rock); this.type = type; @@ -65,7 +56,9 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo @Override public void breakBlock(World world, int x, int y, int z, Block block, int par6){ - if(this.type == Type.PLACER || this.type == Type.BREAKER) this.dropInventory(world, x, y, z); + if(this.type == Type.PLACER || this.type == Type.BREAKER){ + this.dropInventory(world, x, y, z); + } super.breakBlock(world, x, y, z, block, par6); } @@ -147,6 +140,14 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo } } + public enum Type{ + FACE, + PLACER, + BREAKER, + LIQUIFACE, + ENERGYFACE + } + public static class TheItemBlock extends ItemBlock{ private Block theBlock; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java index 8e1644718..9e34a07f3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java @@ -30,11 +30,11 @@ import java.util.Random; public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{ - private IIcon[] textures; - private String name; public Item seedItem; public Item returnItem; public int returnMeta; + private IIcon[] textures; + private String name; private int minDropAmount; private int addDropAmount; @@ -59,7 +59,9 @@ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{ @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta){ if(meta < 7){ - if(meta == 6) meta = 5; + if(meta == 6){ + meta = 5; + } return this.textures[meta >> 1]; } else{ diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java index 7b2f7dff0..27bdaba1e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java @@ -62,8 +62,12 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{ @Override public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float hitX, float hitY, float hitZ, int meta){ - if(side == 1) return meta; - if(side == 0 || hitY >= 0.5F) return meta+1; + if(side == 1){ + return meta; + } + if(side == 0 || hitY >= 0.5F){ + return meta+1; + } return meta; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java index 5f6faece1..6055a1d99 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java @@ -80,10 +80,18 @@ public class BlockSmileyCloud extends BlockContainerBase implements IActAddItemO public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; - if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); - if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 2); - if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 3, 2); + if(rotation == 0){ + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + } + if(rotation == 1){ + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + } + if(rotation == 2){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + if(rotation == 3){ + world.setBlockMetadataWithNotify(x, y, z, 3, 2); + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java index f79d70d4f..a8f3e1489 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java @@ -59,10 +59,18 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; - if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); - if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); - if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); + if(rotation == 0){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + if(rotation == 1){ + world.setBlockMetadataWithNotify(x, y, z, 3, 2); + } + if(rotation == 2){ + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + } + if(rotation == 3){ + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + } } @Override @@ -72,18 +80,30 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{ @Override public IIcon getIcon(int side, int meta){ - if(side == 1) return this.topIcon; - if(side == 0) return this.bottomIcon; - if(side == 3) return this.frontIcon; + if(side == 1){ + return this.topIcon; + } + if(side == 0){ + return this.bottomIcon; + } + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side == 1) return this.topIcon; - if(side == meta+2) return this.frontIcon; - if(side == 0) return this.bottomIcon; + if(side == 1){ + return this.topIcon; + } + if(side == meta+2){ + return this.frontIcon; + } + if(side == 0){ + return this.bottomIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java index d2f63c50f..76c261fad 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java @@ -51,10 +51,18 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; - if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); - if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); - if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); + if(rotation == 0){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + if(rotation == 1){ + world.setBlockMetadataWithNotify(x, y, z, 3, 2); + } + if(rotation == 2){ + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + } + if(rotation == 3){ + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + } } @Override @@ -64,16 +72,24 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem @Override public IIcon getIcon(int side, int meta){ - if(side == 1 || side == 0) return this.topIcon; - if(side == 3) return this.frontIcon; + if(side == 1 || side == 0){ + return this.topIcon; + } + if(side == 3){ + return this.frontIcon; + } return this.blockIcon; } @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ int meta = world.getBlockMetadata(x, y, z); - if(side == 1 || side == 0) return this.topIcon; - if(side == meta+2) return this.frontIcon; + if(side == 1 || side == 0){ + return this.topIcon; + } + if(side == meta+2){ + return this.frontIcon; + } return this.blockIcon; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheColoredLampColors.java b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheColoredLampColors.java index 1ac7ba69f..49551e2bf 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheColoredLampColors.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/metalists/TheColoredLampColors.java @@ -37,18 +37,20 @@ public enum TheColoredLampColors implements IActAddItemOrBlock{ this.name = name; } - @Override - public String getName(){ - return name; - } - public static TheColoredLampColors getColorFromDyeName(String color){ if(color.substring(0, 3).equals("dye")){ String actualName = color.substring(3); for(int i = 0; i < values().length; i++){ - if(values()[i].getName().equals(actualName)) return values()[i]; + if(values()[i].getName().equals(actualName)){ + return values()[i]; + } } } return null; } + + @Override + public String getName(){ + return name; + } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java index 0f63e8aac..32fb51e5e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelCompost.java @@ -59,7 +59,9 @@ public class ModelCompost extends ModelBaseAA{ int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); if(meta > 0 && meta <= ConfigIntValues.COMPOST_AMOUNT.getValue()){ int heightToDisplay = meta*13/ConfigIntValues.COMPOST_AMOUNT.getValue(); - if(heightToDisplay > 13) heightToDisplay = 13; + if(heightToDisplay > 13){ + heightToDisplay = 13; + } this.innerRawList[heightToDisplay-1].render(f); } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelSmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelSmileyCloud.java index 0fa104247..b379233df 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelSmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelSmileyCloud.java @@ -31,11 +31,6 @@ public class ModelSmileyCloud extends ModelBaseAA{ ModelRenderer s15; ModelRenderer s16; - @Override - public boolean doesRotate(){ - return true; - } - public ModelSmileyCloud(){ textureWidth = 64; textureHeight = 64; @@ -138,6 +133,11 @@ public class ModelSmileyCloud extends ModelBaseAA{ setRotation(s16, 0F, 0F, 0F); } + @Override + public boolean doesRotate(){ + return true; + } + @Override public void render(float f){ s1.render(f); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderSmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderSmileyCloud.java index 86a80863e..dee7d0887 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderSmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderSmileyCloud.java @@ -31,12 +31,16 @@ public class RenderSmileyCloud extends RenderTileEntity{ @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){ - if(!(tile instanceof TileEntitySmileyCloud)) return; + if(!(tile instanceof TileEntitySmileyCloud)){ + return; + } TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile; GL11.glPushMatrix(); { - if(theCloud.flyHeight == 0) theCloud.flyHeight = new Random().nextInt(30)+30; + if(theCloud.flyHeight == 0){ + theCloud.flyHeight = new Random().nextInt(30)+30; + } int bobHeight = theCloud.flyHeight; long theTime = Minecraft.getSystemTime(); long time = theTime/50; @@ -60,9 +64,15 @@ public class RenderSmileyCloud extends RenderTileEntity{ { if(theModel.doesRotate()){ int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); - if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F); - if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F); - if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F); + if(meta == 0){ + GL11.glRotatef(180F, 0F, 1F, 0F); + } + if(meta == 1){ + GL11.glRotatef(90F, 0F, 1F, 0F); + } + if(meta == 3){ + GL11.glRotatef(270F, 0F, 1F, 0F); + } } this.bindTexture(resLoc); @@ -79,7 +89,9 @@ public class RenderSmileyCloud extends RenderTileEntity{ break; } } - if(canBreak) break; + if(canBreak){ + break; + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java index 01f720242..2e4950f17 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderTileEntity.java @@ -36,9 +36,15 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{ if(theModel.doesRotate()){ int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); - if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F); - if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F); - if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F); + if(meta == 0){ + GL11.glRotatef(180F, 0F, 1F, 0F); + } + if(meta == 1){ + GL11.glRotatef(90F, 0F, 1F, 0F); + } + if(meta == 3){ + GL11.glRotatef(270F, 0F, 1F, 0F); + } } theModel.render(0.0625F); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java index 5fa0b3cb3..40c5f0bc4 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java @@ -18,9 +18,9 @@ import net.minecraft.item.ItemStack; public class BookletChapter{ public final BookletPage[] pages; - private final String unlocalizedName; public final BookletIndexEntry entry; public final ItemStack displayStack; + private final String unlocalizedName; public BookletChapter(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ this.pages = pages.clone(); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index f671c8a97..84d84a717 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -38,39 +38,29 @@ import java.util.List; public class GuiBooklet extends GuiScreen{ public static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBooklet"); + public static final int CHAPTER_BUTTONS_AMOUNT = 13; + public static final int TOOLTIP_SPLIT_LENGTH = 200; public FontRenderer unicodeRenderer; - public int xSize; public int ySize; public int guiLeft; public int guiTop; - public BookletPage currentPage; public BookletChapter currentChapter; public BookletIndexEntry currentIndexEntry; public int pageOpenInIndex; public int indexPageAmount; - - private GuiTextField searchField; - public GuiButton buttonForward; public GuiButton buttonBackward; - public GuiButton buttonPreviousScreen; public GuiButton buttonPreviouslyOpenedGui; - public GuiButton buttonUpdate; public GuiButton buttonTwitter; public GuiButton buttonForum; - public GuiButton buttonAchievements; public GuiButton buttonConfig; - - public static final int CHAPTER_BUTTONS_AMOUNT = 13; public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT]; - - public static final int TOOLTIP_SPLIT_LENGTH = 200; - + private GuiTextField searchField; private int ticksElapsed; private boolean mouseClicked; @@ -303,7 +293,9 @@ public class GuiBooklet extends GuiScreen{ } } - if(this.mouseClicked) this.mouseClicked = false; + if(this.mouseClicked){ + this.mouseClicked = false; + } } private boolean isGimmicky(){ @@ -381,7 +373,9 @@ public class GuiBooklet extends GuiScreen{ if(this.currentIndexEntry != null){ if(this.currentPage != null){ BookletPage page = this.getNextPage(this.currentChapter, this.currentPage); - if(page != null) this.currentPage = page; + if(page != null){ + this.currentPage = page; + } this.buttonForward.visible = this.getNextPage(this.currentChapter, this.currentPage) != null; this.buttonBackward.visible = this.getPrevPage(this.currentChapter, this.currentPage) != null; @@ -395,7 +389,9 @@ public class GuiBooklet extends GuiScreen{ if(this.currentIndexEntry != null){ if(this.currentPage != null){ BookletPage page = this.getPrevPage(this.currentChapter, this.currentPage); - if(page != null) this.currentPage = page; + if(page != null){ + this.currentPage = page; + } this.buttonForward.visible = this.getNextPage(this.currentChapter, this.currentPage) != null; this.buttonBackward.visible = this.getPrevPage(this.currentChapter, this.currentPage) != null; @@ -479,7 +475,9 @@ public class GuiBooklet extends GuiScreen{ } public void openChapter(BookletChapter chapter, BookletPage page){ - if(chapter == null) return; + if(chapter == null){ + return; + } this.searchField.setVisible(false); this.searchField.setFocused(false); @@ -509,8 +507,8 @@ public class GuiBooklet extends GuiScreen{ private static class IndexButton extends GuiButton{ - private GuiBooklet gui; public BookletChapter chap; + private GuiBooklet gui; public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){ super(id, x, y, width, height, text); @@ -569,7 +567,9 @@ public class GuiBooklet extends GuiScreen{ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height; int k = this.getHoverState(this.field_146123_n); - if(k == 0) k = 1; + if(k == 0){ + k = 1; + } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java index 99a0489d2..92960c68f 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java @@ -32,16 +32,33 @@ import java.util.Map; public class BookletPage{ - private HashMap textReplacements = new HashMap(); - protected int id; protected BookletChapter chapter; + private HashMap textReplacements = new HashMap(); private boolean hasNoText; public BookletPage(int id){ this.id = id; } + public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){ + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslated(x, y, 0); + GL11.glScalef(scale, scale, scale); + RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, 0, 0); + RenderItem.getInstance().renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0); + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + } + public BookletPage setNoText(){ this.hasNoText = true; return this; @@ -51,14 +68,14 @@ public class BookletPage{ return this.id; } - public void setChapter(BookletChapter chapter){ - this.chapter = chapter; - } - public BookletChapter getChapter(){ return this.chapter; } + public void setChapter(BookletChapter chapter){ + this.chapter = chapter; + } + public final String getText(){ if(this.hasNoText){ return null; @@ -128,22 +145,4 @@ public class BookletPage{ gui.drawHoveringText(list, x, y); } - - public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){ - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glPushMatrix(); - GL11.glTranslated(x, y, 0); - GL11.glScalef(scale, scale, scale); - RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, 0, 0); - RenderItem.getInstance().renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0); - GL11.glPopMatrix(); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCoffeeRecipe.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCoffeeRecipe.java index df8f988a4..c51211013 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCoffeeRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCoffeeRecipe.java @@ -78,7 +78,9 @@ public class PageCoffeeRecipe extends BookletPage{ } if(stack != null){ - if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); + if(stack.getItemDamage() == Util.WILDCARD){ + stack.setItemDamage(0); + } boolean tooltip = i == 1; diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java index fe9ae2a51..9f3ab850c 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java @@ -136,7 +136,9 @@ public class PageCrafting extends BookletPage{ for(int y = 0; y < height; y++){ ItemStack stack = stacks[y*width+x]; if(stack != null){ - if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); + if(stack.getItemDamage() == Util.WILDCARD){ + stack.setItemDamage(0); + } int xShow = gui.guiLeft+27+4+x*18; int yShow = gui.guiTop+20+4+y*18; if(!tooltip){ diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java index 01da455c2..0b60b59fd 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java @@ -68,7 +68,9 @@ public class PageCrusherRecipe extends BookletPage{ ItemStack stack = (j == 0 ? this.recipe.input : (j == 1 ? recipe.firstOutput : (j == 2 ? recipe.secondOutput : null))); if(stack != null){ - if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); + if(stack.getItemDamage() == Util.WILDCARD){ + stack.setItemDamage(0); + } boolean tooltip = i == 1; diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java index a9e06d666..846106d2c 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java @@ -71,7 +71,9 @@ public class PageFurnace extends BookletPage{ for(int i = 0; i < 2; i++){ for(int x = 0; x < 2; x++){ ItemStack stack = x == 0 ? input : this.result; - if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); + if(stack.getItemDamage() == Util.WILDCARD){ + stack.setItemDamage(0); + } boolean tooltip = i == 1; int xShow = gui.guiLeft+37+1+x*42; @@ -92,7 +94,9 @@ public class PageFurnace extends BookletPage{ private ItemStack getInputForOutput(ItemStack output){ for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){ ItemStack stack = (ItemStack)((Map.Entry)o).getValue(); - if(stack.isItemEqual(output)) return (ItemStack)((Map.Entry)o).getKey(); + if(stack.isItemEqual(output)){ + return (ItemStack)((Map.Entry)o).getKey(); + } } return null; } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 87a99d678..7b41e24e6 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -487,7 +487,9 @@ public class ItemCrafting{ private static boolean isBlacklisted(Object item){ for(String except : ConfigValues.mashedFoodCraftingExceptions){ - if(Item.itemRegistry.getNameForObject(item).equals(except)) return true; + if(Item.itemRegistry.getNameForObject(item).equals(except)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java index b8fa438df..55cab5248 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/CraftEvent.java @@ -25,6 +25,19 @@ import net.minecraft.item.ItemStack; public class CraftEvent{ + public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){ + for(int i = 0; i < TheAchievements.values().length; i++){ + TheAchievements ach = TheAchievements.values()[i]; + if(ach.type == type){ + if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){ + if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){ + player.addStat(ach.ach, 1); + } + } + } + } + } + @SubscribeEvent public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ checkAchievements(event.crafting, event.player, InitAchievements.CRAFTING_ACH); @@ -42,17 +55,4 @@ public class CraftEvent{ } } } - - public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){ - for(int i = 0; i < TheAchievements.values().length; i++){ - TheAchievements ach = TheAchievements.values()[i]; - if(ach.type == type){ - if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){ - if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){ - player.addStat(ach.ach, 1); - } - } - } - } - } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java index 76a8a4dc6..161fb18c0 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java +++ b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java @@ -23,11 +23,11 @@ import java.util.UUID; public class RenderPlayerEventAA{ + public static RenderSpecial lariRender = new RenderSpecial(null); private static RenderSpecial ellpeckRender = new RenderSpecial(new ItemStack(InitItems.itemPhantomConnector)); private static RenderSpecial hoseRender = new RenderSpecial(new ItemStack(Blocks.torch)); private static RenderSpecial paktoRender = new RenderSpecial(new ItemStack(Blocks.wool, 1, 6)); private static RenderSpecial glenRender = new RenderSpecial(new ItemStack(InitBlocks.blockHeatCollector)); - public static RenderSpecial lariRender = new RenderSpecial(null); @SubscribeEvent(priority = EventPriority.HIGHEST) public void RenderPlayerEvent(RenderPlayerEvent.Specials.Pre event){ diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java index b8f51e648..20ae1068b 100644 --- a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -24,18 +24,18 @@ import org.lwjgl.opengl.GL11; public class RenderSpecial{ - private double lastTimeForBobbing; - - private ItemStack theThingToRender; - private static final ResourceLocation squidTextures = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/specialSquid.png"); + private double lastTimeForBobbing; + private ItemStack theThingToRender; public RenderSpecial(ItemStack stack){ this.theThingToRender = stack; } public void render(EntityPlayer player, float size, float offsetUp){ - if(player.isInvisible() || player.getHideCape()) return; + if(player.isInvisible() || player.getHideCape()){ + return; + } int bobHeight = 70; long theTime = Minecraft.getSystemTime(); diff --git a/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java b/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java index 79b46bc37..dc80f97f3 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/JamVillagerTradeHandler.java @@ -56,7 +56,9 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa wantsTwo.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(k).minStackSize, trades.get(k).maxStackSize); } } - if(wantsOne == wantsTwo) wantsTwo = null; + if(wantsOne == wantsTwo){ + wantsTwo = null; + } for(int k = 0; k < TheJams.values().length; k++){ recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(3)+1, k))); diff --git a/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java b/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java index 5f926d1e6..d75d9d003 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/OreGen.java @@ -29,9 +29,16 @@ import java.util.Random; public class OreGen implements IWorldGenerator{ + public static void init(){ + ModUtil.LOGGER.info("Registering World Generator..."); + GameRegistry.registerWorldGenerator(new OreGen(), 10); + } + @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ - if(world.provider.terrainType == WorldType.FLAT) return; + if(world.provider.terrainType == WorldType.FLAT){ + return; + } switch(world.provider.dimensionId){ case -1: @@ -75,9 +82,4 @@ public class OreGen implements IWorldGenerator{ ModUtil.LOGGER.fatal("Couldn't generate '"+block.getUnlocalizedName()+"' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!"); } } - - public static void init(){ - ModUtil.LOGGER.info("Registering World Generator..."); - GameRegistry.registerWorldGenerator(new OreGen(), 10); - } } diff --git a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentCustomCropField.java b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentCustomCropField.java index 9fa325310..e63ae90b0 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentCustomCropField.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentCustomCropField.java @@ -49,7 +49,9 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ if(this.averageGroundLevel < 0){ this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); - if(this.averageGroundLevel < 0) return true; + if(this.averageGroundLevel < 0){ + return true; + } this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0); } diff --git a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java index 5d6672bfa..a554781f9 100644 --- a/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java +++ b/src/main/java/ellpeck/actuallyadditions/gen/VillageComponentJamHouse.java @@ -52,7 +52,9 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{ public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ if(this.averageGroundLevel < 0){ this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); - if(this.averageGroundLevel < 0) return true; + if(this.averageGroundLevel < 0){ + return true; + } this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java index 6132c6799..1e8e4eeef 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java @@ -67,14 +67,18 @@ public class ContainerBreaker extends Container{ if(!this.mergeItemStack(newStack, 0, 9, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -83,7 +87,9 @@ public class ContainerBreaker extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCanolaPress.java index 272277cd5..1eecc4c23 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCanolaPress.java @@ -69,21 +69,29 @@ public class ContainerCanolaPress extends Container{ if(slot >= inventoryStart){ //Shift from Inventory if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidCanolaOil, 1), newStack) > 0){ - if(!this.mergeItemStack(newStack, 1, 2, false)) return null; + if(!this.mergeItemStack(newStack, 1, 2, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -92,7 +100,9 @@ public class ContainerCanolaPress extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoalGenerator.java index 023b2af9f..cd195efef 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoalGenerator.java @@ -62,18 +62,24 @@ public class ContainerCoalGenerator extends Container{ if(slot >= inventoryStart){ //Shift from Inventory if(TileEntityFurnace.getItemBurnTime(newStack) > 0){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -82,7 +88,9 @@ public class ContainerCoalGenerator extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java index 7b55f78a5..0db5c83ca 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java @@ -77,7 +77,9 @@ public class ContainerCoffeeMachine extends Container{ //Slots in Inventory to shift from if(slot == TileEntityCoffeeMachine.SLOT_OUTPUT){ - if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; + if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ + return null; + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded @@ -94,7 +96,9 @@ public class ContainerCoffeeMachine extends Container{ } } else if(ItemCoffee.getIngredientFromStack(newStack) != null){ - if(!this.mergeItemStack(newStack, 3, 11, false)) return null; + if(!this.mergeItemStack(newStack, 3, 11, false)){ + return null; + } } else if(newStack.getItem() == InitItems.itemCoffeeBean){ if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)){ @@ -104,13 +108,17 @@ public class ContainerCoffeeMachine extends Container{ // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -119,7 +127,9 @@ public class ContainerCoffeeMachine extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java index 5aaaa36b1..0d9432701 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCrafter.java @@ -21,13 +21,12 @@ import net.minecraft.world.World; @InventoryContainer public class ContainerCrafter extends Container{ - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - public IInventory craftResult = new InventoryCraftResult(); - public final int x; public final int y; public final int z; public final World world; + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); + public IInventory craftResult = new InventoryCraftResult(); public ContainerCrafter(EntityPlayer player){ InventoryPlayer inventory = player.inventory; @@ -68,7 +67,9 @@ public class ContainerCrafter extends Container{ if(!this.world.isRemote){ for(int i = 0; i < 9; ++i){ ItemStack stack = this.craftMatrix.getStackInSlotOnClosing(i); - if(stack != null) player.dropPlayerItemWithRandomChoice(stack, false); + if(stack != null){ + player.dropPlayerItemWithRandomChoice(stack, false); + } } } } @@ -88,7 +89,9 @@ public class ContainerCrafter extends Container{ stack = savedStack.copy(); if(slot == 0){ - if(!this.mergeItemStack(savedStack, 10, 46, true)) return null; + if(!this.mergeItemStack(savedStack, 10, 46, true)){ + return null; + } theSlot.onSlotChange(savedStack, stack); } else if(slot >= 10 && slot < 37 && !this.mergeItemStack(savedStack, 37, 46, false)){ @@ -97,7 +100,9 @@ public class ContainerCrafter extends Container{ else if(slot >= 37 && slot < 46 && !this.mergeItemStack(savedStack, 10, 37, false)){ return null; } - else if(!this.mergeItemStack(savedStack, 10, 46, false)) return null; + else if(!this.mergeItemStack(savedStack, 10, 46, false)){ + return null; + } if(savedStack.stackSize == 0){ theSlot.putStack(null); @@ -106,7 +111,9 @@ public class ContainerCrafter extends Container{ theSlot.onSlotChanged(); } - if(savedStack.stackSize == stack.stackSize) return null; + if(savedStack.stackSize == stack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, savedStack); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java index 8efc02ed5..869ba827e 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java @@ -59,7 +59,9 @@ public class ContainerDrill extends Container{ ItemStack stack = inventory.getCurrentItem(); if(stack != null && stack.getItem() instanceof ItemDrill){ ItemStack[] slots = ((ItemDrill)stack.getItem()).getSlotsFromNBT(inventory.getCurrentItem()); - if(slots != null && slots.length > 0) this.drillInventory.slots = slots; + if(slots != null && slots.length > 0){ + this.drillInventory.slots = slots; + } } } @@ -106,18 +108,24 @@ public class ContainerDrill extends Container{ if(slot >= inventoryStart){ //Shift from Inventory if(newStack.getItem() instanceof ItemDrillUpgrade || newStack.getItem() instanceof IEnergyContainerItem){ - if(!this.mergeItemStack(newStack, 0, 5, false)) return null; + if(!this.mergeItemStack(newStack, 0, 5, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -126,7 +134,9 @@ public class ContainerDrill extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; @@ -214,7 +224,9 @@ public class ContainerDrill extends Container{ } else{ stackAt = slots[i].splitStack(j); - if(slots[i].stackSize == 0) slots[i] = null; + if(slots[i].stackSize == 0){ + slots[i] = null; + } this.markDirty(); return stackAt; } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java index fccc31f61..d83695ed9 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java @@ -67,14 +67,18 @@ public class ContainerDropper extends Container{ if(!this.mergeItemStack(newStack, 0, 9, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -83,7 +87,9 @@ public class ContainerDropper extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java index 3e194e108..97f9795a7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java @@ -88,25 +88,33 @@ public class ContainerEnergizer extends Container{ //Slots in Inventory to shift from if(slot == 1){ - if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; + if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ + return null; + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded else if(slot >= inventoryStart){ //Shift from Inventory if(newStack.getItem() instanceof IEnergyContainerItem){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -115,7 +123,9 @@ public class ContainerEnergizer extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java index 9e3510646..5786c0434 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java @@ -88,25 +88,33 @@ public class ContainerEnervator extends Container{ //Slots in Inventory to shift from if(slot == 1){ - if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; + if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ + return null; + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded else if(slot >= inventoryStart){ //Shift from Inventory if(newStack.getItem() instanceof IEnergyContainerItem){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -115,7 +123,9 @@ public class ContainerEnervator extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java index b93f72c4c..6fc97a1ef 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFeeder.java @@ -62,14 +62,18 @@ public class ContainerFeeder extends Container{ if(!this.mergeItemStack(newStack, 0, 1, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -78,7 +82,9 @@ public class ContainerFeeder extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFermentingBarrel.java index 92c45ce9f..805489060 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFermentingBarrel.java @@ -68,21 +68,29 @@ public class ContainerFermentingBarrel extends Container{ if(slot >= inventoryStart){ //Shift from Inventory if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidCanolaOil, 1))){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidOil, 1), newStack) > 0){ - if(!this.mergeItemStack(newStack, 2, 3, false)) return null; + if(!this.mergeItemStack(newStack, 2, 3, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -91,7 +99,9 @@ public class ContainerFermentingBarrel extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFluidCollector.java index d7bf5215b..834d573c5 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFluidCollector.java @@ -62,25 +62,33 @@ public class ContainerFluidCollector extends Container{ //Slots in Inventory to shift from if(slot == 1){ - if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; + if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ + return null; + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded else if(slot >= inventoryStart){ //Shift from Inventory if(FluidContainerRegistry.isEmptyContainer(newStack)){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -89,7 +97,9 @@ public class ContainerFluidCollector extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java index 6aaf8297a..838a6bdc7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerFurnaceDouble.java @@ -64,7 +64,9 @@ public class ContainerFurnaceDouble extends Container{ //Slots in Inventory to shift from if(slot == TileEntityFurnaceDouble.SLOT_OUTPUT_1 || slot == TileEntityFurnaceDouble.SLOT_OUTPUT_2){ - if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; + if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ + return null; + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded @@ -80,13 +82,17 @@ public class ContainerFurnaceDouble extends Container{ // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -95,7 +101,9 @@ public class ContainerFurnaceDouble extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java index 843155331..3d574671b 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGiantChest.java @@ -67,14 +67,18 @@ public class ContainerGiantChest extends Container{ if(!this.mergeItemStack(newStack, 0, 117, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -83,7 +87,9 @@ public class ContainerGiantChest extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java index 5dc4c8335..6d9fcd1e5 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java @@ -70,7 +70,9 @@ public class ContainerGrinder extends Container{ //Slots in Inventory to shift from if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || (this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2))){ - if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; + if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){ + return null; + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded @@ -91,13 +93,17 @@ public class ContainerGrinder extends Container{ // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -106,7 +112,9 @@ public class ContainerGrinder extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java index ff39e1f3d..cd1963386 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerInputter.java @@ -89,14 +89,18 @@ public class ContainerInputter extends Container{ if(!this.mergeItemStack(newStack, 0, 1, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -105,7 +109,9 @@ public class ContainerInputter extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOilGenerator.java index d72b13647..a90f8e5d0 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOilGenerator.java @@ -66,18 +66,24 @@ public class ContainerOilGenerator extends Container{ if(slot >= inventoryStart){ //Shift from Inventory if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidOil, 1))){ - if(!this.mergeItemStack(newStack, 0, 1, false)) return null; + if(!this.mergeItemStack(newStack, 0, 1, false)){ + return null; + } } // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -86,7 +92,9 @@ public class ContainerOilGenerator extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOreMagnet.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOreMagnet.java index 0f07eba32..f25a5c546 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOreMagnet.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerOreMagnet.java @@ -75,13 +75,17 @@ public class ContainerOreMagnet extends Container{ // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -90,7 +94,9 @@ public class ContainerOreMagnet extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java index 25182fce4..40aff5234 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java @@ -67,14 +67,18 @@ public class ContainerPhantomPlacer extends Container{ if(!this.mergeItemStack(newStack, 0, 9, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -83,7 +87,9 @@ public class ContainerPhantomPlacer extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java index dc4893fb0..2d2330470 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerRepairer.java @@ -70,13 +70,17 @@ public class ContainerRepairer extends Container{ // else if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -85,7 +89,9 @@ public class ContainerRepairer extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java index 825f4d768..4b5aae67d 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java @@ -61,13 +61,17 @@ public class ContainerXPSolidifier extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ if(slot >= inventoryStart && slot <= inventoryEnd){ - if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } } else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ return null; } } - else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } if(newStack.stackSize == 0){ theSlot.putStack(null); @@ -76,7 +80,9 @@ public class ContainerXPSolidifier extends Container{ theSlot.onSlotChanged(); } - if(newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize){ + return null; + } theSlot.onPickupFromSlot(player, newStack); return currentStack; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index 528f034d9..41de14c8f 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -22,6 +22,11 @@ import net.minecraft.world.World; public class GuiHandler implements IGuiHandler{ + public static void init(){ + ModUtil.LOGGER.info("Initializing GuiHandler..."); + NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.instance, new GuiHandler()); + } + @Override public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ TileEntityBase tile = null; @@ -181,9 +186,4 @@ public class GuiHandler implements IGuiHandler{ this(true); } } - - public static void init(){ - ModUtil.LOGGER.info("Initializing GuiHandler..."); - NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.instance, new GuiHandler()); - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiBreaker.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiBreaker.java index 54b4e10a1..947b65a7c 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiBreaker.java @@ -24,9 +24,8 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiBreaker extends GuiContainer{ - private TileEntityBreaker breaker; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); + private TileEntityBreaker breaker; public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerBreaker(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java index beb8b484c..1db1817d4 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCanolaPress.java @@ -27,9 +27,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiCanolaPress extends GuiContainer{ - private TileEntityCanolaPress press; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCanolaPress"); + private TileEntityCanolaPress press; public GuiCanolaPress(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerCanolaPress(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoalGenerator.java index 09ca32414..5595ef7ff 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoalGenerator.java @@ -26,9 +26,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiCoalGenerator extends GuiContainer{ - private TileEntityCoalGenerator generator; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoalGenerator"); + private TileEntityCoalGenerator generator; public GuiCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerCoalGenerator(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java index e962f8427..495d2bc6c 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiCoffeeMachine.java @@ -34,10 +34,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiCoffeeMachine extends GuiContainer{ - private TileEntityCoffeeMachine machine; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoffeeMachine"); - + private TileEntityCoffeeMachine machine; private int x; private int y; private int z; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDropper.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDropper.java index b250522b9..6d0a9af12 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiDropper.java @@ -24,9 +24,8 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiDropper extends GuiContainer{ - private TileEntityDropper dropper; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); + private TileEntityDropper dropper; public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerDropper(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java index c3f5b87a2..a7d3b8584 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java @@ -26,9 +26,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiEnergizer extends GuiContainer{ - private TileEntityEnergizer energizer; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); + private TileEntityEnergizer energizer; public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile){ super(new ContainerEnergizer(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java index d88635b8b..d7b0e3caf 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java @@ -26,9 +26,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiEnervator extends GuiContainer{ - private TileEntityEnervator enervator; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); + private TileEntityEnervator enervator; public GuiEnervator(EntityPlayer inventory, TileEntityBase tile){ super(new ContainerEnervator(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java index 45a324347..bd0bf818e 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFermentingBarrel.java @@ -27,9 +27,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiFermentingBarrel extends GuiContainer{ - private TileEntityFermentingBarrel press; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFermentingBarrel"); + private TileEntityFermentingBarrel press; public GuiFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerFermentingBarrel(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java index a606e078f..b8d8bf270 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiFluidCollector.java @@ -26,9 +26,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiFluidCollector extends GuiContainer{ - private TileEntityFluidCollector collector; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFluidCollector"); + private TileEntityFluidCollector collector; public GuiFluidCollector(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerFluidCollector(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java index 1ff48d101..80bd3c889 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java @@ -26,17 +26,10 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiGrinder extends GuiContainer{ - public static class GuiGrinderDouble extends GuiGrinder{ - public GuiGrinderDouble(InventoryPlayer inventory, TileEntityBase tile){ - super(inventory, tile, true); - } - } - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGrinder"); private static final ResourceLocation resLocDouble = AssetUtil.getGuiLocation("guiGrinderDouble"); private TileEntityGrinder tileGrinder; private boolean isDouble; - public GuiGrinder(InventoryPlayer inventoryPlayer, TileEntityBase tile){ this(inventoryPlayer, tile, false); } @@ -88,4 +81,10 @@ public class GuiGrinder extends GuiContainer{ this.func_146283_a(Collections.singletonList(text), x, y); } } + + public static class GuiGrinderDouble extends GuiGrinder{ + public GuiGrinderDouble(InventoryPlayer inventory, TileEntityBase tile){ + super(inventory, tile, true); + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java index a267e8e95..b50346922 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiInputter.java @@ -40,29 +40,7 @@ import java.util.List; @SideOnly(Side.CLIENT) public class GuiInputter extends GuiContainer{ - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); - private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced"); - - public TileEntityInputter tileInputter; - - private int x; - private int y; - private int z; - private World world; - - private SmallerButton whitelistPut; - private SmallerButton whitelistPull; - - private GuiTextField fieldPutStart; - private GuiTextField fieldPutEnd; - - private GuiTextField fieldPullStart; - private GuiTextField fieldPullEnd; - - private boolean isAdvanced; - public static final int OFFSET_ADVANCED = 12+36; - public static final String[] sideString = new String[]{ StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.disabled"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.up"), @@ -71,6 +49,20 @@ public class GuiInputter extends GuiContainer{ StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.east"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.south"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.west")}; + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); + private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced"); + public TileEntityInputter tileInputter; + private int x; + private int y; + private int z; + private World world; + private SmallerButton whitelistPut; + private SmallerButton whitelistPull; + private GuiTextField fieldPutStart; + private GuiTextField fieldPutEnd; + private GuiTextField fieldPullStart; + private GuiTextField fieldPullEnd; + private boolean isAdvanced; public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){ super(new ContainerInputter(inventory, tile, isAdvanced)); @@ -152,10 +144,18 @@ public class GuiInputter extends GuiContainer{ @Override public void keyTyped(char theChar, int key){ if(key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER){ - if(this.fieldPutStart.isFocused()) this.setVariable(this.fieldPutStart, 0); - if(this.fieldPutEnd.isFocused()) this.setVariable(this.fieldPutEnd, 1); - if(this.fieldPullStart.isFocused()) this.setVariable(this.fieldPullStart, 2); - if(this.fieldPullEnd.isFocused()) this.setVariable(this.fieldPullEnd, 3); + if(this.fieldPutStart.isFocused()){ + this.setVariable(this.fieldPutStart, 0); + } + if(this.fieldPutEnd.isFocused()){ + this.setVariable(this.fieldPutEnd, 1); + } + if(this.fieldPullStart.isFocused()){ + this.setVariable(this.fieldPullStart, 2); + } + if(this.fieldPullEnd.isFocused()){ + this.setVariable(this.fieldPullEnd, 3); + } } else if(Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT){ this.fieldPutStart.textboxKeyTyped(theChar, key); @@ -298,7 +298,9 @@ public class GuiInputter extends GuiContainer{ else if(!this.enabled){ color = 10526880; } - else if(this.field_146123_n) color = 16777120; + else if(this.field_146123_n){ + color = 16777120; + } this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition+this.width/2, this.yPosition+(this.height-8)/2, color); } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java index 29a0918bd..21d8daeeb 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOilGenerator.java @@ -27,9 +27,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiOilGenerator extends GuiContainer{ - private TileEntityOilGenerator generator; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOilGenerator"); + private TileEntityOilGenerator generator; public GuiOilGenerator(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerOilGenerator(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOreMagnet.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOreMagnet.java index db639da8e..5ab5c9ecc 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOreMagnet.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiOreMagnet.java @@ -28,9 +28,8 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiOreMagnet extends GuiContainer{ - private TileEntityOreMagnet magnet; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOreMagnet"); + private TileEntityOreMagnet magnet; public GuiOreMagnet(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerOreMagnet(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiPhantomPlacer.java index a203f01f6..e44f834a8 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiPhantomPlacer.java @@ -24,9 +24,8 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiPhantomPlacer extends GuiContainer{ - private TileEntityPhantomPlacer placer; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); + private TileEntityPhantomPlacer placer; public GuiPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){ super(new ContainerPhantomPlacer(inventory, tile)); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java index df3a148e1..1aa8e824f 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java @@ -30,10 +30,8 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiXPSolidifier extends GuiContainer{ - private TileEntityXPSolidifier solidifier; - private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiXPSolidifier"); - + private TileEntityXPSolidifier solidifier; private int x; private int y; private int z; diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java index 8183cfbec..b108f2818 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java @@ -27,15 +27,13 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; public class InitForeignPaxels{ + public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"}; private static final String THERMAL_FOUNDATION = "ThermalFoundation"; private static final String MEKANISM_TOOLS = "MekanismTools"; - - public static Item[] tfPaxels = new Item[9]; private static final String[] tfNames = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"}; - - private static Item[] mtPaxels = new Item[6]; - public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"}; private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"}; + public static Item[] tfPaxels = new Item[9]; + private static Item[] mtPaxels = new Item[6]; public static void init(){ //MekanismTools diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java b/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java index f159320ab..7ddab59bd 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java @@ -64,7 +64,9 @@ public class ItemArmorAA extends ItemArmor implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java index 0479c52d6..e3fef9d49 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java @@ -37,6 +37,14 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ public static ArrayList ingredients = new ArrayList(); + public ItemCoffee(){ + super(8, 5.0F, false); + this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1); + this.setAlwaysEdible(); + this.setMaxStackSize(1); + this.setNoRepair(); + } + public static void initIngredients(){ registerIngredient(new MilkIngredient(new ItemStack(Items.milk_bucket))); //Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?) @@ -56,31 +64,11 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 2)); } - public ItemCoffee(){ - super(8, 5.0F, false); - this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1); - this.setAlwaysEdible(); - this.setMaxStackSize(1); - this.setNoRepair(); - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ - PotionEffect[] effects = getEffectsFromStack(stack); - if(effects != null){ - for(PotionEffect effect : effects){ - list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20)); - } - } - else{ - list.add("No Effects"); - } - } - public static Ingredient getIngredientFromStack(ItemStack stack){ for(Ingredient ingredient : ingredients){ - if(ingredient.ingredient.copy().isItemEqual(stack)) return ingredient; + if(ingredient.ingredient.copy().isItemEqual(stack)){ + return ingredient; + } } return null; } @@ -98,7 +86,9 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ public static void addEffectToStack(ItemStack stack, PotionEffect effect){ NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) tag = new NBTTagCompound(); + if(tag == null){ + tag = new NBTTagCompound(); + } int prevCounter = tag.getInteger("Counter"); NBTTagCompound compound = new NBTTagCompound(); @@ -157,7 +147,9 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ PotionEffect[] effectsStack = getEffectsFromStack(stack); if(effectsStack != null && effectsStack.length > 0){ for(PotionEffect effectStack : effectsStack){ - if(effect.getPotionID() == effectStack.getPotionID()) return effectStack; + if(effect.getPotionID() == effectStack.getPotionID()){ + return effectStack; + } } } return null; @@ -172,6 +164,24 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ } } + public static void registerIngredient(Ingredient ingredient){ + ingredients.add(ingredient); + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ + PotionEffect[] effects = getEffectsFromStack(stack); + if(effects != null){ + for(PotionEffect effect : effects){ + list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20)); + } + } + else{ + list.add("No Effects"); + } + } + @Override public boolean getShareTag(){ return true; @@ -222,15 +232,11 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ return "itemCoffee"; } - public static void registerIngredient(Ingredient ingredient){ - ingredients.add(ingredient); - } - public static class Ingredient{ public final ItemStack ingredient; - protected PotionEffect[] effects; public final int maxAmplifier; + protected PotionEffect[] effects; public Ingredient(ItemStack ingredient, PotionEffect[] effects, int maxAmplifier){ this.ingredient = ingredient.copy(); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index e3dd38f4f..ed9a6464e 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -205,13 +205,17 @@ public class ItemDrill extends ItemEnergy{ */ public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) return null; + if(compound == null){ + return null; + } ItemStack[] slots = this.getSlotsFromNBT(stack); if(slots != null && slots.length > 0){ for(ItemStack slotStack : slots){ if(slotStack != null && slotStack.getItem() instanceof ItemDrillUpgrade){ - if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade) return slotStack; + if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade){ + return slotStack; + } } } } @@ -237,7 +241,9 @@ public class ItemDrill extends ItemEnergy{ */ public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); + if(compound == null){ + compound = new NBTTagCompound(); + } if(slots != null && slots.length > 0){ compound.setInteger("SlotAmount", slots.length); @@ -264,7 +270,9 @@ public class ItemDrill extends ItemEnergy{ */ public ItemStack[] getSlotsFromNBT(ItemStack stack){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) return null; + if(compound == null){ + return null; + } int slotAmount = compound.getInteger("SlotAmount"); ItemStack[] slots = new ItemStack[slotAmount]; @@ -301,7 +309,9 @@ public class ItemDrill extends ItemEnergy{ //Block hit MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); - if(pos == null) return false; + if(pos == null){ + return false; + } //Corrects Blocks to hit depending on Side of original Block hit int side = pos.sideHit; @@ -320,7 +330,9 @@ public class ItemDrill extends ItemEnergy{ //Break Middle Block first int use = this.getEnergyUsePerBlock(stack); if(this.getEnergyStored(stack) >= use){ - if(!this.tryHarvestBlock(world, x, y, z, false, stack, player, use)) return false; + if(!this.tryHarvestBlock(world, x, y, z, false, stack, player, use)){ + return false; + } } else{ return false; @@ -429,7 +441,9 @@ public class ItemDrill extends ItemEnergy{ String name = Block.blockRegistry.getNameForObject(block); if(name != null){ for(String list : ConfigValues.drillExtraminingWhitelist){ - if(list.equals(name)) return true; + if(list.equals(name)){ + return true; + } } } return false; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java index 70db26c62..9a6fc3c85 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java @@ -24,27 +24,22 @@ import net.minecraft.world.World; public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ - public enum UpgradeType{ - SPEED, - SPEED_II, - SPEED_III, - SILK_TOUCH, - FORTUNE, - FORTUNE_II, - THREE_BY_THREE, - FIVE_BY_FIVE, - PLACER - } - public UpgradeType type; public String unlocalizedName; - public ItemDrillUpgrade(UpgradeType type, String unlocName){ this.type = type; this.unlocalizedName = unlocName; this.setMaxStackSize(1); } + public static int getSlotToPlaceFrom(ItemStack stack){ + NBTTagCompound compound = stack.getTagCompound(); + if(compound != null){ + return compound.getInteger("SlotToPlaceFrom")-1; + } + return -1; + } + @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ if(!world.isRemote && this.type == UpgradeType.PLACER){ @@ -55,21 +50,15 @@ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ public void setSlotToPlaceFrom(ItemStack stack, int slot){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); + if(compound == null){ + compound = new NBTTagCompound(); + } compound.setInteger("SlotToPlaceFrom", slot+1); stack.setTagCompound(compound); } - public static int getSlotToPlaceFrom(ItemStack stack){ - NBTTagCompound compound = stack.getTagCompound(); - if(compound != null){ - return compound.getInteger("SlotToPlaceFrom")-1; - } - return -1; - } - @Override public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; @@ -85,4 +74,16 @@ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ public String getName(){ return this.unlocalizedName; } + + public enum UpgradeType{ + SPEED, + SPEED_II, + SPEED_III, + SILK_TOUCH, + FORTUNE, + FORTUNE_II, + THREE_BY_THREE, + FIVE_BY_FIVE, + PLACER + } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java b/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java index 710902e46..4ca067e2b 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java @@ -74,7 +74,9 @@ public abstract class ItemEnergy extends ItemEnergyContainer implements IActAddI public void setEnergy(ItemStack stack, int energy){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); + if(compound == null){ + compound = new NBTTagCompound(); + } compound.setInteger("Energy", energy); stack.setTagCompound(compound); } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java index 89201f15b..35089c742 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java @@ -28,7 +28,9 @@ public class ItemFertilizer extends Item implements IActAddItemOrBlock{ @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ if(ItemDye.applyBonemeal(stack, world, x, y, z, player)){ - if(!world.isRemote) world.playAuxSFX(2005, x, y, z, 0); + if(!world.isRemote){ + world.playAuxSFX(2005, x, y, z, 0); + } return true; } return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java index bd80e4223..9d30c5e2c 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java @@ -40,7 +40,9 @@ public class ItemGrowthRing extends ItemEnergy{ @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ - if(!(entity instanceof EntityPlayer) || world.isRemote) return; + if(!(entity instanceof EntityPlayer) || world.isRemote){ + return; + } EntityPlayer player = (EntityPlayer)entity; ItemStack equipped = player.getCurrentEquippedItem(); @@ -48,7 +50,9 @@ public class ItemGrowthRing extends ItemEnergy{ if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= ConfigIntValues.GROWTH_RING_ENERGY_USE.getValue()){ ArrayList blocks = new ArrayList(); - if(stack.stackTagCompound == null) stack.setTagCompound(new NBTTagCompound()); + if(stack.stackTagCompound == null){ + stack.setTagCompound(new NBTTagCompound()); + } int waitTime = stack.stackTagCompound.getInteger("WaitTime"); //Adding all possible Blocks diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java index 3451e2f1a..8537acb5c 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java @@ -75,7 +75,9 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{ @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ - if(this.getStoredPosition(stack) == null) this.clearStorage(stack); + if(this.getStoredPosition(stack) == null){ + this.clearStorage(stack); + } } public WorldPos getStoredPosition(ItemStack stack){ @@ -94,7 +96,9 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{ public void storeConnection(ItemStack stack, int x, int y, int z, World world){ NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) tag = new NBTTagCompound(); + if(tag == null){ + tag = new NBTTagCompound(); + } tag.setInteger("XCoordOfTileStored", x); tag.setInteger("YCoordOfTileStored", y); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java index 38e812ba7..041666915 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java @@ -44,11 +44,15 @@ public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{ if(stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()){ if(!player.isSneaking()){ world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT)); - if(!player.capabilities.isCreativeMode) stack.stackSize--; + if(!player.capabilities.isCreativeMode){ + stack.stackSize--; + } } else{ world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT*stack.stackSize)); - if(!player.capabilities.isCreativeMode) stack.stackSize = 0; + if(!player.capabilities.isCreativeMode){ + stack.stackSize = 0; + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java b/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java index b163e0a75..9589a79fc 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java @@ -65,7 +65,9 @@ public class ItemTeleStaff extends ItemEnergy{ private void setWaitTime(ItemStack stack, int time){ NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); + if(compound == null){ + compound = new NBTTagCompound(); + } compound.setInteger("waitTime", time); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java index 2c664155f..2d56f5b10 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java @@ -32,7 +32,9 @@ public class ItemWaterRemovalRing extends ItemEnergy{ @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ - if(!(entity instanceof EntityPlayer) || world.isRemote) return; + if(!(entity instanceof EntityPlayer) || world.isRemote){ + return; + } EntityPlayer player = (EntityPlayer)entity; ItemStack equipped = player.getCurrentEquippedItem(); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java index aa6b35086..8f40478b0 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java @@ -77,6 +77,21 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{ wingedPlayers.add(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : "")); } + /** + * Checks if the Player has Wings in its Inventory + * + * @param player The Player + * @return The Wings + */ + public static ItemStack getWingItem(EntityPlayer player){ + for(int i = 0; i < player.inventory.getSizeInventory(); i++){ + if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats){ + return player.inventory.getStackInSlot(i); + } + } + return null; + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; @@ -97,19 +112,4 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{ public String getName(){ return "itemWingsOfTheBats"; } - - /** - * Checks if the Player has Wings in its Inventory - * - * @param player The Player - * @return The Wings - */ - public static ItemStack getWingItem(EntityPlayer player){ - for(int i = 0; i < player.inventory.getSizeInventory(); i++){ - if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats){ - return player.inventory.getStackInSlot(i); - } - } - return null; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java index 8765f66f8..d54d8c709 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/TheFoods.java @@ -38,22 +38,13 @@ public enum TheFoods implements IActAddItemOrBlock{ RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon), DOUGHNUT("Doughnut", 4, 0.5F, false, 10, EnumRarity.epic); - public static void setReturnItems(){ - SPAGHETTI.returnItem = new ItemStack(Items.bowl); - PUMPKIN_STEW.returnItem = new ItemStack(Items.bowl); - CARROT_JUICE.returnItem = new ItemStack(Items.glass_bottle); - FRENCH_FRIES.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()); - FISH_N_CHIPS.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()); - } - public final String name; public final int healAmount; public final float saturation; public final boolean getsDrunken; public final int useDuration; - public ItemStack returnItem; public final EnumRarity rarity; - + public ItemStack returnItem; TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){ this.name = name; this.getsDrunken = getsDrunken; @@ -63,6 +54,14 @@ public enum TheFoods implements IActAddItemOrBlock{ this.rarity = rarity; } + public static void setReturnItems(){ + SPAGHETTI.returnItem = new ItemStack(Items.bowl); + PUMPKIN_STEW.returnItem = new ItemStack(Items.bowl); + CARROT_JUICE.returnItem = new ItemStack(Items.glass_bottle); + FRENCH_FRIES.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()); + FISH_N_CHIPS.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()); + } + @Override public String getName(){ return this.name; diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java index 8ded7ba83..7bbbe5b15 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java @@ -55,7 +55,9 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ String name = Block.blockRegistry.getNameForObject(block); if(name != null){ for(String list : ConfigValues.paxelExtraMiningWhitelist){ - if(list.equals(name)) return true; + if(list.equals(name)){ + return true; + } } } return false; @@ -78,7 +80,9 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ } else{ UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z); - if(MinecraftForge.EVENT_BUS.post(event)) return false; + if(MinecraftForge.EVENT_BUS.post(event)){ + return false; + } if(event.getResult() == Event.Result.ALLOW){ stack.damageItem(1, player); return true; @@ -106,7 +110,9 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java index 9d781b99b..7a2063b74 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java @@ -38,7 +38,9 @@ public class ItemAxeAA extends ItemAxe implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java index db39681ff..afdd511ba 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java @@ -40,7 +40,9 @@ public class ItemHoeAA extends ItemHoe implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java index 08b1cbbc2..7d49142ad 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java @@ -38,7 +38,9 @@ public class ItemPickaxeAA extends ItemPickaxe implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java index 47f096cfc..4c1eeb1d1 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java @@ -40,7 +40,9 @@ public class ItemShovelAA extends ItemSpade implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java index c9075c7cc..1322b4f84 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java @@ -40,7 +40,9 @@ public class ItemSwordAA extends ItemSword implements IActAddItemOrBlock{ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); for(int id : idsStack){ - if(OreDictionary.getOreName(id).equals(repairItem)) return true; + if(OreDictionary.getOreName(id).equals(repairItem)){ + return true; + } } return false; } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java index 73eff7474..51f5fdc3a 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java @@ -46,6 +46,97 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler implements return new ItemStack(InitBlocks.blockCoffeeMachine); } + @Override + public int recipiesPerPage(){ + return 1; + } + + @Override + public void loadTransferRects(){ + transferRects.add(new RecipeTransferRect(new Rectangle(20, 39, 20, 16), NAME)); + transferRects.add(new RecipeTransferRect(new Rectangle(64, 42, 23, 10), NAME)); + } + + @Override + public Class getGuiClass(){ + return GuiCoffeeMachine.class; + } + + @Override + public String getRecipeName(){ + return StringUtil.localize("container.nei."+NAME+".name"); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results){ + if(outputId.equals(NAME) && getClass() == CoffeeMachineRecipeHandler.class){ + ArrayList ingredients = ItemCoffee.ingredients; + for(ItemCoffee.Ingredient ingredient : ingredients){ + arecipes.add(new CachedCoffee(ingredient)); + } + } + else{ + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result){ + ArrayList ingredients = ItemCoffee.ingredients; + for(ItemCoffee.Ingredient ingredient : ingredients){ + if(result.getItem() instanceof ItemCoffee){ + arecipes.add(new CachedCoffee(ingredient)); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient){ + + ArrayList ingredients = ItemCoffee.ingredients; + for(ItemCoffee.Ingredient ingr : ingredients){ + if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient.copy(), ingredient)){ + CachedCoffee theRecipe = new CachedCoffee(ingr); + theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredientStack), ingredient); + arecipes.add(theRecipe); + } + } + } + + @Override + public String getGuiTexture(){ + return ModUtil.MOD_ID_LOWER+":textures/gui/guiNEICoffeeMachine.png"; + } + + @Override + public void drawBackground(int recipeIndex){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 126, 88); + } + + @Override + public void drawExtras(int recipe){ + drawProgressBar(20, 39, 126, 0, 21, 16, 48, 0); + drawProgressBar(63, 42, 125, 16, 24, 12, 48, 2); + + CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe); + if(cache.extraText != null){ + GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + } + GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + + if(cache.maxAmp > 0){ + GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount")+": "+cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + } + } + + @Override + public String getOverlayIdentifier(){ + return NAME; + } + public class CachedCoffee extends CachedRecipe{ public PositionedStack cup; @@ -84,91 +175,4 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler implements return result; } } - - @Override - public int recipiesPerPage(){ - return 1; - } - - @Override - public void loadTransferRects(){ - transferRects.add(new RecipeTransferRect(new Rectangle(20, 39, 20, 16), NAME)); - transferRects.add(new RecipeTransferRect(new Rectangle(64, 42, 23, 10), NAME)); - } - - @Override - public Class getGuiClass(){ - return GuiCoffeeMachine.class; - } - - @Override - public String getRecipeName(){ - return StringUtil.localize("container.nei."+NAME+".name"); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results){ - if(outputId.equals(NAME) && getClass() == CoffeeMachineRecipeHandler.class){ - ArrayList ingredients = ItemCoffee.ingredients; - for(ItemCoffee.Ingredient ingredient : ingredients){ - arecipes.add(new CachedCoffee(ingredient)); - } - } - else super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack result){ - ArrayList ingredients = ItemCoffee.ingredients; - for(ItemCoffee.Ingredient ingredient : ingredients){ - if(result.getItem() instanceof ItemCoffee) arecipes.add(new CachedCoffee(ingredient)); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient){ - - ArrayList ingredients = ItemCoffee.ingredients; - for(ItemCoffee.Ingredient ingr : ingredients){ - if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient.copy(), ingredient)){ - CachedCoffee theRecipe = new CachedCoffee(ingr); - theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredientStack), ingredient); - arecipes.add(theRecipe); - } - } - } - - @Override - public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEICoffeeMachine.png"; - } - - @Override - public void drawBackground(int recipeIndex){ - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(getGuiTexture()); - GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 126, 88); - } - - @Override - public void drawExtras(int recipe){ - drawProgressBar(20, 39, 126, 0, 21, 16, 48, 0); - drawProgressBar(63, 42, 125, 16, 24, 12, 48, 2); - - CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe); - if(cache.extraText != null){ - GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special") + ":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - } - GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - - if(cache.maxAmp > 0){ - GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount") + ": " + cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - } - } - - @Override - public String getOverlayIdentifier(){ - return NAME; - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java index 771607a55..0bf6a50ff 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java @@ -42,28 +42,6 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR return new ItemStack(InitBlocks.blockCompost); } - public class CachedCompostRecipe extends CachedRecipe{ - - public PositionedStack result; - public PositionedStack input; - public int chance; - - public CachedCompostRecipe(ItemStack input, ItemStack result){ - this.result = new PositionedStack(result, 67+32, 19); - this.input = new PositionedStack(input, 5+32, 19); - } - - @Override - public PositionedStack getIngredient(){ - return input; - } - - @Override - public PositionedStack getResult(){ - return result; - } - } - @Override public int recipiesPerPage(){ return 2; @@ -89,12 +67,16 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR if(outputId.equals(NAME) && getClass() == CompostRecipeHandler.class){ arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()))); } - else super.loadCraftingRecipes(outputId, results); + else{ + super.loadCraftingRecipes(outputId, results); + } } @Override public void loadCraftingRecipes(ItemStack result){ - if(NEIServerUtils.areStacksSameType(new ItemStack(InitItems.itemFertilizer), result)) arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()))); + if(NEIServerUtils.areStacksSameType(new ItemStack(InitItems.itemFertilizer), result)){ + arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()))); + } } @Override @@ -108,7 +90,7 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png"; + return ModUtil.MOD_ID_LOWER+":textures/gui/guiNEISimple.png"; } @Override @@ -122,4 +104,26 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR public String getOverlayIdentifier(){ return NAME; } + + public class CachedCompostRecipe extends CachedRecipe{ + + public PositionedStack result; + public PositionedStack input; + public int chance; + + public CachedCompostRecipe(ItemStack input, ItemStack result){ + this.result = new PositionedStack(result, 67+32, 19); + this.input = new PositionedStack(input, 5+32, 19); + } + + @Override + public PositionedStack getIngredient(){ + return input; + } + + @Override + public PositionedStack getResult(){ + return result; + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java index 074647981..9f01d1807 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java @@ -31,84 +31,13 @@ import java.util.List; public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiRecipeHandler{ - @Override - public ItemStack getStackForInfo(){ - return new ItemStack(InitBlocks.blockGrinder); - } - - public static class CrusherDoubleRecipeHandler extends CrusherRecipeHandler{ - - @Override - public ItemStack getStackForInfo(){ - return new ItemStack(InitBlocks.blockGrinderDouble); - } - - @Override - public Class getGuiClass(){ - return GuiGrinder.GuiGrinderDouble.class; - } - - @Override - public void loadTransferRects(){ - transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getName())); - transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getName())); - } - - @Override - public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png"; - } - - @Override - public void drawBackground(int recipeIndex){ - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(getGuiTexture()); - GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70); - } - - @Override - public void drawExtras(int recipe){ - drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1); - this.drawChanceString(66, 93, recipe); - } - } - public CrusherRecipeHandler(){ RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } - public class CachedCrush extends CachedRecipe{ - - public PositionedStack ingredient; - public PositionedStack resultOne; - public PositionedStack resultTwo; - public int secondChance; - - public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance, CrusherRecipeHandler handler){ - boolean isDouble = handler instanceof CrusherDoubleRecipeHandler; - in.stackSize = 1; - this.ingredient = new PositionedStack(in, isDouble ? 51 : 80, 21); - this.resultOne = new PositionedStack(resultOne, isDouble ? 38 : 66, 69); - if(resultTwo != null) this.resultTwo = new PositionedStack(resultTwo, isDouble ? 63 : 94, 69); - this.secondChance = secondChance; - } - - @Override - public List getIngredients(){ - return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient)); - } - - @Override - public PositionedStack getResult(){ - return resultOne; - } - - @Override - public List getOtherStacks(){ - ArrayList list = new ArrayList(); - if(this.resultTwo != null) list.add(this.resultTwo); - return list; - } + @Override + public ItemStack getStackForInfo(){ + return new ItemStack(InitBlocks.blockGrinder); } @Override @@ -139,15 +68,18 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this)); } } - else super.loadCraftingRecipes(outputId, results); + else{ + super.loadCraftingRecipes(outputId, results); + } } @Override public void loadCraftingRecipes(ItemStack result){ ArrayList recipes = CrusherRecipeManualRegistry.recipes; for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){ - if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) + if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)){ arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this)); + } } } @@ -198,4 +130,79 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR GuiDraw.drawString(secondString, x, y, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); } } + + public static class CrusherDoubleRecipeHandler extends CrusherRecipeHandler{ + + @Override + public ItemStack getStackForInfo(){ + return new ItemStack(InitBlocks.blockGrinderDouble); + } + + @Override + public Class getGuiClass(){ + return GuiGrinder.GuiGrinderDouble.class; + } + + @Override + public void loadTransferRects(){ + transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getName())); + transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getName())); + } + + @Override + public String getGuiTexture(){ + return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png"; + } + + @Override + public void drawBackground(int recipeIndex){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70); + } + + @Override + public void drawExtras(int recipe){ + drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1); + this.drawChanceString(66, 93, recipe); + } + } + + public class CachedCrush extends CachedRecipe{ + + public PositionedStack ingredient; + public PositionedStack resultOne; + public PositionedStack resultTwo; + public int secondChance; + + public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance, CrusherRecipeHandler handler){ + boolean isDouble = handler instanceof CrusherDoubleRecipeHandler; + in.stackSize = 1; + this.ingredient = new PositionedStack(in, isDouble ? 51 : 80, 21); + this.resultOne = new PositionedStack(resultOne, isDouble ? 38 : 66, 69); + if(resultTwo != null){ + this.resultTwo = new PositionedStack(resultTwo, isDouble ? 63 : 94, 69); + } + this.secondChance = secondChance; + } + + @Override + public List getIngredients(){ + return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient)); + } + + @Override + public PositionedStack getResult(){ + return resultOne; + } + + @Override + public List getOtherStacks(){ + ArrayList list = new ArrayList(); + if(this.resultTwo != null){ + list.add(this.resultTwo); + } + return list; + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/FurnaceDoubleRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/FurnaceDoubleRecipeHandler.java index 3c1c276cd..91013df1b 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/FurnaceDoubleRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/FurnaceDoubleRecipeHandler.java @@ -42,28 +42,6 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements return new ItemStack(InitBlocks.blockFurnaceDouble); } - public class CachedFurn extends CachedRecipe{ - - public PositionedStack ingredient; - public PositionedStack resultOne; - - public CachedFurn(ItemStack in, ItemStack resultOne){ - in.stackSize = 1; - this.ingredient = new PositionedStack(in, 51, 21); - this.resultOne = new PositionedStack(resultOne, 50, 69); - } - - @Override - public List getIngredients(){ - return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient)); - } - - @Override - public PositionedStack getResult(){ - return resultOne; - } - } - @Override public Class getGuiClass(){ return GuiFurnaceDouble.class; @@ -111,7 +89,9 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue())); } } - else super.loadCraftingRecipes(outputId, results); + else{ + super.loadCraftingRecipes(outputId, results); + } } @SuppressWarnings("unchecked") @@ -119,8 +99,9 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements public void loadCraftingRecipes(ItemStack result){ Map recipes = (Map)FurnaceRecipes.smelting().getSmeltingList(); for(Map.Entry recipe : recipes.entrySet()){ - if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)) + if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)){ arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue())); + } } } @@ -141,4 +122,26 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements public String getOverlayIdentifier(){ return NAME; } + + public class CachedFurn extends CachedRecipe{ + + public PositionedStack ingredient; + public PositionedStack resultOne; + + public CachedFurn(ItemStack in, ItemStack resultOne){ + in.stackSize = 1; + this.ingredient = new PositionedStack(in, 51, 21); + this.resultOne = new PositionedStack(resultOne, 50, 69); + } + + @Override + public List getIngredients(){ + return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient)); + } + + @Override + public PositionedStack getResult(){ + return resultOne; + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java index 799c39bac..c8d2a93c0 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java @@ -41,29 +41,6 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler implements INe return null; } - public class CachedBallRecipe extends CachedRecipe{ - - public PositionedStack result; - public PositionedStack input; - public int chance; - - public CachedBallRecipe(ItemStack input, ItemStack result, int chance){ - this.result = new PositionedStack(result, 67+32, 19); - this.chance = chance; - this.input = new PositionedStack(input, 5+32, 19); - } - - @Override - public PositionedStack getIngredient(){ - return input; - } - - @Override - public PositionedStack getResult(){ - return result; - } - } - @Override public int recipiesPerPage(){ return 2; @@ -92,14 +69,18 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler implements INe arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight)); } } - else super.loadCraftingRecipes(outputId, results); + else{ + super.loadCraftingRecipes(outputId, results); + } } @Override public void loadCraftingRecipes(ItemStack result){ ArrayList recipes = HairyBallHandler.returns; for(HairyBallHandler.Return recipe : recipes){ - if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)) arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight)); + if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)){ + arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight)); + } } } @@ -117,7 +98,7 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler implements INe @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png"; + return ModUtil.MOD_ID_LOWER+":textures/gui/guiNEISimple.png"; } @Override @@ -132,7 +113,7 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler implements INe CachedBallRecipe recipe = (CachedBallRecipe)this.arecipes.get(rec); if(recipe.result != null){ int secondChance = recipe.chance; - String secondString = secondChance + "%"; + String secondString = secondChance+"%"; GuiDraw.drawString(secondString, 65+32, 45, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); } } @@ -141,4 +122,27 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler implements INe public String getOverlayIdentifier(){ return NAME; } + + public class CachedBallRecipe extends CachedRecipe{ + + public PositionedStack result; + public PositionedStack input; + public int chance; + + public CachedBallRecipe(ItemStack input, ItemStack result, int chance){ + this.result = new PositionedStack(result, 67+32, 19); + this.chance = chance; + this.input = new PositionedStack(input, 5+32, 19); + } + + @Override + public PositionedStack getIngredient(){ + return input; + } + + @Override + public PositionedStack getResult(){ + return result; + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java index 30ac0de67..8d71f0c30 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java @@ -66,7 +66,7 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{ @Override public String getName(){ - return ModUtil.MOD_ID + " NEI Plugin"; + return ModUtil.MOD_ID+" NEI Plugin"; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java index 8c59a59c4..08b1c7695 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java @@ -41,33 +41,6 @@ public class TreasureChestRecipeHandler extends TemplateRecipeHandler implements return new ItemStack(InitBlocks.blockTreasureChest); } - public class CachedTreasure extends CachedRecipe{ - - public PositionedStack result; - public PositionedStack input; - public int chance; - public int minAmount; - public int maxAmount; - - public CachedTreasure(ItemStack input, ItemStack result, int chance, int minAmount, int maxAmount){ - this.result = new PositionedStack(result, 67+32, 19); - this.chance = chance; - this.input = new PositionedStack(input, 5+32, 19); - this.minAmount = minAmount; - this.maxAmount = maxAmount; - } - - @Override - public PositionedStack getIngredient(){ - return input; - } - - @Override - public PositionedStack getResult(){ - return result; - } - } - @Override public int recipiesPerPage(){ return 2; @@ -96,14 +69,18 @@ public class TreasureChestRecipeHandler extends TemplateRecipeHandler implements arecipes.add(new CachedTreasure(recipe.input, recipe.returnItem, recipe.itemWeight, recipe.minAmount, recipe.maxAmount)); } } - else super.loadCraftingRecipes(outputId, results); + else{ + super.loadCraftingRecipes(outputId, results); + } } @Override public void loadCraftingRecipes(ItemStack result){ ArrayList recipes = TreasureChestHandler.returns; for(TreasureChestHandler.Return recipe : recipes){ - if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)) arecipes.add(new CachedTreasure(recipe.input, recipe.returnItem, recipe.itemWeight, recipe.minAmount, recipe.maxAmount)); + if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)){ + arecipes.add(new CachedTreasure(recipe.input, recipe.returnItem, recipe.itemWeight, recipe.minAmount, recipe.maxAmount)); + } } } @@ -121,7 +98,7 @@ public class TreasureChestRecipeHandler extends TemplateRecipeHandler implements @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png"; + return ModUtil.MOD_ID_LOWER+":textures/gui/guiNEISimple.png"; } @Override @@ -143,4 +120,31 @@ public class TreasureChestRecipeHandler extends TemplateRecipeHandler implements public String getOverlayIdentifier(){ return NAME; } + + public class CachedTreasure extends CachedRecipe{ + + public PositionedStack result; + public PositionedStack input; + public int chance; + public int minAmount; + public int maxAmount; + + public CachedTreasure(ItemStack input, ItemStack result, int chance, int minAmount, int maxAmount){ + this.result = new PositionedStack(result, 67+32, 19); + this.chance = chance; + this.input = new PositionedStack(input, 5+32, 19); + this.minAmount = minAmount; + this.maxAmount = maxAmount; + } + + @Override + public PositionedStack getIngredient(){ + return input; + } + + @Override + public PositionedStack getResult(){ + return result; + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/network/sync/PacketSyncerToClient.java b/src/main/java/ellpeck/actuallyadditions/network/sync/PacketSyncerToClient.java index 6b65dc554..2ef1add5d 100644 --- a/src/main/java/ellpeck/actuallyadditions/network/sync/PacketSyncerToClient.java +++ b/src/main/java/ellpeck/actuallyadditions/network/sync/PacketSyncerToClient.java @@ -41,13 +41,21 @@ public class PacketSyncerToClient implements IMessage{ this.values = values; } + public static void sendPacket(TileEntity tile){ + if(tile instanceof IPacketSyncerToClient){ + PacketHandler.theNetwork.sendToAllAround(new PacketSyncerToClient(tile, ((IPacketSyncerToClient)tile).getValues()), new NetworkRegistry.TargetPoint(tile.getWorldObj().provider.dimensionId, tile.xCoord, tile.yCoord, tile.zCoord, 128)); + } + } + @Override public void fromBytes(ByteBuf buf){ this.x = buf.readInt(); this.y = buf.readInt(); this.z = buf.readInt(); int length = buf.readInt(); - if(this.values == null) this.values = new int[length]; + if(this.values == null){ + this.values = new int[length]; + } for(int i = 0; i < length; i++){ this.values[i] = buf.readInt(); } @@ -77,10 +85,4 @@ public class PacketSyncerToClient implements IMessage{ return null; } } - - public static void sendPacket(TileEntity tile){ - if(tile instanceof IPacketSyncerToClient){ - PacketHandler.theNetwork.sendToAllAround(new PacketSyncerToClient(tile, ((IPacketSyncerToClient)tile).getValues()), new NetworkRegistry.TargetPoint(tile.getWorldObj().provider.dimensionId, tile.xCoord, tile.yCoord, tile.zCoord, 128)); - } - } } diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeAutoRegistry.java b/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeAutoRegistry.java index 235f21a34..eea95d46c 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeAutoRegistry.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeAutoRegistry.java @@ -19,26 +19,11 @@ public class CrusherRecipeAutoRegistry{ public static ArrayList searchCases = new ArrayList(); - public static class SearchCase{ - - public final String name; - public final int resultAmount; - public final String replacer; - - public SearchCase(String name, int resultAmount, String replacer){ - this.name = name; - this.resultAmount = resultAmount; - this.replacer = replacer; - } - - public SearchCase(String name, int resultAmount){ - this(name, resultAmount, "dust"); - } - } - private static boolean hasException(String name){ for(String except : ConfigValues.crusherRecipeExceptions){ - if(except.equals(name)) return true; + if(except.equals(name)){ + return true; + } } return false; } @@ -69,4 +54,21 @@ public class CrusherRecipeAutoRegistry{ } } } + + public static class SearchCase{ + + public final String name; + public final int resultAmount; + public final String replacer; + + public SearchCase(String name, int resultAmount, String replacer){ + this.name = name; + this.resultAmount = resultAmount; + this.replacer = replacer; + } + + public SearchCase(String name, int resultAmount){ + this(name, resultAmount, "dust"); + } + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/FuelHandler.java b/src/main/java/ellpeck/actuallyadditions/recipe/FuelHandler.java index 1735526e7..d1e6e478e 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/FuelHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/FuelHandler.java @@ -42,11 +42,6 @@ public class FuelHandler implements IFuelHandler{ setFuelValues(); } - @Override - public int getBurnTime(ItemStack fuel){ - return getFuelValue(fuel); - } - private static void addFuel(Item item, int metadata, int value){ fuelList.put(Pair.of(item, metadata), value); } @@ -71,4 +66,9 @@ public class FuelHandler implements IFuelHandler{ } return 0; } + + @Override + public int getBurnTime(ItemStack fuel){ + return getFuelValue(fuel); + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/tile/IPhantomTile.java b/src/main/java/ellpeck/actuallyadditions/tile/IPhantomTile.java index 3ae5f0ecf..fc9ba5fca 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/IPhantomTile.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/IPhantomTile.java @@ -29,6 +29,8 @@ public interface IPhantomTile{ */ WorldPos getBoundPosition(); + void setBoundPosition(WorldPos pos); + /** * @return The ID of the GUI it opens, -1 if none */ @@ -38,6 +40,4 @@ public interface IPhantomTile{ * @return The range the tile currently has */ int getRange(); - - void setBoundPosition(WorldPos pos); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 41552dffe..5b01f2c53 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -22,18 +22,6 @@ import net.minecraft.world.World; public class TileEntityBase extends TileEntity{ - @Override - public Packet getDescriptionPacket(){ - NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ - this.readFromNBT(pkt.func_148857_g()); - } - public static void init(){ ModUtil.LOGGER.info("Registering TileEntities..."); GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID_LOWER+":tileEntityCompost"); @@ -74,6 +62,18 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityLeafGenerator.class, ModUtil.MOD_ID_LOWER+":tileEntityLeafGenerator"); } + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + this.readFromNBT(pkt.func_148857_g()); + } + @Override public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){ return !(oldBlock.isAssociatedBlock(newBlock)); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java index eec1e8402..b6189353e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java @@ -22,17 +22,7 @@ import java.util.ArrayList; public class TileEntityBreaker extends TileEntityInventoryBase{ - public static class TileEntityPlacer extends TileEntityBreaker{ - - public TileEntityPlacer(){ - super(9, "placer"); - this.isPlacer = true; - } - - } - public boolean isPlacer; - private int currentTime; public TileEntityBreaker(int slots, String name){ @@ -113,4 +103,13 @@ public class TileEntityBreaker extends TileEntityInventoryBase{ return true; } + public static class TileEntityPlacer extends TileEntityBreaker{ + + public TileEntityPlacer(){ + super(9, "placer"); + this.isPlacer = true; + } + + } + } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java index b391125bc..97b8d5c4a 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java @@ -30,12 +30,10 @@ import net.minecraftforge.fluids.*; public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler, IPacketSyncerToClient{ public EnergyStorage storage = new EnergyStorage(40000); - private int lastEnergyStored; - public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME); - private int lastTankAmount; - public int currentProcessTime; + private int lastEnergyStored; + private int lastTankAmount; private int lastProcessTime; public TileEntityCanolaPress(){ @@ -54,7 +52,9 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE this.currentProcessTime = 0; this.slots[0].stackSize--; - if(this.slots[0].stackSize == 0) this.slots[0] = null; + if(this.slots[0].stackSize == 0){ + this.slots[0] = null; + } this.tank.fill(new FluidStack(InitBlocks.fluidCanolaOil, ConfigIntValues.PRESS_MB_PRODUCED.getValue()), true); this.markDirty(); @@ -163,7 +163,9 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ - if(resource.getFluid() == InitBlocks.fluidCanolaOil) return this.tank.drain(resource.amount, doDrain); + if(resource.getFluid() == InitBlocks.fluidCanolaOil){ + return this.tank.drain(resource.amount, doDrain); + } return null; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java index b6bf95203..595861283 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java @@ -26,11 +26,10 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider, IPacketSyncerToClient{ public EnergyStorage storage = new EnergyStorage(60000); - private int lastEnergy; - public int maxBurnTime; - private int lastBurnTime; public int currentBurnTime; + private int lastEnergy; + private int lastBurnTime; private int lastCurrentBurnTime; public TileEntityCoalGenerator(){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java index 37f151afb..07f98e55e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java @@ -35,19 +35,15 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public static final int SLOT_OUTPUT = 2; public static final int SLOT_WATER_INPUT = 11; public static final int SLOT_WATER_OUTPUT = 12; - - public EnergyStorage storage = new EnergyStorage(300000); - private int lastEnergy; - public FluidTank tank = new FluidTank(4*FluidContainerRegistry.BUCKET_VOLUME); - private int lastTank; - public final int waterUsedPerCoffee = 500; - public final int coffeeCacheMaxAmount = 300; + public EnergyStorage storage = new EnergyStorage(300000); + public FluidTank tank = new FluidTank(4*FluidContainerRegistry.BUCKET_VOLUME); public int coffeeCacheAmount; - private int lastCoffeeAmount; - public int brewTime; + private int lastEnergy; + private int lastTank; + private int lastCoffeeAmount; private int lastBrewTime; public TileEntityCoffeeMachine(){ @@ -77,7 +73,9 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if(this.slots[SLOT_COFFEE_BEANS] != null && this.slots[SLOT_COFFEE_BEANS].getItem() == InitItems.itemCoffeeBean){ if(ConfigIntValues.COFFEE_CACHE_ADDED_PER_ITEM.getValue() <= this.coffeeCacheMaxAmount-this.coffeeCacheAmount){ this.slots[SLOT_COFFEE_BEANS].stackSize--; - if(this.slots[SLOT_COFFEE_BEANS].stackSize <= 0) this.slots[SLOT_COFFEE_BEANS] = null; + if(this.slots[SLOT_COFFEE_BEANS].stackSize <= 0){ + this.slots[SLOT_COFFEE_BEANS] = null; + } this.coffeeCacheAmount += ConfigIntValues.COFFEE_CACHE_ADDED_PER_ITEM.getValue(); } } @@ -109,7 +107,9 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } this.slots[SLOT_OUTPUT] = output.copy(); this.slots[SLOT_INPUT].stackSize--; - if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null; + if(this.slots[SLOT_INPUT].stackSize <= 0){ + this.slots[SLOT_INPUT] = null; + } this.coffeeCacheAmount -= ConfigIntValues.COFFEE_CACHE_USED_PER_ITEM.getValue(); this.tank.drain(this.waterUsedPerCoffee, true); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java index daa22e557..568c41a90 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java @@ -64,7 +64,9 @@ public class TileEntityDropper extends TileEntityInventoryBase{ ItemStack slot = this.slots[i].copy(); if(actuallyDo){ this.slots[i].stackSize--; - if(this.slots[i].stackSize <= 0) this.slots[i] = null; + if(this.slots[i].stackSize <= 0){ + this.slots[i] = null; + } } return slot; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java index 9340d0581..d9986a675 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java @@ -42,7 +42,9 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) >= ((IEnergyContainerItem)this.slots[0].getItem()).getMaxEnergyStored(this.slots[0])){ this.slots[1] = this.slots[0].copy(); this.slots[0].stackSize--; - if(this.slots[0].stackSize <= 0) this.slots[0] = null; + if(this.slots[0].stackSize <= 0){ + this.slots[0] = null; + } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java index eacb044a6..e90cca98b 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java @@ -43,7 +43,9 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) <= 0){ this.slots[1] = this.slots[0].copy(); this.slots[0].stackSize--; - if(this.slots[0].stackSize <= 0) this.slots[0] = null; + if(this.slots[0].stackSize <= 0){ + this.slots[0] = null; + } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java index 3ee5610f9..73394ed36 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java @@ -26,11 +26,10 @@ import net.minecraftforge.fluids.*; public class TileEntityFermentingBarrel extends TileEntityInventoryBase implements IFluidHandler, IPacketSyncerToClient{ public FluidTank canolaTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME); - private int lastCanola; public FluidTank oilTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME); - private int lastOil; - public int currentProcessTime; + private int lastCanola; + private int lastOil; private int lastProcessTime; public TileEntityFermentingBarrel(){ @@ -135,7 +134,9 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ - if(resource.getFluid() == InitBlocks.fluidOil) return this.oilTank.drain(resource.amount, doDrain); + if(resource.getFluid() == InitBlocks.fluidOil){ + return this.oilTank.drain(resource.amount, doDrain); + } return null; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java index 0be923249..677838a82 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java @@ -27,7 +27,18 @@ import net.minecraftforge.fluids.*; public class TileEntityFluidCollector extends TileEntityInventoryBase implements IFluidHandler, IPacketSyncerToClient{ public FluidTank tank = new FluidTank(8*FluidContainerRegistry.BUCKET_VOLUME); + public boolean isPlacer; private int lastTankAmount; + private int currentTime; + + public TileEntityFluidCollector(int slots, String name){ + super(slots, name); + } + + public TileEntityFluidCollector(){ + super(2, "fluidCollector"); + this.isPlacer = false; + } @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ @@ -88,28 +99,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements PacketSyncerToClient.sendPacket(this); } - public static class TileEntityFluidPlacer extends TileEntityFluidCollector{ - - public TileEntityFluidPlacer(){ - super(2, "fluidPlacer"); - this.isPlacer = true; - } - - } - - public boolean isPlacer; - - private int currentTime; - - public TileEntityFluidCollector(int slots, String name){ - super(slots, name); - } - - public TileEntityFluidCollector(){ - super(2, "fluidCollector"); - this.isPlacer = false; - } - @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -228,4 +217,13 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements return slot == 1; } + public static class TileEntityFluidPlacer extends TileEntityFluidCollector{ + + public TileEntityFluidPlacer(){ + super(2, "fluidPlacer"); + this.isPlacer = true; + } + + } + } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 49189eb2a..9cbcca159 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -30,12 +30,10 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public static final int SLOT_OUTPUT_2 = 3; public EnergyStorage storage = new EnergyStorage(30000); - private int lastEnergy; - public int firstSmeltTime; - private int lastFirstSmelt; - public int secondSmeltTime; + private int lastEnergy; + private int lastFirstSmelt; private int lastSecondSmelt; public TileEntityFurnaceDouble(){ @@ -128,7 +126,9 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } this.slots[theInput].stackSize--; - if(this.slots[theInput].stackSize <= 0) this.slots[theInput] = null; + if(this.slots[theInput].stackSize <= 0){ + this.slots[theInput] = null; + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java index 003f20e5b..4d5b0082d 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java @@ -19,6 +19,8 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyProvider{ + public EnergyStorage storage = new EnergyStorage(30000); + @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){ return this.storage.extractEnergy(maxExtract, simulate); @@ -39,8 +41,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro return from != ForgeDirection.UP; } - public EnergyStorage storage = new EnergyStorage(30000); - @Override public void updateEntity(){ if(!worldObj.isRemote){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 0b48b51cd..e64a388e9 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -26,8 +26,26 @@ import java.util.Random; public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver, IPacketSyncerToClient{ + public static final int SLOT_INPUT_1 = 0; + public static final int SLOT_OUTPUT_1_1 = 1; + public static final int SLOT_OUTPUT_1_2 = 2; + public static final int SLOT_INPUT_2 = 3; + public static final int SLOT_OUTPUT_2_1 = 4; + public static final int SLOT_OUTPUT_2_2 = 5; public EnergyStorage storage = new EnergyStorage(60000); + public int firstCrushTime; + public int secondCrushTime; + public boolean isDouble; private int lastEnergy; + private int lastFirstCrush; + private int lastSecondCrush; + public TileEntityGrinder(int slots, String name){ + super(slots, name); + } + public TileEntityGrinder(){ + super(3, "grinder"); + this.isDouble = false; + } @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){ @@ -66,38 +84,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg PacketSyncerToClient.sendPacket(this); } - public static class TileEntityGrinderDouble extends TileEntityGrinder{ - - public TileEntityGrinderDouble(){ - super(6, "grinderDouble"); - this.isDouble = true; - } - - } - - public static final int SLOT_INPUT_1 = 0; - public static final int SLOT_OUTPUT_1_1 = 1; - public static final int SLOT_OUTPUT_1_2 = 2; - public static final int SLOT_INPUT_2 = 3; - public static final int SLOT_OUTPUT_2_1 = 4; - public static final int SLOT_OUTPUT_2_2 = 5; - - public int firstCrushTime; - private int lastFirstCrush; - public int secondCrushTime; - private int lastSecondCrush; - - public boolean isDouble; - - public TileEntityGrinder(int slots, String name){ - super(slots, name); - } - - public TileEntityGrinder(){ - super(3, "grinder"); - this.isDouble = false; - } - private int getMaxCrushTime(){ return this.isDouble ? ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue() : ConfigIntValues.GRINDER_CRUSH_TIME.getValue(); } @@ -114,7 +100,9 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); boolean canCrushOnSecond = false; - if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); + if(this.isDouble){ + canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); + } if(canCrushOnFirst){ if(this.storage.getEnergyStored() >= getEnergyUse()){ @@ -211,7 +199,9 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } this.slots[theInput].stackSize--; - if(this.slots[theInput].stackSize <= 0) this.slots[theInput] = null; + if(this.slots[theInput].stackSize <= 0){ + this.slots[theInput] = null; + } } @Override @@ -259,4 +249,13 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg public boolean canExtractItem(int slot, ItemStack stack, int side){ return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2; } + + public static class TileEntityGrinderDouble extends TileEntityGrinder{ + + public TileEntityGrinderDouble(){ + super(6, "grinderDouble"); + this.isDouble = true; + } + + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index 3f140d14e..c7bfb6c93 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -24,6 +24,40 @@ import net.minecraft.tileentity.TileEntity; public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor, IPacketSyncerToClient{ + public static final int PUT_FILTER_START = 13; + public static final int PULL_FILTER_START = 1; + public static final int WHITELIST_PULL_BUTTON_ID = 87; + public static final int WHITELIST_PUT_BUTTON_ID = 88; + public static final int OKAY_BUTTON_ID = 133; + public int sideToPut = -1; + public int slotToPutStart; + public int slotToPutEnd; + public TileEntity placeToPut; + public int sideToPull = -1; + public int slotToPullStart; + public int slotToPullEnd; + public TileEntity placeToPull; + public boolean isAdvanced; + public boolean isPullWhitelist = true; + public boolean isPutWhitelist = true; + private int lastPutSide; + private int lastPutStart; + private int lastPutEnd; + private int lastPullSide; + private int lastPullStart; + private int lastPullEnd; + private boolean lastPullWhite; + private boolean lastPutWhite; + + public TileEntityInputter(int slots, String name){ + super(slots, name); + } + + public TileEntityInputter(){ + super(1, "inputter"); + this.isAdvanced = false; + } + @Override public void onNumberReceived(int text, int textID, EntityPlayer player){ if(text != -1){ @@ -70,61 +104,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt PacketSyncerToClient.sendPacket(this); } - public static class TileEntityInputterAdvanced extends TileEntityInputter{ - - public TileEntityInputterAdvanced(){ - super(25, "inputterAdvanced"); - this.isAdvanced = true; - } - - } - - public static final int PUT_FILTER_START = 13; - public static final int PULL_FILTER_START = 1; - - public static final int WHITELIST_PULL_BUTTON_ID = 87; - public static final int WHITELIST_PUT_BUTTON_ID = 88; - public static final int OKAY_BUTTON_ID = 133; - - public int sideToPut = -1; - private int lastPutSide; - - public int slotToPutStart; - private int lastPutStart; - - public int slotToPutEnd; - private int lastPutEnd; - - public TileEntity placeToPut; - - public int sideToPull = -1; - private int lastPullSide; - - public int slotToPullStart; - private int lastPullStart; - - public int slotToPullEnd; - private int lastPullEnd; - - public TileEntity placeToPull; - - public boolean isAdvanced; - - public boolean isPullWhitelist = true; - private boolean lastPullWhite; - - public boolean isPutWhitelist = true; - private boolean lastPutWhite; - - public TileEntityInputter(int slots, String name){ - super(slots, name); - } - - public TileEntityInputter(){ - super(1, "inputter"); - this.isAdvanced = false; - } - @Override public void updateEntity(){ if(!worldObj.isRemote){ @@ -133,8 +112,12 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt //Is Block not powered by Redstone? if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ if(!(this.sideToPull == this.sideToPut && this.slotToPullStart == this.slotToPutStart && this.slotToPullEnd == this.slotToPutEnd)){ - if(sideToPull != -1 && this.placeToPull instanceof IInventory) this.pull(); - if(sideToPut != -1 && this.placeToPut instanceof IInventory) this.put(); + if(sideToPull != -1 && this.placeToPull instanceof IInventory){ + this.pull(); + } + if(sideToPut != -1 && this.placeToPut instanceof IInventory){ + this.put(); + } } } @@ -167,7 +150,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt int maxSize = theInventory.getInventoryStackLimit(); //If the Inventory is ISided, deal with that ISidedInventory theSided = null; - if(theInventory instanceof ISidedInventory) theSided = (ISidedInventory)theInventory; + if(theInventory instanceof ISidedInventory){ + theSided = (ISidedInventory)theInventory; + } //If can be pulled (for later) boolean can = false; @@ -208,7 +193,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } } //Stop if it can already pull - if(can) break; + if(can){ + break; + } } //If pull can be done if(can){ @@ -230,7 +217,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt //If ESD is empty else{ ItemStack toBePut = theStack.copy(); - if(maxSize < toBePut.stackSize) toBePut.stackSize = maxSize; + if(maxSize < toBePut.stackSize){ + toBePut.stackSize = maxSize; + } //Actually puts the Item this.setInventorySlotContents(0, toBePut); //Removes the Item from the inventory getting pulled from @@ -255,7 +244,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt int theSlotToPut = this.slotToPutStart; int maxSize = theInventory.getInventoryStackLimit(); ISidedInventory theSided = null; - if(theInventory instanceof ISidedInventory) theSided = (ISidedInventory)theInventory; + if(theInventory instanceof ISidedInventory){ + theSided = (ISidedInventory)theInventory; + } boolean can = false; if(this.slots[0] != null){ @@ -287,7 +278,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt can = true; } } - if(can) break; + if(can){ + break; + } } if(can){ if(theStack != null){ @@ -307,7 +300,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } else{ ItemStack toBePut = this.slots[0].copy(); - if(maxSize < toBePut.stackSize) toBePut.stackSize = maxSize; + if(maxSize < toBePut.stackSize){ + toBePut.stackSize = maxSize; + } theInventory.setInventorySlotContents(theSlotToPut, toBePut); if(this.slots[0].stackSize == toBePut.stackSize){ this.slots[0] = null; @@ -341,13 +336,17 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt * @return Is Item on White-/Blacklist? */ private boolean checkFilter(ItemStack stack, boolean isPull, boolean isWhitelist){ - if(!this.isAdvanced) return true; + if(!this.isAdvanced){ + return true; + } int slotStart = isPull ? PULL_FILTER_START : PUT_FILTER_START; int slotStop = slotStart+12; for(int i = slotStart; i < slotStop; i++){ - if(this.slots[i] != null && this.slots[i].isItemEqual(stack)) return isWhitelist; + if(this.slots[i] != null && this.slots[i].isItemEqual(stack)){ + return isWhitelist; + } } return !isWhitelist; } @@ -363,10 +362,14 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt //Resets the Variables if(this.placeToPull instanceof IInventory){ - if(this.slotToPullEnd <= 0) this.slotToPullEnd = ((IInventory)this.placeToPull).getSizeInventory(); + if(this.slotToPullEnd <= 0){ + this.slotToPullEnd = ((IInventory)this.placeToPull).getSizeInventory(); + } } if(this.placeToPut instanceof IInventory){ - if(this.slotToPutEnd <= 0) this.slotToPutEnd = ((IInventory)this.placeToPut).getSizeInventory(); + if(this.slotToPutEnd <= 0){ + this.slotToPutEnd = ((IInventory)this.placeToPut).getSizeInventory(); + } } } @@ -391,11 +394,19 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.slotToPullEnd = 0; } - if(buttonID == 0) this.sideToPut++; - if(buttonID == 1) this.sideToPut--; + if(buttonID == 0){ + this.sideToPut++; + } + if(buttonID == 1){ + this.sideToPut--; + } - if(buttonID == 2) this.sideToPull++; - if(buttonID == 3) this.sideToPull--; + if(buttonID == 2){ + this.sideToPull++; + } + if(buttonID == 3){ + this.sideToPull--; + } if(this.sideToPut >= 6){ this.sideToPut = -1; @@ -406,7 +417,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt else if(this.sideToPull >= 6){ this.sideToPull = -1; } - else if(this.sideToPull < -1) this.sideToPull = 5; + else if(this.sideToPull < -1){ + this.sideToPull = 5; + } this.markDirty(); } @@ -451,4 +464,13 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt public boolean canExtractItem(int slot, ItemStack stack, int side){ return slot == 0; } + + public static class TileEntityInputterAdvanced extends TileEntityInputter{ + + public TileEntityInputterAdvanced(){ + super(25, "inputterAdvanced"); + this.isAdvanced = true; + } + + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index cc646f63b..7d62f332e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -110,7 +110,9 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements } else{ stackAt = slots[i].splitStack(j); - if(slots[i].stackSize == 0) slots[i] = null; + if(slots[i].stackSize == 0){ + slots[i] = null; + } this.markDirty(); return stackAt; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java index 13f5fbe68..620b374d6 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java @@ -27,14 +27,17 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I public static final int SLOT_OUTPUT = 1; public EnergyStorage storage = new EnergyStorage(300000); - private int lastEnergy; - public int nextRepairTick; + private int lastEnergy; public TileEntityItemRepairer(){ super(2, "repairer"); } + public static boolean canBeRepaired(ItemStack stack){ + return stack != null && stack.getItem().isRepairable(); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -67,10 +70,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I } } - public static boolean canBeRepaired(ItemStack stack){ - return stack != null && stack.getItem().isRepairable(); - } - @Override public void writeToNBT(NBTTagCompound compound){ compound.setInteger("NextRepairTick", this.nextRepairTick); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java index 081e830b0..3f72e19d1 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java @@ -22,12 +22,13 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyReceiver{ - public EnergyStorage storage = new EnergyStorage(3000000); - - private int currentWorkTime; - + public static final int NOT_MULTI = 0; + public static final int HAS_LAVA = 1; + public static final int HAS_AIR = 2; //The Positions the Case Blocks should be in for the Factory to work private static final int[][] CASE_POSITIONS = {{-1, 1, 0}, {1, 1, 0}, {0, 1, -1}, {0, 1, 1}}; + public EnergyStorage storage = new EnergyStorage(3000000); + private int currentWorkTime; @Override @SuppressWarnings("unchecked") @@ -59,10 +60,6 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I return NOT_MULTI; } - public static final int NOT_MULTI = 0; - public static final int HAS_LAVA = 1; - public static final int HAS_AIR = 2; - @Override public void writeToNBT(NBTTagCompound compound){ this.storage.writeToNBT(compound); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java index e49c1640f..6486b122c 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java @@ -27,12 +27,10 @@ import net.minecraftforge.fluids.*; public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler, IPacketSyncerToClient{ public EnergyStorage storage = new EnergyStorage(50000); - private int lastEnergy; - public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME); - private int lastTank; - public int currentBurnTime; + private int lastEnergy; + private int lastTank; private int lastBurnTime; public TileEntityOilGenerator(){ @@ -158,7 +156,9 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ - if(resource.getFluid() == InitBlocks.fluidOil) return this.tank.fill(resource, doFill); + if(resource.getFluid() == InitBlocks.fluidOil){ + return this.tank.fill(resource, doFill); + } return 0; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java index a80c8d98d..e4f385800 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java @@ -40,9 +40,8 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne public static final int SLOT_UPGRADE = 2; public EnergyStorage storage = new EnergyStorage(2000000); - private int lastEnergy; - public FluidTank tank = new FluidTank(16*FluidContainerRegistry.BUCKET_VOLUME); + private int lastEnergy; private int lastTankAmount; private int currentWorkTimer; @@ -153,7 +152,9 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne private boolean hasException(String name){ for(String except : ConfigValues.oreMagnetExceptions){ - if(except.equals(name)) return true; + if(except.equals(name)){ + return true; + } } return false; } @@ -162,7 +163,9 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne String name = Block.blockRegistry.getNameForObject(block); if(name != null){ for(String list : ConfigValues.oreMagnetExtraWhitelist){ - if(list.equals(name)) return true; + if(list.equals(name)){ + return true; + } } } return false; @@ -231,7 +234,9 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ - if(this.canFill(from, resource.getFluid())) return this.tank.fill(resource, doFill); + if(this.canFill(from, resource.getFluid())){ + return this.tank.fill(resource, doFill); + } return 0; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java index 0f33e8c49..c036b3363 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java @@ -25,20 +25,9 @@ import java.util.ArrayList; public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile{ - public static class TileEntityPhantomBreaker extends TileEntityPhantomPlacer{ - - public TileEntityPhantomBreaker(){ - super(9, "phantomBreaker"); - this.isBreaker = true; - } - - } - public WorldPos boundPosition; - public int currentTime; public int range; - public boolean isBreaker; public TileEntityPhantomPlacer(int slots, String name){ @@ -133,6 +122,11 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements return this.boundPosition; } + @Override + public void setBoundPosition(WorldPos pos){ + this.boundPosition = pos == null ? null : pos.copy(); + } + @Override public int getGuiID(){ return GuiHandler.GuiTypes.PHANTOM_PLACER.ordinal(); @@ -143,11 +137,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements return this.range; } - @Override - public void setBoundPosition(WorldPos pos){ - this.boundPosition = pos == null ? null : pos.copy(); - } - @Override public void writeToNBT(NBTTagCompound compound){ super.writeToNBT(compound); @@ -187,4 +176,13 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements public boolean canExtractItem(int slot, ItemStack stack, int side){ return this.isBreaker; } + + public static class TileEntityPhantomBreaker extends TileEntityPhantomPlacer{ + + public TileEntityPhantomBreaker(){ + super(9, "phantomBreaker"); + this.isBreaker = true; + } + + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index 1a92ec384..523b2b8a2 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -149,6 +149,11 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return this.boundPosition; } + @Override + public void setBoundPosition(WorldPos pos){ + this.boundPosition = pos == null ? null : pos.copy(); + } + @Override public int getGuiID(){ return -1; @@ -159,11 +164,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return this.range; } - @Override - public void setBoundPosition(WorldPos pos){ - this.boundPosition = pos == null ? null : pos.copy(); - } - public static class TileEntityPhantomLiquiface extends TileEntityPhantomface implements IFluidHandler{ public TileEntityPhantomLiquiface(){ @@ -214,26 +214,34 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP public IFluidHandler getHandler(){ if(this.boundPosition != null && this.boundPosition.getWorld() != null){ TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IFluidHandler) return (IFluidHandler)tile; + if(tile instanceof IFluidHandler){ + return (IFluidHandler)tile; + } } return null; } @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ - if(this.isBoundThingInRange()) return this.getHandler().fill(from, resource, doFill); + if(this.isBoundThingInRange()){ + return this.getHandler().fill(from, resource, doFill); + } return 0; } @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ - if(this.isBoundThingInRange()) return this.getHandler().drain(from, resource, doDrain); + if(this.isBoundThingInRange()){ + return this.getHandler().drain(from, resource, doDrain); + } return null; } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){ - if(this.isBoundThingInRange()) return this.getHandler().drain(from, maxDrain, doDrain); + if(this.isBoundThingInRange()){ + return this.getHandler().drain(from, maxDrain, doDrain); + } return null; } @@ -249,7 +257,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public FluidTankInfo[] getTankInfo(ForgeDirection from){ - if(this.isBoundThingInRange()) return this.getHandler().getTankInfo(from); + if(this.isBoundThingInRange()){ + return this.getHandler().getTankInfo(from); + } return new FluidTankInfo[0]; } } @@ -296,7 +306,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP public IEnergyProvider getProvider(){ if(this.boundPosition != null && this.boundPosition.getWorld() != null){ TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IEnergyProvider) return (IEnergyProvider)tile; + if(tile instanceof IEnergyProvider){ + return (IEnergyProvider)tile; + } } return null; } @@ -304,7 +316,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP public IEnergyReceiver getReceiver(){ if(this.boundPosition != null && this.boundPosition.getWorld() != null){ TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IEnergyReceiver) return (IEnergyReceiver)tile; + if(tile instanceof IEnergyReceiver){ + return (IEnergyReceiver)tile; + } } return null; } @@ -322,8 +336,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public int getEnergyStored(ForgeDirection from){ if(this.isBoundThingInRange()){ - if(this.getProvider() != null) return this.getProvider().getEnergyStored(from); - if(this.getReceiver() != null) return this.getReceiver().getEnergyStored(from); + if(this.getProvider() != null){ + return this.getProvider().getEnergyStored(from); + } + if(this.getReceiver() != null){ + return this.getReceiver().getEnergyStored(from); + } } return 0; } @@ -331,8 +349,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public int getMaxEnergyStored(ForgeDirection from){ if(this.isBoundThingInRange()){ - if(this.getProvider() != null) return this.getProvider().getMaxEnergyStored(from); - if(this.getReceiver() != null) return this.getReceiver().getMaxEnergyStored(from); + if(this.getProvider() != null){ + return this.getProvider().getMaxEnergyStored(from); + } + if(this.getReceiver() != null){ + return this.getReceiver().getMaxEnergyStored(from); + } } return 0; } @@ -340,8 +362,12 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public boolean canConnectEnergy(ForgeDirection from){ if(this.isBoundThingInRange()){ - if(this.getProvider() != null) return this.getProvider().canConnectEnergy(from); - if(this.getReceiver() != null) return this.getReceiver().canConnectEnergy(from); + if(this.getProvider() != null){ + return this.getProvider().canConnectEnergy(from); + } + if(this.getReceiver() != null){ + return this.getReceiver().canConnectEnergy(from); + } } return false; } @@ -357,7 +383,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP public IInventory getInventory(){ if(this.boundPosition != null && this.boundPosition.getWorld() != null){ TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IInventory) return (IInventory)tile; + if(tile instanceof IInventory){ + return (IInventory)tile; + } } return null; } @@ -388,7 +416,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public void setInventorySlotContents(int i, ItemStack stack){ - if(this.isBoundThingInRange()) this.getInventory().setInventorySlotContents(i, stack); + if(this.isBoundThingInRange()){ + this.getInventory().setInventorySlotContents(i, stack); + } this.markDirty(); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java index 1788fc185..cb112a089 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java @@ -23,12 +23,11 @@ import java.util.Objects; public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSyncerToClient, IStringReactor{ public String name; - private String nameBefore; - @SideOnly(Side.CLIENT) public double lastFlyHeight; @SideOnly(Side.CLIENT) public int flyHeight; + private String nameBefore; @Override public void updateEntity(){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java index 2ede19055..745fb061d 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java @@ -25,6 +25,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I public short amount; private short lastAmount; + private int[] buttonAmounts = new int[]{1, 5, 10, 20, 30, 40, 50, 64, -999}; public TileEntityXPSolidifier(){ super(1, "xpSolidifier"); @@ -81,8 +82,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I return true; } - private int[] buttonAmounts = new int[]{1, 5, 10, 20, 30, 40, 50, 64, -999}; - @Override public void onButtonPressed(int buttonID, EntityPlayer player){ if(buttonID < this.buttonAmounts.length){ @@ -90,7 +89,9 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I int xp = this.buttonAmounts[buttonID] == -999 ? this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT : this.buttonAmounts[buttonID]; if(this.amount < Short.MAX_VALUE-xp && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*xp){ this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*xp)); - if(!worldObj.isRemote) this.amount += xp; + if(!worldObj.isRemote){ + this.amount += xp; + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java b/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java index f5edc25e5..7682d495f 100644 --- a/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java +++ b/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java @@ -16,6 +16,7 @@ import ellpeck.actuallyadditions.util.Util; public class UpdateChecker{ + public static final String DOWNLOAD_LINK = "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files"; public static boolean doneChecking = false; public static boolean checkFailed = false; public static String updateVersionS; @@ -23,8 +24,6 @@ public class UpdateChecker{ public static int clientVersion; public static String changelog; - public static final String DOWNLOAD_LINK = "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files"; - public void init(){ if(ConfigBoolValues.DO_UPDATE_CHECK.isEnabled()){ ModUtil.LOGGER.info("Initializing Update Checker..."); diff --git a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java index 204e705b7..d78aa5123 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java @@ -25,6 +25,7 @@ import net.minecraft.util.ResourceLocation; public class AssetUtil{ + public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory"); public static int COMPOST_RENDER_ID; public static int FISHING_NET_RENDER_ID; public static int FURNACE_SOLAR_RENDER_ID; @@ -33,8 +34,6 @@ public class AssetUtil{ public static int SMILEY_CLOUD_RENDER_ID; public static int TOOL_TABLE_RENDER_ID; - public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory"); - public static ResourceLocation getGuiLocation(String file){ return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/"+file+".png"); } diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index 2899a06ec..ad2bb9a7a 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -37,8 +37,21 @@ import java.util.ArrayList; public class WorldUtil{ + /** + * Vertical Directions in Order: + * Up, Down + */ + public static final ForgeDirection[] VERTICAL_DIRECTIONS_ORDER = new ForgeDirection[]{ForgeDirection.UP, ForgeDirection.DOWN}; + /** + * Cardinal Directions in Order: + * North, East, South, West + */ + public static final ForgeDirection[] CARDINAL_DIRECTIONS_ORDER = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.WEST}; + public static WorldPos getCoordsFromSide(ForgeDirection side, World world, int x, int y, int z){ - if(side == ForgeDirection.UNKNOWN) return null; + if(side == ForgeDirection.UNKNOWN){ + return null; + } return new WorldPos(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ); } @@ -178,7 +191,9 @@ public class WorldUtil{ if(slots[outputSlot] != null){ tank.drain(cap, true); slots[inputSlot].stackSize--; - if(slots[inputSlot].stackSize <= 0) slots[inputSlot] = null; + if(slots[inputSlot].stackSize <= 0){ + slots[inputSlot] = null; + } } } } @@ -202,23 +217,14 @@ public class WorldUtil{ tank.fill(FluidContainerRegistry.getFluidForFilledItem(slots[inputSlot]), true); slots[inputSlot].stackSize--; - if(slots[inputSlot].stackSize <= 0) slots[inputSlot] = null; + if(slots[inputSlot].stackSize <= 0){ + slots[inputSlot] = null; + } } } } } - /** - * Vertical Directions in Order: - * Up, Down - */ - public static final ForgeDirection[] VERTICAL_DIRECTIONS_ORDER = new ForgeDirection[]{ForgeDirection.UP, ForgeDirection.DOWN}; - /** - * Cardinal Directions in Order: - * North, East, South, West - */ - public static final ForgeDirection[] CARDINAL_DIRECTIONS_ORDER = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.WEST}; - public static ForgeDirection getDirectionBySidesInOrder(int side){ if(side >= 0 && side < VERTICAL_DIRECTIONS_ORDER.length+CARDINAL_DIRECTIONS_ORDER.length){ if(side < VERTICAL_DIRECTIONS_ORDER.length){ diff --git a/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistentServerData.java b/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistentServerData.java index 487c2baae..fa93b353a 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistentServerData.java +++ b/src/main/java/ellpeck/actuallyadditions/util/playerdata/PersistentServerData.java @@ -22,6 +22,14 @@ public class PersistentServerData implements IExtendedEntityProperties{ public boolean bookGottenAlready; + public static PersistentServerData get(EntityPlayer player){ + IExtendedEntityProperties properties = player.getExtendedProperties(ModUtil.MOD_ID); + if(properties != null && properties instanceof PersistentServerData){ + return (PersistentServerData)properties; + } + return null; + } + @Override public void saveNBTData(NBTTagCompound aComp){ NBTTagCompound compound = new NBTTagCompound(); @@ -45,12 +53,4 @@ public class PersistentServerData implements IExtendedEntityProperties{ public void init(Entity entity, World world){ } - - public static PersistentServerData get(EntityPlayer player){ - IExtendedEntityProperties properties = player.getExtendedProperties(ModUtil.MOD_ID); - if(properties != null && properties instanceof PersistentServerData){ - return (PersistentServerData)properties; - } - return null; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java b/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java index 75b6217d0..5e4304fd1 100644 --- a/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java +++ b/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java @@ -26,6 +26,10 @@ import java.util.List; @SuppressWarnings("unused") public class WailaDataProvider implements IWailaDataProvider{ + public static void register(IWailaRegistrar registrar){ + ModUtil.LOGGER.info("Initializing Waila Plugin..."); + } + @Override public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){ return null; @@ -50,8 +54,4 @@ public class WailaDataProvider implements IWailaDataProvider{ public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z){ return tag; } - - public static void register(IWailaRegistrar registrar){ - ModUtil.LOGGER.info("Initializing Waila Plugin..."); - } }