Jump to content

SackCastellon

Members
  • Posts

    180
  • Joined

  • Last visited

Everything posted by SackCastellon

  1. Oh, that's it. Looks like I could have searched a bit better. Thank you very much.
  2. Hi, I am wondering how can I register an ItemColorHandler for may custom Item. I have seen that the Item.getColorFromItemstack(ItemStack stack, int index) in 1.8, has been moved to ItemColors.getColorFromItemstack(ItemStack stack, int tintIndex) in 1.9, so I have been looking in the code for some hook but I found any. So I would like to know whether there is a way to do it or not. Thanks, SackCastellon.
  3. Take a look about how the glass block is rendered (json, texture and class). It should help you.
  4. Ok... excuse me if i'm very ignorant but, how do I get an ISmartItemModel as the ibakedmodel variable to use the handleItemState(stack) later?? Because all the ibakedmodel are IFlexibleBakedModel (I hope you understood me) <<net.minecraft.client.renderer.ItemModelMesher>> public IBakedModel getItemModel(ItemStack stack) { Item item = stack.getItem(); IBakedModel ibakedmodel = this.getItemModel(item, this.getMetadata(stack)); if (ibakedmodel == null) { ItemMeshDefinition itemmeshdefinition = (ItemMeshDefinition)this.shapers.get(item); if (itemmeshdefinition != null) { ibakedmodel = this.modelManager.getModel(itemmeshdefinition.getModelLocation(stack)); } } if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) { ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); } if (ibakedmodel == null) { ibakedmodel = this.modelManager.getMissingModel(); } return ibakedmodel; }
  5. Hi, i have a bunch of item variables based on NBT Tags, so the same item has got more than 100 variables, and its not cool to create 100 json files, which are completely identical with the difference of the texture location, so i was wondering if is there any way to set dynamically the location of the texture. Something like: public ResourceLocation getTextureLocation(ItemStack stack, int layer) { // You stuff return new ResourceLocation("modid:itemVariable"); } I hope I explained correctly Thanks in advance for helping.
  6. Ok, I have decide to return a texture of the soup but without the bowl so it can work with all the soup variants
  7. I'm creating wood based item variations (only wooden items), for example: Stick --> Oak Stick, Spruce Stick, ... , Acacia Stick; and I also have thought about adding support for other mods by the way that if we only consider Vanilla, Extrabiomes XL and Biomes o' Plenty with their respective wood we'd have about 30 different wood types, which implies 30 sticks, 30 bowls, etc. But the greatness comes with the tools, because on them what variates is the head and the handle, so only with the Swords we already have 30*30=900 variations!! now apply it to the rest of tools ;D
  8. Hi, I have created a bunch of Item variants based on NBT Tags, i have also created an "ItemSoup" item, which generates particles from the item texture on being eaten, this far so good, but the real problem is that on the way the texture is requested, the ItemStack where the NBT Tags are stored, is reseted. Basically what minecraft does to get the texture of an item to later generate particles is, oversimplified, the following: "ItemSoup" is used --{ onUpdate() }--> ItemStack w/ NBT Tag --{ getIdFromItem(ItemStack.getItem()), getItemDamage() }--> ID, Damage --{ getItemFromId() }--> Item, Damage --{ new ItemStack(Item, 0, Damage) }--> ItemStack w/o NBT So it erases all the possible information stored on the NBT Tags, what from my point of view is no sense. Finally my question is: Is there any workaround to get what I'm looking for? or must I create a pull request? Thank in advance for helping
  9. Ok, and yes i know folders can have hyphens Now Minecraft seems to find the .json, as nothing strange is shown on the console, but it's how it looks inside a world: https://dl.dropboxusercontent.com/u/184200482/img/2014-12-07_21.38.23.png[/img]
  10. But Minecraft is looking for a model at a folder named as my mod's id (which contains a hyphen): java.io.FileNotFoundException: skc-craftablehorsearmor:models/item/Knot.json Even when i am specifying another folder location: Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(CHAItems.Knot, 0, new ModelResourceLocation("craftablehorsearmor:Knot", "inventory"));
  11. Then I'll need to change my mod's id, as far as package names cannot contain hyphens, right?
  12. I am getting this error every time i run Minecraft (on Eclipse): [20:13:52] [main/INFO] [GradleStart]: userProperties: {} [20:13:52] [main/INFO] [GradleStart]: assetIndex: 1.8 [20:13:52] [main/INFO] [GradleStart]: accessToken: FML [20:13:52] [main/INFO] [GradleStart]: Extra: [] [20:13:52] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Juanjo hijo/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker] [20:13:52] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [20:13:52] [main/INFO] [FML]: Forge Mod Loader version 8.0.12.1252 for Minecraft 1.8 loading [20:13:52] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_25, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre1.8.0_25 [20:13:52] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [20:13:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker [20:13:52] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [20:13:52] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [20:13:52] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [20:13:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [20:13:52] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [20:13:55] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [20:13:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [20:13:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [20:13:56] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [20:13:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [20:13:56] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [20:13:57] [Client thread/INFO]: Setting user: Player318 [20:14:04] [Client thread/INFO]: LWJGL Version: 2.9.1 [20:14:06] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [20:14:06] [Client thread/INFO] [FML]: MinecraftForge v11.14.0.1252 Initialized [20:14:06] [Client thread/INFO] [FML]: Replaced 215 ore recipies [20:14:06] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [20:14:06] [Client thread/INFO] [FML]: Searching C:\Modding\Github\CraftableHorseArmor\mods for mods [20:14:12] [Client thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load [20:14:13] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, SKC-CraftableHorseArmor, SKC-Core] at CLIENT [20:14:13] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, SKC-CraftableHorseArmor, SKC-Core] at SERVER [20:14:14] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Craftable Horse Armor, FMLFileResourcePack:SKC Core [20:14:14] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [20:14:14] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [20:14:14] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [20:14:14] [Client thread/INFO] [sKC Logger]: [sKC-Core] Loading configuration file [20:14:14] [Client thread/INFO] [sKC Logger]: [sKC-Core] Configuration file successfully loaded [20:14:15] [Client thread/INFO] [sKC Logger]: [sKC-CraftableHorseArmor] Loading configuration file [20:14:15] [Client thread/INFO] [sKC Logger]: [sKC-CraftableHorseArmor] Configuration file successfully loaded [20:14:16] [Client thread/INFO] [sKC Logger]: [sKC-CraftableHorseArmor] Loading items [20:14:16] [Client thread/INFO] [sKC Logger]: [sKC-CraftableHorseArmor] Items successfully loaded [20:14:16] [Client thread/INFO] [FML]: Applying holder lookups [20:14:16] [Client thread/INFO] [FML]: Holder lookups applied [20:14:16] [sound Library Loader/INFO]: Starting up SoundSystem... [20:14:17] [Thread-7/INFO]: Initializing LWJGL OpenAL [20:14:17] [Thread-7/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [20:14:17] [Thread-7/INFO]: OpenAL initialized. [20:14:17] [sound Library Loader/INFO]: Sound engine started [20:14:20] [Client thread/WARN]: Unable to load item model: 'skc-craftablehorsearmor:item/Knot' for item: 'skc-craftablehorsearmor:Knot' java.io.FileNotFoundException: skc-craftablehorsearmor:models/item/Knot.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:71) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.loadItemModels(ModelBakery.java:307) [ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:105) [ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] [20:14:21] [Client thread/INFO]: Created: 512x512 textures-atlas [20:14:22] [Client thread/WARN]: Missing model for: skc-craftablehorsearmor:item/Knot [20:14:23] [Client thread/INFO] [sKC Logger]: [sKC-CraftableHorseArmor] Loading crafting recipes [20:14:23] [Client thread/INFO] [sKC Logger]: [sKC-CraftableHorseArmor] Crafting recipes successfully loaded [20:14:23] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods [20:14:23] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Craftable Horse Armor, FMLFileResourcePack:SKC Core [20:14:23] [Client thread/INFO]: SoundSystem shutting down... [20:14:24] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [20:14:24] [sound Library Loader/INFO]: Starting up SoundSystem... [20:14:24] [Thread-9/INFO]: Initializing LWJGL OpenAL [20:14:24] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [20:14:24] [Thread-9/INFO]: OpenAL initialized. [20:14:24] [sound Library Loader/INFO]: Sound engine started [20:14:27] [Client thread/WARN]: Unable to load item model: 'skc-craftablehorsearmor:item/Knot' for item: 'skc-craftablehorsearmor:Knot' java.io.FileNotFoundException: skc-craftablehorsearmor:models/item/Knot.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:71) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.loadItemModels(ModelBakery.java:307) [ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariantItemModels(ModelBakery.java:105) [ModelBakery.class:?] at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:727) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:298) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:484) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] [20:14:27] [Client thread/INFO]: Created: 512x512 textures-atlas [20:14:27] [Client thread/WARN]: Missing model for: skc-craftablehorsearmor:item/Knot [20:15:19] [Client thread/INFO]: Stopping! [20:15:19] [Client thread/INFO]: SoundSystem shutting down... [20:15:19] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com This is my init() method: @Mod.EventHandler public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(new CHAEvents.init()); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(CHAItems.Knot, 0, new ModelResourceLocation("craftablehorsearmor:Knot", "inventory")); CHARecipeLoader.init(); } The item is loaded on the preInit() method. Also NOTICE that my mod id is: public static final String ID = "SKC-CraftableHorseArmor"; This is the .json file: { "parent": "builtin/generated", "textures": { "layer0": "craftablehorsearmor:items/Knot" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } And this is where the .json file is located: https://dl.dropboxusercontent.com/u/184200482/img/Captura%20de%20pantalla%202014-12-07%2020.20.20.png[/img] Thanks in advance for helping
  13. Hi, I am getting this crash every time I try running my mod on eclipse: Crash: [16:33:33] [Client thread/ERROR] [sKC-CraftableHorseArmor]: Skipping event FMLPreInitializationEvent and marking errored mod SKC-CraftableHorseArmor since required dependency SKC-Core has errored [16:33:33] [Client thread/INFO] [FML]: Applying holder lookups [16:33:33] [Client thread/INFO] [FML]: Holder lookups applied [16:33:33] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue [16:33:33] [Client thread/ERROR] [FML]: mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{8.0.12.1252} [Forge Mod Loader] (forgeSrc-1.8-11.14.0.1252-1.8.jar) Unloaded->Constructed->Pre-initialized Forge{11.14.0.1252} [Minecraft Forge] (forgeSrc-1.8-11.14.0.1252-1.8.jar) Unloaded->Constructed->Pre-initialized SKC-Core{1.1.3.0} [sKC Core] (SKC-Core-1.8-1.1.3.0.jar) Unloaded->Constructed->Errored SKC-CraftableHorseArmor{mod.version} [Craftable Horse Armor] (bin) Unloaded->Constructed->Errored [16:33:33] [Client thread/ERROR] [FML]: The following problems were captured during this phase [16:33:33] [Client thread/ERROR] [FML]: Caught exception from SKC-Core java.lang.NoSuchMethodError: net.minecraft.client.resources.I18n.func_135052_a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; at com.sackcastellon.core.helper.SKCVersionHelper.translateToLocalFormatted(SKCVersionHelper.java:226) ~[sKC-Core-1.8-1.1.3.0.jar:?] at com.sackcastellon.core.helper.SKCVersionHelper.getMessage(SKCVersionHelper.java:173) ~[sKC-Core-1.8-1.1.3.0.jar:?] at com.sackcastellon.core.helper.SKCVersionHelper.check(SKCVersionHelper.java:141) ~[sKC-Core-1.8-1.1.3.0.jar:?] at com.sackcastellon.core.handler.SKCConfigHandler.syncConfig(SKCConfigHandler.java:95) ~[sKC-Core-1.8-1.1.3.0.jar:?] at com.sackcastellon.core.handler.SKCConfigHandler.init(SKCConfigHandler.java:49) ~[sKC-Core-1.8-1.1.3.0.jar:?] at com.sackcastellon.core.SKCCore.preInit(SKCCore.java:49) ~[sKC-Core-1.8-1.1.3.0.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) ~[forgeSrc-1.8-11.14.0.1252-1.8.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.8-11.14.0.1252-1.8.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.8-11.14.0.1252-1.8.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:235) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:412) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] [16:33:33] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 6/12/14 16:33 Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.NoSuchMethodError: net.minecraft.client.resources.I18n.func_135052_a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:162) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:515) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:235) at net.minecraft.client.Minecraft.startGame(Minecraft.java:412) at net.minecraft.client.Minecraft.run(Minecraft.java:325) at net.minecraft.client.main.Main.main(Main.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) at GradleStart.main(GradleStart.java:45) Caused by: java.lang.NoSuchMethodError: net.minecraft.client.resources.I18n.func_135052_a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; at com.sackcastellon.core.helper.SKCVersionHelper.translateToLocalFormatted(SKCVersionHelper.java:226) at com.sackcastellon.core.helper.SKCVersionHelper.getMessage(SKCVersionHelper.java:173) at com.sackcastellon.core.helper.SKCVersionHelper.check(SKCVersionHelper.java:141) at com.sackcastellon.core.handler.SKCConfigHandler.syncConfig(SKCConfigHandler.java:95) at com.sackcastellon.core.handler.SKCConfigHandler.init(SKCConfigHandler.java:49) at com.sackcastellon.core.SKCCore.preInit(SKCCore.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:513) ... 12 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 57022472 bytes (54 MB) / 373817344 bytes (356 MB) up to 878182400 bytes (837 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.0.12.1252 Minecraft Forge 11.14.0.1252 5 mods loaded, 5 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{8.0.12.1252} [Forge Mod Loader] (forgeSrc-1.8-11.14.0.1252-1.8.jar) Unloaded->Constructed->Pre-initialized Forge{11.14.0.1252} [Minecraft Forge] (forgeSrc-1.8-11.14.0.1252-1.8.jar) Unloaded->Constructed->Pre-initialized SKC-Core{1.1.3.0} [sKC Core] (SKC-Core-1.8-1.1.3.0.jar) Unloaded->Constructed->Errored SKC-CraftableHorseArmor{mod.version} [Craftable Horse Armor] (bin) Unloaded->Constructed->Errored [16:33:33] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Modding\Github\CraftableHorseArmor\.\crash-reports\crash-2014-12-06_16.33.33-client.txt And this is the Method where the error, is theoretically, located: private static String translateToLocalFormatted(String key, Object... str) { String local; try { local = I18n.format(key); // <-- HERE IS THE ERROR return String.format(local, str); } catch(Exception e) { Logger.error("By some reason the language files of \"" + str[0] + "\" are missing/damaged/outdated, so please consider re-downloading the mod or contact the author.", e); } return "MISSING_LANG"; } Also notice, that the error comes from another mod which is a library (API), that i developed. I tested the API on eclipse, builded it, and tested it again on Minecraft and worked properly. But by some reason i could not understand, when i use the API as an library, of another mod it crashes. This is the "Main" mod: https://dl.dropboxusercontent.com/u/184200482/img/Captura%20de%20pantalla%202014-12-06%2016.51.37.png[/img] And this the API mod: https://dl.dropboxusercontent.com/u/184200482/img/Captura%20de%20pantalla%202014-12-06%2016.52.09.png[/img] I hope someone can help me with this problem. Thanks. SOLUTION (Message with the solution)
  14. Oops. I don't know why but i didn't noticed about that. Now it world properly. Thanks.
  15. OK, did it but it says the null variable is the world (IBlockAccess): https://dl.dropboxusercontent.com/u/184200482/img/Captura%20de%20pantalla%202014-08-29%2020.43.13.png[/img] Any suggestion??
  16. I've created some lever variants bassed on NBT Tags, using as base code the origina levers, also i created a new render handler, for the new levers, because as the textures depends on the NBT tags, the original render handler, doesn't work. LeverBlock.class package com.sackcastellon.betterwood.block; import static net.minecraftforge.common.util.ForgeDirection.DOWN; import static net.minecraftforge.common.util.ForgeDirection.EAST; import static net.minecraftforge.common.util.ForgeDirection.NORTH; import static net.minecraftforge.common.util.ForgeDirection.SOUTH; import static net.minecraftforge.common.util.ForgeDirection.UP; import static net.minecraftforge.common.util.ForgeDirection.WEST; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import com.sackcastellon.betterwood.api.Tabs; import com.sackcastellon.betterwood.handler.LeverHandler; public class BlockLever extends BlockWoodBase { public BlockLever() { super(Material.circuits, "lever", false); this.setCreativeTab(Tabs.tabBW); this.setStepSound(soundTypeWood); } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } @Override public int getRenderType() { return LeverHandler.renderId; } @Override public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) { ForgeDirection dir = ForgeDirection.getOrientation(side); return (dir == DOWN && world.isSideSolid(x, y + 1, z, DOWN )) || (dir == UP && world.isSideSolid(x, y - 1, z, UP )) || (dir == NORTH && world.isSideSolid(x, y, z + 1, NORTH)) || (dir == SOUTH && world.isSideSolid(x, y, z - 1, SOUTH)) || (dir == WEST && world.isSideSolid(x + 1, y, z, WEST )) || (dir == EAST && world.isSideSolid(x - 1, y, z, EAST )); } @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { return world.isSideSolid(x - 1, y, z, EAST ) || world.isSideSolid(x + 1, y, z, WEST ) || world.isSideSolid(x, y, z - 1, SOUTH) || world.isSideSolid(x, y, z + 1, NORTH) || world.isSideSolid(x, y - 1, z, UP ) || world.isSideSolid(x, y + 1, z, DOWN ); } @Override public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { int k1 = metadata & 8; byte b0 = -1; if (side == 0 && world.isSideSolid(x, y + 1, z, DOWN)) { b0 = 0; } if (side == 1 && world.isSideSolid(x, y - 1, z, UP)) { b0 = 5; } if (side == 2 && world.isSideSolid(x, y, z + 1, NORTH)) { b0 = 4; } if (side == 3 && world.isSideSolid(x, y, z - 1, SOUTH)) { b0 = 3; } if (side == 4 && world.isSideSolid(x + 1, y, z, WEST)) { b0 = 2; } if (side == 5 && world.isSideSolid(x - 1, y, z, EAST)) { b0 = 1; } return b0 + k1; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int l = world.getBlockMetadata(x, y, z); int i1 = l & 7; int j1 = l & 8; if (i1 == invertMetadata(1)) { if ((MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) { world.setBlockMetadataWithNotify(x, y, z, 5 | j1, 2); } else { world.setBlockMetadataWithNotify(x, y, z, 6 | j1, 2); } } else if (i1 == invertMetadata(0)) { if ((MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) { world.setBlockMetadataWithNotify(x, y, z, 7 | j1, 2); } else { world.setBlockMetadataWithNotify(x, y, z, 0 | j1, 2); } } } public static int invertMetadata(int metadata) { switch (metadata) { case 0: return 0; case 1: return 5; case 2: return 4; case 3: return 3; case 4: return 2; case 5: return 1; default: return -1; } } @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { if (this.canPlaceBlock(world, x, y, z)) { int l = world.getBlockMetadata(x, y, z) & 7; boolean flag = false; if (!world.isSideSolid(x - 1, y, z, EAST) && l == 1) { flag = true; } if (!world.isSideSolid(x + 1, y, z, WEST) && l == 2) { flag = true; } if (!world.isSideSolid(x, y, z - 1, SOUTH) && l == 3) { flag = true; } if (!world.isSideSolid(x, y, z + 1, NORTH) && l == 4) { flag = true; } if (!world.isSideSolid(x, y - 1, z, UP) && l == 5) { flag = true; } if (!world.isSideSolid(x, y - 1, z, UP) && l == 6) { flag = true; } if (!world.isSideSolid(x, y + 1, z, DOWN) && l == 0) { flag = true; } if (!world.isSideSolid(x, y + 1, z, DOWN) && l == 7) { flag = true; } if (flag) { this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); } } } private boolean canPlaceBlock(World world, int x, int y, int z) { if (!this.canPlaceBlockAt(world, x, y, z)) { this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); return false; } else { return true; } } @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { int l = world.getBlockMetadata(x, y, z) & 7; float f = 0.1875F; if (l == 1) { this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); } else if (l == 2) { this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); } else if (l == 3) { this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); } else if (l == 4) { this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); } else if (l != 5 && l != 6) { if (l == 0 || l == 7) { f = 0.25F; this.setBlockBounds(0.5F - f, 0.4F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); } } else { f = 0.25F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); } } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } else { int i1 = world.getBlockMetadata(x, y, z); int j1 = i1 & 7; int k1 = 8 - (i1 & ; world.setBlockMetadataWithNotify(x, y, z, j1 + k1, 3); world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F); world.notifyBlocksOfNeighborChange(x, y, z, this); if (j1 == 1) { world.notifyBlocksOfNeighborChange(x - 1, y, z, this); } else if (j1 == 2) { world.notifyBlocksOfNeighborChange(x + 1, y, z, this); } else if (j1 == 3) { world.notifyBlocksOfNeighborChange(x, y, z - 1, this); } else if (j1 == 4) { world.notifyBlocksOfNeighborChange(x, y, z + 1, this); } else if (j1 != 5 && j1 != 6) { if (j1 == 0 || j1 == 7) { world.notifyBlocksOfNeighborChange(x, y + 1, z, this); } } else { world.notifyBlocksOfNeighborChange(x, y - 1, z, this); } return true; } } @Override public void breakBlock(World world, int x, int y, int z, Block block, int metadata) { if ((metadata & > 0) { world.notifyBlocksOfNeighborChange(x, y, z, this); int i1 = metadata & 7; if (i1 == 1) { world.notifyBlocksOfNeighborChange(x - 1, y, z, this); } else if (i1 == 2) { world.notifyBlocksOfNeighborChange(x + 1, y, z, this); } else if (i1 == 3) { world.notifyBlocksOfNeighborChange(x, y, z - 1, this); } else if (i1 == 4) { world.notifyBlocksOfNeighborChange(x, y, z + 1, this); } else if (i1 != 5 && i1 != 6) { if (i1 == 0 || i1 == 7) { world.notifyBlocksOfNeighborChange(x, y + 1, z, this); } } else { world.notifyBlocksOfNeighborChange(x, y - 1, z, this); } } super.breakBlock(world, x, y, z, block, metadata); } @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { return (world.getBlockMetadata(x, y, z) & > 0 ? 15 : 0; } @Override public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { int i1 = world.getBlockMetadata(x, y, z); if ((i1 & == 0) { return 0; } else { int j1 = i1 & 7; return j1 == 0 && side == 0 ? 15 : (j1 == 7 && side == 0 ? 15 : (j1 == 6 && side == 1 ? 15 : (j1 == 5 && side == 1 ? 15 : (j1 == 4 && side == 2 ? 15 : (j1 == 3 && side == 3 ? 15 : (j1 == 2 && side == 4 ? 15 : (j1 == 1 && side == 5 ? 15 : 0))))))); } } @Override public boolean canProvidePower() { return true; } } BlockWoodBase.class package com.sackcastellon.betterwood.block; import java.util.ArrayList; import java.util.Random; import com.sackcastellon.betterwood.lib.Reference; import com.sackcastellon.betterwood.loader.ItemLoader; import com.sackcastellon.betterwood.tileentities.TileEntityWoodBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockWoodBase extends BlockContainer { @SideOnly(Side.CLIENT) public IIcon[] iconArray = new IIcon[itemLoader.woodTypes.length]; protected String path; /** * * @param material * @param block * @param planks Use planks texture? */ protected BlockWoodBase(Material material, String block, boolean planks) { super(material); this.setBlockName(block); this.path = Reference.TexturePath + (planks ? "planks" : block.replace('.', '/')) + "/"; } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); ItemStack stack = new ItemStack(Item.getItemFromBlock(this)); if(tile instanceof TileEntityWoodBase) { TileEntityWoodBase wood = (TileEntityWoodBase) tile; stack.stackTagCompound = new NBTTagCompound(); NBTTagCompound nbt = stack.getTagCompound(); nbt.setInteger("variant", wood.getVariant()); return stack; } return stack; } @Override public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); TileEntity tile = world.getTileEntity(x, y, z); ItemStack stack = new ItemStack(Item.getItemFromBlock(this)); if(tile instanceof TileEntityWoodBase) { TileEntityWoodBase wood = (TileEntityWoodBase) tile; stack.stackTagCompound = new NBTTagCompound(); NBTTagCompound nbt = stack.getTagCompound(); nbt.setInteger("variant", wood.getVariant()); } ret.add(stack); return ret; } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityWoodBase(); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return this.getRenderType() == 0; } @Override public void registerBlockIcons(IIconRegister iconRegister) { for(int i = 0; i < ItemLoader.woodTypes.length; ++i) { this.iconArray[i] = iconRegister.registerIcon(path + (String) ItemLoader.woodTypes[i][1]); } } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity tile = world.getTileEntity(x, y, z); TileEntityWoodBase wood = (TileEntityWoodBase) tile; int variant = wood.getVariant(); return this.iconArray[variant]; // if(tile instanceof TileEntityWoodBase) // { // TileEntityWoodBase wood = (TileEntityWoodBase) tile; // // int variant = wood.getVariant(); // // System.out.println(this.iconArray[variant]); // // return this.iconArray[variant]; // } // // return this.blockIcon; } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityWoodBase) { TileEntityWoodBase wood = (TileEntityWoodBase) tile; NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null) { int variant = nbt.getInteger("variant"); wood.setVariant(variant); } } } @Override public int quantityDropped(Random random) { return 1; } } TileEntityWoodBase.class package com.sackcastellon.betterwood.tileentities; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileEntityWoodBase extends TileEntity { /** * 0. Oak<br> * 1. Spruce<br> * 2. Birch<br> * 3. Jungle<br> * 4. Acacia<br> * 5. DarkOak<br> */ private int variant; private boolean active; public TileEntityWoodBase() {} @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.setVariant(nbt.getInteger("variant")); this.setIsActive(nbt.getBoolean("active")); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("variant", this.getVariant()); nbt.setBoolean("active", this.getIsActive()); } public int getVariant() { return variant; } public void setVariant(int variant) { if(variant < 0 || variant > 5) { this.variant = 0; } else { this.variant = variant; } } public boolean getIsActive() { return active; } public void setIsActive(boolean active) { this.active = active; } @Override public Packet getDescriptionPacket() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); } } LeverHandler.class package com.sackcastellon.betterwood.handler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.init.Blocks; import net.minecraft.util.IIcon; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; public class LeverHandler implements ISimpleBlockRenderingHandler { public static int renderId = RenderingRegistry.getNextAvailableRenderId(); private RenderBlocks render = RenderBlocks.getInstance(); @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {} @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int l = world.getBlockMetadata(x, y, z); int i1 = l & 7; boolean flag = (l & > 0; Tessellator tessellator = Tessellator.instance; boolean flag1 = render.hasOverrideBlockTexture(); if (!flag1) { render.setOverrideBlockTexture(render.getBlockIcon(Blocks.cobblestone)); } float f = 0.25F; float f1 = 0.1875F; float f2 = 0.1875F; if (i1 == 5) { render.setRenderBounds((double)(0.5F - f1), 0.0D, (double)(0.5F - f), (double)(0.5F + f1), (double)f2, (double)(0.5F + f)); } else if (i1 == 6) { render.setRenderBounds((double)(0.5F - f), 0.0D, (double)(0.5F - f1), (double)(0.5F + f), (double)f2, (double)(0.5F + f1)); } else if (i1 == 4) { render.setRenderBounds((double)(0.5F - f1), (double)(0.5F - f), (double)(1.0F - f2), (double)(0.5F + f1), (double)(0.5F + f), 1.0D); } else if (i1 == 3) { render.setRenderBounds((double)(0.5F - f1), (double)(0.5F - f), 0.0D, (double)(0.5F + f1), (double)(0.5F + f), (double)f2); } else if (i1 == 2) { render.setRenderBounds((double)(1.0F - f2), (double)(0.5F - f), (double)(0.5F - f1), 1.0D, (double)(0.5F + f), (double)(0.5F + f1)); } else if (i1 == 1) { render.setRenderBounds(0.0D, (double)(0.5F - f), (double)(0.5F - f1), (double)f2, (double)(0.5F + f), (double)(0.5F + f1)); } else if (i1 == 0) { render.setRenderBounds((double)(0.5F - f), (double)(1.0F - f2), (double)(0.5F - f1), (double)(0.5F + f), 1.0D, (double)(0.5F + f1)); } else if (i1 == 7) { render.setRenderBounds((double)(0.5F - f1), (double)(1.0F - f2), (double)(0.5F - f), (double)(0.5F + f1), 1.0D, (double)(0.5F + f)); } render.renderStandardBlock(block, x, y, z); if (!flag1) { render.clearOverrideBlockTexture(); } tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F); IIcon icon = render.getBlockIcon(block, world, x, y, z, 0); if (render.hasOverrideBlockTexture()) { icon = render.overrideBlockTexture; } double d0 = (double)icon.getMinU(); double d1 = (double)icon.getMinV(); double d2 = (double)icon.getMaxU(); double d3 = (double)icon.getMaxV(); Vec3[] avec3 = new Vec3[8]; float f3 = 0.0625F; float f4 = 0.0625F; float f5 = 0.625F; avec3[0] = Vec3.createVectorHelper((double)(-f3), 0.0D, (double)(-f4)); avec3[1] = Vec3.createVectorHelper((double)f3, 0.0D, (double)(-f4)); avec3[2] = Vec3.createVectorHelper((double)f3, 0.0D, (double)f4); avec3[3] = Vec3.createVectorHelper((double)(-f3), 0.0D, (double)f4); avec3[4] = Vec3.createVectorHelper((double)(-f3), (double)f5, (double)(-f4)); avec3[5] = Vec3.createVectorHelper((double)f3, (double)f5, (double)(-f4)); avec3[6] = Vec3.createVectorHelper((double)f3, (double)f5, (double)f4); avec3[7] = Vec3.createVectorHelper((double)(-f3), (double)f5, (double)f4); for (int j1 = 0; j1 < 8; ++j1) { if (flag) { avec3[j1].zCoord -= 0.0625D; avec3[j1].rotateAroundX(((float)Math.PI * 2F / 9F)); } else { avec3[j1].zCoord += 0.0625D; avec3[j1].rotateAroundX(-((float)Math.PI * 2F / 9F)); } if (i1 == 0 || i1 == 7) { avec3[j1].rotateAroundZ((float)Math.PI); } if (i1 == 6 || i1 == 0) { avec3[j1].rotateAroundY(((float)Math.PI / 2F)); } if (i1 > 0 && i1 < 5) { avec3[j1].yCoord -= 0.375D; avec3[j1].rotateAroundX(((float)Math.PI / 2F)); if (i1 == 4) { avec3[j1].rotateAroundY(0.0F); } if (i1 == 3) { avec3[j1].rotateAroundY((float)Math.PI); } if (i1 == 2) { avec3[j1].rotateAroundY(((float)Math.PI / 2F)); } if (i1 == 1) { avec3[j1].rotateAroundY(-((float)Math.PI / 2F)); } avec3[j1].xCoord += (double)x + 0.5D; avec3[j1].yCoord += (double)((float)y + 0.5F); avec3[j1].zCoord += (double)z + 0.5D; } else if (i1 != 0 && i1 != 7) { avec3[j1].xCoord += (double)x + 0.5D; avec3[j1].yCoord += (double)((float)y + 0.125F); avec3[j1].zCoord += (double)z + 0.5D; } else { avec3[j1].xCoord += (double)x + 0.5D; avec3[j1].yCoord += (double)((float)y + 0.875F); avec3[j1].zCoord += (double)z + 0.5D; } } Vec3 vec33 = null; Vec3 vec3 = null; Vec3 vec31 = null; Vec3 vec32 = null; for (int k1 = 0; k1 < 6; ++k1) { if (k1 == 0) { d0 = (double)icon.getInterpolatedU(7.0D); d1 = (double)icon.getInterpolatedV(6.0D); d2 = (double)icon.getInterpolatedU(9.0D); d3 = (double)icon.getInterpolatedV(8.0D); } else if (k1 == 2) { d0 = (double)icon.getInterpolatedU(7.0D); d1 = (double)icon.getInterpolatedV(6.0D); d2 = (double)icon.getInterpolatedU(9.0D); d3 = (double)icon.getMaxV(); } if (k1 == 0) { vec33 = avec3[0]; vec3 = avec3[1]; vec31 = avec3[2]; vec32 = avec3[3]; } else if (k1 == 1) { vec33 = avec3[7]; vec3 = avec3[6]; vec31 = avec3[5]; vec32 = avec3[4]; } else if (k1 == 2) { vec33 = avec3[1]; vec3 = avec3[0]; vec31 = avec3[4]; vec32 = avec3[5]; } else if (k1 == 3) { vec33 = avec3[2]; vec3 = avec3[1]; vec31 = avec3[5]; vec32 = avec3[6]; } else if (k1 == 4) { vec33 = avec3[3]; vec3 = avec3[2]; vec31 = avec3[6]; vec32 = avec3[7]; } else if (k1 == 5) { vec33 = avec3[0]; vec3 = avec3[3]; vec31 = avec3[7]; vec32 = avec3[4]; } tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d3); tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d2, d3); tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d1); tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d0, d1); } return true; } @Override public boolean shouldRender3DInInventory(int modelId) { return false; } @Override public int getRenderId() { return renderId; } } Everything should work correctly, but it crashes: CrashLog [15:33:57] [Client thread/FATAL]: Unreported exception thrown! java.lang.NullPointerException at net.minecraft.block.Block.getMixedBrightnessForBlock(Block.java:612) ~[block.class:?] at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithColorMultiplier(RenderBlocks.java:6222) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4473) ~[RenderBlocks.class:?] at com.sackcastellon.betterwood.handler.LeverHandler.renderWorldBlock(LeverHandler.java:72) ~[LeverHandler.class:?] at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:118) ~[RenderingRegistry.class:?] at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:53) ~[FMLRenderAccessLibrary.class:?] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:435) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) ~[WorldRenderer.class:?] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1624) ~[RenderGlobal.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1271) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1095) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1066) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] ---- Minecraft Crash Report ---- // Oh - I know what I did wrong! Time: 29/08/14 15:33 Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraft.block.Block.getMixedBrightnessForBlock(Block.java:612) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithColorMultiplier(RenderBlocks.java:6222) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4473) at com.sackcastellon.betterwood.handler.LeverHandler.renderWorldBlock(LeverHandler.java:72) at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:118) at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:53) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:435) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1624) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1271) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1095) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1066) at net.minecraft.client.Minecraft.run(Minecraft.java:961) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.block.Block.getMixedBrightnessForBlock(Block.java:612) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithColorMultiplier(RenderBlocks.java:6222) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4473) at com.sackcastellon.betterwood.handler.LeverHandler.renderWorldBlock(LeverHandler.java:72) at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:118) at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:53) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:435) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1624) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1271) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player801'/0, l='MpServer', x=-977,51, y=57,62, z=1583,78]] Chunk stats: MultiplayerChunkCache: 25, 25 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (-983,4,1583), Chunk: (at 9,0,15 in -62,98; contains blocks -992,0,1568 to -977,255,1583), Region: (-2,3; contains chunks -64,96 to -33,127, blocks -1024,0,1536 to -513,255,2047) Level time: 630 game time, 630 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 1 total; [EntityClientPlayerMP['Player801'/0, l='MpServer', x=-977,51, y=57,62, z=1583,78]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2567) at net.minecraft.client.Minecraft.run(Minecraft.java:990) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_11, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 95152824 bytes (90 MB) / 327155712 bytes (312 MB) up to 878182400 bytes (837 MB) JVM Flags: 0 total; AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.25.1203 Minecraft Forge 10.13.0.1203 5 mods loaded, 5 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.25.1203} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1203.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1203} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1203.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-Core{1.1.2.0} [sKC Core] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-BetterWood{1.1.0.7} [better Wood] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.6 LWJGL: 2.9.1 OpenGL: GeForce GT 330M/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) #@!@# Game crashed! Crash report saved to: #@!@# C:\Modding\Github\BetterWood\.\crash-reports\crash-2014-08-29_15.33.57-client.txt 2014-08-29 15:33:58,296 WARN Unable to register shutdown hook due to JVM state AL lib: (EE) alc_cleanup: 1 device not closed Basically it says that the problem is on this line of the LeverHandler.class render.renderStandardBlock(block, x, y, z); Thanks for helping.
  17. Search for usages on the getter (getBlockMetadata). There are a lot of usages in the minecraft codebase. Do not do this. Yes, I know there are a bunch of classes using the getter, but (in my opinion) the important is to know where is the value of the field set, so as there are no setter, the only way to set the value of the field is this: public void markDirty() { if (this.worldObj != null) { this.blockMetadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); if (this.getBlockType() != Blocks.air) { this.worldObj.func_147453_f(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); } } } More concretely this part: this.blockMetadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); Which I think is the same thing that I'm doing, isn't it?
  18. I've been looking for where the blockMetadata field were used and it's only used on the TileEntity.class , so I'm assuming there is no problem if I use it to store the block metadata. And looks like it works by adding the default constructor: public TileEntityLadder() {} Thanks PS: Unless I get an error by "re-using" Minecraft's field in the TE, I won't change it.
  19. I've created a TileEntity to store the metadata of a block, when i place my block averything goes well: https://dl.dropboxusercontent.com/u/184200482/img/ladder_ok.png[/img] ** The blocks' metadata are the following | 2 | 6 | 10 | 14 | 18 | 22 | ** But once I restart minecraft I see that the blockMetadata information has not been stored by the TileEntity: https://dl.dropboxusercontent.com/u/184200482/img/ladder_bad.png[/img] ** The blocks' metadata are the following | 2 | 6 | 10 | 14 | 2 (18) | 6 (22) | ** This is the error: [20:26:41] [server thread/INFO]: Preparing start region for level 0 java.lang.InstantiationException: com.sackcastellon.betterwood.tileentities.TileEntityLadder at java.lang.Class.newInstance(Unknown Source) at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:127) at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:146) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) Caused by: java.lang.NoSuchMethodException: com.sackcastellon.betterwood.tileentities.TileEntityLadder.<init>() at java.lang.Class.getConstructor0(Unknown Source) ... 15 more java.lang.InstantiationException: com.sackcastellon.betterwood.tileentities.TileEntityLadder at java.lang.Class.newInstance(Unknown Source) at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:127) at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:146) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) Caused by: java.lang.NoSuchMethodException: com.sackcastellon.betterwood.tileentities.TileEntityLadder.<init>() at java.lang.Class.getConstructor0(Unknown Source) ... 15 more java.lang.InstantiationException: com.sackcastellon.betterwood.tileentities.TileEntityLadder at java.lang.Class.newInstance(Unknown Source) at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:127) at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:146) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) Caused by: java.lang.NoSuchMethodException: com.sackcastellon.betterwood.tileentities.TileEntityLadder.<init>() at java.lang.Class.getConstructor0(Unknown Source) ... 15 more java.lang.InstantiationException: com.sackcastellon.betterwood.tileentities.TileEntityLadder at java.lang.Class.newInstance(Unknown Source) at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:127) at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:146) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) Caused by: java.lang.NoSuchMethodException: com.sackcastellon.betterwood.tileentities.TileEntityLadder.<init>() at java.lang.Class.getConstructor0(Unknown Source) ... 15 more java.lang.InstantiationException: com.sackcastellon.betterwood.tileentities.TileEntityLadder at java.lang.Class.newInstance(Unknown Source) at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:127) at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:146) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) Caused by: java.lang.NoSuchMethodException: com.sackcastellon.betterwood.tileentities.TileEntityLadder.<init>() at java.lang.Class.getConstructor0(Unknown Source) ... 15 more java.lang.InstantiationException: com.sackcastellon.betterwood.tileentities.TileEntityLadder at java.lang.Class.newInstance(Unknown Source) at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:127) at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:146) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) Caused by: java.lang.NoSuchMethodException: com.sackcastellon.betterwood.tileentities.TileEntityLadder.<init>() at java.lang.Class.getConstructor0(Unknown Source) ... 15 more [20:26:42] [server thread/WARN]: Skipping BlockEntity with id Ladder [20:26:42] [server thread/WARN]: Skipping BlockEntity with id Ladder [20:26:42] [server thread/WARN]: Skipping BlockEntity with id Ladder [20:26:42] [server thread/WARN]: Skipping BlockEntity with id Ladder [20:26:42] [server thread/WARN]: Skipping BlockEntity with id Ladder [20:26:42] [server thread/WARN]: Skipping BlockEntity with id Ladder [20:26:42] [server thread/INFO]: Preparing spawn area: 81% And this is my code: BlockLadder.class package com.sackcastellon.betterwood.block; import static net.minecraftforge.common.util.ForgeDirection.EAST; import static net.minecraftforge.common.util.ForgeDirection.NORTH; import static net.minecraftforge.common.util.ForgeDirection.SOUTH; import static net.minecraftforge.common.util.ForgeDirection.WEST; import java.util.ArrayList; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import com.sackcastellon.betterwood.api.Tabs; import com.sackcastellon.betterwood.handler.LadderHandler; import com.sackcastellon.betterwood.lib.Reference; import com.sackcastellon.betterwood.loader.ItemLoader; import com.sackcastellon.betterwood.tileentities.TileEntityLadder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockLadder extends BlockContainer { @SideOnly(Side.CLIENT) private final IIcon[] iconArray; private final String path = Reference.TexturePath + "ladder/"; public BlockLadder() { super(Material.wood); this.setCreativeTab(Tabs.tabBW); this.iconArray = new IIcon[itemLoader.woodTypes.length]; } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { int meta = world.getTileEntity(x, y, z).getBlockMetadata() & 28; //Some tests to save up space System.out.println(world.getTileEntity(x, y, z).getBlockMetadata() + "=>" + meta); return new ItemStack(Item.getItemFromBlock(this), 1, meta); } @Override public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); int meta = 0; switch(world.getTileEntity(x, y, z).getBlockMetadata()) { case 0: case 1: case 2: case 3: meta = 0; break; case 4: case 5: case 6: case 7: meta = 4; break; case 8: case 9: case 10: case 11: meta = 8; break; case 12: case 13: case 14: case 15: meta = 12; break; case 16: case 17: case 18: case 19: meta = 16; break; case 20: case 21: case 22: case 23: meta = 20; break; } ret.add(new ItemStack(Item.getItemFromBlock(this), 1, meta)); return ret; } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityLadder(meta); } @Override public boolean isOpaqueCube() { return false; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void getSubBlocks(Item item, CreativeTabs tab, List list) { for(int i = 0; i < ItemLoader.woodTypes.length; ++i) { list.add(new ItemStack(this, 1, i * 4)); } } @Override public void registerBlockIcons(IIconRegister iconRegister) { for(int i = 0; i < ItemLoader.woodTypes.length; ++i) { this.iconArray[i] = iconRegister.registerIcon(path + (String) ItemLoader.woodTypes[i][1]); } } @Override public IIcon getIcon(int side, int meta) { return this.iconArray[meta / 4]; } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { this.setBlockBoundsBasedOnState(world, x, y, z); return super.getCollisionBoundingBoxFromPool(world, x, y, z); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ @Override public void setBlockBoundsBasedOnState(IBlockAccess block, int x, int y, int z) { this.setBlockBounds(block.getBlockMetadata(x, y, z)); } /** * Returns the bounding box of the wired rectangular prism to render. */ @Override @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { this.setBlockBoundsBasedOnState(world, x, y, z); return super.getSelectedBoundingBoxFromPool(world, x, y, z); } public void setBlockBounds(int metadata) { float f = 0.125F; int meta = metadata & 3; if(meta == 0) { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } else if(meta == 1) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } else if(meta == 2) { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } else if(meta == 3) { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ @Override public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ @Override public int getRenderType() { return LadderHandler.renderId; } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { return world.isSideSolid(x - 1, y, z, EAST ) || world.isSideSolid(x + 1, y, z, WEST ) || world.isSideSolid(x, y, z - 1, SOUTH) || world.isSideSolid(x, y, z + 1, NORTH); } /** * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata */ @Override public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) { int j1 = meta; switch(meta) { case 0: if ((meta == 0 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 0; } if ((j1 == 0 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 1; } if ((j1 == 0 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 2; } if ((j1 == 0 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 3; } break; case 4: if ((meta == 4 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 4; } if ((j1 == 4 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 5; } if ((j1 == 4 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 6; } if ((j1 == 4 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 7; } break; case 8: if ((meta == 8 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 8; } if ((j1 == 8 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 9; } if ((j1 == 8 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 10; } if ((j1 == 8 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 11; } break; case 12: if ((meta == 12 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 12; } if ((j1 == 12 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 13; } if ((j1 == 12 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 14; } if ((j1 == 12 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 15; } break; case 16: if ((meta == 16 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 16; } if ((j1 == 16 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 17; } if ((j1 == 16 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 18; } if ((j1 == 16 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 19; } break; case 20: if ((meta == 20 || side == 2) && world.isSideSolid(x, y, z + 1, NORTH)) { j1 = 20; } if ((j1 == 20 || side == 3) && world.isSideSolid(x, y, z - 1, SOUTH)) { j1 = 21; } if ((j1 == 20 || side == 4) && world.isSideSolid(x + 1, y, z, WEST)) { j1 = 22; } if ((j1 == 20 || side == 5) && world.isSideSolid(x - 1, y, z, EAST)) { j1 = 23; } break; } return j1; } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor Block */ @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { int l = world.getBlockMetadata(x, y, z); boolean flag = false; if ((l == 0 || l == 4 || l == 8 || l == 12 || l == 16 || l == 20) && world.isSideSolid(x, y, z + 1, NORTH)) { flag = true; } if ((l == 1 || l == 5 || l == 9 || l == 13 || l == 17 || l == 21) && world.isSideSolid(x, y, z - 1, SOUTH)) { flag = true; } if ((l == 2 || l == 6 || l == 10 || l == 14 || l == 18 || l == 22) && world.isSideSolid(x + 1, y, z, WEST)) { flag = true; } if ((l == 3 || l == 7 || l == 11 || l == 15 || l == 19 || l == 23) && world.isSideSolid(x - 1, y, z, EAST)) { flag = true; } if (!flag) { this.dropBlockAsItem(world, x, y, z, l, 0); world.setBlockToAir(x, y, z); } super.onNeighborBlockChange(world, x, y, z, block); } /** * Returns the quantity of items to drop on block destruction. */ @Override public int quantityDropped(Random random) { return 1; } @Override public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) { return true; } } TileEntityLadder.class package com.sackcastellon.betterwood.tileentities; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileEntityLadder extends TileEntity { public TileEntityLadder(int meta) { this.blockMetadata = meta; } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.blockMetadata = nbt.getInteger("Metadata"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("Metadata", this.blockMetadata); } @Override public int getBlockMetadata() { return this.blockMetadata; } @Override public Packet getDescriptionPacket() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); } } ItemBlockLadder.class package com.sackcastellon.betterwood.itemblock; import java.util.List; import com.sackcastellon.betterwood.loader.ItemLoader; import com.sackcastellon.betterwood.loader.LoreLoader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; public class ItemBlockLadder extends ItemBlock { public ItemBlockLadder(Block block) { super(block); this.setHasSubtypes(true); this.setMaxDamage(0); } public int getMetadata(int metadata) { return metadata; } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int meta) { return this.field_150939_a.getIcon(2, meta); } @Override public String getUnlocalizedName(ItemStack stack) { return "bw.block.ladder." + (String) ItemLoader.woodTypes[stack.getItemDamage() / 4][1]; } @Override @SuppressWarnings({ "rawtypes", "unchecked" }) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { list.add(LoreLoader.Block + ": " + LoreLoader.getMaterialLore((String) ItemLoader.woodTypes[stack.getItemDamage() / 4][1])); } } ClientProxy.class package com.sackcastellon.betterwood.proxy; import com.sackcastellon.betterwood.handler.*; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRenderers() { RenderingRegistry.registerBlockHandler(new LadderHandler()); } } This code goes in the preInit method: Blocks.Ladder = new BlockLadder(); GameRegistry.registerBlock(Blocks.Ladder, ItemBlockLadder.class, "Ladder"); And this in the init method: GameRegistry.registerTileEntity(TileEntityLadder.class, "Ladder");
  20. What I'm trying to do is create about 400 different tools, with 5 different enchantability levels, depending on the materials made of (information stored on the NBT Tags).
  21. Done, and waiting: https://github.com/MinecraftForge/MinecraftForge/pull/1314 Thanks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.