Changed ItemBlock and Rarity Method because.

This commit is contained in:
Ellpeck 2015-10-23 16:48:56 +02:00
parent 247122c312
commit a6f989f45c
60 changed files with 283 additions and 1007 deletions

View file

@ -24,7 +24,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -106,33 +105,14 @@ public class BlockBreaker extends BlockContainerBase implements IActAddItemOrBlo
return this.isPlacer ? "blockPlacer" : "blockBreaker";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -74,33 +73,14 @@ public class BlockCanolaPress extends BlockContainerBase implements IActAddItemO
return "blockCanolaPress";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -91,33 +90,14 @@ public class BlockCoalGenerator extends BlockContainerBase implements IActAddIte
return "blockCoalGenerator";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -24,7 +24,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -116,27 +115,8 @@ public class BlockCoffeeMachine extends BlockContainerBase implements IActAddIte
return "blockCoffeeMachine";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
return EnumRarity.epic;
}
}

View file

@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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;
@ -23,7 +24,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -52,6 +52,11 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{
return this.isOn ? "blockColoredLampOn" : "blockColoredLamp";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public IIcon getIcon(int side, int meta){
return meta >= allLampTypes.length ? null : textures[meta];
@ -132,7 +137,7 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{
return this.isOn ? 15 : 0;
}
public static class TheItemBlock extends ItemBlock{
public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){
super(block);
@ -155,12 +160,13 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
return rarity == null ? EnumRarity.common : rarity;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return InitBlocks.blockColoredLamp.getUnlocalizedName()+allLampTypes[stack.getItemDamage()].getName();
return InitBlocks.blockColoredLamp.getUnlocalizedName()+allLampTypes[stack.getItemDamage()].name;
}
}
}

View file

@ -26,7 +26,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@ -143,27 +142,8 @@ public class BlockCompost extends BlockContainerBase implements IActAddItemOrBlo
return "blockCompost";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -24,7 +24,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -103,33 +102,14 @@ public class BlockDirectionalBreaker extends BlockContainerBase implements IActA
return "blockDirectionalBreaker";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
}
}

View file

@ -24,7 +24,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -103,33 +102,14 @@ public class BlockDropper extends BlockContainerBase implements IActAddItemOrBlo
return "blockDropper";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -23,7 +23,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -87,33 +86,14 @@ public class BlockEnergizer extends BlockContainerBase implements IActAddItemOrB
return this.isEnergizer ? "blockEnergizer" : "blockEnervator";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -74,33 +73,14 @@ public class BlockFeeder extends BlockContainerBase implements IActAddItemOrBloc
return "blockFeeder";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -80,27 +79,8 @@ public class BlockFermentingBarrel extends BlockContainerBase implements IActAdd
return "blockFermentingBarrel";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
return EnumRarity.rare;
}
}

View file

@ -15,12 +15,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityFishingNet;
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;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -73,27 +71,8 @@ public class BlockFishingNet extends BlockContainerBase implements IActAddItemOr
return "blockFishingNet";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
return EnumRarity.rare;
}
}

View file

@ -24,7 +24,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -106,33 +105,14 @@ public class BlockFluidCollector extends BlockContainerBase implements IActAddIt
return this.isPlacer ? "blockFluidPlacer" : "blockFluidCollector";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -14,11 +14,9 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -67,27 +65,8 @@ public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemO
return this.name;
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
return EnumRarity.epic;
}
}

View file

@ -23,7 +23,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -163,33 +162,14 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte
return "blockFurnaceDouble";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -15,13 +15,11 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar;
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;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -87,27 +85,8 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IActAddItem
return "blockFurnaceSolar";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
return EnumRarity.uncommon;
}
}

View file

@ -18,7 +18,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -51,27 +50,8 @@ public class BlockGeneric extends Block implements IActAddItemOrBlock{
return this.name;
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
return EnumRarity.common;
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -76,35 +75,14 @@ public class BlockGiantChest extends BlockContainerBase implements IActAddItemOr
return "blockGiantChest";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -15,11 +15,9 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityGreenhouseGlass;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Facing;
@ -76,32 +74,14 @@ public class BlockGreenhouseGlass extends BlockContainerBase implements IActAddI
return "blockGreenhouseGlass";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGreenhouseGlass();
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -113,33 +112,14 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo
return isDouble ? "blockGrinderDouble" : "blockGrinder";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return ((BlockGrinder)this.field_150939_a).isDouble ? EnumRarity.epic : EnumRarity.rare;
}
}
}

View file

@ -15,12 +15,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityHeatCollector;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
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.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -75,27 +73,8 @@ public class BlockHeatCollector extends BlockContainerBase implements IActAddIte
return "blockHeatCollector";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
return EnumRarity.uncommon;
}
}

View file

@ -14,6 +14,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
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;
@ -24,7 +25,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -81,6 +81,11 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
return this.isAdvanced ? "blockInputterAdvanced" : "blockInputter";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
if(!world.isRemote){
@ -93,7 +98,7 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public static class TheItemBlock extends ItemBlockBase{
private long lastSysTime;
private int toPick;
@ -129,7 +134,8 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
@Override
public EnumRarity getRarity(ItemStack stack){
return ((BlockInputter)this.field_150939_a).isAdvanced ? EnumRarity.epic : EnumRarity.rare;
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
return rarity == null ? EnumRarity.common : rarity;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -89,33 +88,14 @@ public class BlockItemRepairer extends BlockContainerBase implements IActAddItem
return "blockItemRepairer";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
}
}

View file

@ -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.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -86,6 +85,11 @@ public class BlockLampPowerer extends Block implements IActAddItemOrBlock{
return "blockLampPowerer";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
private void updateLamp(World world, int x, int y, int z){
if(!world.isRemote){
WorldPos coords = WorldUtil.getCoordsFromSide(ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)), world, x, y, z, 0);
@ -103,28 +107,4 @@ public class BlockLampPowerer extends Block implements IActAddItemOrBlock{
}
}
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
}
}

View file

@ -15,12 +15,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityLaserRelay;
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;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -72,32 +70,13 @@ public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOr
return "blockLaserRelay";
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityLaserRelay();
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityLaserRelay();
}
}

View file

@ -16,12 +16,10 @@ import ellpeck.actuallyadditions.tile.TileEntityLavaFactoryController;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -81,27 +79,8 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IA
return "blockLavaFactoryController";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
return EnumRarity.rare;
}
}

View file

@ -20,7 +20,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -75,33 +74,14 @@ public class BlockLeafGenerator extends BlockContainerBase implements IActAddIte
return "blockLeafGenerator";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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;
@ -22,7 +23,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -68,7 +68,7 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allMiscBlocks[i].getName());
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allMiscBlocks[i].name);
}
this.stoneCasingSeasonalTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockMiscStoneCasingSnowTop");
@ -80,7 +80,12 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{
return "blockMisc";
}
public static class TheItemBlock extends ItemBlock{
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
}
public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){
super(block);
@ -90,7 +95,7 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allMiscBlocks.length ? " ERROR!" : allMiscBlocks[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allMiscBlocks.length ? " ERROR!" : allMiscBlocks[stack.getItemDamage()].name);
}
@Override
@ -100,7 +105,8 @@ public class BlockMisc extends Block implements IActAddItemOrBlock{
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
return rarity == null ? EnumRarity.common : rarity;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -91,33 +90,14 @@ public class BlockOilGenerator extends BlockContainerBase implements IActAddItem
return "blockOilGenerator";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -76,33 +75,14 @@ public class BlockOreMagnet extends BlockContainerBase implements IActAddItemOrB
return "blockOreMagnet";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.rare;
}
}
}

View file

@ -25,7 +25,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -144,6 +143,11 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo
}
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
public enum Type{
FACE,
PLACER,
@ -151,28 +155,4 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo
LIQUIFACE,
ENERGYFACE
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
}
}

View file

@ -15,12 +15,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityPhantomBooster;
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;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -70,32 +68,13 @@ public class BlockPhantomBooster extends BlockContainerBase implements IActAddIt
return "blockPhantomBooster";
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityPhantomBooster();
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityPhantomBooster();
}
}

View file

@ -14,12 +14,10 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -92,6 +90,11 @@ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{
return this.name;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public int damageDropped(int meta){
return this.returnMeta;
@ -106,28 +109,4 @@ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{
public int quantityDropped(int meta, int fortune, Random random){
return meta >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(meta, fortune, random);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
}
}

View file

@ -22,7 +22,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -71,6 +70,11 @@ public class BlockRangedCollector extends BlockContainerBase implements IActAddI
return "blockRangedCollector";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
if(!world.isRemote){
@ -84,28 +88,4 @@ public class BlockRangedCollector extends BlockContainerBase implements IActAddI
}
super.breakBlock(world, x, y, z, block, par6);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
}
}

View file

@ -17,9 +17,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
@ -98,39 +96,8 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{
return this.name;
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
if(world.getBlock(x, y, z) == this.field_150939_a && ((side == 1 && world.getBlockMetadata(x, y, z) == 0) || (side == 0 && world.getBlockMetadata(x, y, z) == 1))){
if(world.setBlock(x, y, z, ((BlockSlabs)this.field_150939_a).fullBlock, 0, 3)){
world.playSoundEffect(x+0.5F, y+0.5F, z+0.5F, this.field_150939_a.stepSound.getBreakSound(), (this.field_150939_a.stepSound.getVolume()+1.0F)/2.0F, this.field_150939_a.stepSound.getPitch()*0.8F);
stack.stackSize--;
return true;
}
}
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
return EnumRarity.common;
}
}

View file

@ -24,7 +24,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -131,27 +130,8 @@ public class BlockSmileyCloud extends BlockContainerBase implements IActAddItemO
return "blockSmileyCloud";
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.uncommon;
}
return EnumRarity.rare;
}
}

View file

@ -14,7 +14,6 @@ import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class BlockStair extends BlockStairs implements IActAddItemOrBlock{
@ -32,27 +31,8 @@ public class BlockStair extends BlockStairs implements IActAddItemOrBlock{
return this.name;
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(Block block){
super(block);
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
public int getMetadata(int meta){
return meta;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
return EnumRarity.common;
}
}

View file

@ -24,7 +24,6 @@ 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.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
@ -144,6 +143,11 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{
return "blockTreasureChest";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
private void dropItems(World world, int x, int y, int z){
Random rand = new Random();
for(int i = 0; i < MathHelper.getRandomIntegerInRange(rand, 3, 6); i++){
@ -166,28 +170,4 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{
itemStack.stackSize = 0;
}
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
}
}

View file

@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.metalists.TheWildPlants;
import ellpeck.actuallyadditions.items.ItemBlockBase;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
@ -21,7 +22,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -85,7 +85,12 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{
return "blockWild";
}
public static class TheItemBlock extends ItemBlock{
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity;
}
public static class TheItemBlock extends ItemBlockBase{
public TheItemBlock(Block block){
super(block);
@ -100,7 +105,8 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity;
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
return rarity == null ? EnumRarity.common : rarity;
}
@SideOnly(Side.CLIENT)
@ -111,8 +117,7 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allWildPlants.length ? " ERROR!" : allWildPlants[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allWildPlants.length ? " ERROR!" : allWildPlants[stack.getItemDamage()].name);
}
}
}

View file

@ -26,7 +26,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -118,6 +117,11 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem
return "blockXPSolidifier";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
@ -149,28 +153,4 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem
entityItem.motionZ = world.rand.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem);
}
public static class TheItemBlock extends ItemBlock{
public TheItemBlock(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){
return EnumRarity.epic;
}
}
}

View file

@ -142,9 +142,9 @@ public class InitBlocks{
BlockUtil.register(blockTestifiBucksWhiteSlab);
blockColoredLamp = new BlockColoredLamp(false);
BlockUtil.register(blockColoredLamp);
BlockUtil.register(blockColoredLamp, BlockColoredLamp.TheItemBlock.class);
blockColoredLampOn = new BlockColoredLamp(true);
BlockUtil.register(blockColoredLampOn);
BlockUtil.register(blockColoredLampOn, BlockColoredLamp.TheItemBlock.class);
blockLampPowerer = new BlockLampPowerer();
BlockUtil.register(blockLampPowerer);
@ -207,7 +207,7 @@ public class InitBlocks{
BlockUtil.register(blockCompost);
blockMisc = new BlockMisc();
BlockUtil.register(blockMisc);
BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class);
blockFeeder = new BlockFeeder();
BlockUtil.register(blockFeeder);
@ -225,10 +225,10 @@ public class InitBlocks{
BlockUtil.register(blockFurnaceDouble);
blockInputter = new BlockInputter(false);
BlockUtil.register(blockInputter);
BlockUtil.register(blockInputter, BlockInputter.TheItemBlock.class);
blockInputterAdvanced = new BlockInputter(true);
BlockUtil.register(blockInputterAdvanced);
BlockUtil.register(blockInputterAdvanced, BlockInputter.TheItemBlock.class);
blockFishingNet = new BlockFishingNet();
BlockUtil.register(blockFishingNet);
@ -267,7 +267,7 @@ public class InitBlocks{
BlockUtil.register(blockPhantomBooster);
blockWildPlant = new BlockWildPlant();
BlockUtil.register(blockWildPlant, false);
BlockUtil.register(blockWildPlant, BlockWildPlant.TheItemBlock.class, false);
registerFluids();
}

View file

@ -10,9 +10,7 @@
package ellpeck.actuallyadditions.blocks.metalists;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
public enum TheColoredLampColors implements IActAddItemOrBlock{
public enum TheColoredLampColors{
WHITE("White"),
ORANGE("Orange"),
@ -41,16 +39,11 @@ public enum TheColoredLampColors implements IActAddItemOrBlock{
if(color.substring(0, 3).equals("dye")){
String actualName = color.substring(3);
for(int i = 0; i < values().length; i++){
if(values()[i].getName().equals(actualName)){
if(values()[i].name.equals(actualName)){
return values()[i];
}
}
}
return null;
}
@Override
public String getName(){
return name;
}
}

View file

@ -10,10 +10,9 @@
package ellpeck.actuallyadditions.blocks.metalists;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.item.EnumRarity;
public enum TheMiscBlocks implements IActAddItemOrBlock{
public enum TheMiscBlocks{
QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare),
QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare),
@ -33,9 +32,4 @@ public enum TheMiscBlocks implements IActAddItemOrBlock{
this.name = name;
this.rarity = rarity;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -11,11 +11,10 @@
package ellpeck.actuallyadditions.blocks.metalists;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.block.Block;
import net.minecraft.item.EnumRarity;
public enum TheWildPlants implements IActAddItemOrBlock{
public enum TheWildPlants{
CANOLA("Canola", EnumRarity.rare, InitBlocks.blockCanola),
FLAX("Flax", EnumRarity.rare, InitBlocks.blockFlax),
@ -31,9 +30,4 @@ public enum TheWildPlants implements IActAddItemOrBlock{
this.rarity = rarity;
this.wildVersionOf = wildVersionOf;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -0,0 +1,42 @@
/*
* 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;
}
}

View file

@ -94,4 +94,5 @@ public class ItemChestToCrateUpgrade extends Item implements IActAddItemOrBlock{
public String getName(){
return "itemChestToCrateUpgrade";
}
}

View file

@ -39,7 +39,7 @@ public class ItemDust extends Item implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allDusts.length ? " ERROR!" : allDusts[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allDusts.length ? " ERROR!" : allDusts[stack.getItemDamage()].name);
}
@Override

View file

@ -85,7 +85,7 @@ public class ItemFoods extends ItemFood implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allFoods.length ? " ERROR!" : allFoods[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allFoods.length ? " ERROR!" : allFoods[stack.getItemDamage()].name);
}
@Override
@ -105,7 +105,7 @@ public class ItemFoods extends ItemFood implements IActAddItemOrBlock{
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allFoods[i].getName());
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allFoods[i].name);
}
}

View file

@ -48,7 +48,7 @@ public class ItemJams extends ItemFood implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allJams.length ? " ERROR!" : allJams[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allJams.length ? " ERROR!" : allJams[stack.getItemDamage()].name);
}
@Override

View file

@ -45,7 +45,7 @@ public class ItemMisc extends Item implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allMiscItems.length ? " ERROR!" : allMiscItems[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allMiscItems.length ? " ERROR!" : allMiscItems[stack.getItemDamage()].name);
}
@Override
@ -65,7 +65,7 @@ public class ItemMisc extends Item implements IActAddItemOrBlock{
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allMiscItems[i].getName());
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allMiscItems[i].name);
}
}

View file

@ -48,7 +48,7 @@ public class ItemPotionRing extends Item implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allRings.length ? " ERROR!" : allRings[stack.getItemDamage()].getName().substring("potion".length()));
return this.getUnlocalizedName()+(stack.getItemDamage() >= allRings.length ? " ERROR!" : allRings[stack.getItemDamage()].name.substring("potion".length()));
}
@Override
@ -86,7 +86,7 @@ public class ItemPotionRing extends Item implements IActAddItemOrBlock{
public String getItemStackDisplayName(ItemStack stack){
String standardName = StringUtil.localize(this.getUnlocalizedName()+".name");
if(stack.getItemDamage() < allRings.length){
String effect = StringUtil.localize(allRings[stack.getItemDamage()].getName());
String effect = StringUtil.localize(allRings[stack.getItemDamage()].name);
return standardName+" "+effect;
}
return standardName;

View file

@ -71,7 +71,7 @@ public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName()+(stack.getItemDamage() >= allDrops.length ? " ERROR!" : allDrops[stack.getItemDamage()].getName());
return this.getUnlocalizedName()+(stack.getItemDamage() >= allDrops.length ? " ERROR!" : allDrops[stack.getItemDamage()].name);
}
@Override
@ -91,7 +91,7 @@ public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allDrops[i].getName());
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+allDrops[i].name);
}
}

View file

@ -10,11 +10,10 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.item.EnumRarity;
public enum TheDusts implements IActAddItemOrBlock{
public enum TheDusts{
IRON("Iron", 7826534, EnumRarity.common),
GOLD("Gold", 14335744, EnumRarity.uncommon),
@ -35,8 +34,5 @@ public enum TheDusts implements IActAddItemOrBlock{
this.rarity = rarity;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -11,12 +11,11 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
public enum TheFoods implements IActAddItemOrBlock{
public enum TheFoods{
CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.common),
PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.common),
@ -62,9 +61,4 @@ public enum TheFoods implements IActAddItemOrBlock{
FRENCH_FRIES.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal());
FISH_N_CHIPS.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal());
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -10,10 +10,9 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.item.EnumRarity;
public enum TheJams implements IActAddItemOrBlock{
public enum TheJams{
CU_BA_RA("CuBaRa", 6, 0.1F, EnumRarity.rare, 5, 12, 12595273),
GRA_KI_BA("GraKiBa", 6, 0.1F, EnumRarity.rare, 16, 13, 5492820),
@ -39,9 +38,4 @@ public enum TheJams implements IActAddItemOrBlock{
this.secondEffectToGet = secondEffectID;
this.color = color;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -10,10 +10,9 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.item.EnumRarity;
public enum TheMiscItems implements IActAddItemOrBlock{
public enum TheMiscItems{
PAPER_CONE("PaperCone", EnumRarity.common),
MASHED_FOOD("MashedFood", EnumRarity.uncommon),
@ -39,9 +38,4 @@ public enum TheMiscItems implements IActAddItemOrBlock{
this.name = name;
this.rarity = rarity;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -10,14 +10,13 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
public enum ThePotionRings implements IActAddItemOrBlock{
public enum ThePotionRings{
SPEED(Potion.moveSpeed.getName(), 8171462, Potion.moveSpeed.getId(), 0, 1, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)),
//Slowness
@ -63,9 +62,4 @@ public enum ThePotionRings implements IActAddItemOrBlock{
this.needsWaitBeforeActivating = needsWaitBeforeActivating;
this.craftingItem = craftingItem;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -11,14 +11,13 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.item.EnumRarity;
public enum TheSpecialDrops implements IActAddItemOrBlock{
public enum TheSpecialDrops{
SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 40, 3, EntityCreature.class, EnumRarity.uncommon, ConfigBoolValues.EXPERIENCE_DROP.isEnabled()),
BLOOD_FRAGMENT("BloodFragment", 15, 1, EntityCreature.class, EnumRarity.uncommon, ConfigBoolValues.BLOOD_DROP.isEnabled()),
@ -42,9 +41,4 @@ public enum TheSpecialDrops implements IActAddItemOrBlock{
this.dropFrom = dropFrom;
this.canDrop = canDrop;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -12,27 +12,28 @@ 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{
@SuppressWarnings("unchecked")
public static void register(Block block){
register(block, true);
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
register(block, itemBlock, true);
}
public static void register(Block block){
register(block, ItemBlockBase.class, true);
}
@SuppressWarnings("unchecked")
public static void register(Block block, boolean addTab){
register(block, ItemBlockBase.class, addTab);
}
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab){
block.setCreativeTab(addTab ? CreativeTab.instance : null);
block.setBlockName(createUnlocalizedName(block));
for(Class sub : block.getClass().getDeclaredClasses()){
if(sub.getSuperclass() == ItemBlock.class){
GameRegistry.registerBlock(block, sub, ((IActAddItemOrBlock)block).getName());
break;
}
}
GameRegistry.registerBlock(block, itemBlock, ((IActAddItemOrBlock)block).getName());
}
public static String createUnlocalizedName(Block block){

View file

@ -10,6 +10,9 @@
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
*/
@ -17,4 +20,6 @@ public interface IActAddItemOrBlock{
String getName();
EnumRarity getRarity(ItemStack stack);
}