Jump to content

[1.10] Custom Arrow not working right


terraya

Recommended Posts

Hello@All ,

 

i did a custom arrow but somehow it is not working right,

 

it work on one site, i get the arrow in my inventory etc ...

but after i shoot 1 arrow, (it waste 1 arrow from my Stack) but a normal "Arrow" appear ...so idk where the problem actualy is ...

 

my CustomArrowClass:

public class CustomArrow extends ItemArrow{

public CustomArrow() {
	super();
}

    public EntityArrow makeTippedArrow(World worldIn, ItemStack itemstack, EntityLivingBase shooter)
    {
        EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
        return new ExplosionArrow(worldIn, shooter);
    }
    
}

 

my ClientProxy register:

public class ClientProxy
  extends CommonProxy
{
@EventHandler
  public void registeRenders()
  {
    CustomBlocks.registerRenders();
    ItemsUpdate.registerRenders();
    
	 RenderManager rm = Minecraft.getMinecraft().getRenderManager();
 RenderingRegistry.registerEntityRenderingHandler(EntityModelTest.class, new RenderModelTest()); 
 RenderingRegistry.registerEntityRenderingHandler(EntityDragonTest.class, new RenderDragonTest()); 
 RenderingRegistry.registerEntityRenderingHandler(FireBall.class, new RenderFireBall(rm)); 	
 RenderingRegistry.registerEntityRenderingHandler(BigFireBall.class, new RenderBigFireBall(rm)); 	
 RenderingRegistry.registerEntityRenderingHandler(IceBall.class, new RenderIceBall(rm)); 	
 RenderingRegistry.registerEntityRenderingHandler(IceWall.class, new RenderIceBall(rm)); 	


 //RenderingRegistry.registerEntityRenderingHandler(PawHit.class, new ThrowableBlockRender(rm, ArturFarid.BlockUpdate.init.CustomBlocks.planks1,Minecraft.getMinecraft().getRenderItem()));
 //RenderingRegistry.registerEntityRenderingHandler(BigFireBall.class, new RenderApple(rm, ItemsUpdate.yoru, Minecraft.getMinecraft().getRenderItem()));	  

  }

public void registerRenderer() {
	RenderingRegistry.registerEntityRenderingHandler(ExplosionArrow.class, new IRenderFactory() {
		@Override
		public Render createRenderFor(RenderManager manager) {
			return new RenderExplosionArrow(manager);
		}
	});
}
}

 

my registry in the main class:

EntityRegistry.registerModEntity(ExplosionArrow.class, "TestArrow", 14, this, 80, 3, true);

 

my entityarrow:

public class ExplosionArrow extends EntityArrow {

public ExplosionArrow(World worldIn) {
	super(worldIn);
}

public ExplosionArrow(World worldIn, EntityLivingBase shooter) {
	super(worldIn, shooter);
}

public ExplosionArrow(World worldIn, double x, double y, double z) {
	super(worldIn, x, y, z);
}

@Override
public void onUpdate() {
	super.onUpdate();
	if (this.worldObj.isRemote && !this.inGround) {
		this.worldObj.spawnParticle(EnumParticleTypes.END_ROD, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
	} else if (!this.worldObj.isRemote && this.inGround) {
		worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, 4.0F, true);
		this.setDead();
	}
}

@Override
public ItemStack getArrowStack() {
	return new ItemStack(ItemsUpdate.TestArrow);
}

@Override
public void arrowHit(EntityLivingBase living) {
	super.arrowHit(living);
	World world = living.getEntityWorld();
	if (living != shootingEntity) {
		world.createExplosion(shootingEntity, living.posX, living.posY, living.posZ, 4.0F, true);
	}
}

}

 

my render:

@SideOnly(Side.CLIENT)
public class RenderExplosionArrow extends RenderArrow<ExplosionArrow> {

    public static final ResourceLocation res = new ResourceLocation("blockupdate:textures/entity/projectiles/TestArrow.png");

    public RenderExplosionArrow(RenderManager rm)
    {
        super(rm);
    }
    
@Override
public ResourceLocation getEntityTexture(ExplosionArrow entity) {
	return res;
}
}

 

after i shoot with the bow, the arrows land in the ground and when i pick them up i get a normal vanilla arrow ...

and the arrow is shoot is also a vanilla one , even he uses my "customarrow" from my inventory ...

 

Link to comment
Share on other sites

makeTippedArrow()

isn't overriding any method and you are not calling it yourself.

Did you mean

createArrow()

?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

makeTippedArrow()

isn't overriding any method and you are not calling it yourself.

Did you mean

createArrow()

?

 

"makeTippedArrow" is from the vanilla code , i actualy dont know what it does, but i was searchin for the past 2h for a solucion and 2codes i´ve found had it like it is in my code :S

Link to comment
Share on other sites

makeTippedArrow()

isn't overriding any method and you are not calling it yourself.

Did you mean

createArrow()

?

 

public class CustomArrow extends ItemArrow{

public CustomArrow() {
	super();
}

    public EntityArrow createArrow(World worldIn, ItemStack itemstack, EntityLivingBase shooter)
    {
    	ExplosionArrow entitytippedarrow = new ExplosionArrow(worldIn, shooter);
        return new ExplosionArrow(worldIn, shooter);
    }
    
}

 

solved it, thank you very much!

Link to comment
Share on other sites

And this is why you use @Override

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

yes, the thing is, ppl say most of the time "learn java before starting to code mods" but i started to learn java with coding mods :S

 

Do you have any OOP experience?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

yes, the thing is, ppl say most of the time "learn java before starting to code mods" but i started to learn java with coding mods :S

 

Do you have any OOP experience?

 

 

i dont think so (i dont know what OOP is)

 

i just learn before a bit of "C++" and i codetbefore in "AutoIT" like "Ingame Bots" which more around the character etc etc ..

 

 

Link to comment
Share on other sites

yes, the thing is, ppl say most of the time "learn java before starting to code mods" but i started to learn java with coding mods :S

 

Do you have any OOP experience?

 

 

i dont think so (i dont know what OOP is)

 

i just learn before a bit of "C++" and i codetbefore in "AutoIT" like "Ingame Bots" which more around the character etc etc ..

OOP is Object Oriented Programming, and C++ which can be OOP. Note always use @Override unless you are creating the method yourself.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

i dont think so (i dont know what OOP is)

 

i just learn before a bit of "C++" and i codetbefore in "AutoIT" like "Ingame Bots" which more around the character etc etc ..

 

Then basically you're doing things backwards.  You're trying to learn an entire way of thinking without knowing either the language, the codebase, or the general principles.

 

i.e. you named a method "makeTippedArrow" with the intent to override, but never actually overrode anything and didn't tell your IDE that that was your intent either, so when I asked about it you said "no no, that's actually a method in ItemArrow" which was pretty much false (I had already checked and supplied the actual method name), which meant that (at some point) you intentionally renamed the method, making the assumption (wrongly, due to your lack of OOP knowledge) that the change was meaningless and that because you didn't inform your IDE that it was supposed to override something (using @Override) your IDE couldn't spot the mistake.

 

And the reason we ask that people have some background in programming already is so that we don't have to explain things like "that's not how that works" or that's all we'd be doing.  You can go virtually anywhere else to learn Java already, this forum is not a place for it because there's already too many questions available about Minecraft and Forge specifically to handle the increased load of "I don't understand, what's X?"

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

i dont think so (i dont know what OOP is)

 

i just learn before a bit of "C++" and i codetbefore in "AutoIT" like "Ingame Bots" which more around the character etc etc ..

 

Then basically you're doing things backwards.  You're trying to learn an entire way of thinking without knowing either the language, the codebase, or the general principles.

 

i.e. you named a method "makeTippedArrow" with the intent to override, but never actually overrode anything and didn't tell your IDE that that was your intent either, so when I asked about it you said "no no, that's actually a method in ItemArrow" which was pretty much false (I had already checked and supplied the actual method name), which meant that (at some point) you intentionally renamed the method, making the assumption (wrongly, due to your lack of OOP knowledge) that the change was meaningless and that because you didn't inform your IDE that it was supposed to override something (using @Override) your IDE couldn't spot the mistake.

 

And the reason we ask that people have some background in programming already is so that we don't have to explain things like "that's not how that works" or that's all we'd be doing.  You can go virtually anywhere else to learn Java already, this forum is not a place for it because there's already too many questions available about Minecraft and Forge specifically to handle the increased load of "I don't understand, what's X?"

 

yes that true what you say , but until now it does work pretty well on coding minecraft forge (obv. i dont have to do much until now becouse there are many tutorials out there) ,

 

but  yes you´re right.

 

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.