I'm not sure what you mean by #1, but for #2, you need to set the model's rotation (i.e. yaw and pitch) each time in your render class before you render it - there is always just one model being shared by every similar entity (e.g. one creeper model for all creepers).
Your entity class already extends EntityThrowable, so you don't need to explicitly call setThrowableHeading in the constructors. Get rid of that. If you were trying to make it shoot faster, all you need to do is override the getVelocity method (still obfuscated as 'func_70182_d()') to return a higher value; default is 1.5F.
but for #2, you need to set the model's rotation (i.e. yaw and pitch) each time in your render class before you render it - there is always just one model being shared by every similar entity (e.g. one creeper model for all creepers).
I'm not sure what you mean by that. Could you please eleborate? Also, in my code, I do call the rotate and translate functions before the model.render call.
I mean remove the line in each of your entity class' constructors that says 'setThrowableHeading' - it's not needed.
Also, the models rotation is not at all related to the spawn position. Using GL rotate should simply rotate your model so that it spins in one direction or another, unless you have mis-translated your matrix so that you are not rotating around the center of the model.
RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(GrenadeMod.grenade));
When I put this in my ClientProxy, it causes an error.
I use a custom Render though, but it's the same as a snowball.
I change my EntityGrenade.class to what my entity is, my own render, and changed GrenadeMod.grenade to Mymod.myitem
It simply causes an error, as it needs 3 items, not just the Item.
However if I leave that line out, it shoots a nice white block.
In all honesty, I am absolutely terrible with rendering. I have no idea how it works.
I've copied the render for a fireball, and a snowball just to see if I could get the texture working; but those both require 3 items, fireball 2 I think though. And I don't know how to fill it in.
You should have mentioned you were coding for 1.8. That's a HUGE difference.
For one, you can only register Item renderers during FMLInitializationEvent (init, NOT pre-init as the RenderManager and/or RenderItem will be null at that point).
Second, you get those from the Minecraft instance:
// where 'mc' has already been declared as 'private final Minecraft mc = Minecraft.getMinecraft();' in my ClientProxy class
RenderingRegistry.registerEntityRenderingHandler(EntityThrowingRock.class,
new RenderSnowball(mc.getRenderManager(), TutorialMain.throwingRock, mc.getRenderItem()));
So wait, do I put it in ClientProxy, or FMLInitializationEvent in my main mod file?
'during' is not a location, it is a time. Thus, 'during the FMLInitializationEvent' means you have to register the renderers within that phase of mod loading, i.e. call whatever class / methods you need to during the initialization event, such as 'proxy.registerRenderers()'. That doesn't mean move all the code from your client proxy into the event-handling method - that will crash your game when run on a dedicated server because many of the things in your client proxy are @SideOnly(Side.CLIENT), which is why they are sequestered there in the first place.
um I dont know how to say dis but how do I register a proxy? I have been watching mrcrayfish tutorials and am just now getting into stuff that may require proxies.... and when I try to add a proxy the entire code redlines.... am I able to do this without a proxy? cus I am starting to really really really hate proxies... I AM NOT REDOING THE ENTIRE CODE AGAIN!
public class SuperSmashBrosModCommonProxy implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
return null;
}
public void registerRenderers() {}
}
Thanks it works sort of how i wanted it to work. but i ran into and issue where it is a white cube and i want it to render as a snowball but it won't, any help?
@Mod(modid = mw.MODID, version = mw.VERSION, name = mw.NAME)
public final class mw
{
public static final String NAME = "mw";
public static final String MODID = "mw";
public static final String VERSION = "1.0";
@Instance(MODID)
public static mw instance = new mw();
Same for your ClientProxy location. I don't know what your "PROXY_LOCATION" constant is, but right now you are saying 'look in mw.PROXY_LOCATION' for the CommonProxy, which is definitely not the same as the package name listed in your CommonProxy.
D': I am new in programing, can you upload a video on YT? I don't understand the structure of codes...Thanks you.
If you don't have any clue about Java, you should start learning it before you attempt modding. I only make text tutorials, as code is all text. You will need to do a lot of reading if you plan to become any good at writing code.
Let me show you (you may want to turn your screen brightness all the way up):
When I shoot up, the bullet spawns to my right (the bullet is a little bit right of the middle. It the orange splotch),
But when I shoot down, the bullet spawns to my left (the bullet is on the far lower-left corner).
I'm not sure what you mean by that. Could you please eleborate? Also, in my code, I do call the rotate and translate functions before the model.render call.
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F, 0.0F, 1.0F);
However, my bullet still does not have any pitch.
Also, the models rotation is not at all related to the spawn position. Using GL rotate should simply rotate your model so that it spins in one direction or another, unless you have mis-translated your matrix so that you are not rotating around the center of the model.
So I've done everything except:
When I put this in my ClientProxy, it causes an error.
I use a custom Render though, but it's the same as a snowball.
I change my EntityGrenade.class to what my entity is, my own render, and changed GrenadeMod.grenade to Mymod.myitem
It simply causes an error, as it needs 3 items, not just the Item.
However if I leave that line out, it shoots a nice white block.
I've copied the render for a fireball, and a snowball just to see if I could get the texture working; but those both require 3 items, fireball 2 I think though. And I don't know how to fill it in.
Snowball needs a Rendermanager, Item, RenderItem
For one, you can only register Item renderers during FMLInitializationEvent (init, NOT pre-init as the RenderManager and/or RenderItem will be null at that point).
Second, you get those from the Minecraft instance:
EDIT: I've fixed it! Thank you so much!
'during' is not a location, it is a time. Thus, 'during the FMLInitializationEvent' means you have to register the renderers within that phase of mod loading, i.e. call whatever class / methods you need to during the initialization event, such as 'proxy.registerRenderers()'. That doesn't mean move all the code from your client proxy into the event-handling method - that will crash your game when run on a dedicated server because many of the things in your client proxy are @SideOnly(Side.CLIENT), which is why they are sequestered there in the first place.
package thedwainfilms19.SuperSmashBrosMod.Common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class SuperSmashBrosModCommonProxy implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
return null;
}
public void registerRenderers() {}
}
package thedwainfilms19.SuperSmashBrosMod.client;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class SuperSmashBrosModClientProxy {
}
EDIT FIXED!
code :
package thedwainfilms19.SuperSmashBrosMod;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
@SideOnly(Side.CLIENT)
public class Renderpew extends RenderSnowball
{
public Renderpew(Item item) {
this(item, 0);
}
public Renderpew(Item item, int par2) {
super(item, par2);
}
Thanks it works sort of how i wanted it to work. but i ran into and issue where it is a white cube and i want it to render as a snowball but it won't, any help?
When I tried to make the CommonProxy class and I registered it in the main mod file it says that .PROXY_LOCATION cannot be resolved or is not a field
Any ideas what is going on?
package com.example.mw;
import java.util.Iterator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCompressed;
import net.minecraft.block.material.MapColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.projectile.EntityArrow;
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.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
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.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mod(modid = mw.MODID, version = mw.VERSION, name = mw.NAME)
public final class mw
{
public static final String NAME = "mw";
public static final String MODID = "mw";
public static final String VERSION = "1.0";
@Instance(MODID)
public static mw instance = new mw();
@SidedProxy(clientSide = MODID.PROXY_LOCATION + ".client.ClientProxy", serverSide = MODID.PROXY_LOCATION + ".CommonProxy")
public static CommonProxy proxy;
// etc. then in load method:
@EventHandler
public void load(FMLInitializationEvent event)
{
proxy.registerRenderers();
// whatever else you need to register here as well
}
package com.example.mw;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class CommonProxy implements IGuiHandler
{
/*
* Methods for ClientProxy to Override
*/
public void registerRenderers() {}
@Override
public Object getClientGuiElement(int arg0, EntityPlayer arg1, World arg2,
int arg3, int arg4, int arg5) {
// TODO Auto-generated method stub
returnnull;
}
@Override
public Object getServerGuiElement(int arg0, EntityPlayer arg1, World arg2,
int arg3, int arg4, int arg5) {
// TODO Auto-generated method stub
returnnull;
}
}
If you don't have any clue about Java, you should start learning it before you attempt modding. I only make text tutorials, as code is all text. You will need to do a lot of reading if you plan to become any good at writing code.
Any changes in 1.8?