Hello,
After 2 days of hard works triying to solve my render problem, i found this post, and now it's works, Thank you !
Well, in fact i have another problem now:
My render works well in Creative but in Survival when i shoot i see the arrow(or the bullet for my mod) rotate to 180 degrees and face me but the trajectory still working. Don't really matter but still annoying.
If someone know how to fix it.
Sorry for typing error, English is not my native language.
Thanks for help !
I'm happy it worked for you xD
That's very strange your render works fine in Creative but not in Survival. If you post your code I'll take a look at it. Please post each class in it's own [ SPOILER ] and [ CODE ] tag section (remove the spaces) and include the following:
1. Class that spawns your Entity (probably an Item)
2. Entity class
3. Render class
4. Entity and Render registration code, just for completeness
I've changed my code since my last post but now the bullet have strange behavior in both mode (Still rotate in Survival but in Creative the bullet seems to do an arc of a circle to his target).
Anyway,i will put an empty texture on bullet thats it (entity hit the target even if the render doesnt).
Here's still my code:
Ok, well my advice to you would be first to extend EntityThrowable and just call the super methods where needed, rather than copying them all over to your class.
Second, you are using '21.0F' as the velocity when you spawn your bullet; that seems pretty high and may adversely affect the animations. Have you tried using 2.0F or 3.0F instead? If so, do you still get the same strange rendering behavior with the lower velocities?
Third, it looks like you are using the render arrow code, but keep in mind that is for a long thin projectile with the head at a specific orientation related to the icon texture; is your bullet icon in the exact same orientation as the arrow icon? Is your bullet the same length? Perhaps you could try using a different render base such as RenderSnowball and see how that looks.
In fact i want my gun with the same stats in real life:
I mesure ticks number in onUpdate, multiply 50ms and i shoot the target 100 meters away (100 cubes) I compare with the real life stat.
That's why my bullet are really fast. I will try your hints but if it doesn't works i will not display bullets, it doesn t really matter.
followed all of your instructions, and it doesn't seem to be working. i'm using render snowball btw. were there any changes from 1.6.2 to 1.6.4 because i saw this tutorial was made for 1.6.2 and i'm using 1.6.4
my previous problem was that my client proxy and common proxy had some issues. but those are all worked out now.
anyways, i'm now using my own render file that extends render snowball. i haven't changed anything yet in the render file, but when i right click in game to spawn my entity from my item, the game crashes. i looked through the crash report and found that the problem traces to this line of code in render snowball:
now obviously it has something to do with render snowball wanting to grab my item icon but that isn't working. my item renders the icon fine in my inventory and everything. i don't know what the problem is.
here is all my code that has to do with this problem:
Main mod file:
package mtndewey.ninjamod;
import java.net.Proxy;
import java.util.Map;
import java.util.Random;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
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.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import mtndewey.ninjamod.items.ItemKatana;
import mtndewey.ninjamod.items.ItemCommonArmor;
import mtndewey.ninjamod.items.ItemAwesomeArmor;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.client.EnumHelperClient;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import mtndewey.ninjamod.items.*;
import mtndewey.ninjamod.blocks.*;
import mtndewey.ninjamod.client.EntityNinjaStar;
import mtndewey.ninjamod.client.EventHandlerClient;
import mtndewey.ninjamod.client.CommonProxy;
import mtndewey.ninjamod.client.WorldGenClient;
import mtndewey.ninjamod.client.WorldGenSmallDojo;
import mtndewey.ninjamod.client.tabNinja;
import mtndewey.ninjamod.items.ninjamoditems;
import mtndewey.ninjamod.*;
//Forge Declaration
@Mod(modid="ninjamod",name="Ninja Mod",version="v3.6")
@NetworkMod(clientSideRequired=true,serverSideRequired=true)
public class ninjamod {
@Instance(value = "ninjamod")
public static ninjamod instance;
//Proxy & Forge
@SidedProxy(clientSide = "mtndewey.ninjamod.client.ClientProxy", serverSide = "mtndewey.ninjamod.client.ServerProxy")
public static CommonProxy proxy;
public static final String modid = "ninjamod";
private static int modEntityID = 0;
//Armor
public static Item ninjaChestAwesome;
public static Item ninjaLegsAwesome;
public static Item ninjaHelmAwesome;
public static Item ninjaBootsAwesome;
public static Item ninjaChest;
public static Item ninjaLegs;
public static Item ninjaHelm;
public static Item ninjaBoots;
//Creative Tab
public static CreativeTabs tabNinja = new tabNinja(CreativeTabs.getNextID(), "Ninja Mod");
//Materials
public static final EnumToolMaterial LEGENDARY = EnumHelperClient.addToolMaterial ("legendary", 0, 1700, 10.0F, 6.0F, 20);
public static final EnumArmorMaterial AWESOME = EnumHelperClient.addArmorMaterial("awesome", 20 , new int[]{3, 7, 6, 2}, 30);
public static final EnumArmorMaterial COMMON = EnumHelperClient.addArmorMaterial("common", 11, new int[]{3, 5, 4, 2}, 30);
@PreInit
public void PreInit(FMLPreInitializationEvent event){
//Proxy
proxy.registerRenderers();
proxy.registerServerTickHandler();
}
@Init
public void load(FMLInitializationEvent event) throws Exception {
//Method Addition
new ninjamodblocks();
new ninjamoditems();
new ninjamodrecipes();
//Armor
ninjaChestAwesome = new ItemAwesomeArmor(7905, this.AWESOME, proxy.addArmor("ninjaChestAwesome"), 1).setUnlocalizedName("ninjamod:chestNinjaAwesome").setCreativeTab(ninjamod.tabNinja);
ninjaLegsAwesome = new ItemAwesomeArmor(7906, this.AWESOME, proxy.addArmor("ninjaLegsAwesome"), 2).setUnlocalizedName("ninjamod:legsNinjaAwesome").setCreativeTab(ninjamod.tabNinja);
ninjaHelmAwesome = new ItemAwesomeArmor(7904, this.AWESOME, proxy.addArmor("ninjaHelmAwesome"), 0).setUnlocalizedName("ninjamod:helmNinjaAwesome").setCreativeTab(ninjamod.tabNinja);
ninjaBootsAwesome = new ItemAwesomeArmor(7907, this.AWESOME, proxy.addArmor("ninjaBootsAwesome"), 3).setUnlocalizedName("ninjamod:bootsNinjaAwesome").setCreativeTab(ninjamod.tabNinja);
ninjaChest = new ItemCommonArmor(7909, this.COMMON, proxy.addArmor("ninjaChest"), 1).setUnlocalizedName("ninjamod:chestNinja").setCreativeTab(ninjamod.tabNinja);
ninjaLegs = new ItemCommonArmor(7910, this.COMMON, proxy.addArmor("ninjaLegs"), 2).setUnlocalizedName("ninjamod:legsNinja").setCreativeTab(ninjamod.tabNinja);
ninjaHelm = new ItemCommonArmor(7908, this.COMMON, proxy.addArmor("ninjaHelm"), 0).setUnlocalizedName("ninjamod:helmNinja").setCreativeTab(ninjamod.tabNinja);
ninjaBoots = new ItemCommonArmor(7911, this.COMMON, proxy.addArmor("ninjaBoots"), 3).setUnlocalizedName("ninjamod:bootsNinja").setCreativeTab(ninjamod.tabNinja);
//Armor Recipes
GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaChest), Item.plateLeather, Item.dyePowder, ninjamoditems.ingotSteel);
GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaLegs), Item.legsLeather, Item.dyePowder, ninjamoditems.ingotSteel);
GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaBoots), Item.bootsLeather, Item.dyePowder, ninjamoditems.ingotSteel);
GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaHelm), Item.helmetLeather, Item.dyePowder, ninjamoditems.ingotSteel);
GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaChestAwesome), "PCP", " I ", 'I', Item.diamond, 'C', ninjamod.ninjaChest, 'P', Block.glass);
GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaLegsAwesome), "PLP" , " D ", 'L', ninjamod.ninjaLegs, 'P', Block.pistonBase, 'D', Item.diamond);
GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaBootsAwesome), "FBF", " D ", 'B', ninjamod.ninjaBoots, 'F', Item.feather, 'D', Item.diamond);
GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaHelmAwesome), "SHS", " G ", 'S', Item.diamond, 'G', Block.glass, 'H', ninjamod.ninjaHelm);
//Armor Names
LanguageRegistry.addName(ninjamod.ninjaChestAwesome, EnumChatFormatting.YELLOW + "The Strength");
LanguageRegistry.addName(ninjamod.ninjaBootsAwesome, EnumChatFormatting.YELLOW + "The Stamina");
LanguageRegistry.addName(ninjamod.ninjaLegsAwesome, EnumChatFormatting.YELLOW + "The Speed");
LanguageRegistry.addName(ninjamod.ninjaHelmAwesome, EnumChatFormatting.YELLOW + "The Sight");
LanguageRegistry.addName(ninjamod.ninjaLegs, "Common Ninja Leggings");
LanguageRegistry.addName(ninjamod.ninjaHelm, "Common Ninja Cowl");
LanguageRegistry.addName(ninjamod.ninjaBoots, "Common Ninja Boots");
LanguageRegistry.addName(ninjamod.ninjaChest, "Common Ninja Robe");
//WorldGen
GameRegistry.registerWorldGenerator(new WorldGenClient());
//Ninja Star
EntityRegistry.registerModEntity(EntityNinjaStar.class, "Ninja Star", ++modEntityID, this, 64, 10, true);
//Event Handler
MinecraftForge.EVENT_BUS.register(new EventHandlerClient());
}
@EventHandler
public void PostInit(){
//Stub Method
}
}
client proxy:
package mtndewey.ninjamod.client;
import mtndewey.ninjamod.items.ninjamoditems;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
import net.minecraft.src.ModLoader;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
public class ClientProxy extends CommonProxy {
@Override
public void registerRenderers() {
RenderingRegistry.registerEntityRenderingHandler(EntityNinjaStar.class, new RenderNinjaStar(ninjamoditems.ninjaStar));
}
@Override
public int addArmor(String armor){
return RenderingRegistry.addNewArmourRendererPrefix(armor);
}
}
my previous problem was that my client proxy and common proxy had some issues. but those are all worked out now.
anyways, i'm now using my own render file that extends render snowball. i haven't changed anything yet in the render file, but when i right click in game to spawn my entity from my item, the game crashes. i looked through the crash report and found that the problem traces to this line of code in render snowball:
now obviously it has something to do with render snowball wanting to grab my item icon but that isn't working. my item renders the icon fine in my inventory and everything. i don't know what the problem is.
here is all my code that has to do with this problem:
and that's about it. like i said in the previous post, if there were any changes between 1.6.2 and 1.6.4 let me know.
btw nice tutorial. it's just about the only one i could seem to find on the internet
Thanks. No, not much changed between those two versions that I can think of.
Could you post the entire crash report, as well as your NinjaModItems class? Do you get the same crash when using RenderSnowball instead of your custom render class?
On a side note, you should really follow Java naming conventions. Not only does it make your code easier to follow, it also helps to avoid some kinds of errors.
You can also press 'ctrl-shift-o' in Eclipse to remove unnecessary imports (like in your ItemNinjaStar class).
it does the same thing with rendersnowball. and thanks for the removing useless import advice. all my classes are now useless import free! and i looked at the naming convention link, i don't see a difference between my code and those guidlines. maybe you could help me on that a little more?
ninjamoditems:
package mtndewey.ninjamod.items;
import mtndewey.ninjamod.Registry;
import mtndewey.ninjamod.ninjamod;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.util.EnumChatFormatting;
public class ninjamoditems {
public static Item fireKatana;
public static Item waterKatana;
public static Item earthKatana;
public static Item airKatana;
public static Item ninjaStar;
public static Item katana;
public static Item legendaryKatana;
public static Item ingotSteel;
public static Item rawCarbon;
public static Item climbingSpikes;
public ninjamoditems(){
//Katanas
katana = new ItemKatana(7894, EnumToolMaterial.IRON);
legendaryKatana = new ItemKatana(7895, ninjamod.LEGENDARY);
fireKatana = new ItemFireKatana(7896, EnumToolMaterial.EMERALD);
waterKatana = new ItemWaterKatana(7897, EnumToolMaterial.EMERALD);
earthKatana = new ItemEarthKatana(7898, EnumToolMaterial.EMERALD);
airKatana = new ItemAirKatana(7899, EnumToolMaterial.EMERALD);
//Items
climbingSpikes = new ItemClimbingSpikes(7900);
ingotSteel = new ItemSteelIngot(7901);
ninjaStar = new ItemNinjaStar(7902);
rawCarbon = new ItemRawCarbon(7903);
//Registry
Registry.RegisterBasicItem(katana, "Katana", "ninjamod:katana");
Registry.RegisterBasicItem(legendaryKatana, EnumChatFormatting.YELLOW + "Legendary Katana", "ninjamod:katanaLegendary");
Registry.RegisterBasicItem(fireKatana, EnumChatFormatting.DARK_RED + "Fire Katana", "ninjamod:katanaFire");
Registry.RegisterBasicItem(waterKatana, EnumChatFormatting.DARK_BLUE + "Water Katana", "ninjamod:katanaWater");
Registry.RegisterBasicItem(earthKatana, EnumChatFormatting.DARK_GREEN + "Earth Katana", "ninjamod:katanaEarth");
Registry.RegisterBasicItem(airKatana, EnumChatFormatting.BOLD + "Air Katana", "ninjamod:katanaAir");
Registry.RegisterBasicItem(ingotSteel, "Steel Ingot", "ninjamod:ingotSteel");
Registry.RegisterBasicItem(ninjaStar, "Ninja Star", "ninjamod:ninjaStar");
Registry.RegisterBasicItem(rawCarbon, "Raw Carbon", "ninjamod:rawCarbon");
Registry.RegisterBasicItem(climbingSpikes, "Climbing Spikes", "ninjamod:climbingSpikes");
}
}
And the crash report:
Jan 31, 2014 7:51:44 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
Jan 31, 2014 7:51:44 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
Jan 31, 2014 7:51:44 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Forge Mod Loader version 6.4.49.965 for Minecraft 1.6.4 loading
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_51, running on Windows 8:amd64:6.2, installed at C:\Program Files\Java\jre7
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
2014-01-31 19:51:44 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
2014-01-31 19:51:44 [INFO] [STDOUT] Loaded 40 rules from AccessTransformer config file fml_at.cfg
2014-01-31 19:51:44 [SEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work!
2014-01-31 19:51:45 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
2014-01-31 19:51:45 [INFO] [STDOUT] Loaded 110 rules from AccessTransformer config file forge_at.cfg
2014-01-31 19:51:45 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
2014-01-31 19:51:45 [INFO] [ForgeModLoader] Launching wrapped minecraft {net.minecraft.client.main.Main}
2014-01-31 19:51:46 [INFO] [Minecraft-Client] Setting user: Player0
2014-01-31 19:51:47 [INFO] [Minecraft-Client] LWJGL Version: 2.9.0
2014-01-31 19:51:48 [INFO] [Minecraft-Client] Reloading ResourceManager: Default
2014-01-31 19:51:48 [INFO] [MinecraftForge] Attempting early MinecraftForge initialization
2014-01-31 19:51:48 [INFO] [STDOUT] MinecraftForge v9.11.1.965 Initialized
2014-01-31 19:51:48 [INFO] [ForgeModLoader] MinecraftForge v9.11.1.965 Initialized
2014-01-31 19:51:49 [INFO] [STDOUT] Replaced 111 ore recipies
2014-01-31 19:51:49 [INFO] [MinecraftForge] Completed early MinecraftForge initialization
2014-01-31 19:51:49 [INFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Jonathan\Documents\modding\Mc 1.6.4\ninjamod\ninjamod\jars\config\logging.properties
2014-01-31 19:51:49 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2014-01-31 19:51:49 [INFO] [ForgeModLoader] Searching C:\Users\Jonathan\Documents\modding\Mc 1.6.4\ninjamod\ninjamod\jars\mods for mods
2014-01-31 19:51:52 [INFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2014-01-31 19:51:52 [INFO] [mcp] Activating mod mcp
2014-01-31 19:51:52 [INFO] [FML] Activating mod FML
2014-01-31 19:51:52 [INFO] [Forge] Activating mod Forge
2014-01-31 19:51:52 [INFO] [ninjamod] Activating mod ninjamod
2014-01-31 19:51:52 [WARNING] [Forge Mod Loader] Mod Forge Mod Loader is missing a pack.mcmeta file, things may not work well
2014-01-31 19:51:52 [WARNING] [Minecraft Forge] Mod Minecraft Forge is missing a pack.mcmeta file, things may not work well
2014-01-31 19:51:52 [WARNING] [Ninja Mod] Mod Ninja Mod is missing a pack.mcmeta file, things may not work well
2014-01-31 19:51:52 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Ninja Mod
2014-01-31 19:51:52 [INFO] [ForgeModLoader] Registering Forge Packet Handler
2014-01-31 19:51:52 [INFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
2014-01-31 19:51:52 [SEVERE] [ninjamod] The mod ninjamod appears to have an invalid event annotation EventHandler. This annotation can only apply to methods with recognized event arguments - it will not be called
2014-01-31 19:51:52 [INFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2014-01-31 19:51:53 [INFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2014-01-31 19:51:53 [WARNING] [Forge Mod Loader] Mod Forge Mod Loader is missing a pack.mcmeta file, things may not work well
2014-01-31 19:51:53 [WARNING] [Minecraft Forge] Mod Minecraft Forge is missing a pack.mcmeta file, things may not work well
2014-01-31 19:51:53 [WARNING] [Ninja Mod] Mod Ninja Mod is missing a pack.mcmeta file, things may not work well
2014-01-31 19:51:53 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Ninja Mod
2014-01-31 19:51:54 [INFO] [STDOUT]
2014-01-31 19:51:54 [INFO] [STDOUT] Starting up SoundSystem...
2014-01-31 19:51:54 [INFO] [STDOUT] Initializing LWJGL OpenAL
2014-01-31 19:51:54 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
2014-01-31 19:51:54 [INFO] [STDOUT] OpenAL initialized.
2014-01-31 19:51:54 [INFO] [STDOUT]
2014-01-31 19:51:58 [INFO] [Minecraft-Server] Starting integrated minecraft server version 1.6.4
2014-01-31 19:51:58 [INFO] [Minecraft-Server] Generating keypair
2014-01-31 19:51:58 [INFO] [ForgeModLoader] Loading dimension 0 (New World) ([email protected])
2014-01-31 19:51:58 [INFO] [ForgeModLoader] Loading dimension 1 (New World) ([email protected])
2014-01-31 19:51:58 [INFO] [ForgeModLoader] Loading dimension -1 (New World) ([email protected])
2014-01-31 19:51:58 [INFO] [Minecraft-Server] Preparing start region for level 0
2014-01-31 19:51:59 [INFO] [Minecraft-Server] Preparing spawn area: 72%
2014-01-31 19:52:00 [SEVERE] [Minecraft-Client] Realms: Server not available!
2014-01-31 19:52:00 [INFO] [STDOUT] loading single player
2014-01-31 19:52:00 [INFO] [Minecraft-Server] Player0[/127.0.0.1:0] logged in with entity id 33 at (-678.1838325744934, 4.0, -1394.674594224321)
2014-01-31 19:52:00 [INFO] [Minecraft-Server] Player0 joined the game
2014-01-31 19:52:00 [INFO] [STDOUT] Setting up custom skins
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Stopping server
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving players
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Player0 left the game
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving worlds
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2014-01-31 19:52:03 [INFO] [ForgeModLoader] Unloading dimension 0
2014-01-31 19:52:03 [INFO] [ForgeModLoader] Unloading dimension -1
2014-01-31 19:52:03 [INFO] [ForgeModLoader] Unloading dimension 1
2014-01-31 19:52:03 [INFO] [STDERR] net.minecraft.util.ReportedException: Rendering entity in world
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:339)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:838)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.main.Main.main(Main.java:93)
2014-01-31 19:52:03 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2014-01-31 19:52:03 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2014-01-31 19:52:03 [INFO] [STDERR] Caused by: java.lang.NullPointerException
2014-01-31 19:52:03 [INFO] [STDERR] at mtndewey.ninjamod.client.RenderNinjaStar.doRender(RenderNinjaStar.java:45)
2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)
2014-01-31 19:52:03 [INFO] [STDERR] ... 13 more
2014-01-31 19:52:03 [INFO] [STDOUT] ---- Minecraft Crash Report ----
2014-01-31 19:52:03 [INFO] [STDOUT] // Shall we play a game?
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] Time: 1/31/14 7:52 PM
2014-01-31 19:52:03 [INFO] [STDOUT] Description: Rendering entity in world
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] java.lang.NullPointerException
2014-01-31 19:52:03 [INFO] [STDOUT] at mtndewey.ninjamod.client.RenderNinjaStar.doRender(RenderNinjaStar.java:45)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:838)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93)
2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2014-01-31 19:52:03 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] -- Head --
2014-01-31 19:52:03 [INFO] [STDOUT] Stacktrace:
2014-01-31 19:52:03 [INFO] [STDOUT] at mtndewey.ninjamod.client.RenderNinjaStar.doRender(RenderNinjaStar.java:45)
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] -- Entity being rendered --
2014-01-31 19:52:03 [INFO] [STDOUT] Details:
2014-01-31 19:52:03 [INFO] [STDOUT] Entity Type: ninjamod.Ninja Star (mtndewey.ninjamod.client.EntityNinjaStar)
2014-01-31 19:52:03 [INFO] [STDOUT] Entity ID: 812
2014-01-31 19:52:03 [INFO] [STDOUT] Entity Name: entity.ninjamod.Ninja Star.name
2014-01-31 19:52:03 [INFO] [STDOUT] Entity's Exact location: -678.34, 5.50, -1394.69
2014-01-31 19:52:03 [INFO] [STDOUT] Entity's Block location: World: (-679,5,-1395), Chunk: (at 9,0,13 in -43,-88; contains blocks -688,0,-1408 to -673,255,-1393), Region: (-2,-3; contains chunks -64,-96 to -33,-65, blocks -1024,0,-1536 to -513,255,-1025)
2014-01-31 19:52:03 [INFO] [STDOUT] Entity's Momentum: 0.09, 0.05, 1.48
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] -- Renderer details --
2014-01-31 19:52:03 [INFO] [STDOUT] Details:
2014-01-31 19:52:03 [INFO] [STDOUT] Assigned renderer: [email protected]
2014-01-31 19:52:03 [INFO] [STDOUT] Location: -0.16,-0.12,-0.01 - World: (-1,-1,-1), Chunk: (at 15,-1,15 in -1,-1; contains blocks -16,0,-16 to -1,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
2014-01-31 19:52:03 [INFO] [STDOUT] Rotation: 3.6084688
2014-01-31 19:52:03 [INFO] [STDOUT] Delta: 0.28200638
2014-01-31 19:52:03 [INFO] [STDOUT] Stacktrace:
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160)
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] -- Affected level --
2014-01-31 19:52:03 [INFO] [STDOUT] Details:
2014-01-31 19:52:03 [INFO] [STDOUT] Level name: MpServer
2014-01-31 19:52:03 [INFO] [STDOUT] All players: 1 total; [EntityClientPlayerMP['Player0'/33, l='MpServer', x=-678.18, y=5.62, z=-1394.67]]
2014-01-31 19:52:03 [INFO] [STDOUT] Chunk stats: MultiplayerChunkCache: 210
2014-01-31 19:52:03 [INFO] [STDOUT] Level seed: 0
2014-01-31 19:52:03 [INFO] [STDOUT] Level generator: ID 01 - flat, ver 0. Features enabled: false
2014-01-31 19:52:03 [INFO] [STDOUT] Level generator options:
2014-01-31 19:52:03 [INFO] [STDOUT] Level spawn location: World: (-669,4,-1387), Chunk: (at 3,0,5 in -42,-87; contains blocks -672,0,-1392 to -657,255,-1377), Region: (-2,-3; contains chunks -64,-96 to -33,-65, blocks -1024,0,-1536 to -513,255,-1025)
2014-01-31 19:52:03 [INFO] [STDOUT] Level time: 1428 game time, 1428 day time
2014-01-31 19:52:03 [INFO] [STDOUT] Level dimension: 0
2014-01-31 19:52:03 [INFO] [STDOUT] Level storage version: 0x00000 - Unknown?
2014-01-31 19:52:03 [INFO] [STDOUT] Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
2014-01-31 19:52:03 [INFO] [STDOUT] Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
2014-01-31 19:52:03 [INFO] [STDOUT] Forced entities: 8 total; [EntitySlime['Slime'/21, l='MpServer', x=-732.06, y=4.00, z=-1428.09], EntitySlime['Slime'/20, l='MpServer', x=-732.26, y=4.00, z=-1454.00], EntitySlime['Slime'/23, l='MpServer', x=-703.15, y=4.00, z=-1349.64], EntityNinjaStar['entity.ninjamod.Ninja Star.name'/812, l='MpServer', x=-678.34, y=5.50, z=-1394.69], EntitySlime['Slime'/24, l='MpServer', x=-681.72, y=4.00, z=-1443.59], EntitySlime['Slime'/27, l='MpServer', x=-638.47, y=4.81, z=-1368.37], EntitySlime['Slime'/26, l='MpServer', x=-645.88, y=4.96, z=-1462.69], EntityClientPlayerMP['Player0'/33, l='MpServer', x=-678.18, y=5.62, z=-1394.67]]
2014-01-31 19:52:03 [INFO] [STDOUT] Retry entities: 0 total; []
2014-01-31 19:52:03 [INFO] [STDOUT] Server brand: fml,forge
2014-01-31 19:52:03 [INFO] [STDOUT] Server type: Integrated singleplayer server
2014-01-31 19:52:03 [INFO] [STDOUT] Stacktrace:
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2312)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:856)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93)
2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2014-01-31 19:52:03 [INFO] [STDOUT]
2014-01-31 19:52:03 [INFO] [STDOUT] -- System Details --
2014-01-31 19:52:03 [INFO] [STDOUT] Details:
2014-01-31 19:52:03 [INFO] [STDOUT] Minecraft Version: 1.6.4
2014-01-31 19:52:03 [INFO] [STDOUT] Operating System: Windows 8 (amd64) version 6.2
2014-01-31 19:52:03 [INFO] [STDOUT] Java Version: 1.7.0_51, Oracle Corporation
2014-01-31 19:52:03 [INFO] [STDOUT] Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
2014-01-31 19:52:03 [INFO] [STDOUT] Memory: 743275184 bytes (708 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
2014-01-31 19:52:03 [INFO] [STDOUT] JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
2014-01-31 19:52:03 [INFO] [STDOUT] AABB Pool Size: 21635 (1211560 bytes; 1 MB) allocated, 144 (8064 bytes; 0 MB) used
2014-01-31 19:52:03 [INFO] [STDOUT] Suspicious classes: FML and Forge are installed
2014-01-31 19:52:03 [INFO] [STDOUT] IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
2014-01-31 19:52:03 [INFO] [STDOUT] FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 4 mods loaded, 4 mods active
2014-01-31 19:52:03 [INFO] [STDOUT] mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2014-01-31 19:52:03 [INFO] [STDOUT] FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2014-01-31 19:52:03 [INFO] [STDOUT] Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2014-01-31 19:52:03 [INFO] [STDOUT] ninjamod{v3.6} [Ninja Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2014-01-31 19:52:03 [INFO] [STDOUT] Launched Version: 1.6
2014-01-31 19:52:03 [INFO] [STDOUT] LWJGL: 2.9.0
2014-01-31 19:52:03 [INFO] [STDOUT] OpenGL: Intel(R) HD Graphics 4600 GL version 4.2.0 - Build 10.18.10.3277, Intel
2014-01-31 19:52:03 [INFO] [STDOUT] Is Modded: Definitely; Client brand changed to 'fml,forge'
2014-01-31 19:52:03 [INFO] [STDOUT] Type: Client (map_client.txt)
2014-01-31 19:52:03 [INFO] [STDOUT] Resource Pack: Default
2014-01-31 19:52:03 [INFO] [STDOUT] Current Language: English (US)
2014-01-31 19:52:03 [INFO] [STDOUT] Profiler Position: N/A (disabled)
2014-01-31 19:52:03 [INFO] [STDOUT] Vec3 Pool Size: 277 (15512 bytes; 0 MB) allocated, 53 (2968 bytes; 0 MB) used
2014-01-31 19:52:03 [INFO] [STDOUT] #@[email protected]# Game crashed! Crash report saved to: #@[email protected]# C:\Users\Jonathan\Documents\modding\Mc 1.6.4\ninjamod\ninjamod\jars\.\crash-reports\crash-2014-01-31_19.52.03-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
it does the same thing with rendersnowball. and thanks for the removing useless import advice. all my classes are now useless import free! and i looked at the naming convention link, i don't see a difference between my code and those guidlines. maybe you could help me on that a little more?
Sure Class names should always be uppercase: NinjaModItems, and method names are written just like field names, the first letter lowercase and then each word with uppercase: public void preInit(...) instead of public void PreInit.
I need to see your BaseModItem and Registry classes, too, to find out why there is a null pointer exception happening in the render code, and if you could do me a favor and just use RenderSnowball for now and post a crash report using that instead of your custom render class, that would be very helpful.
LOL!!! Hahaha, oh man. Can't believe it took this long, but thanks for your patience. So the problem is you are registering the render class before your Item is declared, so of course it is null.
Just put 'proxy.registerRenderers()' AFTER all your items and such are registered, and you should be fine.
Or rather, put your item and block initialization into the pre-init method before you register the renderers:
@PreInit
public void PreInit(FMLPreInitializationEvent event){
new ninjamodblocks();
new ninjamoditems();
//Proxy
proxy.registerRenderers();
proxy.registerServerTickHandler();
}
YES!! Thanks alot man do you know how to make a model for the entity in techne and then using that instead of the normal icon, and also being able to pick them up like arrows?
YES!! Thanks alot man do you know how to make a model for the entity in techne and then using that instead of the normal icon, and also being able to pick them up like arrows?
No problem For Techne, I've never personally used it, but I hear it's pretty simple. Once you have a model, you will need to make a custom render class and call the model's render methods, making sure that the rotation and such is correct.
As for picking them up like arrows, take a look at the EntityArrow class. You will need to save the tile x/y/z that it hits, stop it's motion when it impacts and don't set it to dead; alternatively (and much easier) is to spawn an EntityItem at the impact position if it is a block. It won't look all cool sticking into the ground that way, but it will probably save you both time and frustration.
ok so i made a model in techne and it looks great in game but i want it to be facing sideways, but it only does when i'm facing a certain way. also, i've been trying to play around with the spawning a new entity at the impact position but i cant get it to work. can you help me out?
ok so i made a model in techne and it looks great in game but i want it to be facing sideways, but it only does when i'm facing a certain way. also, i've been trying to play around with the spawning a new entity at the impact position but i cant get it to work. can you help me out?
For the rendering, sorry but you're on your own. OpenGL and I are not good friends
For spawning an entity at the impact position, that's simple. Using your custom throwable entity's onImpact method, you have a MovingObjectPosition as well as the entity's own position coordinates (posX, posY, posZ). Create whatever new entity you want using one of those two coordinate sets and spawn it just like you did the projectile.
when i try to use spawnEntityInWorld (what i used for onrightclick) it gets an error saying i can't make a static reference with a non static method. am i doing something wrong?
when i try to use spawnEntityInWorld (what i used for onrightclick) it gets an error saying i can't make a static reference with a non static method. am i doing something wrong?
Yes. You cannot make a static reference to a non-static method I recommend throwing that error statement into Google and seeing if you can't find an explanation. Or post your code and I can tell you which part is at fault.
protected void onImpact(MovingObjectPosition movObjPos)
{
if (movObjPos.entityHit != null)
{
byte starDamage = 4;
movObjPos.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)starDamage);
int i = movObjPos.blockX;
int j = movObjPos.blockY;
int k = movObjPos.blockZ;
switch (movObjPos.sideHit)
{
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
}
if (!World.isRemote)
{
World.spawnEntityInWorld(new EntityNinjaStar(World, EntityPlayer));
}
The error is at the world.isremote and world.spawnentityinworld
if (!World.isRemote)
{
World.spawnEntityInWorld(new EntityNinjaStar(World, EntityPlayer));
}
Of course, that's why Java naming conventions are so important. Understand that a capital 'W' on 'world' means that you are referencing the World class, rather than a field within your ninja star class. That is what is known as a 'static reference'. You need to use the world object field of your entity, which is non-static, to use the non-static method spawnEntityInWorld.
Please google static as well as following all of the tutorials on Oracle's Java tutorial website, for your own benefit. In the meantime, just change 'World' to 'worldObj' and it should work fine.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI'm happy it worked for you xD
That's very strange your render works fine in Creative but not in Survival. If you post your code I'll take a look at it. Please post each class in it's own [ SPOILER ] and [ CODE ] tag section (remove the spaces) and include the following:
1. Class that spawns your Entity (probably an Item)
2. Entity class
3. Render class
4. Entity and Render registration code, just for completeness
Anyway,i will put an empty texture on bullet thats it (entity hit the target even if the render doesnt).
Here's still my code:
package projectz.gun; import java.util.Timer; import projectz.common.ProjectZMain; import projectz.entity.EntityBullet; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowNockEvent; public class ItemGun extends Item{ private int damage; private float velocity; private float accuracy; private float accuracyMem; private float recoil; private float fireDelay; private int maxMagazine; //id, damage, velocity, accuracy, recoil, firedelay, sighttype, maxmagazine, firemode public ItemGun(int id) { super(id); setCreativeTab(CreativeTabs.tabCombat); } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(ProjectZMain.z45Acp.itemID)) { par3EntityPlayer.inventory.consumeInventoryItem(ProjectZMain.z45Acp.itemID); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityBullet(par2World, par3EntityPlayer, 21.0F)); } } return par1ItemStack; } public Object getAmmo() { return null; } }package projectz.entity; import java.util.List; import java.util.Timer; import java.util.TimerTask; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentThorns; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet70GameEvent; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class EntityBullet extends Entity{ private int knockbackStrength; private double damage; private int canBePickedUp; private boolean inGround; public int arrowShake = 0; private int inData; private int inTile; private int zTile = -1; private int yTile = -1; private int xTile = -1; private int ticksInGround; private int ticksInAir; private Entity shootingEntity; private boolean stopTick = false; private boolean doneDisplay = true; public int nbTicks; public int secondes; private float bulletVelocity; public EntityBullet(World par1World) { super(par1World); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); } public EntityBullet(World par1World, double par2, double par4, double par6) { super(par1World); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); this.setPosition(par2, par4, par6); this.yOffset = 0.0F; } public EntityBullet(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLivingBase; this.posY = par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D; double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX; double d1 = par3EntityLivingBase.boundingBox.minY + (double)(par3EntityLivingBase.height / 3.0F) - this.posY; double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ; double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); if (d3 >= 1.0E-7D) { float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; double d5 = d2 / d3; this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3); this.yOffset = 0.0F; float f4 = (float)d3 * 0.2F; this.setThrowableHeading(d0, d1 + (double)f4, d2, par4, par5); } } public EntityBullet(World par1World, EntityLivingBase par2EntityLivingBase, float par3) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLivingBase; this.setSize(0.5F, 0.5F); this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); //setThrowableHeading(VecteurX, VecteurY, VecteurZ, Vitesse, Precision). this.bulletVelocity = par3; this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.bulletVelocity, 1.0F); } public void setTime() { } @Override protected void entityInit() { this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); } public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) { float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); par1 /= (double)f2; par3 /= (double)f2; par5 /= (double)f2; par1 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8; // =0 pas de dispersion. par3 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8; par5 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8; par1 *= (double)par7; par3 *= (double)par7; par5 *= (double)par7; this.motionX = par1; this.motionY = par3; this.motionZ = par5; float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f3) * 180.0D / Math.PI); this.ticksInGround = 0; } @SideOnly(Side.CLIENT) /** * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @SideOnly(Side.CLIENT) /** * Sets the velocity to the args. Args: x, y, z */ @Override public void setVelocity(double par1, double par3, double par5) { this.motionX = par1; this.motionY = par3; this.motionZ = par5; if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); this.ticksInGround = 0; } } /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); if(this.stopTick && this.doneDisplay) { int nbMs = nbTicks * 50; System.out.println(this.entityId + " 100 meters in " + nbMs + "ms"); this.doneDisplay = false; } if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); } int i = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); if (i > 0) { Block.blocksList[i].setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ))) { this.inGround = true; } } if (this.arrowShake > 0) { --this.arrowShake; } if (this.inGround) { int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); this.stopTick = true; if (j == this.inTile && k == this.inData) { ++this.ticksInGround; if (this.ticksInGround == 1200) { this.setDead(); } } else { this.inGround = false; this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.ticksInGround = 0; this.ticksInAir = 0; } } else { ++this.ticksInAir; ++this.nbTicks; Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, false, true); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int l; float f1; for (l = 0; l < list.size(); ++l) { Entity entity1 = (Entity)list.get(l); if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); if (movingobjectposition1 != null) { double d1 = vec3.distanceTo(movingobjectposition1.hitVec); if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } } } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit; if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } float f2; float f3; if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); int i1 = MathHelper.ceiling_double_int((double)f2 * this.damage); if (this.getIsCritical()) { i1 += this.rand.nextInt(i1 / 2 + 2); } DamageSource damagesource = null; if (this.shootingEntity == null) { damagesource = DamageSource.causeArrowDamage(this, this); } else { damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); } if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { movingobjectposition.entityHit.setFire(5); } if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)i1)) { if (movingobjectposition.entityHit instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit; if (!this.worldObj.isRemote) { entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); } if (this.knockbackStrength > 0) { f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f3 > 0.0F) { movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f3); } } if (this.shootingEntity != null) { EnchantmentThorns.func_92096_a(this.shootingEntity, entitylivingbase, this.rand); } if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0)); } } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); if (!(movingobjectposition.entityHit instanceof EntityEnderman)) { this.setDead(); } } else { this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; this.motionZ *= -0.10000000149011612D; this.rotationYaw += 180.0F; this.prevRotationYaw += 180.0F; this.ticksInAir = 0; } } else { this.xTile = movingobjectposition.blockX; this.yTile = movingobjectposition.blockY; this.zTile = movingobjectposition.blockZ; this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ)); f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / (double)f2 * 0.05000000074505806D; this.posY -= this.motionY / (double)f2 * 0.05000000074505806D; this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D; this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.arrowShake = 0; this.setIsCritical(false); if (this.inTile != 0) { Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); } } } if (this.getIsCritical()) { for (l = 0; l < 4; ++l) { this.worldObj.spawnParticle("crit", this.posX + this.motionX * (double)l / 4.0D, this.posY + this.motionY * (double)l / 4.0D, this.posZ + this.motionZ * (double)l / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); } } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f4 = 0.99F; f1 = 0.0003F * this.bulletVelocity; if (this.isInWater()) { for (int j1 = 0; j1 < 4; ++j1) { f3 = 0.25F; this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); } f4 = 0.8F; } this.motionX *= (double)f4; this.motionY *= (double)f4; this.motionZ *= (double)f4; this.motionY -= (double)f1; this.setPosition(this.posX, this.posY, this.posZ); this.doBlockCollisions(); } } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short)this.xTile); par1NBTTagCompound.setShort("yTile", (short)this.yTile); par1NBTTagCompound.setShort("zTile", (short)this.zTile); par1NBTTagCompound.setByte("inTile", (byte)this.inTile); par1NBTTagCompound.setByte("inData", (byte)this.inData); par1NBTTagCompound.setByte("shake", (byte)this.arrowShake); par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); par1NBTTagCompound.setByte("pickup", (byte)this.canBePickedUp); par1NBTTagCompound.setDouble("damage", this.damage); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { this.xTile = par1NBTTagCompound.getShort("xTile"); this.yTile = par1NBTTagCompound.getShort("yTile"); this.zTile = par1NBTTagCompound.getShort("zTile"); this.inTile = par1NBTTagCompound.getByte("inTile") & 255; this.inData = par1NBTTagCompound.getByte("inData") & 255; this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; this.inGround = par1NBTTagCompound.getByte("inGround") == 1; if (par1NBTTagCompound.hasKey("damage")) { this.damage = par1NBTTagCompound.getDouble("damage"); } if (par1NBTTagCompound.hasKey("pickup")) { this.canBePickedUp = par1NBTTagCompound.getByte("pickup"); } else if (par1NBTTagCompound.hasKey("player")) { this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0; } } /** * Called by a player entity when they collide with an entity */ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1))) { flag = false; } if (flag) { this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } } } /** * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to * prevent them from trampling crops */ protected boolean canTriggerWalking() { return false; } @SideOnly(Side.CLIENT) public float getShadowSize() { return 0.0F; } public void setDamage(double par1) { this.damage = par1; } public double getDamage() { return this.damage; } /** * Sets the amount of knockback the arrow applies when it hits a mob. */ public void setKnockbackStrength(int par1) { this.knockbackStrength = par1; } /** * If returns false, the item will not inflict any damage against entities. */ public boolean canAttackWithItem() { return false; } /** * Whether the arrow has a stream of critical hit particles flying behind it. */ public void setIsCritical(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); } } /** * Whether the arrow has a stream of critical hit particles flying behind it. */ public boolean getIsCritical() { byte b0 = this.dataWatcher.getWatchableObjectByte(16); return (b0 & 1) != 0; } }package projectz.render; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import projectz.entity.EntityBullet; @SideOnly(Side.CLIENT) public class RenderBullet extends Render { private static final ResourceLocation arrowTextures = new ResourceLocation("projectz:textures/entity/bullet.png"); public void renderArrow(EntityBullet par1EntityArrow, double par2, double par4, double par6, float par8, float par9) { this.bindEntityTexture(par1EntityArrow); GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float)(0 + b0 * 10) / 32.0F; float f5 = (float)(5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float)(5 + b0 * 10) / 32.0F; float f9 = (float)(10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = (float)par1EntityArrow.arrowShake - par9; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } protected ResourceLocation getArrowTextures(EntityBullet par1EntityArrow) { return arrowTextures; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getArrowTextures((EntityBullet)par1Entity); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.renderArrow((EntityBullet)par1Entity, par2, par4, par6, par8, par9); } }-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSecond, you are using '21.0F' as the velocity when you spawn your bullet; that seems pretty high and may adversely affect the animations. Have you tried using 2.0F or 3.0F instead? If so, do you still get the same strange rendering behavior with the lower velocities?
Third, it looks like you are using the render arrow code, but keep in mind that is for a long thin projectile with the head at a specific orientation related to the icon texture; is your bullet icon in the exact same orientation as the arrow icon? Is your bullet the same length? Perhaps you could try using a different render base such as RenderSnowball and see how that looks.
I mesure ticks number in onUpdate, multiply 50ms and i shoot the target 100 meters away (100 cubes) I compare with the real life stat.
That's why my bullet are really fast. I will try your hints but if it doesn't works i will not display bullets, it doesn t really matter.
Thanks for help i will tell the results !
anyways, i'm now using my own render file that extends render snowball. i haven't changed anything yet in the render file, but when i right click in game to spawn my entity from my item, the game crashes. i looked through the crash report and found that the problem traces to this line of code in render snowball:
now obviously it has something to do with render snowball wanting to grab my item icon but that isn't working. my item renders the icon fine in my inventory and everything. i don't know what the problem is.
here is all my code that has to do with this problem:
Main mod file:
package mtndewey.ninjamod; import java.net.Proxy; import java.util.Map; import java.util.Random; import org.lwjgl.input.Keyboard; import cpw.mods.fml.client.registry.KeyBindingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; 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.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import mtndewey.ninjamod.items.ItemKatana; import mtndewey.ninjamod.items.ItemCommonArmor; import mtndewey.ninjamod.items.ItemAwesomeArmor; import net.minecraft.block.Block; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.settings.KeyBinding; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.client.EnumHelperClient; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; import mtndewey.ninjamod.items.*; import mtndewey.ninjamod.blocks.*; import mtndewey.ninjamod.client.EntityNinjaStar; import mtndewey.ninjamod.client.EventHandlerClient; import mtndewey.ninjamod.client.CommonProxy; import mtndewey.ninjamod.client.WorldGenClient; import mtndewey.ninjamod.client.WorldGenSmallDojo; import mtndewey.ninjamod.client.tabNinja; import mtndewey.ninjamod.items.ninjamoditems; import mtndewey.ninjamod.*; //Forge Declaration @Mod(modid="ninjamod",name="Ninja Mod",version="v3.6") @NetworkMod(clientSideRequired=true,serverSideRequired=true) public class ninjamod { @Instance(value = "ninjamod") public static ninjamod instance; //Proxy & Forge @SidedProxy(clientSide = "mtndewey.ninjamod.client.ClientProxy", serverSide = "mtndewey.ninjamod.client.ServerProxy") public static CommonProxy proxy; public static final String modid = "ninjamod"; private static int modEntityID = 0; //Armor public static Item ninjaChestAwesome; public static Item ninjaLegsAwesome; public static Item ninjaHelmAwesome; public static Item ninjaBootsAwesome; public static Item ninjaChest; public static Item ninjaLegs; public static Item ninjaHelm; public static Item ninjaBoots; //Creative Tab public static CreativeTabs tabNinja = new tabNinja(CreativeTabs.getNextID(), "Ninja Mod"); //Materials public static final EnumToolMaterial LEGENDARY = EnumHelperClient.addToolMaterial ("legendary", 0, 1700, 10.0F, 6.0F, 20); public static final EnumArmorMaterial AWESOME = EnumHelperClient.addArmorMaterial("awesome", 20 , new int[]{3, 7, 6, 2}, 30); public static final EnumArmorMaterial COMMON = EnumHelperClient.addArmorMaterial("common", 11, new int[]{3, 5, 4, 2}, 30); @PreInit public void PreInit(FMLPreInitializationEvent event){ //Proxy proxy.registerRenderers(); proxy.registerServerTickHandler(); } @Init public void load(FMLInitializationEvent event) throws Exception { //Method Addition new ninjamodblocks(); new ninjamoditems(); new ninjamodrecipes(); //Armor ninjaChestAwesome = new ItemAwesomeArmor(7905, this.AWESOME, proxy.addArmor("ninjaChestAwesome"), 1).setUnlocalizedName("ninjamod:chestNinjaAwesome").setCreativeTab(ninjamod.tabNinja); ninjaLegsAwesome = new ItemAwesomeArmor(7906, this.AWESOME, proxy.addArmor("ninjaLegsAwesome"), 2).setUnlocalizedName("ninjamod:legsNinjaAwesome").setCreativeTab(ninjamod.tabNinja); ninjaHelmAwesome = new ItemAwesomeArmor(7904, this.AWESOME, proxy.addArmor("ninjaHelmAwesome"), 0).setUnlocalizedName("ninjamod:helmNinjaAwesome").setCreativeTab(ninjamod.tabNinja); ninjaBootsAwesome = new ItemAwesomeArmor(7907, this.AWESOME, proxy.addArmor("ninjaBootsAwesome"), 3).setUnlocalizedName("ninjamod:bootsNinjaAwesome").setCreativeTab(ninjamod.tabNinja); ninjaChest = new ItemCommonArmor(7909, this.COMMON, proxy.addArmor("ninjaChest"), 1).setUnlocalizedName("ninjamod:chestNinja").setCreativeTab(ninjamod.tabNinja); ninjaLegs = new ItemCommonArmor(7910, this.COMMON, proxy.addArmor("ninjaLegs"), 2).setUnlocalizedName("ninjamod:legsNinja").setCreativeTab(ninjamod.tabNinja); ninjaHelm = new ItemCommonArmor(7908, this.COMMON, proxy.addArmor("ninjaHelm"), 0).setUnlocalizedName("ninjamod:helmNinja").setCreativeTab(ninjamod.tabNinja); ninjaBoots = new ItemCommonArmor(7911, this.COMMON, proxy.addArmor("ninjaBoots"), 3).setUnlocalizedName("ninjamod:bootsNinja").setCreativeTab(ninjamod.tabNinja); //Armor Recipes GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaChest), Item.plateLeather, Item.dyePowder, ninjamoditems.ingotSteel); GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaLegs), Item.legsLeather, Item.dyePowder, ninjamoditems.ingotSteel); GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaBoots), Item.bootsLeather, Item.dyePowder, ninjamoditems.ingotSteel); GameRegistry.addShapelessRecipe(new ItemStack(ninjamod.ninjaHelm), Item.helmetLeather, Item.dyePowder, ninjamoditems.ingotSteel); GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaChestAwesome), "PCP", " I ", 'I', Item.diamond, 'C', ninjamod.ninjaChest, 'P', Block.glass); GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaLegsAwesome), "PLP" , " D ", 'L', ninjamod.ninjaLegs, 'P', Block.pistonBase, 'D', Item.diamond); GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaBootsAwesome), "FBF", " D ", 'B', ninjamod.ninjaBoots, 'F', Item.feather, 'D', Item.diamond); GameRegistry.addRecipe(new ItemStack(ninjamod.ninjaHelmAwesome), "SHS", " G ", 'S', Item.diamond, 'G', Block.glass, 'H', ninjamod.ninjaHelm); //Armor Names LanguageRegistry.addName(ninjamod.ninjaChestAwesome, EnumChatFormatting.YELLOW + "The Strength"); LanguageRegistry.addName(ninjamod.ninjaBootsAwesome, EnumChatFormatting.YELLOW + "The Stamina"); LanguageRegistry.addName(ninjamod.ninjaLegsAwesome, EnumChatFormatting.YELLOW + "The Speed"); LanguageRegistry.addName(ninjamod.ninjaHelmAwesome, EnumChatFormatting.YELLOW + "The Sight"); LanguageRegistry.addName(ninjamod.ninjaLegs, "Common Ninja Leggings"); LanguageRegistry.addName(ninjamod.ninjaHelm, "Common Ninja Cowl"); LanguageRegistry.addName(ninjamod.ninjaBoots, "Common Ninja Boots"); LanguageRegistry.addName(ninjamod.ninjaChest, "Common Ninja Robe"); //WorldGen GameRegistry.registerWorldGenerator(new WorldGenClient()); //Ninja Star EntityRegistry.registerModEntity(EntityNinjaStar.class, "Ninja Star", ++modEntityID, this, 64, 10, true); //Event Handler MinecraftForge.EVENT_BUS.register(new EventHandlerClient()); } @EventHandler public void PostInit(){ //Stub Method } }client proxy:
package mtndewey.ninjamod.client; import mtndewey.ninjamod.items.ninjamoditems; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.item.Item; import net.minecraft.src.ModLoader; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.EntityRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityNinjaStar.class, new RenderNinjaStar(ninjamoditems.ninjaStar)); } @Override public int addArmor(String armor){ return RenderingRegistry.addNewArmourRendererPrefix(armor); } }my item class:
package mtndewey.ninjamod.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mtndewey.ninjamod.client.EntityNinjaStar; import mtndewey.ninjamod.ninjamod; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.world.World; public class ItemNinjaStar extends BaseModItem{ public ItemNinjaStar(int par1) { super(par1); this.maxStackSize = 16; } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityNinjaStar(par2World, par3EntityPlayer)); } return par1ItemStack; } }my entity class:
package mtndewey.ninjamod.client; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityNinjaStar extends EntityThrowable { public EntityNinjaStar(World par1World) { super(par1World); } public EntityNinjaStar(World par1World, EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); } public EntityNinjaStar(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } @Override protected void onImpact(MovingObjectPosition movObjPos) { if (movObjPos.entityHit != null) { float starDamage = 5; movObjPos.entityHit.attackEntityFrom( DamageSource.causeThrownDamage(this, this.getThrower()), starDamage); } for (int i = 0; i < 8; ++i) { this.worldObj.spawnParticle("crit", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } if (!this.worldObj.isRemote) { this.setDead(); } } }my render class
package mtndewey.ninjamod.client; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityPotion; import net.minecraft.item.Item; import net.minecraft.item.ItemPotion; import net.minecraft.potion.PotionHelper; import net.minecraft.util.Icon; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) public class RenderNinjaStar extends RenderSnowball { public RenderNinjaStar(Item par1Item) { this(par1Item, 0); } public RenderNinjaStar(Item par1Item, int i) { super(par1Item, i); } }and that's about it. like i said in the previous post, if there were any changes between 1.6.2 and 1.6.4 let me know.
btw nice tutorial. it's just about the only one i could seem to find on the internet
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThanks. No, not much changed between those two versions that I can think of.
Could you post the entire crash report, as well as your NinjaModItems class? Do you get the same crash when using RenderSnowball instead of your custom render class?
On a side note, you should really follow Java naming conventions. Not only does it make your code easier to follow, it also helps to avoid some kinds of errors.
You can also press 'ctrl-shift-o' in Eclipse to remove unnecessary imports (like in your ItemNinjaStar class).
Sounds like a fun mod xD
ninjamoditems:
package mtndewey.ninjamod.items; import mtndewey.ninjamod.Registry; import mtndewey.ninjamod.ninjamod; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.util.EnumChatFormatting; public class ninjamoditems { public static Item fireKatana; public static Item waterKatana; public static Item earthKatana; public static Item airKatana; public static Item ninjaStar; public static Item katana; public static Item legendaryKatana; public static Item ingotSteel; public static Item rawCarbon; public static Item climbingSpikes; public ninjamoditems(){ //Katanas katana = new ItemKatana(7894, EnumToolMaterial.IRON); legendaryKatana = new ItemKatana(7895, ninjamod.LEGENDARY); fireKatana = new ItemFireKatana(7896, EnumToolMaterial.EMERALD); waterKatana = new ItemWaterKatana(7897, EnumToolMaterial.EMERALD); earthKatana = new ItemEarthKatana(7898, EnumToolMaterial.EMERALD); airKatana = new ItemAirKatana(7899, EnumToolMaterial.EMERALD); //Items climbingSpikes = new ItemClimbingSpikes(7900); ingotSteel = new ItemSteelIngot(7901); ninjaStar = new ItemNinjaStar(7902); rawCarbon = new ItemRawCarbon(7903); //Registry Registry.RegisterBasicItem(katana, "Katana", "ninjamod:katana"); Registry.RegisterBasicItem(legendaryKatana, EnumChatFormatting.YELLOW + "Legendary Katana", "ninjamod:katanaLegendary"); Registry.RegisterBasicItem(fireKatana, EnumChatFormatting.DARK_RED + "Fire Katana", "ninjamod:katanaFire"); Registry.RegisterBasicItem(waterKatana, EnumChatFormatting.DARK_BLUE + "Water Katana", "ninjamod:katanaWater"); Registry.RegisterBasicItem(earthKatana, EnumChatFormatting.DARK_GREEN + "Earth Katana", "ninjamod:katanaEarth"); Registry.RegisterBasicItem(airKatana, EnumChatFormatting.BOLD + "Air Katana", "ninjamod:katanaAir"); Registry.RegisterBasicItem(ingotSteel, "Steel Ingot", "ninjamod:ingotSteel"); Registry.RegisterBasicItem(ninjaStar, "Ninja Star", "ninjamod:ninjaStar"); Registry.RegisterBasicItem(rawCarbon, "Raw Carbon", "ninjamod:rawCarbon"); Registry.RegisterBasicItem(climbingSpikes, "Climbing Spikes", "ninjamod:climbingSpikes"); } }And the crash report:
Jan 31, 2014 7:51:44 PM net.minecraft.launchwrapper.LogWrapper log INFO: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker Jan 31, 2014 7:51:44 PM net.minecraft.launchwrapper.LogWrapper log INFO: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker Jan 31, 2014 7:51:44 PM net.minecraft.launchwrapper.LogWrapper log INFO: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Forge Mod Loader version 6.4.49.965 for Minecraft 1.6.4 loading 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_51, running on Windows 8:amd64:6.2, installed at C:\Program Files\Java\jre7 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-01-31 19:51:44 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper 2014-01-31 19:51:44 [INFO] [STDOUT] Loaded 40 rules from AccessTransformer config file fml_at.cfg 2014-01-31 19:51:44 [SEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work! 2014-01-31 19:51:45 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper 2014-01-31 19:51:45 [INFO] [STDOUT] Loaded 110 rules from AccessTransformer config file forge_at.cfg 2014-01-31 19:51:45 [INFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker 2014-01-31 19:51:45 [INFO] [ForgeModLoader] Launching wrapped minecraft {net.minecraft.client.main.Main} 2014-01-31 19:51:46 [INFO] [Minecraft-Client] Setting user: Player0 2014-01-31 19:51:47 [INFO] [Minecraft-Client] LWJGL Version: 2.9.0 2014-01-31 19:51:48 [INFO] [Minecraft-Client] Reloading ResourceManager: Default 2014-01-31 19:51:48 [INFO] [MinecraftForge] Attempting early MinecraftForge initialization 2014-01-31 19:51:48 [INFO] [STDOUT] MinecraftForge v9.11.1.965 Initialized 2014-01-31 19:51:48 [INFO] [ForgeModLoader] MinecraftForge v9.11.1.965 Initialized 2014-01-31 19:51:49 [INFO] [STDOUT] Replaced 111 ore recipies 2014-01-31 19:51:49 [INFO] [MinecraftForge] Completed early MinecraftForge initialization 2014-01-31 19:51:49 [INFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Jonathan\Documents\modding\Mc 1.6.4\ninjamod\ninjamod\jars\config\logging.properties 2014-01-31 19:51:49 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL 2014-01-31 19:51:49 [INFO] [ForgeModLoader] Searching C:\Users\Jonathan\Documents\modding\Mc 1.6.4\ninjamod\ninjamod\jars\mods for mods 2014-01-31 19:51:52 [INFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load 2014-01-31 19:51:52 [INFO] [mcp] Activating mod mcp 2014-01-31 19:51:52 [INFO] [FML] Activating mod FML 2014-01-31 19:51:52 [INFO] [Forge] Activating mod Forge 2014-01-31 19:51:52 [INFO] [ninjamod] Activating mod ninjamod 2014-01-31 19:51:52 [WARNING] [Forge Mod Loader] Mod Forge Mod Loader is missing a pack.mcmeta file, things may not work well 2014-01-31 19:51:52 [WARNING] [Minecraft Forge] Mod Minecraft Forge is missing a pack.mcmeta file, things may not work well 2014-01-31 19:51:52 [WARNING] [Ninja Mod] Mod Ninja Mod is missing a pack.mcmeta file, things may not work well 2014-01-31 19:51:52 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Ninja Mod 2014-01-31 19:51:52 [INFO] [ForgeModLoader] Registering Forge Packet Handler 2014-01-31 19:51:52 [INFO] [ForgeModLoader] Succeeded registering Forge Packet Handler 2014-01-31 19:51:52 [SEVERE] [ninjamod] The mod ninjamod appears to have an invalid event annotation EventHandler. This annotation can only apply to methods with recognized event arguments - it will not be called 2014-01-31 19:51:52 [INFO] [ForgeModLoader] Configured a dormant chunk cache size of 0 2014-01-31 19:51:53 [INFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods 2014-01-31 19:51:53 [WARNING] [Forge Mod Loader] Mod Forge Mod Loader is missing a pack.mcmeta file, things may not work well 2014-01-31 19:51:53 [WARNING] [Minecraft Forge] Mod Minecraft Forge is missing a pack.mcmeta file, things may not work well 2014-01-31 19:51:53 [WARNING] [Ninja Mod] Mod Ninja Mod is missing a pack.mcmeta file, things may not work well 2014-01-31 19:51:53 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Ninja Mod 2014-01-31 19:51:54 [INFO] [STDOUT] 2014-01-31 19:51:54 [INFO] [STDOUT] Starting up SoundSystem... 2014-01-31 19:51:54 [INFO] [STDOUT] Initializing LWJGL OpenAL 2014-01-31 19:51:54 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) 2014-01-31 19:51:54 [INFO] [STDOUT] OpenAL initialized. 2014-01-31 19:51:54 [INFO] [STDOUT] 2014-01-31 19:51:58 [INFO] [Minecraft-Server] Starting integrated minecraft server version 1.6.4 2014-01-31 19:51:58 [INFO] [Minecraft-Server] Generating keypair 2014-01-31 19:51:58 [INFO] [ForgeModLoader] Loading dimension 0 (New World) ([email protected]) 2014-01-31 19:51:58 [INFO] [ForgeModLoader] Loading dimension 1 (New World) ([email protected]) 2014-01-31 19:51:58 [INFO] [ForgeModLoader] Loading dimension -1 (New World) ([email protected]) 2014-01-31 19:51:58 [INFO] [Minecraft-Server] Preparing start region for level 0 2014-01-31 19:51:59 [INFO] [Minecraft-Server] Preparing spawn area: 72% 2014-01-31 19:52:00 [SEVERE] [Minecraft-Client] Realms: Server not available! 2014-01-31 19:52:00 [INFO] [STDOUT] loading single player 2014-01-31 19:52:00 [INFO] [Minecraft-Server] Player0[/127.0.0.1:0] logged in with entity id 33 at (-678.1838325744934, 4.0, -1394.674594224321) 2014-01-31 19:52:00 [INFO] [Minecraft-Server] Player0 joined the game 2014-01-31 19:52:00 [INFO] [STDOUT] Setting up custom skins 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Stopping server 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving players 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Player0 left the game 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving worlds 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether 2014-01-31 19:52:03 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/The End 2014-01-31 19:52:03 [INFO] [ForgeModLoader] Unloading dimension 0 2014-01-31 19:52:03 [INFO] [ForgeModLoader] Unloading dimension -1 2014-01-31 19:52:03 [INFO] [ForgeModLoader] Unloading dimension 1 2014-01-31 19:52:03 [INFO] [STDERR] net.minecraft.util.ReportedException: Rendering entity in world 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:339) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:838) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.main.Main.main(Main.java:93) 2014-01-31 19:52:03 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-31 19:52:03 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2014-01-31 19:52:03 [INFO] [STDERR] Caused by: java.lang.NullPointerException 2014-01-31 19:52:03 [INFO] [STDERR] at mtndewey.ninjamod.client.RenderNinjaStar.doRender(RenderNinjaStar.java:45) 2014-01-31 19:52:03 [INFO] [STDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312) 2014-01-31 19:52:03 [INFO] [STDERR] ... 13 more 2014-01-31 19:52:03 [INFO] [STDOUT] ---- Minecraft Crash Report ---- 2014-01-31 19:52:03 [INFO] [STDOUT] // Shall we play a game? 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] Time: 1/31/14 7:52 PM 2014-01-31 19:52:03 [INFO] [STDOUT] Description: Rendering entity in world 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] java.lang.NullPointerException 2014-01-31 19:52:03 [INFO] [STDOUT] at mtndewey.ninjamod.client.RenderNinjaStar.doRender(RenderNinjaStar.java:45) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:838) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93) 2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows: 2014-01-31 19:52:03 [INFO] [STDOUT] --------------------------------------------------------------------------------------- 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] -- Head -- 2014-01-31 19:52:03 [INFO] [STDOUT] Stacktrace: 2014-01-31 19:52:03 [INFO] [STDOUT] at mtndewey.ninjamod.client.RenderNinjaStar.doRender(RenderNinjaStar.java:45) 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] -- Entity being rendered -- 2014-01-31 19:52:03 [INFO] [STDOUT] Details: 2014-01-31 19:52:03 [INFO] [STDOUT] Entity Type: ninjamod.Ninja Star (mtndewey.ninjamod.client.EntityNinjaStar) 2014-01-31 19:52:03 [INFO] [STDOUT] Entity ID: 812 2014-01-31 19:52:03 [INFO] [STDOUT] Entity Name: entity.ninjamod.Ninja Star.name 2014-01-31 19:52:03 [INFO] [STDOUT] Entity's Exact location: -678.34, 5.50, -1394.69 2014-01-31 19:52:03 [INFO] [STDOUT] Entity's Block location: World: (-679,5,-1395), Chunk: (at 9,0,13 in -43,-88; contains blocks -688,0,-1408 to -673,255,-1393), Region: (-2,-3; contains chunks -64,-96 to -33,-65, blocks -1024,0,-1536 to -513,255,-1025) 2014-01-31 19:52:03 [INFO] [STDOUT] Entity's Momentum: 0.09, 0.05, 1.48 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] -- Renderer details -- 2014-01-31 19:52:03 [INFO] [STDOUT] Details: 2014-01-31 19:52:03 [INFO] [STDOUT] Assigned renderer: [email protected] 2014-01-31 19:52:03 [INFO] [STDOUT] Location: -0.16,-0.12,-0.01 - World: (-1,-1,-1), Chunk: (at 15,-1,15 in -1,-1; contains blocks -16,0,-16 to -1,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) 2014-01-31 19:52:03 [INFO] [STDOUT] Rotation: 3.6084688 2014-01-31 19:52:03 [INFO] [STDOUT] Delta: 0.28200638 2014-01-31 19:52:03 [INFO] [STDOUT] Stacktrace: 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160) 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] -- Affected level -- 2014-01-31 19:52:03 [INFO] [STDOUT] Details: 2014-01-31 19:52:03 [INFO] [STDOUT] Level name: MpServer 2014-01-31 19:52:03 [INFO] [STDOUT] All players: 1 total; [EntityClientPlayerMP['Player0'/33, l='MpServer', x=-678.18, y=5.62, z=-1394.67]] 2014-01-31 19:52:03 [INFO] [STDOUT] Chunk stats: MultiplayerChunkCache: 210 2014-01-31 19:52:03 [INFO] [STDOUT] Level seed: 0 2014-01-31 19:52:03 [INFO] [STDOUT] Level generator: ID 01 - flat, ver 0. Features enabled: false 2014-01-31 19:52:03 [INFO] [STDOUT] Level generator options: 2014-01-31 19:52:03 [INFO] [STDOUT] Level spawn location: World: (-669,4,-1387), Chunk: (at 3,0,5 in -42,-87; contains blocks -672,0,-1392 to -657,255,-1377), Region: (-2,-3; contains chunks -64,-96 to -33,-65, blocks -1024,0,-1536 to -513,255,-1025) 2014-01-31 19:52:03 [INFO] [STDOUT] Level time: 1428 game time, 1428 day time 2014-01-31 19:52:03 [INFO] [STDOUT] Level dimension: 0 2014-01-31 19:52:03 [INFO] [STDOUT] Level storage version: 0x00000 - Unknown? 2014-01-31 19:52:03 [INFO] [STDOUT] Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) 2014-01-31 19:52:03 [INFO] [STDOUT] Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false 2014-01-31 19:52:03 [INFO] [STDOUT] Forced entities: 8 total; [EntitySlime['Slime'/21, l='MpServer', x=-732.06, y=4.00, z=-1428.09], EntitySlime['Slime'/20, l='MpServer', x=-732.26, y=4.00, z=-1454.00], EntitySlime['Slime'/23, l='MpServer', x=-703.15, y=4.00, z=-1349.64], EntityNinjaStar['entity.ninjamod.Ninja Star.name'/812, l='MpServer', x=-678.34, y=5.50, z=-1394.69], EntitySlime['Slime'/24, l='MpServer', x=-681.72, y=4.00, z=-1443.59], EntitySlime['Slime'/27, l='MpServer', x=-638.47, y=4.81, z=-1368.37], EntitySlime['Slime'/26, l='MpServer', x=-645.88, y=4.96, z=-1462.69], EntityClientPlayerMP['Player0'/33, l='MpServer', x=-678.18, y=5.62, z=-1394.67]] 2014-01-31 19:52:03 [INFO] [STDOUT] Retry entities: 0 total; [] 2014-01-31 19:52:03 [INFO] [STDOUT] Server brand: fml,forge 2014-01-31 19:52:03 [INFO] [STDOUT] Server type: Integrated singleplayer server 2014-01-31 19:52:03 [INFO] [STDOUT] Stacktrace: 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2312) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:856) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93) 2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2014-01-31 19:52:03 [INFO] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2014-01-31 19:52:03 [INFO] [STDOUT] 2014-01-31 19:52:03 [INFO] [STDOUT] -- System Details -- 2014-01-31 19:52:03 [INFO] [STDOUT] Details: 2014-01-31 19:52:03 [INFO] [STDOUT] Minecraft Version: 1.6.4 2014-01-31 19:52:03 [INFO] [STDOUT] Operating System: Windows 8 (amd64) version 6.2 2014-01-31 19:52:03 [INFO] [STDOUT] Java Version: 1.7.0_51, Oracle Corporation 2014-01-31 19:52:03 [INFO] [STDOUT] Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation 2014-01-31 19:52:03 [INFO] [STDOUT] Memory: 743275184 bytes (708 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) 2014-01-31 19:52:03 [INFO] [STDOUT] JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M 2014-01-31 19:52:03 [INFO] [STDOUT] AABB Pool Size: 21635 (1211560 bytes; 1 MB) allocated, 144 (8064 bytes; 0 MB) used 2014-01-31 19:52:03 [INFO] [STDOUT] Suspicious classes: FML and Forge are installed 2014-01-31 19:52:03 [INFO] [STDOUT] IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 2014-01-31 19:52:03 [INFO] [STDOUT] FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 4 mods loaded, 4 mods active 2014-01-31 19:52:03 [INFO] [STDOUT] mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available 2014-01-31 19:52:03 [INFO] [STDOUT] FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available 2014-01-31 19:52:03 [INFO] [STDOUT] Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available 2014-01-31 19:52:03 [INFO] [STDOUT] ninjamod{v3.6} [Ninja Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available 2014-01-31 19:52:03 [INFO] [STDOUT] Launched Version: 1.6 2014-01-31 19:52:03 [INFO] [STDOUT] LWJGL: 2.9.0 2014-01-31 19:52:03 [INFO] [STDOUT] OpenGL: Intel(R) HD Graphics 4600 GL version 4.2.0 - Build 10.18.10.3277, Intel 2014-01-31 19:52:03 [INFO] [STDOUT] Is Modded: Definitely; Client brand changed to 'fml,forge' 2014-01-31 19:52:03 [INFO] [STDOUT] Type: Client (map_client.txt) 2014-01-31 19:52:03 [INFO] [STDOUT] Resource Pack: Default 2014-01-31 19:52:03 [INFO] [STDOUT] Current Language: English (US) 2014-01-31 19:52:03 [INFO] [STDOUT] Profiler Position: N/A (disabled) 2014-01-31 19:52:03 [INFO] [STDOUT] Vec3 Pool Size: 277 (15512 bytes; 0 MB) allocated, 53 (2968 bytes; 0 MB) used 2014-01-31 19:52:03 [INFO] [STDOUT] #@[email protected]# Game crashed! Crash report saved to: #@[email protected]# C:\Users\Jonathan\Documents\modding\Mc 1.6.4\ninjamod\ninjamod\jars\.\crash-reports\crash-2014-01-31_19.52.03-client.txt AL lib: (EE) alc_cleanup: 1 device not closed-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSure
I need to see your BaseModItem and Registry classes, too, to find out why there is a null pointer exception happening in the render code, and if you could do me a favor and just use RenderSnowball for now and post a crash report using that instead of your custom render class, that would be very helpful.
anyways, heres the stuff you asked for:
Registry:
package mtndewey.ninjamod; import net.minecraft.item.Item; import cpw.mods.fml.common.registry.LanguageRegistry; public class Registry { public static void RegisterBasicItem(Item item, String name, String texturename){ item.setUnlocalizedName(texturename); LanguageRegistry.addName(item, name); } }BaseModItem:
package mtndewey.ninjamod.items; import mtndewey.ninjamod.ninjamod; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.item.Item; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BaseModItem extends Item{ public BaseModItem(int par1) { super(par1); this.setCreativeTab(ninjamod.tabNinja); } @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister iconRegister){ this.itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(5)); } }Crash Report w/ RenderSnowball in use:
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumJust put 'proxy.registerRenderers()' AFTER all your items and such are registered, and you should be fine.
Or rather, put your item and block initialization into the pre-init method before you register the renderers:
@PreInit public void PreInit(FMLPreInitializationEvent event){ new ninjamodblocks(); new ninjamoditems(); //Proxy proxy.registerRenderers(); proxy.registerServerTickHandler(); }-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNo problem
As for picking them up like arrows, take a look at the EntityArrow class. You will need to save the tile x/y/z that it hits, stop it's motion when it impacts and don't set it to dead; alternatively (and much easier) is to spawn an EntityItem at the impact position if it is a block. It won't look all cool sticking into the ground that way, but it will probably save you both time and frustration.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumFor the rendering, sorry but you're on your own. OpenGL and I are not good friends
For spawning an entity at the impact position, that's simple. Using your custom throwable entity's onImpact method, you have a MovingObjectPosition as well as the entity's own position coordinates (posX, posY, posZ). Create whatever new entity you want using one of those two coordinate sets and spawn it just like you did the projectile.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYes. You cannot make a static reference to a non-static method
protected void onImpact(MovingObjectPosition movObjPos) { if (movObjPos.entityHit != null) { byte starDamage = 4; movObjPos.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)starDamage); int i = movObjPos.blockX; int j = movObjPos.blockY; int k = movObjPos.blockZ; switch (movObjPos.sideHit) { case 0: --j; break; case 1: ++j; break; case 2: --k; break; case 3: ++k; break; case 4: --i; break; case 5: ++i; } } if (!World.isRemote) { World.spawnEntityInWorld(new EntityNinjaStar(World, EntityPlayer)); }The error is at the world.isremote and world.spawnentityinworld
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOf course, that's why Java naming conventions are so important. Understand that a capital 'W' on 'world' means that you are referencing the World class, rather than a field within your ninja star class. That is what is known as a 'static reference'. You need to use the world object field of your entity, which is non-static, to use the non-static method spawnEntityInWorld.
Please google static as well as following all of the tutorials on Oracle's Java tutorial website, for your own benefit. In the meantime, just change 'World' to 'worldObj' and it should work fine.
-
View User Profile
-
View Posts
-
Send Message
Curse Premium