From a5dfbc426cbf96ea166fa4f5f03a1ae88bb3df54 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 3 Dec 2015 20:15:07 +0100 Subject: [PATCH] Changed the way block naming is handled code-wise. Didn't change anything to the game. --- .../achievement/TheAchievements.java | 2 +- .../blocks/BlockAtomicReconstructor.java | 25 +- .../blocks/BlockBlackLotus.java | 25 +- .../blocks/BlockBookletStand.java | 13 +- .../blocks/BlockBreaker.java | 19 +- .../blocks/BlockCanolaPress.java | 17 +- .../blocks/BlockCoalGenerator.java | 19 +- .../blocks/BlockCoffeeMachine.java | 13 +- .../blocks/BlockColoredLamp.java | 33 +-- .../blocks/BlockCompost.java | 13 +- .../blocks/BlockCrystal.java | 33 +-- .../blocks/BlockDirectionalBreaker.java | 19 +- .../blocks/BlockDropper.java | 19 +- .../blocks/BlockEnergizer.java | 19 +- .../actuallyadditions/blocks/BlockFeeder.java | 17 +- .../blocks/BlockFermentingBarrel.java | 17 +- .../blocks/BlockFishingNet.java | 13 +- .../blocks/BlockFluidCollector.java | 19 +- .../blocks/BlockFurnaceDouble.java | 21 +- .../blocks/BlockFurnaceSolar.java | 13 +- .../blocks/BlockGeneric.java | 17 +- .../blocks/BlockGiantChest.java | 19 +- .../blocks/BlockGreenhouseGlass.java | 15 +- .../blocks/BlockGrinder.java | 15 +- .../blocks/BlockHeatCollector.java | 19 +- .../blocks/BlockInputter.java | 28 +-- .../blocks/BlockItemRepairer.java | 19 +- .../blocks/BlockLampPowerer.java | 17 +- .../blocks/BlockLaserRelay.java | 13 +- .../blocks/BlockLavaFactoryController.java | 17 +- .../blocks/BlockLeafGenerator.java | 19 +- .../actuallyadditions/blocks/BlockMisc.java | 31 +-- .../blocks/BlockOilGenerator.java | 19 +- .../blocks/BlockPhantom.java | 26 +-- .../blocks/BlockPhantomBooster.java | 13 +- .../blocks/BlockRangedCollector.java | 15 +- .../actuallyadditions/blocks/BlockSlabs.java | 29 +-- .../blocks/BlockSmileyCloud.java | 13 +- .../blocks/BlockTreasureChest.java | 22 +- .../blocks/BlockWildPlant.java | 30 +-- .../blocks/BlockXPSolidifier.java | 19 +- .../actuallyadditions/blocks/InitBlocks.java | 213 +++++------------- .../blocks/base/BlockBase.java | 55 +++++ .../blocks/base/BlockBushBase.java | 54 +++++ .../blocks/{ => base}/BlockContainerBase.java | 39 +++- .../blocks/{ => base}/BlockFluidFlowing.java | 40 +++- .../blocks/{ => base}/BlockPlant.java | 45 ++-- .../blocks/{ => base}/BlockStair.java | 31 ++- .../blocks/{ => base}/BlockWallAA.java | 44 ++-- .../blocks/base/ItemBlockBase.java | 64 ++++++ .../booklet/BookletUtils.java | 2 +- .../booklet/InitBooklet.java | 4 +- .../crafting/BlockCrafting.java | 2 +- .../crafting/ItemCrafting.java | 2 +- .../creative/CreativeTab.java | 4 +- .../event/PlayerObtainEvents.java | 27 ++- .../items/InitForeignPaxels.java | 5 +- .../actuallyadditions/items/InitItems.java | 148 +++--------- .../actuallyadditions/items/ItemBattery.java | 13 +- .../items/ItemBlockBase.java | 42 ---- .../actuallyadditions/items/ItemBooklet.java | 17 +- .../items/ItemChestToCrateUpgrade.java | 16 +- .../actuallyadditions/items/ItemCoffee.java | 20 +- .../items/ItemCoffeeBean.java | 16 +- .../items/ItemCrafterOnAStick.java | 15 +- .../actuallyadditions/items/ItemCrystal.java | 14 +- .../actuallyadditions/items/ItemDrill.java | 12 +- .../items/ItemDrillUpgrade.java | 15 +- .../actuallyadditions/items/ItemDust.java | 14 +- .../items/ItemFertilizer.java | 16 +- .../actuallyadditions/items/ItemFoods.java | 20 +- .../items/ItemGrowthRing.java | 12 +- .../items/ItemHairyBall.java | 20 +- .../actuallyadditions/items/ItemJams.java | 18 +- .../actuallyadditions/items/ItemKnife.java | 15 +- .../items/ItemLaserWrench.java | 15 +- .../items/ItemLeafBlower.java | 15 +- .../actuallyadditions/items/ItemLens.java | 15 +- .../items/ItemMagnetRing.java | 12 +- .../actuallyadditions/items/ItemMisc.java | 14 +- .../items/ItemPhantomConnector.java | 15 +- .../items/ItemPotionRing.java | 14 +- .../items/ItemResonantRice.java | 16 +- .../actuallyadditions/items/ItemSeed.java | 24 +- .../items/ItemSpecialDrop.java | 14 +- .../items/ItemTeleStaff.java | 12 +- .../items/ItemWaterRemovalRing.java | 12 +- .../items/ItemWingsOfTheBats.java | 15 +- .../items/{tools => base}/ItemAllToolAA.java | 31 ++- .../items/{ => base}/ItemArmorAA.java | 32 ++- .../items/{tools => base}/ItemAxeAA.java | 37 ++- .../items/base/ItemBase.java | 44 ++++ .../items/{ => base}/ItemBucketAA.java | 32 ++- .../items/{ => base}/ItemEnergy.java | 31 ++- .../items/base/ItemFoodBase.java | 45 ++++ .../items/{tools => base}/ItemHoeAA.java | 46 ++-- .../items/{tools => base}/ItemPickaxeAA.java | 37 ++- .../items/{tools => base}/ItemShovelAA.java | 46 ++-- .../items/{tools => base}/ItemSwordAA.java | 48 ++-- .../nei/NEICrusherRecipe.java | 14 +- .../actuallyadditions/util/BlockUtil.java | 34 --- .../util/IActAddItemOrBlock.java | 25 -- .../actuallyadditions/util/ItemUtil.java | 30 --- .../ellpeck/actuallyadditions/util/Util.java | 4 + 104 files changed, 1199 insertions(+), 1388 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBase.java create mode 100644 src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBushBase.java rename src/main/java/ellpeck/actuallyadditions/blocks/{ => base}/BlockContainerBase.java (77%) rename src/main/java/ellpeck/actuallyadditions/blocks/{ => base}/BlockFluidFlowing.java (73%) rename src/main/java/ellpeck/actuallyadditions/blocks/{ => base}/BlockPlant.java (79%) rename src/main/java/ellpeck/actuallyadditions/blocks/{ => base}/BlockStair.java (51%) rename src/main/java/ellpeck/actuallyadditions/blocks/{ => base}/BlockWallAA.java (65%) create mode 100644 src/main/java/ellpeck/actuallyadditions/blocks/base/ItemBlockBase.java delete mode 100644 src/main/java/ellpeck/actuallyadditions/items/ItemBlockBase.java rename src/main/java/ellpeck/actuallyadditions/items/{tools => base}/ItemAllToolAA.java (91%) rename src/main/java/ellpeck/actuallyadditions/items/{ => base}/ItemArmorAA.java (78%) rename src/main/java/ellpeck/actuallyadditions/items/{tools => base}/ItemAxeAA.java (71%) create mode 100644 src/main/java/ellpeck/actuallyadditions/items/base/ItemBase.java rename src/main/java/ellpeck/actuallyadditions/items/{ => base}/ItemBucketAA.java (68%) rename src/main/java/ellpeck/actuallyadditions/items/{ => base}/ItemEnergy.java (75%) create mode 100644 src/main/java/ellpeck/actuallyadditions/items/base/ItemFoodBase.java rename src/main/java/ellpeck/actuallyadditions/items/{tools => base}/ItemHoeAA.java (66%) rename src/main/java/ellpeck/actuallyadditions/items/{tools => base}/ItemPickaxeAA.java (71%) rename src/main/java/ellpeck/actuallyadditions/items/{tools => base}/ItemShovelAA.java (66%) rename src/main/java/ellpeck/actuallyadditions/items/{tools => base}/ItemSwordAA.java (67%) delete mode 100644 src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java delete mode 100644 src/main/java/ellpeck/actuallyadditions/util/IActAddItemOrBlock.java diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java index 0c9e2f248..289d7bb74 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java @@ -18,7 +18,7 @@ import net.minecraft.stats.Achievement; public enum TheAchievements{ - OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemLexicon), null, InitAchievements.MISC_ACH), + OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, InitAchievements.MISC_ACH), NAME_SMILEY_CLOUD("nameSmileyCloud", 2, 0, new ItemStack(InitBlocks.blockSmileyCloud), OPEN_BOOKLET.ach, InitAchievements.MISC_ACH), CRAFT_PHANTOMFACE("craftPhantomface", -2, 0, new ItemStack(InitBlocks.blockPhantomface), OPEN_BOOKLET.ach), OPEN_TREASURE_CHEST("openTreasureChest", 0, -2, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET.ach, InitAchievements.MISC_ACH); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockAtomicReconstructor.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockAtomicReconstructor.java index 3e402045c..9b520a1bf 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockAtomicReconstructor.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.items.IReconstructorLens; import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -22,7 +22,6 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; @@ -30,15 +29,15 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockAtomicReconstructor extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockAtomicReconstructor extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon frontIcon; @SideOnly(Side.CLIENT) private IIcon topIcon; - public BlockAtomicReconstructor(){ - super(Material.rock); + public BlockAtomicReconstructor(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(10F); this.setResistance(80F); @@ -114,19 +113,9 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IAct @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockAtomicReconstructor"; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.epic; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBlackLotus.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBlackLotus.java index 9493a4d82..e633879fe 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBlackLotus.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBlackLotus.java @@ -1,5 +1,5 @@ /* - * This file ("BlockFlower.java") is part of the Actually Additions Mod for Minecraft. + * This file ("BlockBlackLotus.java") is part of the Actually Additions Mod for Minecraft. * It is created and owned by Ellpeck and distributed * under the Actually Additions License to be found at * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md @@ -12,18 +12,15 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.blocks.base.BlockBushBase; import ellpeck.actuallyadditions.util.ModUtil; -import net.minecraft.block.BlockBush; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class BlockBlackLotus extends BlockBush implements IActAddItemOrBlock{ +public class BlockBlackLotus extends BlockBushBase{ - public BlockBlackLotus(){ - this.setStepSound(soundTypeGrass); + public BlockBlackLotus(String name){ + super(name); } @Override @@ -35,16 +32,6 @@ public class BlockBlackLotus extends BlockBush implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "blockBlackLotus"; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.epic; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java index d0e916d2b..d5696c4c0 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityBookletStand; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -29,10 +29,10 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockBookletStand extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockBookletStand extends BlockContainerBase{ - public BlockBookletStand(){ - super(Material.wood); + public BlockBookletStand(String name){ + super(Material.wood, name); this.setHarvestLevel("axe", 0); this.setHardness(1.0F); this.setResistance(4.0F); @@ -103,11 +103,6 @@ public class BlockBookletStand extends BlockContainerBase implements IActAddItem this.blockIcon = Blocks.planks.getIcon(0, 0); } - @Override - public String getName(){ - return "blockBookStand"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.rare; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java index 482363b35..6591b7248 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityBreaker; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -30,7 +30,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockBreaker extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockBreaker extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon frontIcon; @@ -39,8 +39,8 @@ public class BlockBreaker extends BlockContainerBase implements IActAddItemOrBlo private boolean isPlacer; - public BlockBreaker(boolean isPlacer){ - super(Material.rock); + public BlockBreaker(boolean isPlacer, String name){ + super(Material.rock, name); this.isPlacer = isPlacer; this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); @@ -99,14 +99,9 @@ public class BlockBreaker extends BlockContainerBase implements IActAddItemOrBlo @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return this.isPlacer ? "blockPlacer" : "blockBreaker"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java index 63067a077..8dbace51b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityCanolaPress; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -27,13 +27,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockCanolaPress extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockCanolaPress extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; - public BlockCanolaPress(){ - super(Material.rock); + public BlockCanolaPress(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -66,13 +66,8 @@ public class BlockCanolaPress extends BlockContainerBase implements IActAddItemO @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockCanolaPress"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java index 1dc7fe1e3..2b96a1a35 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.proxy.ClientProxy; import ellpeck.actuallyadditions.tile.TileEntityCoalGenerator; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -30,15 +30,15 @@ import net.minecraft.world.World; import java.util.Random; -public class BlockCoalGenerator extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockCoalGenerator extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockCoalGenerator(){ - super(Material.rock); + public BlockCoalGenerator(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -84,14 +84,9 @@ public class BlockCoalGenerator extends BlockContainerBase implements IActAddIte @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); - } - - @Override - public String getName(){ - return "blockCoalGenerator"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java index 72d00862e..1335e582b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityCoffeeMachine; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -30,10 +30,10 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockCoffeeMachine extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockCoffeeMachine extends BlockContainerBase{ - public BlockCoffeeMachine(){ - super(Material.rock); + public BlockCoffeeMachine(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -111,11 +111,6 @@ public class BlockCoffeeMachine extends BlockContainerBase implements IActAddIte super.breakBlock(world, x, y, z, block, par6); } - @Override - public String getName(){ - return "blockCoffeeMachine"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java index 5d0fb0979..a8ef4e3df 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockColoredLamp.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockBase; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors; -import ellpeck.actuallyadditions.items.ItemBlockBase; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.block.Block; @@ -33,26 +33,21 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.List; import java.util.Random; -public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ +public class BlockColoredLamp extends BlockBase{ public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values(); public boolean isOn; @SideOnly(Side.CLIENT) private IIcon[] textures; - public BlockColoredLamp(boolean isOn){ - super(Material.redstoneLight); + public BlockColoredLamp(boolean isOn, String name){ + super(Material.redstoneLight, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(0.5F); this.setResistance(3.0F); this.isOn = isOn; } - @Override - public String getName(){ - return this.isOn ? "blockColoredLampOn" : "blockColoredLamp"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.rare; @@ -131,7 +126,7 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ public void registerBlockIcons(IIconRegister iconReg){ this.textures = new IIcon[allLampTypes.length]; for(int i = 0; i < allLampTypes.length; i++){ - this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+((IActAddItemOrBlock)InitBlocks.blockColoredLamp).getName()+allLampTypes[i].name+(isOn ? "On" : "")); + this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allLampTypes[i].name+(isOn ? "On" : "")); } } @@ -140,6 +135,11 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ return this.isOn ? 15 : 0; } + @Override + public Class getItemBlock(){ + return TheItemBlock.class; + } + public static class TheItemBlock extends ItemBlockBase{ public TheItemBlock(Block block){ @@ -160,16 +160,5 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ public String getUnlocalizedName(ItemStack stack){ return InitBlocks.blockColoredLamp.getUnlocalizedName()+allLampTypes[stack.getItemDamage()].name; } - - @Override - public int getMetadata(int damage){ - return damage; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java index a1f96caa5..280fb2bb1 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCompost.java @@ -12,12 +12,12 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.items.ItemFertilizer; import ellpeck.actuallyadditions.items.ItemMisc; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -33,10 +33,10 @@ import net.minecraft.world.World; import java.util.List; -public class BlockCompost extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockCompost extends BlockContainerBase{ - public BlockCompost(){ - super(Material.wood); + public BlockCompost(String name){ + super(Material.wood, name); this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(5.0F); @@ -137,11 +137,6 @@ public class BlockCompost extends BlockContainerBase implements IActAddItemOrBlo super.breakBlock(world, x, y, z, block, par6); } - @Override - public String getName(){ - return "blockCompost"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.uncommon; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCrystal.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCrystal.java index c2f4a254f..b3de2cee9 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCrystal.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCrystal.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.items.ItemBlockBase; +import ellpeck.actuallyadditions.blocks.base.BlockBase; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; import ellpeck.actuallyadditions.items.metalists.TheCrystals; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.block.Block; @@ -29,12 +29,12 @@ import net.minecraft.world.IBlockAccess; import java.util.List; -public class BlockCrystal extends Block implements IActAddItemOrBlock{ +public class BlockCrystal extends BlockBase{ public static final TheCrystals[] allCrystals = TheCrystals.values(); - public BlockCrystal(){ - super(Material.rock); + public BlockCrystal(String name){ + super(Material.rock, name); this.setHardness(1.5F); this.setResistance(10.0F); this.setHarvestLevel("pickaxe", 1); @@ -74,12 +74,7 @@ public class BlockCrystal extends Block implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "blockCrystal"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -87,6 +82,11 @@ public class BlockCrystal extends Block implements IActAddItemOrBlock{ return stack.getItemDamage() >= allCrystals.length ? EnumRarity.common : allCrystals[stack.getItemDamage()].rarity; } + @Override + public Class getItemBlock(){ + return TheItemBlock.class; + } + public static class TheItemBlock extends ItemBlockBase{ public TheItemBlock(Block block){ @@ -99,16 +99,5 @@ public class BlockCrystal extends Block implements IActAddItemOrBlock{ public String getUnlocalizedName(ItemStack stack){ return stack.getItemDamage() >= allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allCrystals[stack.getItemDamage()].name; } - - @Override - public int getMetadata(int damage){ - return damage; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDirectionalBreaker.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDirectionalBreaker.java index 2af149383..3270fc86f 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDirectionalBreaker.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityDirectionalBreaker; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -30,15 +30,15 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockDirectionalBreaker extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockDirectionalBreaker extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon frontIcon; @SideOnly(Side.CLIENT) private IIcon topIcon; - public BlockDirectionalBreaker(){ - super(Material.rock); + public BlockDirectionalBreaker(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -96,14 +96,9 @@ public class BlockDirectionalBreaker extends BlockContainerBase implements IActA @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockDirectionalBreaker"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java index 1a5a14c6e..bd4927c55 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityDropper; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -30,15 +30,15 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockDropper extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockDropper extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon frontIcon; @SideOnly(Side.CLIENT) private IIcon topIcon; - public BlockDropper(){ - super(Material.rock); + public BlockDropper(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -96,14 +96,9 @@ public class BlockDropper extends BlockContainerBase implements IActAddItemOrBlo @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockDropper"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java index 9152cf5da..8274471da 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityEnergizer; import ellpeck.actuallyadditions.tile.TileEntityEnervator; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -28,7 +28,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockEnergizer extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockEnergizer extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @@ -36,8 +36,8 @@ public class BlockEnergizer extends BlockContainerBase implements IActAddItemOrB private IIcon sideIcon; private boolean isEnergizer; - public BlockEnergizer(boolean isEnergizer){ - super(Material.rock); + public BlockEnergizer(boolean isEnergizer, String name){ + super(Material.rock, name); this.isEnergizer = isEnergizer; this.setHarvestLevel("pickaxe", 0); this.setHardness(2.0F); @@ -79,14 +79,9 @@ public class BlockEnergizer extends BlockContainerBase implements IActAddItemOrB @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.sideIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Side"); - } - - @Override - public String getName(){ - return this.isEnergizer ? "blockEnergizer" : "blockEnervator"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.sideIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Side"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java index f55e9216d..853e5a736 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFeeder; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -27,13 +27,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockFeeder extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockFeeder extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; - public BlockFeeder(){ - super(Material.rock); + public BlockFeeder(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(0.5F); this.setResistance(6.0F); @@ -66,13 +66,8 @@ public class BlockFeeder extends BlockContainerBase implements IActAddItemOrBloc @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockFeeder"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java index e8f96cebb..f85286977 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -27,13 +27,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockFermentingBarrel extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockFermentingBarrel extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon iconTop; - public BlockFermentingBarrel(){ - super(Material.wood); + public BlockFermentingBarrel(String name){ + super(Material.wood, name); this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(5.0F); @@ -72,13 +72,8 @@ public class BlockFermentingBarrel extends BlockContainerBase implements IActAdd @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.iconTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockFermentingBarrel"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.iconTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java index 052fb1823..2d0df6015 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFishingNet.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityFishingNet; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; @@ -24,10 +24,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockFishingNet extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockFishingNet extends BlockContainerBase{ - public BlockFishingNet(){ - super(Material.wood); + public BlockFishingNet(String name){ + super(Material.wood, name); this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(3.0F); @@ -67,11 +67,6 @@ public class BlockFishingNet extends BlockContainerBase implements IActAddItemOr this.blockIcon = Blocks.planks.getIcon(0, 0); } - @Override - public String getName(){ - return "blockFishingNet"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.rare; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java index 841080045..adb7fd922 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityFluidCollector; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -30,7 +30,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockFluidCollector extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockFluidCollector extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon frontIcon; @@ -39,8 +39,8 @@ public class BlockFluidCollector extends BlockContainerBase implements IActAddIt private boolean isPlacer; - public BlockFluidCollector(boolean isPlacer){ - super(Material.rock); + public BlockFluidCollector(boolean isPlacer, String name){ + super(Material.rock, name); this.isPlacer = isPlacer; this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); @@ -99,14 +99,9 @@ public class BlockFluidCollector extends BlockContainerBase implements IActAddIt @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return this.isPlacer ? "blockFluidPlacer" : "blockFluidCollector"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java index d50a18404..a3e8536d6 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.proxy.ClientProxy; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -33,7 +33,7 @@ import net.minecraft.world.World; import java.util.Random; -public class BlockFurnaceDouble extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockFurnaceDouble extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @@ -42,8 +42,8 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte @SideOnly(Side.CLIENT) private IIcon frontIcon; - public BlockFurnaceDouble(){ - super(Material.rock); + public BlockFurnaceDouble(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -152,10 +152,10 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"On"); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"On"); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); } @Override @@ -163,11 +163,6 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0; } - @Override - public String getName(){ - return "blockFurnaceDouble"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.uncommon; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java index 4555054de..31f9e9794 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceSolar.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -26,10 +26,10 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockFurnaceSolar extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockFurnaceSolar extends BlockContainerBase{ - public BlockFurnaceSolar(){ - super(Material.rock); + public BlockFurnaceSolar(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -81,11 +81,6 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IActAddItem this.blockIcon = Blocks.daylight_detector.getIcon(0, 0); } - @Override - public String getName(){ - return "blockFurnaceSolar"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.uncommon; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java index e7cc02576..0f742dda8 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGeneric.java @@ -12,22 +12,18 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.blocks.base.BlockBase; import ellpeck.actuallyadditions.util.ModUtil; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class BlockGeneric extends Block implements IActAddItemOrBlock{ - - public String name; +public class BlockGeneric extends BlockBase{ public BlockGeneric(String name){ - super(Material.rock); - this.name = name; + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -43,12 +39,7 @@ public class BlockGeneric extends Block implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return this.name; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java index f018c2c54..7e6788155 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityGiantChest; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -27,15 +27,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockGiantChest extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockGiantChest extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockGiantChest(){ - super(Material.wood); + public BlockGiantChest(String name){ + super(Material.wood, name); this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(15.0F); @@ -68,14 +68,9 @@ public class BlockGiantChest extends BlockContainerBase implements IActAddItemOr @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); - } - - @Override - public String getName(){ - return "blockGiantChest"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java index 264278130..96d4ba262 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGreenhouseGlass.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityGreenhouseGlass; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,10 +25,10 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockGreenhouseGlass extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockGreenhouseGlass extends BlockContainerBase{ - public BlockGreenhouseGlass(){ - super(Material.rock); + public BlockGreenhouseGlass(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(0.5F); this.setResistance(10.0F); @@ -67,12 +67,7 @@ public class BlockGreenhouseGlass extends BlockContainerBase implements IActAddI @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "blockGreenhouseGlass"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index 4775690c0..a69bad51f 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.proxy.ClientProxy; import ellpeck.actuallyadditions.tile.TileEntityGrinder; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -31,7 +31,7 @@ import net.minecraft.world.World; import java.util.Random; -public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockGrinder extends BlockContainerBase{ private final boolean isDouble; @SideOnly(Side.CLIENT) @@ -41,8 +41,8 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockGrinder(boolean isDouble){ - super(Material.rock); + public BlockGrinder(boolean isDouble, String name){ + super(Material.rock, name); this.isDouble = isDouble; this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); @@ -101,7 +101,7 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockGrinderTop"); this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockGrinderOn"); this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockGrinderBottom"); @@ -112,11 +112,6 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0; } - @Override - public String getName(){ - return isDouble ? "blockGrinderDouble" : "blockGrinder"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java index 92651762b..864ff2088 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockHeatCollector.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityHeatCollector; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,15 +25,15 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockHeatCollector extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockHeatCollector extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockHeatCollector(){ - super(Material.rock); + public BlockHeatCollector(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(2.5F); this.setResistance(10.0F); @@ -66,14 +66,9 @@ public class BlockHeatCollector extends BlockContainerBase implements IActAddIte @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Side"); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); - } - - @Override - public String getName(){ - return "blockHeatCollector"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Side"); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java index 3cdabad6d..a3ad73826 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java @@ -13,11 +13,11 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; import ellpeck.actuallyadditions.inventory.GuiHandler; -import ellpeck.actuallyadditions.items.ItemBlockBase; import ellpeck.actuallyadditions.tile.TileEntityInputter; import ellpeck.actuallyadditions.tile.TileEntityInventoryBase; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.Util; @@ -31,14 +31,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockInputter extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockInputter extends BlockContainerBase{ public static final int NAME_FLAVOR_AMOUNTS = 15; public boolean isAdvanced; - public BlockInputter(boolean isAdvanced){ - super(Material.rock); + public BlockInputter(boolean isAdvanced, String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -73,12 +73,7 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return this.isAdvanced ? "blockInputterAdvanced" : "blockInputter"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -98,6 +93,11 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl super.breakBlock(world, x, y, z, block, par6); } + @Override + public Class getItemBlock(){ + return TheItemBlock.class; + } + public static class TheItemBlock extends ItemBlockBase{ private long lastSysTime; @@ -119,12 +119,6 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl return damage; } - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } - @Override public String getItemStackDisplayName(ItemStack stack){ long sysTime = System.currentTimeMillis(); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java index 68e45cfff..9aee02d55 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -28,15 +28,15 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockItemRepairer extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockItemRepairer extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockItemRepairer(){ - super(Material.rock); + public BlockItemRepairer(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(20.0F); this.setResistance(15.0F); @@ -76,9 +76,9 @@ public class BlockItemRepairer extends BlockContainerBase implements IActAddItem @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); } @Override @@ -86,11 +86,6 @@ public class BlockItemRepairer extends BlockContainerBase implements IActAddItem return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0; } - @Override - public String getName(){ - return "blockItemRepairer"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java index c201ea80f..db2f5a19f 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLampPowerer.java @@ -12,7 +12,7 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.blocks.base.BlockBase; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.WorldPos; import ellpeck.actuallyadditions.util.WorldUtil; @@ -28,13 +28,13 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class BlockLampPowerer extends Block implements IActAddItemOrBlock{ +public class BlockLampPowerer extends BlockBase{ @SideOnly(Side.CLIENT) private IIcon frontIcon; - public BlockLampPowerer(){ - super(Material.rock); + public BlockLampPowerer(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -79,13 +79,8 @@ public class BlockLampPowerer extends Block implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - } - - @Override - public String getName(){ - return "blockLampPowerer"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLaserRelay.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLaserRelay.java index 1a928423d..e840167fc 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLaserRelay.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLaserRelay.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityLaserRelay; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; @@ -25,10 +25,10 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockLaserRelay extends BlockContainerBase{ - public BlockLaserRelay(){ - super(Material.rock); + public BlockLaserRelay(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -92,11 +92,6 @@ public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOr this.blockIcon = Blocks.stone.getIcon(0, 0); } - @Override - public String getName(){ - return "blockLaserRelay"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java index feaf96ffb..d86aca7cf 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLavaFactoryController.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityLavaFactoryController; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.block.material.Material; @@ -26,13 +26,13 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockLavaFactoryController extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockLavaFactoryController extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; - public BlockLavaFactoryController(){ - super(Material.rock); + public BlockLavaFactoryController(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(4.5F); this.setResistance(20.0F); @@ -72,13 +72,8 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IA @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - } - - @Override - public String getName(){ - return "blockLavaFactoryController"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLeafGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLeafGenerator.java index a1e18ebed..0466f4a2c 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockLeafGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockLeafGenerator.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityLeafGenerator; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -26,15 +26,15 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockLeafGenerator extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockLeafGenerator extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockLeafGenerator(){ - super(Material.iron); + public BlockLeafGenerator(String name){ + super(Material.iron, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(5.0F); this.setResistance(10.0F); @@ -67,14 +67,9 @@ public class BlockLeafGenerator extends BlockContainerBase implements IActAddIte @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); - } - - @Override - public String getName(){ - return "blockLeafGenerator"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java index 1f1db362d..cb60222e3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockMisc.java @@ -12,10 +12,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockBase; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.items.ItemBlockBase; import ellpeck.actuallyadditions.proxy.ClientProxy; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.block.Block; @@ -29,7 +29,7 @@ import net.minecraft.util.IIcon; import java.util.List; -public class BlockMisc extends Block implements IActAddItemOrBlock{ +public class BlockMisc extends BlockBase{ public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values(); @SideOnly(Side.CLIENT) @@ -42,8 +42,8 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{ @SideOnly(Side.CLIENT) private IIcon ironCasingSeasonal; - public BlockMisc(){ - super(Material.rock); + public BlockMisc(String name){ + super(Material.rock, name); this.setHardness(1.5F); this.setResistance(10.0F); this.setHarvestLevel("pickaxe", 1); @@ -81,7 +81,7 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{ public void registerBlockIcons(IIconRegister iconReg){ this.textures = new IIcon[allMiscBlocks.length]; for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allMiscBlocks[i].name); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allMiscBlocks[i].name); } this.casingSeasonalTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockMiscStoneCasingSnowTop"); @@ -90,13 +90,13 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{ } @Override - public String getName(){ - return "blockMisc"; + public EnumRarity getRarity(ItemStack stack){ + return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity; } @Override - public EnumRarity getRarity(ItemStack stack){ - return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity; + public Class getItemBlock(){ + return TheItemBlock.class; } public static class TheItemBlock extends ItemBlockBase{ @@ -111,16 +111,5 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{ public String getUnlocalizedName(ItemStack stack){ return stack.getItemDamage() >= allMiscBlocks.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allMiscBlocks[stack.getItemDamage()].name; } - - @Override - public int getMetadata(int damage){ - return damage; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java index f9a4df65a..389c5c419 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java @@ -13,10 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.proxy.ClientProxy; import ellpeck.actuallyadditions.tile.TileEntityOilGenerator; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -30,15 +30,15 @@ import net.minecraft.world.World; import java.util.Random; -public class BlockOilGenerator extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockOilGenerator extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockOilGenerator(){ - super(Material.rock); + public BlockOilGenerator(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -84,14 +84,9 @@ public class BlockOilGenerator extends BlockContainerBase implements IActAddItem @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); - } - - @Override - public String getName(){ - return "blockOilGenerator"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java index d71263eee..d41116fe2 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantom.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.proxy.ClientProxy; import ellpeck.actuallyadditions.tile.*; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.block.Block; @@ -31,7 +31,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockPhantom extends BlockContainerBase{ public Type type; public int range; @@ -39,8 +39,8 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo @SideOnly(Side.CLIENT) private IIcon iconSeasonal; - public BlockPhantom(Type type){ - super(Material.rock); + public BlockPhantom(Type type, String name){ + super(Material.rock, name); this.type = type; this.setHarvestLevel("pickaxe", 0); this.setHardness(4.5F); @@ -123,27 +123,11 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); this.iconSeasonal = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockPhantomfacePumpkin"); } - @Override - public String getName(){ - switch(this.type){ - case PLACER: - return "blockPhantomPlacer"; - case BREAKER: - return "blockPhantomBreaker"; - case LIQUIFACE: - return "blockPhantomLiquiface"; - case ENERGYFACE: - return "blockPhantomEnergyface"; - default: - return "blockPhantomface"; - } - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java index d454258ec..f9af36b44 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomBooster.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.tile.TileEntityPhantomBooster; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; @@ -24,10 +24,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockPhantomBooster extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockPhantomBooster extends BlockContainerBase{ - public BlockPhantomBooster(){ - super(Material.rock); + public BlockPhantomBooster(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -64,11 +64,6 @@ public class BlockPhantomBooster extends BlockContainerBase implements IActAddIt this.blockIcon = Blocks.lapis_block.getIcon(0, 0); } - @Override - public String getName(){ - return "blockPhantomBooster"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockRangedCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockRangedCollector.java index fdc4f7a8a..2c6e58941 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockRangedCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockRangedCollector.java @@ -13,9 +13,9 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntityRangedCollector; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -27,10 +27,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockRangedCollector extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockRangedCollector extends BlockContainerBase{ - public BlockRangedCollector(){ - super(Material.rock); + public BlockRangedCollector(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); @@ -63,12 +63,7 @@ public class BlockRangedCollector extends BlockContainerBase implements IActAddI @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "blockRangedCollector"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java index 9e603b69e..45191d3c5 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSlabs.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.items.ItemBlockBase; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.blocks.base.BlockBase; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -28,17 +28,15 @@ import net.minecraft.world.World; import java.util.List; -public class BlockSlabs extends Block implements IActAddItemOrBlock{ +public class BlockSlabs extends BlockBase{ - private String name; private Block fullBlock; public BlockSlabs(String name, Block fullBlock){ - super(Material.rock); + super(Material.rock, name); this.setHardness(1.5F); this.setResistance(10.0F); this.fullBlock = fullBlock; - this.name = name; } @Override @@ -94,13 +92,13 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{ } @Override - public String getName(){ - return this.name; + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.common; } @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.common; + public Class getItemBlock(){ + return TheItemBlock.class; } public static class TheItemBlock extends ItemBlockBase{ @@ -127,16 +125,5 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{ public String getUnlocalizedName(ItemStack stack){ return this.getUnlocalizedName(); } - - @Override - public int getMetadata(int meta){ - return meta; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java index 8c4d7dcd1..3d36738eb 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockSmileyCloud.java @@ -14,10 +14,10 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.achievement.TheAchievements; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud; import ellpeck.actuallyadditions.util.AssetUtil; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -32,10 +32,10 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockSmileyCloud extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockSmileyCloud extends BlockContainerBase{ - public BlockSmileyCloud(){ - super(Material.cloth); + public BlockSmileyCloud(String name){ + super(Material.cloth, name); this.setHardness(0.5F); this.setResistance(5.0F); this.setStepSound(soundTypeCloth); @@ -129,11 +129,6 @@ public class BlockSmileyCloud extends BlockContainerBase implements IActAddItemO super.breakBlock(world, x, y, z, block, par6); } - @Override - public String getName(){ - return "blockSmileyCloud"; - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.rare; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java index 13b141d47..800668d95 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockTreasureChest.java @@ -13,11 +13,10 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.achievement.TheAchievements; +import ellpeck.actuallyadditions.blocks.base.BlockBase; import ellpeck.actuallyadditions.recipe.TreasureChestHandler; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -35,7 +34,7 @@ import net.minecraft.world.World; import java.util.Random; -public class BlockTreasureChest extends Block implements IActAddItemOrBlock{ +public class BlockTreasureChest extends BlockBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @@ -44,8 +43,8 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{ @SideOnly(Side.CLIENT) private IIcon frontIcon; - public BlockTreasureChest(){ - super(Material.wood); + public BlockTreasureChest(String name){ + super(Material.wood, name); this.setHarvestLevel("axe", 0); this.setHardness(300.0F); this.setResistance(50.0F); @@ -139,15 +138,10 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Bottom"); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - } - - @Override - public String getName(){ - return "blockTreasureChest"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom"); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java index 657ef5df4..c4e08661c 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockWildPlant.java @@ -12,12 +12,12 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.blocks.base.BlockBushBase; +import ellpeck.actuallyadditions.blocks.base.BlockPlant; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; import ellpeck.actuallyadditions.blocks.metalists.TheWildPlants; -import ellpeck.actuallyadditions.items.ItemBlockBase; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.block.Block; -import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -31,11 +31,12 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; import java.util.List; -public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{ +public class BlockWildPlant extends BlockBushBase{ public static final TheWildPlants[] allWildPlants = TheWildPlants.values(); - public BlockWildPlant(){ + public BlockWildPlant(String name){ + super(name); this.setStepSound(soundTypeGrass); } @@ -82,13 +83,13 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{ } @Override - public String getName(){ - return "blockWild"; + public EnumRarity getRarity(ItemStack stack){ + return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity; } @Override - public EnumRarity getRarity(ItemStack stack){ - return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity; + public Class getItemBlock(){ + return TheItemBlock.class; } public static class TheItemBlock extends ItemBlockBase{ @@ -109,16 +110,5 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{ public String getUnlocalizedName(ItemStack stack){ return stack.getItemDamage() >= allWildPlants.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allWildPlants[stack.getItemDamage()].name; } - - @Override - public int getMetadata(int damage){ - return damage; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java index d4099f630..7a5fd3efa 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java @@ -13,11 +13,11 @@ package ellpeck.actuallyadditions.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.blocks.base.BlockContainerBase; import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.tile.TileEntityXPSolidifier; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; @@ -34,15 +34,15 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockXPSolidifier extends BlockContainerBase implements IActAddItemOrBlock{ +public class BlockXPSolidifier extends BlockContainerBase{ @SideOnly(Side.CLIENT) private IIcon topIcon; @SideOnly(Side.CLIENT) private IIcon frontIcon; - public BlockXPSolidifier(){ - super(Material.rock); + public BlockXPSolidifier(String name){ + super(Material.rock, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(2.5F); this.setResistance(10.0F); @@ -112,14 +112,9 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top"); - this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front"); - } - - @Override - public String getName(){ - return "blockXPSolidifier"; + this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top"); + this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 191fa55f3..7a10c3288 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -10,8 +10,11 @@ package ellpeck.actuallyadditions.blocks; +import ellpeck.actuallyadditions.blocks.base.BlockFluidFlowing; +import ellpeck.actuallyadditions.blocks.base.BlockPlant; +import ellpeck.actuallyadditions.blocks.base.BlockStair; +import ellpeck.actuallyadditions.blocks.base.BlockWallAA; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; -import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.CompatUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; @@ -109,180 +112,70 @@ public class InitBlocks{ public static void init(){ ModUtil.LOGGER.info("Initializing Blocks..."); - blockBookletStand = new BlockBookletStand(); - BlockUtil.register(blockBookletStand); - - blockAtomicReconstructor = new BlockAtomicReconstructor(); - BlockUtil.register(blockAtomicReconstructor); - - blockCrystal = new BlockCrystal(); - BlockUtil.register(blockCrystal, BlockCrystal.TheItemBlock.class); - - blockBlackLotus = new BlockBlackLotus(); - BlockUtil.register(blockBlackLotus); - - blockLaserRelay = new BlockLaserRelay(); - BlockUtil.register(blockLaserRelay); - - blockRangedCollector = new BlockRangedCollector(); - BlockUtil.register(blockRangedCollector); - - blockDirectionalBreaker = new BlockDirectionalBreaker(); - BlockUtil.register(blockDirectionalBreaker); - - blockLeafGenerator = new BlockLeafGenerator(); - BlockUtil.register(blockLeafGenerator); - - blockSmileyCloud = new BlockSmileyCloud(); - BlockUtil.register(blockSmileyCloud); - - blockXPSolidifier = new BlockXPSolidifier(); - BlockUtil.register(blockXPSolidifier); - + blockBookletStand = new BlockBookletStand("blockBookStand"); + blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor"); + blockCrystal = new BlockCrystal("blockCrystal"); + blockBlackLotus = new BlockBlackLotus("blockBlackLotus"); + blockLaserRelay = new BlockLaserRelay("blockLaserRelay"); + blockRangedCollector = new BlockRangedCollector("blockRangedCollector"); + blockDirectionalBreaker = new BlockDirectionalBreaker("blockDirectionalBreaker"); + blockLeafGenerator = new BlockLeafGenerator("blockLeafGenerator"); + blockSmileyCloud = new BlockSmileyCloud("blockSmileyCloud"); + blockXPSolidifier = new BlockXPSolidifier("blockXPSolidifier"); blockTestifiBucksGreenWall = new BlockGeneric("blockTestifiBucksGreenWall"); - BlockUtil.register(blockTestifiBucksGreenWall); blockTestifiBucksWhiteWall = new BlockGeneric("blockTestifiBucksWhiteWall"); - BlockUtil.register(blockTestifiBucksWhiteWall); blockTestifiBucksGreenStairs = new BlockStair(blockTestifiBucksGreenWall, "blockTestifiBucksGreenStairs"); - BlockUtil.register(blockTestifiBucksGreenStairs); blockTestifiBucksWhiteStairs = new BlockStair(blockTestifiBucksWhiteWall, "blockTestifiBucksWhiteStairs"); - BlockUtil.register(blockTestifiBucksWhiteStairs); blockTestifiBucksGreenSlab = new BlockSlabs("blockTestifiBucksGreenSlab", blockTestifiBucksGreenWall); - BlockUtil.register(blockTestifiBucksGreenSlab, BlockSlabs.TheItemBlock.class); blockTestifiBucksWhiteSlab = new BlockSlabs("blockTestifiBucksWhiteSlab", blockTestifiBucksWhiteWall); - BlockUtil.register(blockTestifiBucksWhiteSlab, BlockSlabs.TheItemBlock.class); blockTestifiBucksGreenFence = new BlockWallAA("blockTestifiBucksGreenFence", blockTestifiBucksGreenWall); - BlockUtil.register(blockTestifiBucksGreenFence); blockTestifiBucksWhiteFence = new BlockWallAA("blockTestifiBucksWhiteFence", blockTestifiBucksWhiteWall); - BlockUtil.register(blockTestifiBucksWhiteFence); - - blockColoredLamp = new BlockColoredLamp(false); - BlockUtil.register(blockColoredLamp, BlockColoredLamp.TheItemBlock.class); - blockColoredLampOn = new BlockColoredLamp(true); - BlockUtil.register(blockColoredLampOn, BlockColoredLamp.TheItemBlock.class); - blockLampPowerer = new BlockLampPowerer(); - BlockUtil.register(blockLampPowerer); - - blockTreasureChest = new BlockTreasureChest(); - BlockUtil.register(blockTreasureChest); - - blockEnergizer = new BlockEnergizer(true); - BlockUtil.register(blockEnergizer); - - blockEnervator = new BlockEnergizer(false); - BlockUtil.register(blockEnervator); - - blockLavaFactoryController = new BlockLavaFactoryController(); - BlockUtil.register(blockLavaFactoryController); - - blockCanolaPress = new BlockCanolaPress(); - BlockUtil.register(blockCanolaPress); - - blockPhantomface = new BlockPhantom(BlockPhantom.Type.FACE); - BlockUtil.register(blockPhantomface); - - blockPhantomPlacer = new BlockPhantom(BlockPhantom.Type.PLACER); - BlockUtil.register(blockPhantomPlacer); - - blockPhantomLiquiface = new BlockPhantom(BlockPhantom.Type.LIQUIFACE); - BlockUtil.register(blockPhantomLiquiface); - - blockPhantomEnergyface = new BlockPhantom(BlockPhantom.Type.ENERGYFACE); - BlockUtil.register(blockPhantomEnergyface); - - blockPhantomBreaker = new BlockPhantom(BlockPhantom.Type.BREAKER); - BlockUtil.register(blockPhantomBreaker); - - blockCoalGenerator = new BlockCoalGenerator(); - BlockUtil.register(blockCoalGenerator); - - blockOilGenerator = new BlockOilGenerator(); - BlockUtil.register(blockOilGenerator); - - blockFermentingBarrel = new BlockFermentingBarrel(); - BlockUtil.register(blockFermentingBarrel); - + blockColoredLamp = new BlockColoredLamp(false, "blockColoredLamp"); + blockColoredLampOn = new BlockColoredLamp(true, "blockColoredLampOn"); + blockLampPowerer = new BlockLampPowerer("blockLampPowerer"); + blockTreasureChest = new BlockTreasureChest("blockTreasureChest"); + blockEnergizer = new BlockEnergizer(true, "blockEnergizer"); + blockEnervator = new BlockEnergizer(false, "blockEnervator"); + blockLavaFactoryController = new BlockLavaFactoryController("blockLavaFactoryController"); + blockCanolaPress = new BlockCanolaPress("blockCanolaPress"); + blockPhantomface = new BlockPhantom(BlockPhantom.Type.FACE, "blockPhantomface"); + blockPhantomPlacer = new BlockPhantom(BlockPhantom.Type.PLACER, "blockPhantomPlacer"); + blockPhantomLiquiface = new BlockPhantom(BlockPhantom.Type.LIQUIFACE, "blockPhantomLiquiface"); + blockPhantomEnergyface = new BlockPhantom(BlockPhantom.Type.ENERGYFACE, "blockPhantomEnergyface"); + blockPhantomBreaker = new BlockPhantom(BlockPhantom.Type.BREAKER, "blockPhantomBreaker"); + blockCoalGenerator = new BlockCoalGenerator("blockCoalGenerator"); + blockOilGenerator = new BlockOilGenerator("blockOilGenerator"); + blockFermentingBarrel = new BlockFermentingBarrel("blockFermentingBarrel"); blockRice = new BlockPlant("blockRice", 6, 1, 2); - BlockUtil.register(blockRice); CompatUtil.registerMFRPlant(blockRice); - blockCanola = new BlockPlant("blockCanola", 4, 3, 3); - BlockUtil.register(blockCanola); CompatUtil.registerMFRPlant(blockCanola); - blockFlax = new BlockPlant("blockFlax", 6, 2, 4); - BlockUtil.register(blockFlax); CompatUtil.registerMFRPlant(blockFlax); - blockCoffee = new BlockPlant("blockCoffee", 6, 2, 2); - BlockUtil.register(blockCoffee); CompatUtil.registerMFRPlant(blockCoffee); - - blockCompost = new BlockCompost(); - BlockUtil.register(blockCompost); - - blockMisc = new BlockMisc(); - BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class); - - blockFeeder = new BlockFeeder(); - BlockUtil.register(blockFeeder); - - blockGiantChest = new BlockGiantChest(); - BlockUtil.register(blockGiantChest); - - blockGrinder = new BlockGrinder(false); - BlockUtil.register(blockGrinder); - - blockGrinderDouble = new BlockGrinder(true); - BlockUtil.register(blockGrinderDouble); - - blockFurnaceDouble = new BlockFurnaceDouble(); - BlockUtil.register(blockFurnaceDouble); - - blockInputter = new BlockInputter(false); - BlockUtil.register(blockInputter, BlockInputter.TheItemBlock.class); - - blockInputterAdvanced = new BlockInputter(true); - BlockUtil.register(blockInputterAdvanced, BlockInputter.TheItemBlock.class); - - blockFishingNet = new BlockFishingNet(); - BlockUtil.register(blockFishingNet); - - blockFurnaceSolar = new BlockFurnaceSolar(); - BlockUtil.register(blockFurnaceSolar); - - blockHeatCollector = new BlockHeatCollector(); - BlockUtil.register(blockHeatCollector); - - blockItemRepairer = new BlockItemRepairer(); - BlockUtil.register(blockItemRepairer); - - blockGreenhouseGlass = new BlockGreenhouseGlass(); - BlockUtil.register(blockGreenhouseGlass); - - blockBreaker = new BlockBreaker(false); - BlockUtil.register(blockBreaker); - - blockPlacer = new BlockBreaker(true); - BlockUtil.register(blockPlacer); - - blockDropper = new BlockDropper(); - BlockUtil.register(blockDropper); - - blockFluidPlacer = new BlockFluidCollector(true); - BlockUtil.register(blockFluidPlacer); - - blockFluidCollector = new BlockFluidCollector(false); - BlockUtil.register(blockFluidCollector); - - blockCoffeeMachine = new BlockCoffeeMachine(); - BlockUtil.register(blockCoffeeMachine); - - blockPhantomBooster = new BlockPhantomBooster(); - BlockUtil.register(blockPhantomBooster); - - blockWildPlant = new BlockWildPlant(); - BlockUtil.register(blockWildPlant, BlockWildPlant.TheItemBlock.class); + blockCompost = new BlockCompost("blockCompost"); + blockMisc = new BlockMisc("blockMisc"); + blockFeeder = new BlockFeeder("blockFeeder"); + blockGiantChest = new BlockGiantChest("blockGiantChest"); + blockGrinder = new BlockGrinder(false, "blockGrinder"); + blockGrinderDouble = new BlockGrinder(true, "blockGrinderDouble"); + blockFurnaceDouble = new BlockFurnaceDouble("blockFurnaceDouble"); + blockInputter = new BlockInputter(false, "blockInputter"); + blockInputterAdvanced = new BlockInputter(true, "blockInputterAdvanced"); + blockFishingNet = new BlockFishingNet("blockFishingNet"); + blockFurnaceSolar = new BlockFurnaceSolar("blockFurnaceSolar"); + blockHeatCollector = new BlockHeatCollector("blockHeatCollector"); + blockItemRepairer = new BlockItemRepairer("blockItemRepairer"); + blockGreenhouseGlass = new BlockGreenhouseGlass("blockGreenhouseGlass"); + blockBreaker = new BlockBreaker(false, "blockBreaker"); + blockPlacer = new BlockBreaker(true, "blockPlacer"); + blockDropper = new BlockDropper("blockDropper"); + blockFluidPlacer = new BlockFluidCollector(true, "blockFluidPlacer"); + blockFluidCollector = new BlockFluidCollector(false, "blockFluidCollector"); + blockCoffeeMachine = new BlockCoffeeMachine("blockCoffeeMachine"); + blockPhantomBooster = new BlockPhantomBooster("blockPhantomBooster"); + blockWildPlant = new BlockWildPlant("blockWild"); registerFluids(); } @@ -302,7 +195,6 @@ public class InitBlocks{ //Canola Block if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){ blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil"); - BlockUtil.register(blockCanolaOil); } else{ errorAlreadyRegistered("Canola Oil Block"); @@ -323,7 +215,6 @@ public class InitBlocks{ //Oil Block if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){ blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil"); - BlockUtil.register(blockOil); } else{ errorAlreadyRegistered("Oil Block"); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBase.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBase.java new file mode 100644 index 000000000..dbee0b3e4 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBase.java @@ -0,0 +1,55 @@ +/* + * This file ("BlockBase.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015 Ellpeck + */ + +package ellpeck.actuallyadditions.blocks.base; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; + +public class BlockBase extends Block{ + + private String name; + + public BlockBase(Material material, String name){ + super(material); + this.name = name; + + this.register(); + } + + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; + } + + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.common; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBushBase.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBushBase.java new file mode 100644 index 000000000..8451b0550 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockBushBase.java @@ -0,0 +1,54 @@ +/* + * This file ("BlockBushBase.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015 Ellpeck + */ + +package ellpeck.actuallyadditions.blocks.base; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.block.BlockBush; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; + +public class BlockBushBase extends BlockBush{ + + private String name; + + public BlockBushBase(String name){ + this.setStepSound(soundTypeGrass); + this.name = name; + + this.register(); + } + + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; + } + + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.common; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockContainerBase.java similarity index 77% rename from src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java rename to src/main/java/ellpeck/actuallyadditions/blocks/base/BlockContainerBase.java index 23679f883..ea3ac15f2 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockContainerBase.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockContainerBase.java @@ -8,10 +8,13 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.blocks; +package ellpeck.actuallyadditions.blocks.base; +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityInventoryBase; +import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; @@ -19,6 +22,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; +import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -26,8 +30,37 @@ import net.minecraft.world.World; public abstract class BlockContainerBase extends BlockContainer{ - public BlockContainerBase(Material mat){ - super(mat); + private String name; + + public BlockContainerBase(Material material, String name){ + super(material); + this.name = name; + + this.register(); + } + + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; + } + + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.common; } public void dropInventory(World world, int x, int y, int z){ diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockFluidFlowing.java similarity index 73% rename from src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java rename to src/main/java/ellpeck/actuallyadditions/blocks/base/BlockFluidFlowing.java index d5dfce51a..dffd8aff2 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidFlowing.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockFluidFlowing.java @@ -8,11 +8,12 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.blocks; +package ellpeck.actuallyadditions.blocks.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,12 +25,13 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; -public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemOrBlock{ +public class BlockFluidFlowing extends BlockFluidClassic{ @SideOnly(Side.CLIENT) public IIcon stillIcon; @SideOnly(Side.CLIENT) public IIcon flowingIcon; + private String name; public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){ @@ -37,6 +39,28 @@ public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemO this.name = unlocalizedName; this.setRenderPass(1); displacements.put(this, false); + + this.register(); + } + + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; } @Override @@ -58,17 +82,11 @@ public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemO @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconReg){ - this.stillIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Still"); - this.flowingIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Flowing"); + this.stillIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Still"); + this.flowingIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Flowing"); this.definedFluid.setIcons(this.stillIcon, this.flowingIcon); } - @Override - public String getName(){ - return this.name; - } - - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.epic; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockPlant.java similarity index 79% rename from src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java rename to src/main/java/ellpeck/actuallyadditions/blocks/base/BlockPlant.java index 9df6c4dea..4f87f377e 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockPlant.java @@ -8,11 +8,12 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.blocks; +package ellpeck.actuallyadditions.blocks.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.BlockCrops; import net.minecraft.client.renderer.texture.IIconRegister; @@ -26,7 +27,7 @@ import net.minecraftforge.common.EnumPlantType; import java.util.Random; -public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{ +public class BlockPlant extends BlockCrops { public Item seedItem; public Item returnItem; @@ -43,6 +44,32 @@ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{ this.stages = stages; this.minDropAmount = minDropAmount; this.addDropAmount = addDropAmount; + + this.register(); + } + + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; + } + + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.rare; } @Override @@ -84,20 +111,10 @@ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{ public void registerBlockIcons(IIconRegister iconReg){ this.textures = new IIcon[this.stages]; for(int i = 0; i < this.textures.length; i++){ - textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Stage"+(i+1)); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Stage"+(i+1)); } } - @Override - public String getName(){ - return this.name; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.rare; - } - @Override public int damageDropped(int meta){ return this.returnMeta; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockStair.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockStair.java similarity index 51% rename from src/main/java/ellpeck/actuallyadditions/blocks/BlockStair.java rename to src/main/java/ellpeck/actuallyadditions/blocks/base/BlockStair.java index 64b407b8f..d69256722 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockStair.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockStair.java @@ -8,15 +8,18 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.blocks; +package ellpeck.actuallyadditions.blocks.base; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -public class BlockStair extends BlockStairs implements IActAddItemOrBlock{ +public class BlockStair extends BlockStairs{ private String name; @@ -24,14 +27,30 @@ public class BlockStair extends BlockStairs implements IActAddItemOrBlock{ super(block, 0); this.name = name; this.setLightOpacity(0); + + this.register(); } - @Override - public String getName(){ + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ return this.name; } - @Override + protected Class getItemBlock(){ + return ItemBlockBase.class; + } + public EnumRarity getRarity(ItemStack stack){ return EnumRarity.common; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockWallAA.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockWallAA.java similarity index 65% rename from src/main/java/ellpeck/actuallyadditions/blocks/BlockWallAA.java rename to src/main/java/ellpeck/actuallyadditions/blocks/base/BlockWallAA.java index 51121f1ee..fe16efb20 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockWallAA.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/BlockWallAA.java @@ -8,11 +8,13 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.blocks; +package ellpeck.actuallyadditions.blocks.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockWall; import net.minecraft.creativetab.CreativeTabs; @@ -23,7 +25,7 @@ import net.minecraft.util.IIcon; import java.util.List; -public class BlockWallAA extends BlockWall implements IActAddItemOrBlock{ +public class BlockWallAA extends BlockWall { private String name; private Block baseBlock; @@ -32,6 +34,32 @@ public class BlockWallAA extends BlockWall implements IActAddItemOrBlock{ super(base); this.baseBlock = base; this.name = name; + + this.register(); + } + + private void register(){ + this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; + } + + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.common; } @Override @@ -51,14 +79,4 @@ public class BlockWallAA extends BlockWall implements IActAddItemOrBlock{ public int damageDropped(int meta){ return meta; } - - @Override - public String getName(){ - return this.name; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.common; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/base/ItemBlockBase.java b/src/main/java/ellpeck/actuallyadditions/blocks/base/ItemBlockBase.java new file mode 100644 index 000000000..f363e79b3 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/blocks/base/ItemBlockBase.java @@ -0,0 +1,64 @@ +/* + * This file ("ItemBlockBase.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015 Ellpeck + */ + +package ellpeck.actuallyadditions.blocks.base; + +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.block.Block; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockBase extends ItemBlock{ + + public ItemBlockBase(Block block){ + super(block); + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + if(this.field_150939_a instanceof BlockBase){ + return ((BlockBase)this.field_150939_a).getRarity(stack); + } + else if(this.field_150939_a instanceof BlockContainerBase){ + return ((BlockContainerBase)this.field_150939_a).getRarity(stack); + } + else if(this.field_150939_a instanceof BlockFluidFlowing){ + return ((BlockFluidFlowing)this.field_150939_a).getRarity(stack); + } + else if(this.field_150939_a instanceof BlockPlant){ + return ((BlockPlant)this.field_150939_a).getRarity(stack); + } + else if(this.field_150939_a instanceof BlockStair){ + return ((BlockStair)this.field_150939_a).getRarity(stack); + } + else if(this.field_150939_a instanceof BlockWallAA){ + return ((BlockWallAA)this.field_150939_a).getRarity(stack); + } + else if(this.field_150939_a instanceof BlockBushBase){ + return ((BlockBushBase)this.field_150939_a).getRarity(stack); + } + else{ + return Util.FALLBACK_RARITY; + } + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java index ec895d3f5..b9216ec34 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java @@ -538,7 +538,7 @@ public class BookletUtils{ if(this.assignedEntry != null){ GL11.glPushMatrix(); - BookletPage.renderItem(booklet, this.assignedChapter != null && this.assignedChapter.displayStack != null ? this.assignedChapter.displayStack : new ItemStack(InitItems.itemLexicon), this.xPosition+2, this.yPosition+1, 0.725F); + BookletPage.renderItem(booklet, this.assignedChapter != null && this.assignedChapter.displayStack != null ? this.assignedChapter.displayStack : new ItemStack(InitItems.itemBooklet), this.xPosition+2, this.yPosition+1, 0.725F); GL11.glPopMatrix(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index a02e07d6e..ea589c95f 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -60,8 +60,8 @@ public class InitBooklet{ private static void initChapters(){ //Getting Started - chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); - new BookletChapter("bookTutorial", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook)); + chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); + new BookletChapter("bookTutorial", entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook)); new BookletChapter("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(7, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(8, ReconstructorRecipeHandler.mainPageRecipes).setNoText()).setSpecial(); new BookletChapter("coalGen", entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("", TileEntityCoalGenerator.PRODUCE)); new BookletChapter("craftingIngs", entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeStoneCase).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(7, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(8, ItemCrafting.recipeRing).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(11, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(12, ItemCrafting.recipeDough).setNoText(), new PageCrafting(13, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(14, BlockCrafting.recipeIronCase).setNoText()).setImportant(); diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index 7bb31d634..9fe0843be 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -85,7 +85,7 @@ public class BlockCrafting{ public static void init(){ //Book Stand - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBookletStand), new ItemStack(InitItems.itemLexicon), "plankWood")); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBookletStand), new ItemStack(InitItems.itemBooklet), "plankWood")); recipeBookStand = Util.GetRecipes.lastIRecipe(); //White Ethetic Blocks diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 7616058cb..ca34fd4bc 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -93,7 +93,7 @@ public class ItemCrafting{ recipeBlackDye = Util.GetRecipes.lastIRecipe(); //Booklet - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemLexicon), new ItemStack(InitItems.itemCanolaSeed), new ItemStack(Items.paper))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemBooklet), new ItemStack(InitItems.itemCanolaSeed), new ItemStack(Items.paper))); recipeBook = Util.GetRecipes.lastIRecipe(); //Clearing NBT Storage diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 8de49d0ca..ddb508184 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -39,7 +39,7 @@ public class CreativeTab extends CreativeTabs{ @Override public Item getTabIconItem(){ - return InitItems.itemLexicon; + return InitItems.itemBooklet; } @Override @@ -47,7 +47,7 @@ public class CreativeTab extends CreativeTabs{ public void displayAllReleventItems(List list){ this.list = list; - add(InitItems.itemLexicon); + add(InitItems.itemBooklet); add(InitBlocks.blockSmileyCloud); add(InitBlocks.blockBookletStand); diff --git a/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java b/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java index b04799e68..634f24950 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java +++ b/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java @@ -17,14 +17,17 @@ import ellpeck.actuallyadditions.achievement.TheAchievements; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.misc.WorldData; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.playerdata.PersistentServerData; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import java.util.Locale; + public class PlayerObtainEvents{ @SubscribeEvent @@ -32,15 +35,21 @@ public class PlayerObtainEvents{ checkAchievements(event.crafting, event.player, InitAchievements.CRAFTING_ACH); if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){ - if(!event.player.worldObj.isRemote && event.crafting.getItem() != InitItems.itemLexicon && (event.crafting.getItem() instanceof IActAddItemOrBlock || Block.getBlockFromItem(event.crafting.getItem()) instanceof IActAddItemOrBlock)){ - NBTTagCompound compound = PersistentServerData.getDataFromPlayer(event.player); - if(compound != null && !compound.getBoolean("BookGottenAlready")){ - compound.setBoolean("BookGottenAlready", true); - WorldData.makeDirty(); + if(!event.player.worldObj.isRemote && event.crafting.getItem() != InitItems.itemBooklet){ - EntityItem entityItem = new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(InitItems.itemLexicon)); - entityItem.delayBeforeCanPickup = 0; - event.player.worldObj.spawnEntityInWorld(entityItem); + String itemName = Item.itemRegistry.getNameForObject(event.crafting.getItem()); + String blockName = Block.blockRegistry.getNameForObject(Block.getBlockFromItem(event.crafting.getItem())); + + if((itemName != null && itemName.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID_LOWER)) || (blockName != null && blockName.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID_LOWER))){ + NBTTagCompound compound = PersistentServerData.getDataFromPlayer(event.player); + if(compound != null && !compound.getBoolean("BookGottenAlready")){ + compound.setBoolean("BookGottenAlready", true); + WorldData.makeDirty(); + + EntityItem entityItem = new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(InitItems.itemBooklet)); + entityItem.delayBeforeCanPickup = 0; + event.player.worldObj.spawnEntityInWorld(entityItem); + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java index 9c6052d92..9d81e1a07 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java @@ -16,7 +16,7 @@ import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.crafting.ToolCrafting; import ellpeck.actuallyadditions.creative.CreativeTab; -import ellpeck.actuallyadditions.items.tools.ItemAllToolAA; +import ellpeck.actuallyadditions.items.base.ItemAllToolAA; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; @@ -61,7 +61,6 @@ public class InitForeignPaxels{ if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); soPaxels[i] = new ItemAllToolAA(material, SO_REPAIR_NAMES[i], "paxelSO"+SO_NAMES[i], EnumRarity.rare, SO_COLORS[i]); - ItemUtil.register(soPaxels[i]); if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(soPaxels[i], axe, pickaxe, hoe, sword, shovel)); @@ -90,7 +89,6 @@ public class InitForeignPaxels{ if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); mtPaxels[i] = new ItemAllToolAA(material, MT_REPAIR_NAMES[i], "paxelMT"+MT_NAMES[i], EnumRarity.rare, MT_COLORS[i]); - ItemUtil.register(mtPaxels[i]); if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel)); @@ -119,7 +117,6 @@ public class InitForeignPaxels{ if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); tfPaxels[i] = new ItemAllToolAA(material, "ingot"+TF_NAMES[i], "paxelTF"+TF_NAMES[i], EnumRarity.rare, TF_COLORS[i]); - ItemUtil.register(tfPaxels[i]); if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(tfPaxels[i], axe, pickaxe, hoe, sword, shovel)); diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index e83ff86e8..6b3d1dea7 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -11,14 +11,13 @@ package ellpeck.actuallyadditions.items; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.items.base.*; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import ellpeck.actuallyadditions.items.tools.*; import ellpeck.actuallyadditions.material.InitArmorMaterials; import ellpeck.actuallyadditions.material.InitToolMaterials; import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler; import ellpeck.actuallyadditions.util.CompatUtil; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; @@ -28,7 +27,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry; public class InitItems{ - public static Item itemLexicon; + public static Item itemBooklet; public static Item itemFertilizer; public static Item itemMisc; @@ -138,69 +137,35 @@ public class InitItems{ ModUtil.LOGGER.info("Initializing Items..."); itemColorLens = new ItemLens("itemColorLens", ReconstructorRecipeHandler.LensType.COLOR); - ItemUtil.register(itemColorLens); - itemExplosionLens = new ItemLens("itemExplosionLens", ReconstructorRecipeHandler.LensType.DETONATION); - ItemUtil.register(itemExplosionLens); - itemDamageLens = new ItemLens("itemDamageLens", ReconstructorRecipeHandler.LensType.JUST_DAMAGE); - ItemUtil.register(itemDamageLens); - - itemCrystal = new ItemCrystal(); - ItemUtil.register(itemCrystal); - - itemLaserWrench = new ItemLaserWrench(); - ItemUtil.register(itemLaserWrench); - - itemChestToCrateUpgrade = new ItemChestToCrateUpgrade(); - ItemUtil.register(itemChestToCrateUpgrade); - - itemLexicon = new ItemBooklet(); - ItemUtil.register(itemLexicon); - - itemGrowthRing = new ItemGrowthRing(); - ItemUtil.register(itemGrowthRing); - - itemMagnetRing = new ItemMagnetRing(); - ItemUtil.register(itemMagnetRing); - - itemWaterRemovalRing = new ItemWaterRemovalRing(); - ItemUtil.register(itemWaterRemovalRing); - + itemCrystal = new ItemCrystal("itemCrystal"); + itemLaserWrench = new ItemLaserWrench("itemLaserWrench"); + itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade"); + itemBooklet = new ItemBooklet("itemBooklet"); + itemGrowthRing = new ItemGrowthRing("itemGrowthRing"); + itemMagnetRing = new ItemMagnetRing("itemSuctionRing"); + itemWaterRemovalRing = new ItemWaterRemovalRing("itemWaterRemovalRing"); itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, "gemEmerald", "armorEmerald"); itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, "gemEmerald", "armorEmerald"); itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, "gemEmerald", "armorEmerald"); itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, "gemEmerald", "armorEmerald"); - ItemUtil.registerItems(new Item[]{itemHelmEmerald, itemChestEmerald, itemPantsEmerald, itemBootsEmerald}); - itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, "obsidian", "armorObsidian"); itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, "obsidian", "armorObsidian"); itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, "obsidian", "armorObsidian"); itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, "obsidian", "armorObsidian"); - ItemUtil.registerItems(new Item[]{itemHelmObsidian, itemChestObsidian, itemPantsObsidian, itemBootsObsidian}); - itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, "gemQuartzBlack", "armorQuartz"); itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, "gemQuartzBlack", "armorQuartz"); itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, "gemQuartzBlack", "armorQuartz"); itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, "gemQuartzBlack", "armorQuartz"); - ItemUtil.registerItems(new Item[]{itemHelmQuartz, itemChestQuartz, itemPantsQuartz, itemBootsQuartz}); - - itemTeleStaff = new ItemTeleStaff(); - ItemUtil.register(itemTeleStaff); - - itemWingsOfTheBats = new ItemWingsOfTheBats(); - ItemUtil.register(itemWingsOfTheBats); - - itemDrill = new ItemDrill(); - ItemUtil.register(itemDrill); - + itemTeleStaff = new ItemTeleStaff("itemTeleStaff"); + itemWingsOfTheBats = new ItemWingsOfTheBats("itemWingsOfTheBats"); + itemDrill = new ItemDrill("itemDrill"); itemBattery = new ItemBattery("itemBattery", 1000000, 5000); itemBatteryDouble = new ItemBattery("itemBatteryDouble", 2000000, 10000); itemBatteryTriple = new ItemBattery("itemBatteryTriple", 3000000, 15000); itemBatteryQuadruple = new ItemBattery("itemBatteryQuadruple", 4000000, 20000); itemBatteryQuintuple = new ItemBattery("itemBatteryQuintuple", 5000000, 25000); - ItemUtil.registerItems(new Item[]{itemBattery, itemBatteryDouble, itemBatteryTriple, itemBatteryQuadruple, itemBatteryQuintuple}); - itemDrillUpgradeSpeed = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED, "itemDrillUpgradeSpeed"); itemDrillUpgradeSpeedII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II, "itemDrillUpgradeSpeedII"); itemDrillUpgradeSpeedIII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_III, "itemDrillUpgradeSpeedIII"); @@ -210,104 +175,50 @@ public class InitItems{ itemDrillUpgradeThreeByThree = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE, "itemDrillUpgradeThreeByThree"); itemDrillUpgradeFiveByFive = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE, "itemDrillUpgradeFiveByFive"); itemDrillUpgradeBlockPlacing = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER, "itemDrillUpgradeBlockPlacing"); - ItemUtil.registerItems(new Item[]{itemDrillUpgradeSpeed, itemDrillUpgradeSpeedII, itemDrillUpgradeSpeedIII, itemDrillUpgradeSilkTouch, itemDrillUpgradeFortune, itemDrillUpgradeFortuneII, itemDrillUpgradeThreeByThree, itemDrillUpgradeFiveByFive, itemDrillUpgradeBlockPlacing}); - itemBucketOil = new ItemBucketAA(InitBlocks.blockOil, "itemBucketOil"); - ItemUtil.register(itemBucketOil); FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET); - itemBucketCanolaOil = new ItemBucketAA(InitBlocks.blockCanolaOil, "itemBucketCanolaOil"); - ItemUtil.register(itemBucketCanolaOil); FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidCanolaOil, new ItemStack(itemBucketCanolaOil), FluidContainerRegistry.EMPTY_BUCKET); - - itemFertilizer = new ItemFertilizer(); - ItemUtil.register(itemFertilizer); - - itemCoffee = new ItemCoffee(); - ItemUtil.register(itemCoffee); - - itemPhantomConnector = new ItemPhantomConnector(); - ItemUtil.register(itemPhantomConnector); - - itemResonantRice = new ItemResonantRice(); - ItemUtil.register(itemResonantRice); - - itemMisc = new ItemMisc(); - ItemUtil.register(itemMisc); - - itemFoods = new ItemFoods(); - ItemUtil.register(itemFoods); - - itemJams = new ItemJams(); - ItemUtil.register(itemJams); - - itemKnife = new ItemKnife(); - ItemUtil.register(itemKnife); - - itemCrafterOnAStick = new ItemCrafterOnAStick(); - ItemUtil.register(itemCrafterOnAStick); - - itemDust = new ItemDust(); - ItemUtil.register(itemDust); - - itemSpecialDrop = new ItemSpecialDrop(); - ItemUtil.register(itemSpecialDrop); - - itemLeafBlower = new ItemLeafBlower(false); - ItemUtil.register(itemLeafBlower); - - itemLeafBlowerAdvanced = new ItemLeafBlower(true); - ItemUtil.register(itemLeafBlowerAdvanced); - - itemPotionRing = new ItemPotionRing(false); - ItemUtil.register(itemPotionRing); - - itemPotionRingAdvanced = new ItemPotionRing(true); - ItemUtil.register(itemPotionRingAdvanced); - - itemHairyBall = new ItemHairyBall(); - ItemUtil.register(itemHairyBall); - - itemCoffeeBean = new ItemCoffeeBean(); - ItemUtil.register(itemCoffeeBean); - + itemFertilizer = new ItemFertilizer("itemFertilizer"); + itemCoffee = new ItemCoffee("itemCoffee"); + itemPhantomConnector = new ItemPhantomConnector("itemPhantomConnector"); + itemResonantRice = new ItemResonantRice("itemResonantRice"); + itemMisc = new ItemMisc("itemMisc"); + itemFoods = new ItemFoods("itemFood"); + itemJams = new ItemJams("itemJam"); + itemKnife = new ItemKnife("itemKnife"); + itemCrafterOnAStick = new ItemCrafterOnAStick("itemCrafterOnAStick"); + itemDust = new ItemDust("itemDust"); + itemSpecialDrop = new ItemSpecialDrop("itemSpecial"); + itemLeafBlower = new ItemLeafBlower(false, "itemLeafBlower"); + itemLeafBlowerAdvanced = new ItemLeafBlower(true, "itemLeafBlowerAdvanced"); + itemPotionRing = new ItemPotionRing(false, "itemPotionRing"); + itemPotionRingAdvanced = new ItemPotionRing(true, "itemPotionRingAdvanced"); + itemHairyBall = new ItemHairyBall("itemHairyBall"); + itemCoffeeBean = new ItemCoffeeBean("itemCoffeeBeans"); itemRiceSeed = new ItemSeed("itemRiceSeed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal()); - ItemUtil.register(itemRiceSeed); CompatUtil.registerMFRSeed(itemRiceSeed); - itemCanolaSeed = new ItemSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal()); - ItemUtil.register(itemCanolaSeed); CompatUtil.registerMFRSeed(itemCanolaSeed); - itemFlaxSeed = new ItemSeed("itemFlaxSeed", "seedFlax", InitBlocks.blockFlax, Items.string, 0); - ItemUtil.register(itemFlaxSeed); CompatUtil.registerMFRSeed(itemFlaxSeed); - itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", "seedCoffeeBeans", InitBlocks.blockCoffee, itemCoffeeBean, 0); - ItemUtil.register(itemCoffeeSeed); CompatUtil.registerMFRSeed(itemCoffeeSeed); - itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, "gemEmerald", "itemPickaxeEmerald", EnumRarity.epic); itemAxeEmerald = new ItemAxeAA(InitToolMaterials.toolMaterialEmerald, "gemEmerald", "itemAxeEmerald", EnumRarity.epic); itemShovelEmerald = new ItemShovelAA(InitToolMaterials.toolMaterialEmerald, "gemEmerald", "itemShovelEmerald", EnumRarity.epic); itemSwordEmerald = new ItemSwordAA(InitToolMaterials.toolMaterialEmerald, "gemEmerald", "itemSwordEmerald", EnumRarity.epic); itemHoeEmerald = new ItemHoeAA(InitToolMaterials.toolMaterialEmerald, "gemEmerald", "itemHoeEmerald", EnumRarity.epic); - ItemUtil.registerItems(new Item[]{itemPickaxeEmerald, itemAxeEmerald, itemShovelEmerald, itemSwordEmerald, itemHoeEmerald}); - itemPickaxeObsidian = new ItemPickaxeAA(InitToolMaterials.toolMaterialObsidian, "obsidian", "itemPickaxeObsidian", EnumRarity.uncommon); itemAxeObsidian = new ItemAxeAA(InitToolMaterials.toolMaterialObsidian, "obsidian", "itemAxeObsidian", EnumRarity.uncommon); itemShovelObsidian = new ItemShovelAA(InitToolMaterials.toolMaterialObsidian, "obsidian", "itemShovelObsidian", EnumRarity.uncommon); itemSwordObsidian = new ItemSwordAA(InitToolMaterials.toolMaterialObsidian, "obsidian", "itemSwordObsidian", EnumRarity.uncommon); itemHoeObsidian = new ItemHoeAA(InitToolMaterials.toolMaterialObsidian, "obsidian", "itemHoeObsidian", EnumRarity.uncommon); - ItemUtil.registerItems(new Item[]{itemPickaxeObsidian, itemAxeObsidian, itemShovelObsidian, itemSwordObsidian, itemHoeObsidian}); - itemPickaxeQuartz = new ItemPickaxeAA(InitToolMaterials.toolMaterialQuartz, "gemQuartzBlack", "itemPickaxeQuartz", EnumRarity.rare); itemAxeQuartz = new ItemAxeAA(InitToolMaterials.toolMaterialQuartz, "gemQuartzBlack", "itemAxeQuartz", EnumRarity.rare); itemShovelQuartz = new ItemShovelAA(InitToolMaterials.toolMaterialQuartz, "gemQuartzBlack", "itemShovelQuartz", EnumRarity.rare); itemSwordQuartz = new ItemSwordAA(InitToolMaterials.toolMaterialQuartz, "gemQuartzBlack", "itemSwordQuartz", EnumRarity.rare); itemHoeQuartz = new ItemHoeAA(InitToolMaterials.toolMaterialQuartz, "gemQuartzBlack", "itemHoeQuartz", EnumRarity.rare); - ItemUtil.registerItems(new Item[]{itemPickaxeQuartz, itemAxeQuartz, itemShovelQuartz, itemSwordQuartz, itemHoeQuartz}); - woodenPaxel = new ItemAllToolAA(Item.ToolMaterial.WOOD, "plankWood", "woodenPaxel", EnumRarity.uncommon, 5192733); stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, "stone", "stonePaxel", EnumRarity.uncommon, 7040621); ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, "ingotIron", "ironPaxel", EnumRarity.rare, 10920613); @@ -316,6 +227,5 @@ public class InitItems{ emeraldPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialEmerald, "gemEmerald", "emeraldPaxel", EnumRarity.epic, 7723338); obsidianPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialObsidian, "obsidian", "obsidianPaxel", EnumRarity.epic, 4166); quartzPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialQuartz, "gemQuartzBlack", "quartzPaxel", EnumRarity.rare, 1710103); - ItemUtil.registerItems(new Item[]{woodenPaxel, stonePaxel, ironPaxel, goldPaxel, diamondPaxel, emeraldPaxel, obsidianPaxel, quartzPaxel}); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java b/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java index 342640a66..d739984fa 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemBattery.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemEnergy; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; @@ -20,12 +21,9 @@ import net.minecraft.util.IIcon; public class ItemBattery extends ItemEnergy{ - private String name; - public ItemBattery(String name, int capacity, int transfer){ - super(capacity, transfer); + super(capacity, transfer, name); this.setMaxStackSize(1); - this.name = name; } @Override @@ -36,7 +34,7 @@ public class ItemBattery extends ItemEnergy{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -44,9 +42,4 @@ public class ItemBattery extends ItemEnergy{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return name; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBlockBase.java b/src/main/java/ellpeck/actuallyadditions/items/ItemBlockBase.java deleted file mode 100644 index 61d841bab..000000000 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemBlockBase.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file ("ItemBlockBase.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015 Ellpeck - */ - -package ellpeck.actuallyadditions.items; - -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; -import net.minecraft.block.Block; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -public class ItemBlockBase extends ItemBlock{ - - public ItemBlockBase(Block block){ - super(block); - this.setHasSubtypes(false); - this.setMaxDamage(0); - } - - @Override - public String getUnlocalizedName(ItemStack stack){ - return this.getUnlocalizedName(); - } - - @Override - public int getMetadata(int damage){ - return damage; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack); - return rarity == null ? EnumRarity.common : rarity; - } -} diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBooklet.java b/src/main/java/ellpeck/actuallyadditions/items/ItemBooklet.java index 0e7cf9b0b..bf4bc15a7 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemBooklet.java @@ -15,22 +15,22 @@ import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.achievement.TheAchievements; import ellpeck.actuallyadditions.inventory.GuiHandler; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.List; -public class ItemBooklet extends Item implements IActAddItemOrBlock{ +public class ItemBooklet extends ItemBase{ - public ItemBooklet(){ + public ItemBooklet(String name){ + super(name); this.setMaxStackSize(16); this.setMaxDamage(0); } @@ -48,7 +48,7 @@ public class ItemBooklet extends Item implements IActAddItemOrBlock{ @SuppressWarnings("unchecked") @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ - list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc")); + list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getBaseName()+".desc")); } @Override @@ -59,7 +59,7 @@ public class ItemBooklet extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -67,9 +67,4 @@ public class ItemBooklet extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemBooklet"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemChestToCrateUpgrade.java b/src/main/java/ellpeck/actuallyadditions/items/ItemChestToCrateUpgrade.java index 6394ca3f8..cdaf8e693 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemChestToCrateUpgrade.java @@ -13,22 +13,25 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.tile.TileEntityGiantChest; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class ItemChestToCrateUpgrade extends Item implements IActAddItemOrBlock{ +public class ItemChestToCrateUpgrade extends ItemBase{ + + public ItemChestToCrateUpgrade(String name){ + super(name); + } @Override public boolean onItemUse(ItemStack heldStack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ @@ -84,7 +87,7 @@ public class ItemChestToCrateUpgrade extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -93,9 +96,4 @@ public class ItemChestToCrateUpgrade extends Item implements IActAddItemOrBlock{ return this.itemIcon; } - @Override - public String getName(){ - return "itemChestToCrateUpgrade"; - } - } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java index e3bb9ee8a..d1e12a1be 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java @@ -13,15 +13,18 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemFoodBase; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; -import net.minecraft.item.*; +import net.minecraft.item.EnumAction; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; @@ -32,12 +35,12 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; -public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ +public class ItemCoffee extends ItemFoodBase{ public static ArrayList ingredients = new ArrayList(); - public ItemCoffee(){ - super(8, 5.0F, false); + public ItemCoffee(String name){ + super(8, 5.0F, false, name); this.setMaxDamage(3); this.setAlwaysEdible(); this.setMaxStackSize(1); @@ -224,12 +227,7 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "itemCoffee"; + itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } public static class Ingredient{ diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java index d319cf326..3ab6264e8 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffeeBean.java @@ -12,18 +12,17 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemFoodBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class ItemCoffeeBean extends ItemFood implements IActAddItemOrBlock{ +public class ItemCoffeeBean extends ItemFoodBase{ - public ItemCoffeeBean(){ - super(1, 1F, false); + public ItemCoffeeBean(String name){ + super(1, 1F, false, name); this.setMaxDamage(0); } @@ -35,7 +34,7 @@ public class ItemCoffeeBean extends ItemFood implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -43,9 +42,4 @@ public class ItemCoffeeBean extends ItemFood implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemCoffeeBeans"; - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java index ec6e38d4c..49a4adcd9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java @@ -14,19 +14,19 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class ItemCrafterOnAStick extends Item implements IActAddItemOrBlock{ +public class ItemCrafterOnAStick extends ItemBase{ - public ItemCrafterOnAStick(){ + public ItemCrafterOnAStick(String name){ + super(name); this.setMaxStackSize(1); } @@ -46,7 +46,7 @@ public class ItemCrafterOnAStick extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -54,9 +54,4 @@ public class ItemCrafterOnAStick extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemCrafterOnAStick"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCrystal.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCrystal.java index 185e0ecf7..ba50b9b49 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCrystal.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCrystal.java @@ -13,7 +13,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.blocks.BlockCrystal; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,12 +25,13 @@ import net.minecraft.util.IIcon; import java.util.List; -public class ItemCrystal extends Item implements IActAddItemOrBlock{ +public class ItemCrystal extends ItemBase{ @SideOnly(Side.CLIENT) public IIcon[] textures; - public ItemCrystal(){ + public ItemCrystal(String name){ + super(name); this.setHasSubtypes(true); this.setMaxDamage(0); } @@ -69,12 +70,7 @@ public class ItemCrystal extends Item implements IActAddItemOrBlock{ public void registerIcons(IIconRegister iconReg){ this.textures = new IIcon[BlockCrystal.allCrystals.length]; for(int i = 0; i < this.textures.length; i++){ - this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+BlockCrystal.allCrystals[i].name); + this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+BlockCrystal.allCrystals[i].name); } } - - @Override - public String getName(){ - return "itemCrystal"; - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index 12e256de5..7de209878 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -18,6 +18,7 @@ import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors; import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.inventory.GuiHandler; +import ellpeck.actuallyadditions.items.base.ItemEnergy; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.WorldUtil; @@ -55,8 +56,8 @@ public class ItemDrill extends ItemEnergy{ @SideOnly(Side.CLIENT) private IIcon[] allDemDamnIconsMaan; - public ItemDrill(){ - super(500000, 5000); + public ItemDrill(String name){ + super(500000, 5000, name); this.setMaxDamage(0); this.setHasSubtypes(true); } @@ -213,15 +214,10 @@ public class ItemDrill extends ItemEnergy{ public void registerIcons(IIconRegister iconReg){ this.allDemDamnIconsMaan = new IIcon[16]; for(int i = 0; i < this.allDemDamnIconsMaan.length; i++){ - this.allDemDamnIconsMaan[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+TheColoredLampColors.values()[i].name); + this.allDemDamnIconsMaan[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+TheColoredLampColors.values()[i].name); } } - @Override - public String getName(){ - return "itemDrill"; - } - @Override public Multimap getAttributeModifiers(ItemStack stack){ Multimap map = super.getAttributeModifiers(stack); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java index 1d5aa5238..0ff09fef5 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrillUpgrade.java @@ -12,24 +12,22 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ +public class ItemDrillUpgrade extends ItemBase{ public UpgradeType type; - public String unlocalizedName; public ItemDrillUpgrade(UpgradeType type, String unlocName){ + super(unlocName); this.type = type; - this.unlocalizedName = unlocName; this.setMaxStackSize(1); } @@ -63,7 +61,7 @@ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -72,11 +70,6 @@ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ return this.itemIcon; } - @Override - public String getName(){ - return this.unlocalizedName; - } - public enum UpgradeType{ SPEED, SPEED_II, diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java index 50e93aca2..20c73a92d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDust.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.items.metalists.TheDusts; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,11 +25,12 @@ import net.minecraft.util.IIcon; import java.util.List; -public class ItemDust extends Item implements IActAddItemOrBlock{ +public class ItemDust extends ItemBase{ public static final TheDusts[] allDusts = TheDusts.values(); - public ItemDust(){ + public ItemDust(String name){ + super(name); this.setHasSubtypes(true); } @@ -65,12 +66,7 @@ public class ItemDust extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "itemDust"; + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java index 2e56ccf43..8aa94e192 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFertilizer.java @@ -12,18 +12,21 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class ItemFertilizer extends Item implements IActAddItemOrBlock{ +public class ItemFertilizer extends ItemBase{ + + public ItemFertilizer(String name){ + super(name); + } @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ @@ -44,7 +47,7 @@ public class ItemFertilizer extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -52,9 +55,4 @@ public class ItemFertilizer extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemFertilizer"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java index 5021cda07..abe814b26 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemFoods.java @@ -12,28 +12,31 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemFoodBase; import ellpeck.actuallyadditions.items.metalists.TheFoods; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.*; +import net.minecraft.item.EnumAction; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.List; -public class ItemFoods extends ItemFood implements IActAddItemOrBlock{ +public class ItemFoods extends ItemFoodBase{ public static final TheFoods[] allFoods = TheFoods.values(); @SideOnly(Side.CLIENT) public IIcon[] textures; - public ItemFoods(){ - super(0, 0.0F, false); + public ItemFoods(String name){ + super(0, 0.0F, false, name); this.setHasSubtypes(true); this.setMaxDamage(0); TheFoods.setReturnItems(); @@ -109,12 +112,7 @@ public class ItemFoods extends ItemFood implements IActAddItemOrBlock{ public void registerIcons(IIconRegister iconReg){ this.textures = new IIcon[allFoods.length]; for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allFoods[i].name); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allFoods[i].name); } } - - @Override - public String getName(){ - return "itemFood"; - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java index 7131ba083..a766f4233 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemEnergy; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.WorldPos; @@ -33,8 +34,8 @@ import java.util.ArrayList; public class ItemGrowthRing extends ItemEnergy{ - public ItemGrowthRing(){ - super(1000000, 5000); + public ItemGrowthRing(String name){ + super(1000000, 5000, name); } @Override @@ -108,7 +109,7 @@ public class ItemGrowthRing extends ItemEnergy{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -116,9 +117,4 @@ public class ItemGrowthRing extends ItemEnergy{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemGrowthRing"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java b/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java index 1a060ee06..477493cb0 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java @@ -12,26 +12,29 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.recipe.HairyBallHandler; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; -public class ItemHairyBall extends Item implements IActAddItemOrBlock{ +public class ItemHairyBall extends ItemBase{ + + public ItemHairyBall(String name){ + super(name); + } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ if(!world.isRemote){ - ItemStack returnItem = this.getRandomReturnItem(world); + ItemStack returnItem = this.getRandomReturnItem(); if(!player.inventory.addItemStackToInventory(returnItem)){ EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem); entityItem.delayBeforeCanPickup = 0; @@ -43,7 +46,7 @@ public class ItemHairyBall extends Item implements IActAddItemOrBlock{ return stack; } - public ItemStack getRandomReturnItem(World world){ + public ItemStack getRandomReturnItem(){ return ((HairyBallHandler.Return)WeightedRandom.getRandomItem(Util.RANDOM, HairyBallHandler.returns)).returnItem.copy(); } @@ -55,7 +58,7 @@ public class ItemHairyBall extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -63,9 +66,4 @@ public class ItemHairyBall extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemHairyBall"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java b/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java index e63768104..9b9fa79bf 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemJams.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemFoodBase; import ellpeck.actuallyadditions.items.metalists.TheJams; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,7 +23,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; -import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; @@ -31,14 +30,14 @@ import net.minecraft.world.World; import java.util.List; -public class ItemJams extends ItemFood implements IActAddItemOrBlock{ +public class ItemJams extends ItemFoodBase{ public static final TheJams[] allJams = TheJams.values(); @SideOnly(Side.CLIENT) public IIcon overlayIcon; - public ItemJams(){ - super(0, 0.0F, false); + public ItemJams(String name){ + super(0, 0.0F, false, name); this.setHasSubtypes(true); this.setMaxDamage(0); } @@ -86,13 +85,8 @@ public class ItemJams extends ItemFood implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.overlayIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Overlay"); - } - - @Override - public String getName(){ - return "itemJam"; + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + this.overlayIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Overlay"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java index 4555257f2..205d1f593 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemKnife.java @@ -13,19 +13,19 @@ package ellpeck.actuallyadditions.items; import com.google.common.collect.Multimap; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class ItemKnife extends Item implements IActAddItemOrBlock{ +public class ItemKnife extends ItemBase{ - public ItemKnife(){ + public ItemKnife(String name){ + super(name); this.setMaxDamage(100); this.setMaxStackSize(1); this.setContainerItem(this); @@ -49,12 +49,7 @@ public class ItemKnife extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "itemKnife"; + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @SuppressWarnings("unchecked") diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java index 3e05dfc03..49940748f 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java @@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler; import ellpeck.actuallyadditions.tile.TileEntityLaserRelay; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.WorldPos; @@ -22,7 +22,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; @@ -32,9 +31,10 @@ import net.minecraft.world.World; import java.util.List; -public class ItemLaserWrench extends Item implements IActAddItemOrBlock{ +public class ItemLaserWrench extends ItemBase{ - public ItemLaserWrench(){ + public ItemLaserWrench(String name){ + super(name); this.setMaxStackSize(1); } @@ -103,7 +103,7 @@ public class ItemLaserWrench extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -111,9 +111,4 @@ public class ItemLaserWrench extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemLaserWrench"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java index 6a9eb3e29..92ce1dd72 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java @@ -13,7 +13,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.WorldPos; import net.minecraft.block.Block; @@ -23,7 +23,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; @@ -32,11 +31,12 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.Collections; -public class ItemLeafBlower extends Item implements IActAddItemOrBlock{ +public class ItemLeafBlower extends ItemBase{ private final boolean isAdvanced; - public ItemLeafBlower(boolean isAdvanced){ + public ItemLeafBlower(boolean isAdvanced, String name){ + super(name); this.isAdvanced = isAdvanced; this.setMaxStackSize(1); } @@ -66,7 +66,7 @@ public class ItemLeafBlower extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -136,9 +136,4 @@ public class ItemLeafBlower extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return this.isAdvanced ? "itemLeafBlowerAdvanced" : "itemLeafBlower"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java index fbae0243c..c2876868a 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java @@ -12,22 +12,20 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class ItemLens extends Item implements IActAddItemOrBlock, IReconstructorLens{ +public class ItemLens extends ItemBase implements IReconstructorLens{ - private String name; private ReconstructorRecipeHandler.LensType type; public ItemLens(String name, ReconstructorRecipeHandler.LensType type){ - this.name = name; + super(name); this.type = type; this.type.setLens(this); this.setMaxStackSize(1); @@ -41,7 +39,7 @@ public class ItemLens extends Item implements IActAddItemOrBlock, IReconstructor @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -50,11 +48,6 @@ public class ItemLens extends Item implements IActAddItemOrBlock, IReconstructor return this.itemIcon; } - @Override - public String getName(){ - return this.name; - } - @Override public ReconstructorRecipeHandler.LensType getLensType(){ return this.type; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemMagnetRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemMagnetRing.java index e4562dbd8..3cba6c0a9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemMagnetRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemMagnetRing.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemEnergy; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -28,8 +29,8 @@ import java.util.ArrayList; public class ItemMagnetRing extends ItemEnergy{ - public ItemMagnetRing(){ - super(30000000, 5000); + public ItemMagnetRing(String name){ + super(30000000, 5000, name); } @SuppressWarnings("unchecked") @@ -72,7 +73,7 @@ public class ItemMagnetRing extends ItemEnergy{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -80,9 +81,4 @@ public class ItemMagnetRing extends ItemEnergy{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemSuctionRing"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java index f321850a4..c3b857c64 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemMisc.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,13 +25,14 @@ import net.minecraft.util.IIcon; import java.util.List; -public class ItemMisc extends Item implements IActAddItemOrBlock{ +public class ItemMisc extends ItemBase{ public static final TheMiscItems[] allMiscItems = TheMiscItems.values(); @SideOnly(Side.CLIENT) public IIcon[] textures; - public ItemMisc(){ + public ItemMisc(String name){ + super(name); this.setHasSubtypes(true); } @@ -69,12 +70,7 @@ public class ItemMisc extends Item implements IActAddItemOrBlock{ public void registerIcons(IIconRegister iconReg){ this.textures = new IIcon[allMiscItems.length]; for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allMiscItems[i].name); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allMiscItems[i].name); } } - - @Override - public String getName(){ - return "itemMisc"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java index 1261312de..3f883444c 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.tile.IPhantomTile; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.WorldPos; @@ -21,7 +21,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -32,9 +31,10 @@ import net.minecraft.world.World; import java.util.List; -public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{ +public class ItemPhantomConnector extends ItemBase{ - public ItemPhantomConnector(){ + public ItemPhantomConnector(String name){ + super(name); this.setMaxStackSize(1); } @@ -142,7 +142,7 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -150,9 +150,4 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemPhantomConnector"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java index dd7a21790..887fa0606 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPotionRing.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.items.metalists.ThePotionRings; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -29,13 +29,14 @@ import net.minecraft.world.World; import java.util.List; -public class ItemPotionRing extends Item implements IActAddItemOrBlock{ +public class ItemPotionRing extends ItemBase{ public static final ThePotionRings[] allRings = ThePotionRings.values(); private boolean isAdvanced; - public ItemPotionRing(boolean isAdvanced){ + public ItemPotionRing(boolean isAdvanced, String name){ + super(name); this.setHasSubtypes(true); this.setMaxStackSize(1); this.isAdvanced = isAdvanced; @@ -108,12 +109,7 @@ public class ItemPotionRing extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return this.isAdvanced ? "itemPotionRingAdvanced" : "itemPotionRing"; + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java b/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java index 8bb7f9629..c616b0866 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemResonantRice.java @@ -12,17 +12,20 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class ItemResonantRice extends Item implements IActAddItemOrBlock{ +public class ItemResonantRice extends ItemBase{ + + public ItemResonantRice(String name){ + super(name); + } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ @@ -41,7 +44,7 @@ public class ItemResonantRice extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -49,9 +52,4 @@ public class ItemResonantRice extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemResonantRice"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java index 8d059a9fc..ac0288e55 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java @@ -10,10 +10,10 @@ package ellpeck.actuallyadditions.items; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.blocks.BlockPlant; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.blocks.base.BlockPlant; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -public class ItemSeed extends ItemSeeds implements IActAddItemOrBlock{ +public class ItemSeed extends ItemSeeds{ public Block plant; public String name; @@ -39,6 +39,17 @@ public class ItemSeed extends ItemSeeds implements IActAddItemOrBlock{ ((BlockPlant)this.plant).seedItem = this; ((BlockPlant)this.plant).returnItem = returnItem; ((BlockPlant)this.plant).returnMeta = returnMeta; + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + } + + protected String getBaseName(){ + return this.name; } @Override @@ -49,7 +60,7 @@ public class ItemSeed extends ItemSeeds implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -58,11 +69,6 @@ public class ItemSeed extends ItemSeeds implements IActAddItemOrBlock{ return this.itemIcon; } - @Override - public String getName(){ - return this.name; - } - @Override public Block getPlant(IBlockAccess world, int x, int y, int z){ return this.plant; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java index 2604bb915..caa1a1f64 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemSpecialDrop.java @@ -12,8 +12,8 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -28,7 +28,7 @@ import net.minecraft.world.World; import java.util.List; -public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{ +public class ItemSpecialDrop extends ItemBase{ public static final int SOLID_XP_AMOUNT = 8; @@ -36,7 +36,8 @@ public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{ @SideOnly(Side.CLIENT) public IIcon[] textures; - public ItemSpecialDrop(){ + public ItemSpecialDrop(String name){ + super(name); this.setHasSubtypes(true); } @@ -95,12 +96,7 @@ public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{ public void registerIcons(IIconRegister iconReg){ this.textures = new IIcon[allDrops.length]; for(int i = 0; i < textures.length; i++){ - textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allDrops[i].name); + textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allDrops[i].name); } } - - @Override - public String getName(){ - return "itemSpecial"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java b/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java index c5eb15e8b..45612e307 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemEnergy; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.WorldUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -29,8 +30,8 @@ import net.minecraftforge.common.util.ForgeDirection; public class ItemTeleStaff extends ItemEnergy{ - public ItemTeleStaff(){ - super(500000, 10000); + public ItemTeleStaff(String name){ + super(500000, 10000, name); } @Override @@ -82,12 +83,7 @@ public class ItemTeleStaff extends ItemEnergy{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return "itemTeleStaff"; + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java index 9c2295931..8c1759dc7 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.items.base.ItemEnergy; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -25,8 +26,8 @@ import net.minecraft.world.World; public class ItemWaterRemovalRing extends ItemEnergy{ - public ItemWaterRemovalRing(){ - super(1000000, 5000); + public ItemWaterRemovalRing(String name){ + super(1000000, 5000, name); } @Override @@ -81,7 +82,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -89,9 +90,4 @@ public class ItemWaterRemovalRing extends ItemEnergy{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemWaterRemovalRing"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java index 8b5e9919a..00cdf3074 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java @@ -12,18 +12,17 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.items.base.ItemBase; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.ArrayList; -public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{ +public class ItemWingsOfTheBats extends ItemBase{ /** * A List containing all of the Players that can currently fly @@ -37,7 +36,8 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{ */ public static ArrayList wingedPlayers = new ArrayList(); - public ItemWingsOfTheBats(){ + public ItemWingsOfTheBats(String name){ + super(name); this.setMaxStackSize(1); } @@ -100,7 +100,7 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -108,9 +108,4 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return "itemWingsOfTheBats"; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemAllToolAA.java similarity index 91% rename from src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemAllToolAA.java index e9d0e5322..a4b394ac4 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemAllToolAA.java @@ -8,14 +8,15 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items.tools; +package ellpeck.actuallyadditions.items.base; import com.google.common.collect.Sets; import cpw.mods.fml.common.eventhandler.Event; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.config.ConfigValues; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -35,7 +36,7 @@ import java.util.HashSet; import java.util.Set; @SuppressWarnings("unchecked") -public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ +public class ItemAllToolAA extends ItemTool { @SideOnly(Side.CLIENT) private IIcon overlayIcon; @@ -54,6 +55,25 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ this.color = color; this.setMaxDamage(this.getMaxDamage()*4); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -135,11 +155,6 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ return false; } - @Override - public String getName(){ - return name; - } - @Override public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ int[] idsStack = OreDictionary.getOreIDs(stack); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemArmorAA.java similarity index 78% rename from src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemArmorAA.java index c5f1228a0..e823580d2 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemArmorAA.java @@ -8,11 +8,12 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -22,7 +23,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; -public class ItemArmorAA extends ItemArmor implements IActAddItemOrBlock{ +public class ItemArmorAA extends ItemArmor{ private String repairItem; private String name; @@ -37,6 +38,24 @@ public class ItemArmorAA extends ItemArmor implements IActAddItemOrBlock{ //Fixes vanilla's weird durability handling this.setMaxDamage(material.getDurability(type)/10); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -69,11 +88,6 @@ public class ItemArmorAA extends ItemArmor implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - } - - @Override - public String getName(){ - return this.name; + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemAxeAA.java similarity index 71% rename from src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemAxeAA.java index 8362e63f8..afbf74da8 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemAxeAA.java @@ -8,11 +8,12 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items.tools; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; @@ -21,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; -public class ItemAxeAA extends ItemAxe implements IActAddItemOrBlock{ +public class ItemAxeAA extends ItemAxe { private String name; private EnumRarity rarity; @@ -29,9 +30,30 @@ public class ItemAxeAA extends ItemAxe implements IActAddItemOrBlock{ public ItemAxeAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ super(toolMat); + + this.repairItem = repairItem; this.name = unlocalizedName; this.rarity = rarity; - this.repairItem = repairItem; + + this.setMaxDamage(this.getMaxDamage()*4); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -53,7 +75,7 @@ public class ItemAxeAA extends ItemAxe implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -61,9 +83,4 @@ public class ItemAxeAA extends ItemAxe implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return name; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/base/ItemBase.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemBase.java new file mode 100644 index 000000000..12f02dce3 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemBase.java @@ -0,0 +1,44 @@ +/* + * This file ("ItemBase.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015 Ellpeck + */ + +package ellpeck.actuallyadditions.items.base; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.item.Item; + + +public class ItemBase extends Item{ + + private String name; + + public ItemBase(String name){ + this.name = name; + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemBucketAA.java similarity index 68% rename from src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemBucketAA.java index c96d92e63..83ed11d48 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemBucketAA.java @@ -8,11 +8,12 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -22,7 +23,7 @@ import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class ItemBucketAA extends ItemBucket implements IActAddItemOrBlock{ +public class ItemBucketAA extends ItemBucket { private String name; @@ -30,6 +31,24 @@ public class ItemBucketAA extends ItemBucket implements IActAddItemOrBlock{ super(block); this.name = unlocName; this.setContainerItem(Items.bucket); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -40,7 +59,7 @@ public class ItemBucketAA extends ItemBucket implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -48,9 +67,4 @@ public class ItemBucketAA extends ItemBucket implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return this.name; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemEnergy.java similarity index 75% rename from src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemEnergy.java index c29897bb2..748e69371 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemEnergy.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemEnergy.java @@ -8,12 +8,14 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items; +package ellpeck.actuallyadditions.items.base; import cofh.api.energy.ItemEnergyContainer; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -23,12 +25,33 @@ import net.minecraft.world.World; import java.util.List; -public abstract class ItemEnergy extends ItemEnergyContainer implements IActAddItemOrBlock{ +public abstract class ItemEnergy extends ItemEnergyContainer { - public ItemEnergy(int maxPower, int transfer){ + private String name; + + public ItemEnergy(int maxPower, int transfer, String name){ super(maxPower, transfer); this.setHasSubtypes(true); this.setMaxStackSize(1); + this.name = name; + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/base/ItemFoodBase.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemFoodBase.java new file mode 100644 index 000000000..a1f409620 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemFoodBase.java @@ -0,0 +1,45 @@ +/* + * This file ("ItemFoodBase.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015 Ellpeck + */ + +package ellpeck.actuallyadditions.items.base; + +import cpw.mods.fml.common.registry.GameRegistry; +import ellpeck.actuallyadditions.creative.CreativeTab; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.item.ItemFood; + + +public class ItemFoodBase extends ItemFood{ + + private String name; + + public ItemFoodBase(int heal, float saturation, boolean wolfFood, String name){ + super(heal, saturation, wolfFood); + this.name = name; + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemHoeAA.java similarity index 66% rename from src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemHoeAA.java index b5995960c..8bcb49471 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemHoeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemHoeAA.java @@ -8,32 +8,53 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items.tools; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; -public class ItemHoeAA extends ItemHoe implements IActAddItemOrBlock{ +public class ItemHoeAA extends ItemHoe { private String name; - private String oredictName; private EnumRarity rarity; private String repairItem; - public ItemHoeAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ + public ItemHoeAA(Item.ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ super(toolMat); + + this.repairItem = repairItem; this.name = unlocalizedName; this.rarity = rarity; - this.repairItem = repairItem; - this.oredictName = name; + + this.setMaxDamage(this.getMaxDamage()*4); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -55,7 +76,7 @@ public class ItemHoeAA extends ItemHoe implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -63,13 +84,4 @@ public class ItemHoeAA extends ItemHoe implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return name; - } - - private String getOredictName(){ - return this.oredictName; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemPickaxeAA.java similarity index 71% rename from src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemPickaxeAA.java index 493ba88c2..ea415b238 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemPickaxeAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemPickaxeAA.java @@ -8,11 +8,12 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items.tools; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; @@ -21,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; -public class ItemPickaxeAA extends ItemPickaxe implements IActAddItemOrBlock{ +public class ItemPickaxeAA extends ItemPickaxe{ private String name; private EnumRarity rarity; @@ -29,9 +30,30 @@ public class ItemPickaxeAA extends ItemPickaxe implements IActAddItemOrBlock{ public ItemPickaxeAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ super(toolMat); + + this.repairItem = repairItem; this.name = unlocalizedName; this.rarity = rarity; - this.repairItem = repairItem; + + this.setMaxDamage(this.getMaxDamage()*4); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -53,7 +75,7 @@ public class ItemPickaxeAA extends ItemPickaxe implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -61,9 +83,4 @@ public class ItemPickaxeAA extends ItemPickaxe implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return name; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemShovelAA.java similarity index 66% rename from src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemShovelAA.java index 9ea9b3ed1..647b35304 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemShovelAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemShovelAA.java @@ -8,32 +8,53 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items.tools; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; -public class ItemShovelAA extends ItemSpade implements IActAddItemOrBlock{ +public class ItemShovelAA extends ItemSpade { private String name; - private String oredictName; private EnumRarity rarity; private String repairItem; - public ItemShovelAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ + public ItemShovelAA(Item.ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ super(toolMat); + + this.repairItem = repairItem; this.name = unlocalizedName; this.rarity = rarity; - this.repairItem = repairItem; - this.oredictName = name; + + this.setMaxDamage(this.getMaxDamage()*4); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; } @Override @@ -55,7 +76,7 @@ public class ItemShovelAA extends ItemSpade implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -63,13 +84,4 @@ public class ItemShovelAA extends ItemSpade implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return name; - } - - private String getOredictName(){ - return oredictName; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java b/src/main/java/ellpeck/actuallyadditions/items/base/ItemSwordAA.java similarity index 67% rename from src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java rename to src/main/java/ellpeck/actuallyadditions/items/base/ItemSwordAA.java index 0355fd30b..919a52623 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemSwordAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/base/ItemSwordAA.java @@ -8,11 +8,13 @@ * © 2015 Ellpeck */ -package ellpeck.actuallyadditions.items.tools; +package ellpeck.actuallyadditions.items.base; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.util.IActAddItemOrBlock; +import ellpeck.actuallyadditions.blocks.base.ItemBlockBase; +import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; @@ -21,19 +23,42 @@ import net.minecraft.item.ItemSword; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; -public class ItemSwordAA extends ItemSword implements IActAddItemOrBlock{ +public class ItemSwordAA extends ItemSword { private String name; - private String oredictName; private EnumRarity rarity; private String repairItem; public ItemSwordAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity){ super(toolMat); + + this.repairItem = repairItem; this.name = unlocalizedName; this.rarity = rarity; - this.repairItem = repairItem; - this.oredictName = name; + + this.setMaxDamage(this.getMaxDamage()*4); + + this.register(); + } + + private void register(){ + this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); + GameRegistry.registerItem(this, this.getBaseName()); + if(this.shouldAddCreative()){ + this.setCreativeTab(CreativeTab.instance); + } + } + + public boolean shouldAddCreative(){ + return true; + } + + protected String getBaseName(){ + return this.name; + } + + protected Class getItemBlock(){ + return ItemBlockBase.class; } @Override @@ -55,7 +80,7 @@ public class ItemSwordAA extends ItemSword implements IActAddItemOrBlock{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()); } @Override @@ -63,13 +88,4 @@ public class ItemSwordAA extends ItemSword implements IActAddItemOrBlock{ public IIcon getIcon(ItemStack stack, int pass){ return this.itemIcon; } - - @Override - public String getName(){ - return name; - } - - private String getOredictName(){ - return oredictName; - } } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java index 27ef9f877..56f6425e9 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java @@ -44,12 +44,12 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip @Override public void loadTransferRects(){ - transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), this.getName())); + transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), this.getBaseName())); } @Override public void loadCraftingRecipes(String outputId, Object... results){ - if(outputId.equals(this.getName()) && (getClass() == NEICrusherRecipe.class || getClass() == Double.class)){ + if(outputId.equals(this.getBaseName()) && (getClass() == NEICrusherRecipe.class || getClass() == Double.class)){ for(CrusherRecipeRegistry.CrusherRecipe recipe : CrusherRecipeRegistry.recipes){ arecipes.add(new CachedCrush(recipe.getRecipeInputs(), recipe.getRecipeOutputOnes(), recipe.getRecipeOutputTwos(), recipe.outputTwoChance, this)); } @@ -86,7 +86,7 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip @Override public String getOverlayIdentifier(){ - return this.getName(); + return this.getBaseName(); } @Override @@ -121,13 +121,13 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip } } - protected String getName(){ + protected String getBaseName(){ return "actuallyadditions."+(this instanceof Double ? "crushingDouble" : "crushing"); } @Override public String getRecipeName(){ - return StringUtil.localize("container.nei."+this.getName()+".name"); + return StringUtil.localize("container.nei."+this.getBaseName()+".name"); } public static class Double extends NEICrusherRecipe{ @@ -139,8 +139,8 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip @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())); + transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getBaseName())); + transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getBaseName())); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java b/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java deleted file mode 100644 index f91101dac..000000000 --- a/src/main/java/ellpeck/actuallyadditions/util/BlockUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file ("BlockUtil.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015 Ellpeck - */ - -package ellpeck.actuallyadditions.util; - -import cpw.mods.fml.common.registry.GameRegistry; -import ellpeck.actuallyadditions.creative.CreativeTab; -import ellpeck.actuallyadditions.items.ItemBlockBase; -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; - -public class BlockUtil{ - - public static void register(Block block){ - register(block, ItemBlockBase.class); - } - - public static void register(Block block, Class itemBlock){ - block.setCreativeTab(CreativeTab.instance); - block.setBlockName(createUnlocalizedName(block)); - GameRegistry.registerBlock(block, itemBlock, ((IActAddItemOrBlock)block).getName()); - } - - public static String createUnlocalizedName(Block block){ - return ModUtil.MOD_ID_LOWER+"."+((IActAddItemOrBlock)block).getName(); - } -} diff --git a/src/main/java/ellpeck/actuallyadditions/util/IActAddItemOrBlock.java b/src/main/java/ellpeck/actuallyadditions/util/IActAddItemOrBlock.java deleted file mode 100644 index 5be186b19..000000000 --- a/src/main/java/ellpeck/actuallyadditions/util/IActAddItemOrBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file ("IActAddItemOrBlock.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015 Ellpeck - */ - -package ellpeck.actuallyadditions.util; - -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; - -/** - * The indicator interface for any block or item that is part of ActuallyAdditions - */ -public interface IActAddItemOrBlock{ - - String getName(); - - EnumRarity getRarity(ItemStack stack); - -} diff --git a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java index 01a9f17f5..2f25c92d1 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java @@ -10,8 +10,6 @@ package ellpeck.actuallyadditions.util; -import cpw.mods.fml.common.registry.GameRegistry; -import ellpeck.actuallyadditions.creative.CreativeTab; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -29,34 +27,6 @@ public class ItemUtil{ return null; } - public static void registerItems(Item[] items){ - for(Item item : items){ - register(item); - } - } - - public static void register(Item item){ - item.setCreativeTab(CreativeTab.instance); - item.setUnlocalizedName(createUnlocalizedName(item)); - GameRegistry.registerItem(item, ((IActAddItemOrBlock)item).getName()); - } - - public static String createUnlocalizedName(Item item){ - return ModUtil.MOD_ID_LOWER+"."+((IActAddItemOrBlock)item).getName(); - } - - /** - * Returns true if stacksOne contains every ItemStack in stackTwo - */ - public static boolean containsAll(ItemStack[] stacksOne, ItemStack[] stacksTwo, boolean checkWildcard){ - for(ItemStack stackTwo : stacksTwo){ - if(!contains(stacksOne, stackTwo, checkWildcard)){ - return false; - } - } - return true; - } - /** * Returns true if array contains stack or if both contain null */ diff --git a/src/main/java/ellpeck/actuallyadditions/util/Util.java b/src/main/java/ellpeck/actuallyadditions/util/Util.java index 1ab24fb39..414b3eb06 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/Util.java +++ b/src/main/java/ellpeck/actuallyadditions/util/Util.java @@ -15,10 +15,13 @@ import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler; import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; @@ -30,6 +33,7 @@ public class Util{ public static final Random RANDOM = new Random(); public static final int WILDCARD = OreDictionary.WILDCARD_VALUE; + public static final EnumRarity FALLBACK_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+".fallback", EnumChatFormatting.DARK_RED, ModUtil.NAME+" Fallback"); public static void registerEvent(Object o){ MinecraftForge.EVENT_BUS.register(o);