Cleaned up some registry

This commit is contained in:
Ellpeck 2016-03-18 18:38:39 +01:00
parent 9720381540
commit dc8ad581ad
22 changed files with 55 additions and 219 deletions

View file

@ -8,8 +8,9 @@
* © 2016 Ellpeck * © 2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.blocks.base; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockFenceGate;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockWallAA;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.util.CompatUtil; import de.ellpeck.actuallyadditions.mod.util.CompatUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.mod.blocks.base; package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -21,7 +21,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class BlockBase extends Block{ public class BlockBase extends Block{
@ -35,14 +34,7 @@ public class BlockBase extends Block{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.mod.blocks.base; package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.BlockBush; import net.minecraft.block.BlockBush;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
@ -20,7 +20,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class BlockBushBase extends BlockBush{ public class BlockBushBase extends BlockBush{
@ -34,14 +33,7 @@ public class BlockBushBase extends BlockBush{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,8 +11,7 @@
package de.ellpeck.actuallyadditions.mod.blocks.base; package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -22,7 +21,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class BlockFluidFlowing extends BlockFluidClassic{ public class BlockFluidFlowing extends BlockFluidClassic{
@ -37,14 +35,7 @@ public class BlockFluidFlowing extends BlockFluidClassic{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
} }
protected String getBaseName(){ protected String getBaseName(){

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.mod.blocks.base; package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.BlockCrops; import net.minecraft.block.BlockCrops;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -26,7 +26,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.fml.common.registry.GameRegistry;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -48,14 +47,7 @@ public class BlockPlant extends BlockCrops{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -12,14 +12,13 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockStairs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class BlockStair extends BlockStairs{ public class BlockStair extends BlockStairs{
@ -38,14 +37,7 @@ public class BlockStair extends BlockStairs{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -51,9 +51,6 @@ public class ItemBlockBase extends ItemBlock{
else if(this.block instanceof BlockStair){ else if(this.block instanceof BlockStair){
return ((BlockStair)this.block).getRarity(stack); return ((BlockStair)this.block).getRarity(stack);
} }
else if(this.block instanceof BlockWallAA){
return ((BlockWallAA)this.block).getRarity(stack);
}
else if(this.block instanceof BlockBushBase){ else if(this.block instanceof BlockBushBase){
return ((BlockBushBase)this.block).getRarity(stack); return ((BlockBushBase)this.block).getRarity(stack);
} }

View file

@ -12,15 +12,14 @@ package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool; import net.minecraft.item.ItemTool;
@ -28,8 +27,6 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@ -66,15 +63,7 @@ public class ItemAllToolAA extends ItemTool{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }
@ -94,48 +83,7 @@ public class ItemAllToolAA extends ItemTool{
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
if(!playerIn.canPlayerEdit(pos.offset(side), side, stack)){ return Items.iron_hoe.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ);
return false;
}
else{
int hook = ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos);
if(hook != 0){
return hook > 0;
}
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
if(side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())){
if(block == Blocks.grass){
return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getDefaultState());
}
if(block == Blocks.dirt){
switch(state.getValue(BlockDirt.VARIANT)){
case DIRT:
return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getDefaultState());
case COARSE_DIRT:
return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
}
}
}
return false;
}
}
private boolean useHoe(ItemStack stack, EntityPlayer player, World worldIn, BlockPos target, IBlockState newState){
worldIn.playSoundEffect((double)((float)target.getX()+0.5F), (double)((float)target.getY()+0.5F), (double)((float)target.getZ()+0.5F), newState.getBlock().stepSound.getStepSound(), (newState.getBlock().stepSound.getVolume()+1.0F)/2.0F, newState.getBlock().stepSound.getFrequency()*0.8F);
if(worldIn.isRemote){
return true;
}
else{
worldIn.setBlockState(target, newState);
stack.damageItem(1, player);
return true;
}
} }
@Override @Override

View file

@ -11,14 +11,12 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemArmorAA extends ItemArmor{ public class ItemArmorAA extends ItemArmor{
@ -40,14 +38,7 @@ public class ItemArmorAA extends ItemArmor{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,14 +11,12 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemAxeAA extends ItemAxe{ public class ItemAxeAA extends ItemAxe{
@ -37,14 +35,7 @@ public class ItemAxeAA extends ItemAxe{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,12 +11,11 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemBase extends Item{ public class ItemBase extends Item{
@ -30,14 +29,7 @@ public class ItemBase extends Item{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -19,7 +19,6 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemBucketAA extends ItemBucket{ public class ItemBucketAA extends ItemBucket{
@ -34,14 +33,7 @@ public class ItemBucketAA extends ItemBucket{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items.base;
import cofh.api.energy.ItemEnergyContainer; import cofh.api.energy.ItemEnergyContainer;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -21,7 +21,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -41,14 +40,7 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,12 +11,11 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.ItemFood; import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemFoodBase extends ItemFood{ public class ItemFoodBase extends ItemFood{
@ -31,14 +30,7 @@ public class ItemFoodBase extends ItemFood{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -19,7 +18,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemHoeAA extends ItemHoe{ public class ItemHoeAA extends ItemHoe{
@ -38,14 +36,7 @@ public class ItemHoeAA extends ItemHoe{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,14 +11,12 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemPickaxeAA extends ItemPickaxe{ public class ItemPickaxeAA extends ItemPickaxe{
@ -37,14 +35,7 @@ public class ItemPickaxeAA extends ItemPickaxe{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -24,7 +24,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemSeed extends ItemSeeds{ public class ItemSeed extends ItemSeeds{
@ -48,11 +47,7 @@ public class ItemSeed extends ItemSeeds{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.items.base; package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -19,7 +18,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemShovelAA extends ItemSpade{ public class ItemShovelAA extends ItemSpade{
@ -38,14 +36,7 @@ public class ItemShovelAA extends ItemSpade{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -12,14 +12,12 @@ package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ItemSwordAA extends ItemSword{ public class ItemSwordAA extends ItemSword{
@ -38,14 +36,7 @@ public class ItemSwordAA extends ItemSword{
} }
private void register(){ private void register(){
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
GameRegistry.registerItem(this, this.getBaseName());
if(this.shouldAddCreative()){
this.setCreativeTab(CreativeTab.instance);
}
else{
this.setCreativeTab(null);
}
this.registerRendering(); this.registerRendering();
} }

View file

@ -22,10 +22,11 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class SmileyCloudEasterEggs{ public class SmileyCloudEasterEggs{
public static final ArrayList<ISmileyCloudEasterEgg> cloudStuff = new ArrayList<ISmileyCloudEasterEgg>(); public static List<ISmileyCloudEasterEgg> cloudStuff = new ArrayList<ISmileyCloudEasterEgg>();
static{ static{
//Glenthor //Glenthor

View file

@ -10,11 +10,15 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import java.util.List; import java.util.List;
@ -29,6 +33,24 @@ public class ItemUtil{
return null; return null;
} }
public static void registerBlock(Block block, Class<? extends ItemBlockBase> itemBlock, String name, boolean addTab){
block.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+name);
block.setRegistryName(ModUtil.MOD_ID_LOWER, name);
GameRegistry.registerBlock(block, itemBlock);
block.setCreativeTab(addTab ? CreativeTab.instance : null);
}
public static void registerItem(Item item, String name, boolean addTab){
item.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+name);
item.setRegistryName(ModUtil.MOD_ID_LOWER, name);
GameRegistry.registerItem(item);
item.setCreativeTab(addTab ? CreativeTab.instance : null);
}
/** /**
* Returns true if array contains stack or if both contain null * Returns true if array contains stack or if both contain null
*/ */