Jump to content

[1.7.10] Throwable entity doesn't work PLS HELP


Recommended Posts

I am trying to make a explosive type throwable item, but in game nothing happens when I right click the Item. here are the classes. please take a look I am desperate for a solution, thanks.

 

Item 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());
}

}

 

Extended Item Greek Fire

package com.OlympiansMod.Item;

import com.OlympiansMod.entity.EntityGreekFire;

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 onRightClick(ItemStack itemstack, World world, EntityPlayer player){
	if(!player.capabilities.isCreativeMode){
		--itemstack.stackSize;
	}
	world.playSoundAtEntity(player, "random.fuse", 0.7f, 0.8f);

	if(world.isRemote){
		world.spawnEntityInWorld(new EntityGreekFire(world, player));
	}

	return itemstack;
}


}

 

Entity Class

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.registerGlobalEntityID(entityClass, entityName, randomID);
	EntityRegistry.registerModEntity(entityClass, entityName, randomID, MainRegistry.modInstance, 80, 1, true);
	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));

}

}

 

extends entity class

package com.OlympiansMod.entity;

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);
	}

	if(this.worldObj.isRemote){
		this.setDead();
		if(this.worldObj.isRemote){
			this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 4.0f, true);
		}

	}

}

}

 

Main Registry

package com.OlympiansMod.Main;

import com.OlympiansMod.Block.ModBlocks;
import com.OlympiansMod.Item.ModItems;
import com.OlympiansMod.creativetabs.MCreativeTabs;
import com.OlympiansMod.entity.MEntity;
import com.OlympiansMod.lib.Refstrings;
import com.OlympiansMod.world.MWorld;

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) {

}

}

 

Client Proxy

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 ClientProxy extends ServerProxy{
public void registerRenderInfo(){
	RenderingRegistry.registerEntityRenderingHandler(EntityGreekFire.class, new RenderSnowball(ModItems.GreekFire));

}
public int addArmor(String armor){
	return RenderingRegistry.addNewArmourRendererPrefix(armor);

}

}

 

the change doesn't even seem to be registering what should I do???

 

Thank you all for you time- BoonieQuAFtERCrAfTeR

Im serious don't look at it!!

Link to comment
Share on other sites

if (world.isRemote)

 

Hmm, all I could guess is that entities should be spawned server side as it should keep clients aware of it being there after it is created. Try

if(!world.isRemote)

instead

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

I did this before, and inturn  the item did not explode on impact, so I removed it and it worked. but here is the catch, I renamed the package ModEntity, and then back to entity(The Original name, because after changing the name the game didn't seem to register the code at all.) This has happened before, in fact with my ores, after changing the name of my ores package, the game did not seem to load the package or any of its code. I'm wondering if there is something wrong with the java path or something, have any ideas???

Im serious don't look at it!!

Link to comment
Share on other sites

I did this before, and inturn  the item did not explode on impact, so I removed it and it worked. but here is the catch, I renamed the package ModEntity, and then back to entity(The Original name, because after changing the name the game didn't seem to register the code at all.) This has happened before, in fact with my ores, after changing the name of my ores package, the game did not seem to load the package or any of its code. I'm wondering if there is something wrong with the java path or something, have any ideas???

 

Maybe, just maybe if you showed me the code I could help you. And you should really make yourself github repo so it would make it easy to show other  people.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

the only difference is that I put ! before

if(!this.worldObj.isRemote){
		this.setDead();
		if(!this.worldObj.isRemote){
			this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 4.0f, true);

 

after renamed the file and changed it back, nothing works. the game doesn't even seem to register the new entity.

Im serious don't look at it!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.