public class VEntity {
public static void mainRegistry(){
}
public static void registerEntity(){
createEntity(EntityMgGrenade.class, "MgGrenade", 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));
}
}
public class EntityMgGrenade extends EntityThrowable{
public EntityMgGrenade(World p_i1776_1_) {
super(p_i1776_1_);
}
public EntityMgGrenade(World world, EntityLivingBase entity){
super(world, entity);
A throwable item doesn't have to be register unless you want a custom model or custom looks. Your item looks fine, but the entity won't spawn because something's wrong with your registry.
There are many tutorials on how to make a gun, which is probably what you want. Or maybe copy a snowball's source code and then make it explode when it hits something.
A throwable item doesn't have to be register unless you want a custom model or custom looks. Your item looks fine, but the entity won't spawn because something's wrong with your registry.
There are many tutorials on how to make a gun, which is probably what you want. Or maybe copy a snowball's source code and then make it explode when it hits something.
I fixed it, i putted onItemRight instead of onItemRightClick
but now when i throw it (it explodes when it hits the ground) it creates an illusion of destroyed items and when i try to step in the destroyed block i glitch in
Rollback Post to RevisionRollBack
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
I fixed it, i putted onItemRight instead of onItemRightClick
but now when i throw it (it explodes when it hits the ground) it creates an illusion of destroyed items and when i try to step in the destroyed block i glitch in
Only spawn entities on the server (when world.isRemote is false), not the client.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I know that, i fixed it, but now the entity is invisible, it does have all the actions and everything, but when i right click to throw it, when it flies i cant see it
Rollback Post to RevisionRollBack
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
So, me again (i know im kidna boring bcs i always ask for help)
EDIT: The code is fixed(rewriten in spoilers), but now the entity is invisible.
I tried to create a throwable item that explodes, but the problem is, i cant throw it
If you can help, pls reply
The entity codes:
EntityRegistry class:
package com.aosp.Entity;
import net.minecraft.entity.EntityList;
import com.aosp.Entity.EntityMgGrenade;
import com.aosp.Main.MainRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
public class VEntity {
public static void mainRegistry(){
}
public static void registerEntity(){
createEntity(EntityMgGrenade.class, "MgGrenade", 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));
}
}
MgGrenade class:
package com.aosp.ItemClass;
import com.aosp.Entity.EntityMgGrenade;
import ibxm.Player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class MgGrenade extends Item{
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer){
{
}
if (!entityplayer.capabilities.isCreativeMode){
--itemstack.stackSize;
}
world.playSoundAtEntity(entityplayer, "game.tnt.primed", 0.7f, 0.8f);
{
}
if(!world.isRemote){
world.spawnEntityInWorld(new EntityMgGrenade(world, entityplayer));
}
return itemstack;
}
}
EntityMgGrenade.java:
package com.aosp.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 EntityMgGrenade extends EntityThrowable{
public EntityMgGrenade(World p_i1776_1_) {
super(p_i1776_1_);
}
public EntityMgGrenade(World world, EntityLivingBase entity){
super(world, entity);
}
@Override
protected void onImpact(MovingObjectPosition arg0) {
for(int i = 0; i < 10; i++){
this.worldObj.spawnParticle("lagresmoke", 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, 2.0f, true);
}
}
}
}
Main Registry:
package com.aosp.Main;
import com.aosp.Blocks.VBlocks;
import com.aosp.Blocks.Ores;
import com.aosp.Entity.VEntity;
import com.aosp.Item.VItems;
import com.aosp.Item.VTools;
import com.aosp.lib.RefStrings;
import com.aosp.newTabs.newTabs;
import com.aosp.world.WorldGeneration;
import com.aosp.world.biome.Biomes;
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;
//Mod core
@Mod(modid = RefStrings.MODID , name = RefStrings.NAME , version = RefStrings.VERSION )
public class MainRegistry {
//Proxys
@SidedProxy(clientSide = RefStrings.CLIENTSIDE , serverSide = RefStrings.SERVERSIDE)
public static ServerProxy proxy;
@Instance
public static MainRegistry modInstance;
//Load Init
@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent){
//FIRST GOES TABS, SECOND BLOCKS AND ITEMS, *THIRD CRAFTING, FOURTH WORLD GENERATION, AND LAST PROXY!!!
newTabs.initializeTabs();
VBlocks.mainRegistry();
VEntity.mainRegistry();
Ores.mainRegistry();
VItems.mainRegistry();
VTools.mainRegistry();
CraftingManger.mainRegistry();
WorldGeneration.mainRegistry();
Biomes.init();
proxy.registerRenderInfo();
}
@EventHandler
public static void Load(FMLInitializationEvent Event){
}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent){
}
}
The Item code:
Item construct:
MgGrenade = new MgGrenade().setUnlocalizedName("MgGrenade").setCreativeTab(newTabs.tabCombat).setTextureName(RefStrings.MODID + ":MgGrenade");
Item Game Registry:
GameRegistry.registerItem(MgGrenade, MgGrenade.getUnlocalizedName());
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
You have to make the MgGrenade spawn the EntityMgGrenade
A throwable item doesn't have to be register unless you want a custom model or custom looks. Your item looks fine, but the entity won't spawn because something's wrong with your registry.
There are many tutorials on how to make a gun, which is probably what you want. Or maybe copy a snowball's source code and then make it explode when it hits something.
I fixed it, i putted onItemRight instead of onItemRightClick
but now when i throw it (it explodes when it hits the ground) it creates an illusion of destroyed items and when i try to step in the destroyed block i glitch in
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
Only spawn entities on the server (when world.isRemote is false), not the client.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I dont understand, how to do that?
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
Right before you create the explosion and summon the item in the code you have to add if(!this.worldObj.isRemote)
ok so i did that, and now the entity(grenade) falls through the world (acts like a ghost entity and ignores every block)
ok so i did that, and now the entity(grenade) falls through the world (acts like a ghost entity and ignores every block)
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
Is this the updated code:
if(this.worldObj.isRemote){
this.setDead();
if(this.worldObj.isRemote){
this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 4.0f, true);
}
You left out the !
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
I know that, i fixed it, but now the entity is invisible, it does have all the actions and everything, but when i right click to throw it, when it flies i cant see it
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
You know you can edit the first post so we can see the latest code, right?
Show us the latest code.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
O.K ill edit to the newest code.
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
I think that you might need to remove the @Override in front of on impact
No, don't remove the @Override. That is there to ensure you've declared the function correctly.
I like to rename the parameters so I know what they are, so I would change this:
@Override
protected void onImpact(MovingObjectPosition arg0) {
To:
@Override
protected void onImpact(MovingObjectPosition movObjPos) {
And I think that instead of this:
this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 2.0f, true);
You need:
this.worldObj.newExplosion(this, movObjPos.blockX, movObjPos.blockY, movObjPos.blockZ, 2.0f, true, true);
but if you want to stick with the createExplosion, I'd try this:
this.worldObj.createExplosion((Entity) null, movObjPos.posX, movObjPos.posY, movObjPos.posZ, 2.0f, true);
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
OK so i changed that, but the entity is invisible when thrown, and i need it to render like snowball, but with my texture
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
Do you have a line somewhere like this:
RenderingRegistry.registerEntityRenderingHandler(EntityMyRock.class, new RenderSnowball(ModItems.rock));
You need to register a renderer, and also a render class, here is a link to one I have in my mod:
https://github.com/DracoAnimus/Coding/blob/master/src/main/java/net/wildbill22/draco/render/RenderMyRock.java
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
so i did that, but i dont know how to connect the RenderMgGrenade and EntityMgGrenade (They are in the same package)
Sarcasm doesn´t mean what you think it means, It means what you don´t think it means, so it means what you don´t think it means, simple!
I don't think the package matters, it is the class you are registering.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]