diff options
Diffstat (limited to 'src/Java/miscutil/core')
-rw-r--r-- | src/Java/miscutil/core/block/general/LightGlass.java | 32 | ||||
-rw-r--r-- | src/Java/miscutil/core/creative/AddToCreativeTab.java | 3 | ||||
-rw-r--r-- | src/Java/miscutil/core/item/ModItems.java | 28 | ||||
-rw-r--r-- | src/Java/miscutil/core/item/base/BasicSpawnEgg.java | 258 | ||||
-rw-r--r-- | src/Java/miscutil/core/util/Utils.java | 167 | ||||
-rw-r--r-- | src/Java/miscutil/core/util/item/UtilsItems.java | 7 |
6 files changed, 450 insertions, 45 deletions
diff --git a/src/Java/miscutil/core/block/general/LightGlass.java b/src/Java/miscutil/core/block/general/LightGlass.java index 4a06d61135..f2b751bdd0 100644 --- a/src/Java/miscutil/core/block/general/LightGlass.java +++ b/src/Java/miscutil/core/block/general/LightGlass.java @@ -4,6 +4,7 @@ import java.util.Random; import miscutil.core.creative.AddToCreativeTab; import miscutil.core.lib.CORE; +import miscutil.core.util.Utils; import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -120,34 +121,7 @@ public class LightGlass extends BlockBreakable @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){ - if (!world.isRemote){ - int l = world.getBlockMetadata(posX, posY, posZ); - double d0 = (double)((float)posX + 0.5F); - double d1 = (double)((float)posY + 0.7F); - double d2 = (double)((float)posZ + 0.5F); - double d3 = 0.2199999988079071D; - double d4 = 0.27000001072883606D; - - if (l == 1) - { - world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); - } - else if (l == 2) - { - world.spawnParticle("cloud", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); - } - else if (l == 3) - { - world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); - } - else if (l == 4) - { - world.spawnParticle("cloud", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); - } - else - { - world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); - } - } + Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); + } }
\ No newline at end of file diff --git a/src/Java/miscutil/core/creative/AddToCreativeTab.java b/src/Java/miscutil/core/creative/AddToCreativeTab.java index f71de821dc..7655a639ad 100644 --- a/src/Java/miscutil/core/creative/AddToCreativeTab.java +++ b/src/Java/miscutil/core/creative/AddToCreativeTab.java @@ -3,6 +3,7 @@ package miscutil.core.creative; import miscutil.core.creative.tabs.MiscUtilCreativeTabBlock; import miscutil.core.creative.tabs.MiscUtilCreativeTabMachines; import miscutil.core.creative.tabs.MiscUtilCreativeTabMisc; +import miscutil.core.creative.tabs.MiscUtilCreativeTabOther; import miscutil.core.creative.tabs.MiscUtilCreativeTabTools; import miscutil.core.lib.CORE; import net.minecraft.creativetab.CreativeTabs; @@ -21,7 +22,7 @@ public class AddToCreativeTab { tabMisc = new MiscUtilCreativeTabMisc("MiscUtilMiscTab"); tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab"); tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab"); - //tabOther = new MiscUtilCreativeTabOther("MiscUtilOtherTab"); + tabOther = new MiscUtilCreativeTabOther("MiscUtilOtherTab"); if (CORE.DEBUG){ //tabCombat = new MiscUtilCreativeTabCombat("MiscUtilCombatTab"); diff --git a/src/Java/miscutil/core/item/ModItems.java b/src/Java/miscutil/core/item/ModItems.java index b02cc79676..566a90015e 100644 --- a/src/Java/miscutil/core/item/ModItems.java +++ b/src/Java/miscutil/core/item/ModItems.java @@ -14,6 +14,7 @@ import miscutil.core.lib.CORE; import miscutil.core.lib.LoadedMods; import miscutil.core.util.Utils; import miscutil.core.util.debug.DEBUG_INIT; +import miscutil.core.util.item.UtilsItems; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.common.util.EnumHelper; @@ -57,9 +58,11 @@ Gold Tool: 22*/ //Tool Materials //public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", harvestLevel, durability, miningSpeed, damageVsEntities, enchantability); public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18); - + public static Item itemDebugShapeSpawner; - + + public static Item itemBaseSpawnEgg; + //EnderIO public static Item itemPlateSoularium; public static Item itemPlateRedstoneAlloy; @@ -101,18 +104,18 @@ Gold Tool: 22*/ public static Item itemPlateBatteryAlloy; public static Item itemHeliumBlob; public static Item itemPLACEHOLDER_Circuit; - + public static Item FuelRod_Empty; public static Item FuelRod_Thorium; public static Item FuelRod_Uranium; public static Item FuelRod_Plutonium; - + public static Item itemBedLocator_Base; public static Item itemBaseItemWithCharge; - + //@SuppressWarnings("unused") public static final void init(){ - + //Debug Loading if (CORE.DEBUG){ DEBUG_INIT.registerItems(); @@ -238,10 +241,17 @@ Gold Tool: 22*/ else { Utils.LOG_WARNING("IndustrialCraft2 not Found - Skipping Resources."); } + + + + UtilsItems.generateSpawnEgg("minecraft", "villager", Utils.generateSingularRandomHexValue(), Utils.generateSingularRandomHexValue()); + + + /* * Misc Items */ - + //Staballoy Equipment itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", STABALLOY).setCreativeTab(AddToCreativeTab.tabTools); GameRegistry.registerItem(itemStaballoyPickaxe, itemStaballoyPickaxe.getUnlocalizedName()); @@ -275,10 +285,10 @@ Gold Tool: 22*/ GameRegistry.registerItem(itemIngotBatteryAlloy, "itemIngotBatteryAlloy"); itemPlateBatteryAlloy = new Item().setUnlocalizedName("itemPlateBatteryAlloy").setCreativeTab(tabMachines).setTextureName(CORE.MODID + ":itemPlateBatteryAlloy"); GameRegistry.registerItem(itemPlateBatteryAlloy, "itemPlateBatteryAlloy"); - + itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob"); //GameRegistry.registerItem(itemHeliumBlob, "itemHeliumBlob"); - + itemPLACEHOLDER_Circuit = new Item().setUnlocalizedName("itemPLACEHOLDER_Circuit").setTextureName(CORE.MODID + ":itemPLACEHOLDER_Circuit"); GameRegistry.registerItem(itemPLACEHOLDER_Circuit, "itemPLACEHOLDER_Circuit"); //Try some New Tools from GT diff --git a/src/Java/miscutil/core/item/base/BasicSpawnEgg.java b/src/Java/miscutil/core/item/base/BasicSpawnEgg.java new file mode 100644 index 0000000000..fd80fab854 --- /dev/null +++ b/src/Java/miscutil/core/item/base/BasicSpawnEgg.java @@ -0,0 +1,258 @@ +package miscutil.core.item.base; + + +import java.util.List; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.util.Utils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMonsterPlacer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Facing; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + + +public class BasicSpawnEgg extends ItemMonsterPlacer +{ + @SideOnly(Side.CLIENT) + private IIcon theIcon; + protected int colorBase = 0x000000; + protected int colorSpots = 0xFFFFFF; + protected String entityMODID = ""; + protected String entityToSpawnName = ""; + protected String entityToSpawnNameFull = ""; + protected EntityLiving entityToSpawn = null; + + public BasicSpawnEgg(){ + super(); + } + + public BasicSpawnEgg(String MODID, String parEntityToSpawnName, int parPrimaryColor, int parSecondaryColor){ + setHasSubtypes(false); + maxStackSize = 64; + setCreativeTab(AddToCreativeTab.tabOther); + setEntityToSpawnName(parEntityToSpawnName); + colorBase = parPrimaryColor; + colorSpots = parSecondaryColor; + entityMODID = MODID; + + // DEBUG + Utils.LOG_WARNING("Spawn egg constructor for "+entityToSpawnName); + } + + /** + * Callback for item usage. If the item does something special on right clicking, + + * he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ + if (par3World.isRemote) + { + return true; + } + Block block = par3World.getBlock(par4, par5, par6); + par4 += Facing.offsetsXForSide[par7]; + par5 += Facing.offsetsYForSide[par7]; + par6 += Facing.offsetsZForSide[par7]; + double d0 = 0.0D; + + if (par7 == 1 && block.getRenderType() == 11) + { + d0 = 0.5D; + } + + Entity entity = spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); + + if (entity != null) + { + if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par2EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. + + *Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ + if (par2World.isRemote) + { + return par1ItemStack; + } + MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + + if (movingobjectposition == null) + { + return par1ItemStack; + } + if (movingobjectposition.typeOfHit == MovingObjectPosition + + .MovingObjectType.BLOCK) + + { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) + { + return par1ItemStack; + } + + if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (par2World.getBlock(i, j, k) instanceof BlockLiquid) + { + Entity entity = spawnEntity(par2World, i, j, k); + + if (entity != null) + { + if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + } + } + + return par1ItemStack; + } + + /** + * Spawns the creature specified by the egg's type in the location specified by + + * the last three parameters. + * Parameters: world, entityID, x, y, z. + */ + public Entity spawnEntity(World parWorld, double parX, double parY, double parZ){ + + if (!parWorld.isRemote) // never spawn entity on client side + { + entityToSpawnNameFull = entityMODID+"."+entityToSpawnName; + if (EntityList.stringToClassMapping.containsKey(entityToSpawnNameFull)) + { + entityToSpawn = (EntityLiving) EntityList + + .createEntityByName(entityToSpawnNameFull, parWorld); + entityToSpawn.setLocationAndAngles(parX, parY, parZ, + + MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() + + * 360.0F), 0.0F); + parWorld.spawnEntityInWorld(entityToSpawn); + entityToSpawn.onSpawnWithEgg((IEntityLivingData)null); + entityToSpawn.playLivingSound(); + } + else + { + //DEBUG + Utils.LOG_WARNING("Entity not found "+entityToSpawnName); + } + } + + return entityToSpawn; + } + + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item parItem, CreativeTabs parTab, List parList){ + parList.add(new ItemStack(parItem, 1, 0)); + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack par1ItemStack, int parColorType){ + return (parColorType == 0) ? colorBase : colorSpots; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + // Doing this override means that there is no localization for language + // unless you specifically check for localization here and convert + public String getItemStackDisplayName(ItemStack par1ItemStack){ + return "Spawn "+entityToSpawnName; + } + + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister){ + super.registerIcons(par1IconRegister); + theIcon = par1IconRegister.registerIcon(getIconString() + "_overlay"); + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int parDamageVal, int parRenderPass){ + return parRenderPass > 0 ? theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass); + } + + public void setColors(int parColorBase, int parColorSpots){ + colorBase = parColorBase; + colorSpots = parColorSpots; + } + + public int getColorBase(){ + return colorBase; + } + + public int getColorSpots(){ + return colorSpots; + } + + public void setEntityToSpawnName(String parEntityToSpawnName){ + entityToSpawnName = parEntityToSpawnName; + entityToSpawnNameFull = entityMODID+"."+entityToSpawnName; + } + +} + diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java index 03bd0b7ded..5dd121f9b6 100644 --- a/src/Java/miscutil/core/util/Utils.java +++ b/src/Java/miscutil/core/util/Utils.java @@ -6,7 +6,9 @@ import java.awt.Color; import java.awt.Graphics; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Random; import java.util.Timer; import java.util.TimerTask; @@ -16,15 +18,19 @@ import miscutil.MiscUtils; import miscutil.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.registry.EntityRegistry; public class Utils { @@ -40,7 +46,7 @@ public class Utils { /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most - * <code>Integer.MAX_VALUE - 1</code>. + * Integer.MAX_VALUE - 1. * * @param min Minimim value * @param max Maximim value. Must be greater than min. @@ -97,13 +103,18 @@ public class Utils { public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict) { - if (input == null && target != null || input != null && target == null) + if (input == null || target == null) { return false; } return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); } + //TODO + public static void registerEntityToBiomeSpawns(Class<EntityLiving> classy, EnumCreatureType EntityType, BiomeGenBase baseBiomeGen){ + EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. + } + //Non-Dev Comments public static void LOG_INFO(String s){ //if (CORE.DEBUG){ @@ -270,7 +281,7 @@ public class Utils { } return null; } - + @Deprecated public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ int blockX = MathHelper.floor_double(parEntity.posX); @@ -285,27 +296,171 @@ public class Utils { int blockZ = MathHelper.floor_double(parEntity.posZ); return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } - + public static int getFacingDirection(Entity entity){ int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; return d; } - + public static boolean isPlayerOP(EntityPlayer player){ if (player.canCommandSenderUseCommand(2, "")){ return true; } return false; } - + + public static void setEntityOnFire(Entity entity, int length){ + entity.setFire(length); + } + public static void spawnCustomParticle(Entity entity){ MiscUtils.proxy.generateMysteriousParticles(entity); + } + + public static void spawnFX(World world, int x, int y, int z, String particleName, Object particleName2){ + if (!world.isRemote){ + if (particleName2 == null || particleName2.equals("")){ + particleName2 = particleName; + } + int l = randInt(0, 4); + double d0 = (double)((float)x + 0.5F); + double d1 = (double)((float)y + 0.7F); + double d2 = (double)((float)z + 0.5F); + double d3 = 0.2199999988079071D; + double d4 = 0.27000001072883606D; + + if (l == 1) + { + world.spawnParticle(particleName, d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + } + else if (l == 2) + { + world.spawnParticle((String) particleName2, d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + } + else if (l == 3) + { + world.spawnParticle(particleName, d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); + } + else if (l == 4) + { + world.spawnParticle((String) particleName2, d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); + } + else + { + world.spawnParticle(particleName, d0, d1, d2, 0.0D, 0.0D, 0.0D); + if (particleName2 != null){ + world.spawnParticle((String) particleName2, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + } } + public static int getHexNumberFromInt(int myRandomNumber){ + String result = Integer.toHexString(myRandomNumber); + int resultINT = Integer.getInteger(result); + return resultINT; + } + public static int generateRandomHexValue(int min, int max){ + int result = getHexNumberFromInt(randInt(min, max)); + return result; + } + /* + * http://javadevnotes.com/java-left-pad-string-with-zeros-examples + */ + public static String leftPadWithZeroes(String originalString, int length) { + StringBuilder sb = new StringBuilder(); + while (sb.length() + originalString.length() < length) { + sb.append('0'); + } + sb.append(originalString); + String paddedString = sb.toString(); + return paddedString; + } + + /* + * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html + */ + public static Map<Integer, String> hexColourGenerator(int colorCount){ + int maxColorValue = 16777215; + // this is decimal value of the "FFFFFF" + int devidedvalue = maxColorValue/colorCount; + int countValue = 0; + HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>(); + for(int a=0; a < colorCount && maxColorValue >= countValue ; a++){ + if(a != 0){ + countValue+=devidedvalue; + hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase()); + } + else { + hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase()); + } + } + return hexColorMap; + } + + /* + * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html + */ + public static Map<Integer, String> hexColourGeneratorRandom(int colorCount){ + HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>(); + for(int a=0;a < colorCount; a++){ + String code = ""+(int)(Math.random()*256); + code = code+code+code; + int i = Integer.parseInt(code); + hexColorMap.put(a,Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase()); + Utils.LOG_INFO(""+Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase()); + } + return hexColorMap; + } + + public static String appenedHexNotationToString(Object hexAsStringOrInt){ + String hexChar = "0x"; + String result; + if (hexAsStringOrInt.getClass() == String.class){ + result = hexChar+hexAsStringOrInt; + if (result.length() != 6){ + String temp = leftPadWithZeroes(result, 6); + result = temp; + } + return result; + } + else if (hexAsStringOrInt.getClass() == Integer.class){ + result = hexChar+String.valueOf(hexAsStringOrInt); + return result; + } + else { + return null; + } + } + public static Integer appenedHexNotationToInteger(int hexAsStringOrInt){ + String hexChar = "0x"; + String result; + Utils.LOG_INFO(String.valueOf(hexAsStringOrInt)); + result = hexChar+String.valueOf(hexAsStringOrInt); + return Integer.getInteger(result); + } + + public static int generateSingularRandomHexValue(){ + String temp; + int usefuleNumber = 0; + int tDecided = randInt(1, 5); + final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5); + + if (colours.get(tDecided) != null && colours.size() > 0){ + usefuleNumber = Integer.getInteger(colours.get(tDecided)); + } + else { + usefuleNumber = 123456; + } + Utils.LOG_INFO("Operating with "+usefuleNumber); + temp = Utils.appenedHexNotationToString(String.valueOf(usefuleNumber)); + Utils.LOG_INFO("Made "+temp+" - Hopefully it's not a mess."); + return Integer.decode(temp); + } } diff --git a/src/Java/miscutil/core/util/item/UtilsItems.java b/src/Java/miscutil/core/util/item/UtilsItems.java index 82075a7093..a3157e56ab 100644 --- a/src/Java/miscutil/core/util/item/UtilsItems.java +++ b/src/Java/miscutil/core/util/item/UtilsItems.java @@ -1,6 +1,8 @@ package miscutil.core.util.item; import gregtech.api.util.GT_OreDictUnificator; +import miscutil.core.item.base.BasicSpawnEgg; +import miscutil.core.lib.CORE; import miscutil.core.lib.LoadedMods; import miscutil.core.util.Utils; import miscutil.core.util.wrapper.var; @@ -197,5 +199,10 @@ public class UtilsItems { return null; } + + public static void generateSpawnEgg(String entityModID, String parSpawnName, int colourEgg, int colourOverlay){ + Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); + GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); + } } |