You don't need a method, use the new operator to create an instance of a class. Again, this is a fundamental concept of Java that you should already know before trying to write a mod.
You'll need to pass the RenderManager instance to the RenderRageArrow constructor, this is returned from Minecraft#getgetRenderManager. The instance is created between the preInit and init phases, so make sure you register your entity renderers in init (from the client proxy), not preInit.
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.
No, that's accessing a field of the RenderManager class via reflection. This is completely unnecessary because the field is public (i.e. it can be accessed directly) and you don't actually need to use the field at all in this case.
By "pass the RenderManager instance to the RenderRageArrow constructor", I meant that you need to get the RenderManager instance (I described how to do this) and pass it as an argument to the RenderRageArrow constructor in the new expression.
You can't make a mod if you don't understand basic Java concepts and terminology. You said in your PM that you're not doing this to learn Java, but that's a necessary prerequisite to making a mod.
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.
Your rendering registration looks correct now, but you still haven't fixed the entity registration - you're still passing null as the entity name to EntityRegistry.registerModEntity.
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 don't understand what you mean entity name and how am I passing null?
The second argument of EntityRegistry.registerModEntity is the mod-unique name of the entity type. You're passing the value of the CustomEntities.RageArrow field for this argument, but this is never initialised so it's always null. Just pass the entity name directly to the method, there's no need for a field.
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.
That's not what I said. You just need to pass a string, e.g. "rageArrow" instead of null.
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.
Where do I need to put CustomEntities.register(); and CustomEntities.registerRenders(); for the entity arrow to be registered in game?
Call CustomEntities.register from your @Mod class in the preInit phase and call CustomEntities.registerRenders from your client proxy in the init phase.
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.
Edit 1: Changed the code, I started the game and shot an arrow with the rage bow and rage arrow in my inventory but the vanilla arrow is spawned instead of the rage arrow.
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.
no, just proxy.registerRenders(); in the @Mod init phase
If you never call a method, how do you expect the code in it to be run? If registerRenders is called in init, just call CustomEntities.registerRenders from there.
You shouldn't be calling GameRegistry.registerWorldGenerator from the client proxy, that needs to be called on both the client and server.
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.
Client and server? You mean I gotta call GameRegistry.registerWorldGenerator in the common proxy?
I placed CustomEntities.registerRenders in @Mod init phase and when I load up the game, I used the rage bow and it spawned the vanilla arrow that's invisible and it consumes my rage arrow item.
Here are all the codes related to rage arrow:
RageWeapons registry:
package com.spyeedy.itemsplus;
import com.spyeedy.itemsplus.classes.rage.EntityRageArrow;
import com.spyeedy.itemsplus.classes.rage.RenderRageArrow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
public class CustomEntities {
private static int id;
public static EntityRageArrow instance;
public static String RageArrow;
public static void init() {
System.out.println("calling #init");
}
public static void register() {
System.out.println("calling #register");
EntityRegistry.registerModEntity(EntityRageArrow.class, "rage_arrow", id++, PlusMod.instance, 64, 20, false);
}
public static void registerRenders()
{
System.out.println("calling #registerRenders");
RenderingRegistry.registerEntityRenderingHandler(EntityRageArrow.class, new RenderRageArrow(Minecraft.getMinecraft().getRenderManager()));
}
public static void registerRender(String string)
{
}
}
ItemRageArrow class:
package com.spyeedy.itemsplus.classes.rage;
import com.spyeedy.itemsplus.PlusMod;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
public class ItemRageArrow extends Item{
public ItemRageArrow(String unlocalizedName) {
super();
this.setUnlocalizedName(unlocalizedName);
this.setCreativeTab(PlusMod.tabWeaponPlus);
}
}
EntityRageArrow class:
package com.spyeedy.itemsplus.classes.rage;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.world.World;
public class EntityRageArrow extends EntityArrow {
public EntityRageArrow(World worldIn) {
super(worldIn);
}
public EntityRageArrow(World worldIn, double x, double y, double z) {
super(worldIn, x, y, z);
}
public EntityRageArrow(World worldIn, EntityLivingBase shooter, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) {
super(worldIn, shooter, p_i1755_3_, p_i1755_4_, p_i1755_5_);
}
public EntityRageArrow(World worldIn, EntityLivingBase shooter, float p_i1756_3_) {
super(worldIn, shooter, p_i1756_3_);
}
}
Finally, RenderRageArrow class:
package com.spyeedy.itemsplus.classes.rage;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderArrow;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import com.spyeedy.itemsplus.CustomEntities;
import com.spyeedy.itemsplus.Reference;
public class RenderRageArrow extends RenderArrow {
private static final ResourceLocation ragearrowTexture = new ResourceLocation("tm:textures/items/redlantern/rage_arrow.png");
public RenderRageArrow(RenderManager p_i46193_1_) {
super(p_i46193_1_);
}
@Override
public ResourceLocation getEntityTexture(Entity entity) {
return ragearrowTexture;
}
}
Call CustomEntities.registerRenders from ClientProxy#registerRenders (because it's client-only). Call GameRegistry.registerWorldGenerator from your @Mod class (because it's called on both sides).
I'm not sure why your bow isn't spawning the arrow correctly. I'll try implement this myself.
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.
am I supposed to create this code?
am I supposed to create this code?
What value should I put in to return?
You don't need a method, use the new operator to create an instance of a class. Again, this is a fundamental concept of Java that you should already know before trying to write a mod.
You'll need to pass the RenderManager instance to the RenderRageArrow constructor, this is returned from Minecraft#getgetRenderManager. The instance is created between the preInit and init phases, so make sure you register your entity renderers in init (from the client proxy), not preInit.
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.
this is a code I found from stackoverflow when I was searching for "pass the RenderManager instance"
is it "passing" in this code?
No, that's accessing a field of the RenderManager class via reflection. This is completely unnecessary because the field is public (i.e. it can be accessed directly) and you don't actually need to use the field at all in this case.
By "pass the RenderManager instance to the RenderRageArrow constructor", I meant that you need to get the RenderManager instance (I described how to do this) and pass it as an argument to the RenderRageArrow constructor in the new expression.
You can't make a mod if you don't understand basic Java concepts and terminology. You said in your PM that you're not doing this to learn Java, but that's a necessary prerequisite to making a mod.
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.
Like this?
Your rendering registration looks correct now, but you still haven't fixed the entity registration - you're still passing null as the entity name to EntityRegistry.registerModEntity.
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 don't understand what you mean entity name and how am I passing null?
The second argument of EntityRegistry.registerModEntity is the mod-unique name of the entity type. You're passing the value of the CustomEntities.RageArrow field for this argument, but this is never initialised so it's always null. Just pass the entity name directly to the method, there's no need for a field.
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.
So i have to rename RageArrow to EntityRageArrow?
That's not what I said. You just need to pass a string, e.g. "rageArrow" instead of null.
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.
ah! the inverted commas! they make whatever words in the inverted commas bubble a name was it or something along those lines?
Where do I need to put CustomEntities.register(); and CustomEntities.registerRenders(); for the entity arrow to be registered in game?
They create a string literal.
Call CustomEntities.register from your @Mod class in the preInit phase and call CustomEntities.registerRenders from your client proxy in the init phase.
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.
umm.... I made my client proxy like this
Edit 1: Changed the code, I started the game and shot an arrow with the rage bow and rage arrow in my inventory but the vanilla arrow is spawned instead of the rage arrow.
Do you call ClientProxy#init from anywhere?
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.
no, just proxy.registerRenders(); in the @Mod init phase
If you never call a method, how do you expect the code in it to be run? If registerRenders is called in init, just call CustomEntities.registerRenders from there.
You shouldn't be calling GameRegistry.registerWorldGenerator from the client proxy, that needs to be called on both the client and server.
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.
Client and server? You mean I gotta call GameRegistry.registerWorldGenerator in the common proxy?
I placed CustomEntities.registerRenders in @Mod init phase and when I load up the game, I used the rage bow and it spawned the vanilla arrow that's invisible and it consumes my rage arrow item.
Here are all the codes related to rage arrow:
RageWeapons registry:
ItemRageArrow class:
EntityRageArrow class:
Finally, RenderRageArrow class:
Call CustomEntities.registerRenders from ClientProxy#registerRenders (because it's client-only). Call GameRegistry.registerWorldGenerator from your @Mod class (because it's called on both sides).
I'm not sure why your bow isn't spawning the arrow correctly. I'll try implement this myself.
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.
this is my @Mod class
I hope it helps you