k
MainRegistry
package com.OlympiansMod.Main;
import net.minecraft.client.renderer.entity.RenderSnowball;
import com.OlympiansMod.Block.ModBlocks;
import com.OlympiansMod.Item.ModItems;
import com.OlympiansMod.creativetabs.MCreativeTabs;
import com.OlympiansMod.entity.EntityGreekFire;
import com.OlympiansMod.entity.MEntity;
import com.OlympiansMod.lib.Refstrings;
import com.OlympiansMod.world.MWorld;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = Refstrings.MODID , name = Refstrings.NAME , version = Refstrings.VERSION)
public class MainRegistry {
@SidedProxy(clientSide = Refstrings.CLIENTSIDE , serverSide = Refstrings.SERVERSIDE)
public static ServerProxy proxy;
@Instance
public static MainRegistry modInstance;
@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent) {
MCreativeTabs.initialiseTabs();
ModBlocks.MainRegistry();
MEntity.MainRegistry();
ModItems.MainRegistry();
MWorld.MainRegistry();
CraftingManager.mainRegistry();
proxy.registerRenderInfo();
}
@EventHandler
public static void Load(FMLInitializationEvent event) {
}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent) {
}
}
ClientProxy
package com.OlympiansMod.Main;
import net.minecraft.client.renderer.entity.RenderSnowball;
import com.OlympiansMod.Item.ModItems;
import com.OlympiansMod.entity.EntityGreekFire;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ServerProxy {
public void registerRenderInfo() {
RenderingRegistry.registerEntityRenderingHandler(EntityGreekFire.class, new RenderSnowball(ModItems.GreekFire));
}
public int addArmor(String armor){
return 0;
}
}
EntityRegister
package com.OlympiansMod.entity;
import net.minecraft.entity.EntityList;
import com.OlympiansMod.Main.MainRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
public class MEntity {
public static void MainRegistry(){
}
public static void registerEntity(){
createEntity(EntityGreekFire.class, "GreekFire", 0x008521, 0x00FF0800);
}
public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){
int randomId = EntityRegistry.findGlobalUniqueEntityId();
EntityRegistry.registerModEntity(entityClass, entityName, randomId, MainRegistry.modInstance, 80, 1, false);
createEgg(randomId, solidColour, spotColour);
}
private static void createEgg(int randomId, int solidColour, int spotColour){
EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColour, spotColour));
}
}
EntityGreekFireClass
package com.OlympiansMod.entity;
import com.OlympiansMod.Item.ModItems;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityGreekFire extends EntityThrowable{
public EntityGreekFire(World p_i1776_1_) {
super(p_i1776_1_);
}
public EntityGreekFire(World world, EntityLivingBase entity){
super(world, entity);
}
@Override
protected void onImpact(MovingObjectPosition p_70184_1_) {
for(int i = 0; i < 10; i++){
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY, this.posZ, 0f, 0f, 0f);
this.worldObj.playSound(this.posX, this.posY, this.posZ, "random.explode", 10.0f, 1.0f, inGround);
}
if(!this.worldObj.isRemote){
this.setDead();
this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 15.0f, true);
}
}
}
On Item Right Click Function
package com.OlympiansMod.Item;
import com.OlympiansMod.entity.EntityGreekFire;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class GreekFire extends Item{
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){
if(!player.capabilities.isCreativeMode){
--itemstack.stackSize;
}
world.playSoundAtEntity(player, "random.fizz", 0.7f, 0.8f);
if(!world.isRemote){
world.spawnEntityInWorld(new EntityGreekFire(world, player));
}
return itemstack;
}
}
Items Class
package com.OlympiansMod.Item;
import com.OlympiansMod.Block.ModBlocks;
import com.OlympiansMod.Main.MainRegistry;
import com.OlympiansMod.creativetabs.MCreativeTabs;
import com.OlympiansMod.lib.Refstrings;
import com.mojang.realmsclient.client.Request.Delete;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemSeeds;
import net.minecraft.world.SpawnerAnimals;
import net.minecraftforge.common.util.EnumHelper;
public class ModItems {
public static void MainRegistry() {
initializeItem();
registerItem();
}
//Armor Material
public static ArmorMaterial GArmor = EnumHelper.addArmorMaterial("GArmor", 33, new int[]{4, 10, 7, 2}, 10);
public static ArmorMaterial CBArmor = EnumHelper.addArmorMaterial("Celestial Bronze Armor", 33, new int[]{2, 8, 6, 3}, 10);
//Tool Material
public static ToolMaterial FrankMagic = EnumHelper.addToolMaterial("Frank Magic", 3, 3, 9.0f, 6, 10);
public static ToolMaterial Hack = EnumHelper.addToolMaterial("Hack", 3, 1000, 9.0f, 96, 10);
public static ToolMaterial CBronze = EnumHelper.addToolMaterial("Celestial Bronze", 3, 2500, 10.0f, 6, 10);
public static ToolMaterial IGold = EnumHelper.addToolMaterial("Imperial Gold", 3, 2250, 9.0f, 5, 10);
public static ToolMaterial SIron = EnumHelper.addToolMaterial("Stygian Iron", 3, 5000, 11.50f, 7, 10);
//Tools-Items "name" 3 = harvestlevel 2500 = uses 5 = damage
public static Item CelestialBronzeIngot;
public static Item BallPointPen;
public static Item IGoldIngot;
public static Item SIronIngot;
public static Item anklamolses;
public static Item Riptide;
public static Item CBronzePick;
public static Item CBronzeHoe;
public static Item CBronzeSpade;
public static Item CBronzeSword;
public static Item CBronzeAxe;
public static Item FSpear;
public static Item FireEssence;
public static Item IceShard;
public static Item LightningEssence;
public static Item IGoldPick;
public static Item IGoldAxe;
public static Item IGoldSpade;
public static Item IGoldHoe;
public static Item IGoldSword;
public static Item SIronPick;
public static Item SIronAxe;
public static Item SIronSpade;
public static Item SIronHoe;
public static Item SIronSword;
public static Item PoplarWoodStick;
public static Item CBNugget;
public static Item SINugget;
public static Item IGNugget;
//Food-Crops
public static Item SSeeds;
public static Item CBronzeItem;
public static Item Ambrosia;
//Armor
public static Item CBHelm;
public static Item CBChest;
public static Item CBLegg;
public static Item CBBoot;
public static Item GWarHelm;
public static Item GWarChest;
public static Item GWarLegg;
public static Item GWarBoots;
//Item Entitys
public static Item GreekFire;
public static void initializeItem() {
//DiffrentWayToMakeTools: youritem = new youritem(ID, youritemmaterial).setIconIndex(.setItemName("your item");
//DiffrentWayToRegisterName: LanguageRegistry.addName(youritem,(youritem);
//DiffrentWayToMakeItems: youritem = new youritem(ID).setIconIndex(ID).setItemName("your item");
CelestialBronzeIngot = new Item().setUnlocalizedName("CelestialBronzeIngot").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":CelestialBronzeIngot");
BallPointPen = new Item().setUnlocalizedName("BallPointPen").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":BallPointPen");
IGoldIngot = new Item().setUnlocalizedName("IGoldIngot").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":IGoldIngot");
SIronIngot = new Item().setUnlocalizedName("SIronIngot").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":SIronIngot");
anklamolses = new Item().setUnlocalizedName("anklamolses").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":anklamolses");
Riptide = new Riptide(Hack).setUnlocalizedName("Riptide").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":Riptide").setMaxDamage(20).setMaxStackSize(1);
CBronzePick = new CBronzePick(CBronze).setUnlocalizedName("CBronzePick").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBronzePick");
CBronzeAxe = new CBronzeAxe(CBronze).setUnlocalizedName("CBronzeAxe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBronzeAxe");
CBronzeHoe = new CBronzeHoe(CBronze).setUnlocalizedName("CBronzeHoe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBronzeHoe");
CBronzeSword = new CBronzeSword(CBronze).setUnlocalizedName("CBronzeSword").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBronzeSword");
CBronzeSpade = new CBronzeSpade(CBronze).setUnlocalizedName("CBronzeSpade").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBronzeSpade");
FSpear = new FSpear(FrankMagic).setUnlocalizedName("FSpear").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID +":Franks Spear").setNoRepair();
FireEssence = new Item().setUnlocalizedName("FireEssence").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":FireEssence");
IceShard = new Item().setUnlocalizedName("IceShard").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":IceShard");
LightningEssence = new Item().setUnlocalizedName("LightningEssence").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":LightningEssence");
IGoldPick = new IGoldPick(IGold).setUnlocalizedName("IGoldPick").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":IGoldPick");
IGoldAxe = new IGoldAxe(IGold).setUnlocalizedName("IGoldAxe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":IGoldAxe");
IGoldHoe = new IGoldHoe(IGold).setUnlocalizedName("IGoldHoe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":IGoldHoe");
IGoldSpade = new IGoldSpade(IGold).setUnlocalizedName("IGoldSpade").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":IGoldSpade");
IGoldSword = new IGoldSword(IGold).setUnlocalizedName("IGoldSword").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":IGoldSword");
SIronPick = new SIronPick(SIron).setUnlocalizedName("SIronPick").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":SIronPick");
SIronAxe = new SIronAxe(SIron).setUnlocalizedName("SIronAxe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":SIronAxe");
SIronHoe = new SIronHoe(SIron).setUnlocalizedName("SIronHoe").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":SIronHoe");
SIronSpade = new SIronSpade(SIron).setUnlocalizedName("SIronSpade").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":SIronSpade");
SIronSword = new SIronSword(SIron).setUnlocalizedName("SIronSword").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":SIronSword");
CBNugget = new Item().setUnlocalizedName("CBNugget").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":CelestialBronzeNugget");
PoplarWoodStick = new Item().setUnlocalizedName("PoplarWoodStick").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":PoplarWoodStick");
IGNugget = new Item().setUnlocalizedName("IGNugget").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":IGoldNugget");
SINugget = new Item().setUnlocalizedName("SINugget").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":SIronNugget");
//Plants/Crops/Foods
SSeeds = new ItemSeeds(ModBlocks.SPlant, Blocks.farmland).setCreativeTab(MCreativeTabs.tabItems).setUnlocalizedName("SSeeds").setTextureName(Refstrings.MODID + ":SSeeds");
CBronzeItem = new ItemFood(4, 1F, true).setCreativeTab(MCreativeTabs.tabItems).setUnlocalizedName("CBronzeItem").setTextureName(Refstrings.MODID + ":Strawberry");
Ambrosia = new ItemFood(20, 5F, false).setCreativeTab(MCreativeTabs.tabItems).setUnlocalizedName("Ambrosia").setTextureName(Refstrings.MODID + ":Ambrosia");
//Armor
CBHelm = new CBArmor(CBArmor, MainRegistry.proxy.addArmor("CBArmor"), 0).setUnlocalizedName("CBHelm").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBHelm");
CBChest = new CBArmor(CBArmor, MainRegistry.proxy.addArmor("CBArmor"), 1).setUnlocalizedName("CBChest").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBChest");
CBLegg = new CBArmor(CBArmor, MainRegistry.proxy.addArmor("CBArmor"), 2).setUnlocalizedName("CBLegg").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBLegg");
CBBoot = new CBArmor(CBArmor, MainRegistry.proxy.addArmor("CBArmor"), 3).setUnlocalizedName("CBBoot").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":CBBoot");
GWarHelm = new GArmor(GArmor, MainRegistry.proxy.addArmor("GArmor"), 0).setUnlocalizedName("GreekWarHelm").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":GreekWarHelmet");
GWarChest = new GArmor(GArmor, MainRegistry.proxy.addArmor("GArmor"), 1).setUnlocalizedName("GreekWarChest").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":GreekWarChestplate");
GWarLegg = new GArmor(GArmor, MainRegistry.proxy.addArmor("GArmor"), 2).setUnlocalizedName("GreekWarLegg").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":GreekWarLeggings");
GWarBoots = new GArmor(GArmor, MainRegistry.proxy.addArmor("GArmor"), 3).setUnlocalizedName("GreekWarBoot").setCreativeTab(MCreativeTabs.tabTools).setTextureName(Refstrings.MODID + ":GreekWarBoots");
//Item Entitys
GreekFire = new GreekFire().setUnlocalizedName("GreekFire").setCreativeTab(MCreativeTabs.tabItems).setTextureName(Refstrings.MODID + ":GreekFire");
}
public static void registerItem() {
GameRegistry.registerItem(CelestialBronzeIngot, CelestialBronzeIngot.getUnlocalizedName());
GameRegistry.registerItem(BallPointPen, BallPointPen.getUnlocalizedName());
GameRegistry.registerItem(IGoldIngot, IGoldIngot.getUnlocalizedName());
GameRegistry.registerItem(SIronIngot, SIronIngot.getUnlocalizedName());
GameRegistry.registerItem(anklamolses, anklamolses.getUnlocalizedName());
GameRegistry.registerItem(CBronzePick, CBronzePick.getUnlocalizedName());
GameRegistry.registerItem(CBronzeAxe, CBronzeAxe.getUnlocalizedName());
GameRegistry.registerItem(CBronzeHoe, CBronzeHoe.getUnlocalizedName());
GameRegistry.registerItem(CBronzeSword, CBronzeSword.getUnlocalizedName());
GameRegistry.registerItem(CBronzeSpade, CBronzeSpade.getUnlocalizedName());
GameRegistry.registerItem(IGoldPick, IGoldPick.getUnlocalizedName());
GameRegistry.registerItem(IGoldAxe, IGoldAxe.getUnlocalizedName());
GameRegistry.registerItem(IGoldHoe, IGoldHoe.getUnlocalizedName());
GameRegistry.registerItem(IGoldSpade, IGoldSpade.getUnlocalizedName());
GameRegistry.registerItem(IGoldSword, IGoldSword.getUnlocalizedName());
GameRegistry.registerItem(SIronPick, SIronPick.getUnlocalizedName());
GameRegistry.registerItem(SIronHoe, SIronHoe.getUnlocalizedName());
GameRegistry.registerItem(SIronSpade, SIronSpade.getUnlocalizedName());
GameRegistry.registerItem(SIronAxe, SIronAxe.getUnlocalizedName());
GameRegistry.registerItem(SIronSword, SIronSword.getUnlocalizedName());
GameRegistry.registerItem(Riptide, Riptide.getUnlocalizedName());
GameRegistry.registerItem(FSpear, FSpear.getUnlocalizedName());
GameRegistry.registerItem(LightningEssence, LightningEssence.getUnlocalizedName());
GameRegistry.registerItem(FireEssence, FireEssence.getUnlocalizedName());
GameRegistry.registerItem(IceShard, IceShard.getUnlocalizedName());
GameRegistry.registerItem(SSeeds, SSeeds.getUnlocalizedName());
GameRegistry.registerItem(CBronzeItem, CBronzeItem.getUnlocalizedName());
GameRegistry.registerItem(Ambrosia, Ambrosia.getUnlocalizedName());
GameRegistry.registerItem(PoplarWoodStick, PoplarWoodStick.getUnlocalizedName());
GameRegistry.registerItem(CBNugget, CBNugget.getUnlocalizedName());
GameRegistry.registerItem(IGNugget, IGNugget.getUnlocalizedName());
GameRegistry.registerItem(SINugget, SINugget.getUnlocalizedName());
GameRegistry.registerItem(CBChest, CBChest.getUnlocalizedName());
GameRegistry.registerItem(CBHelm, CBHelm.getUnlocalizedName());
GameRegistry.registerItem(CBBoot, CBBoot.getUnlocalizedName());
GameRegistry.registerItem(CBLegg, CBLegg.getUnlocalizedName());
GameRegistry.registerItem(GWarChest, GWarChest.getUnlocalizedName());
GameRegistry.registerItem(GWarHelm, GWarHelm.getUnlocalizedName());
GameRegistry.registerItem(GWarBoots, GWarBoots.getUnlocalizedName());
GameRegistry.registerItem(GWarLegg, GWarLegg.getUnlocalizedName());
GameRegistry.registerItem(GreekFire, GreekFire.getUnlocalizedName());
}
}
Phew! ok that's all of the classes that involve the Entity