Everything posted by Villfuk02
-
[1.11]More problems with custom item
Ok i have something now, is there a way to set some of the values when is the item crafted? Different materials - different values
-
[1.11]More problems with custom item
Can you please translete this to english for me? In general terms, a capability is declared and registered through a single method call to CapabilityManager.INSTANCE.register(). One possibility is to define a static register()method inside a dedicated class for the capability, but this is not required by the capability system. For the purpose of this documentation we will be describing each part as a separate named class, although anonymous classes are an option. CapabilityManager.INSTANCE.register(capability interface class, storage, default implementation factory); The first parameter to this method, is the type that describes the capability feature. In our example, this will be IExampleCapability.class. The second parameter is an instance of a class that implements Capability.IStorage<T>, where T is the same class we specified in the first parameter. This storage class will help manage saving and loading for the default implementation, and it can, optionally, also support other implementations. private static class Storage implements Capability.IStorage<IExampleCapability> { @Override public NBTBase writeNBT(Capability<IExampleCapability> capability, IExampleCapability instance, EnumFacing side) { // return an NBT tag } @Override public void readNBT(Capability<IExampleCapability> capability, IExampleCapability instance, EnumFacing side, NBTBase nbt) { // load from the NBT tag } } The last parameter is a callable factory that will return new instances of the default implementation. private static class Factory implements Callable<IExampleCapability> { @Override public IExampleCapability call() throws Exception { return new Implementation(); } } Finally, we will need the default implementation itself, to be able to instantiate it in the factory. Designing this class is up to you, but it should at least provide a basic skeleton that people can use to test the capability, if it’s not a fully usable implementation on itself. thanks
-
[1.11]More problems with custom item
But there are capabilities for storing items, fluids and energy, but i need to just store some ints bools doubles and some fields so what?
-
[1.11]More problems with custom item
Thanks for everything, now i'd like to make the item use capabilities instead of nbt to store the values. Where do i start?
-
[1.11]More problems with custom item
how do i thank you in this new version of the forum?
-
[1.11]More problems with custom item
When i put two detectors in crafting table or anvil, they combine and repair. I don't want that to be possible, anybody knows how?
-
[1.11]More problems with custom item
no, the values are more than 0 don't worry
-
[1.11]More problems with custom item
Ok, it worked all the time. I FEEL SO STUPID NOW it just can't be damaged in creative mode
-
[1.11]More problems with custom item
Can you please try damageItem yourself, because if it also doesn't work, maybe it's because of bug in this forge version I'm using forge-1.11.2-13.20.0.2210
-
[1.11]More problems with custom item
I'm like really confused, can we do this without Git?
-
[1.11]More problems with custom item
i tried this, but it didnt sync at all, idk how does the GitHub for desktop work i could load in the files, but they didn't show in the browser
-
[1.11]More problems with custom item
which files are important? there is over 5000 files in the folder and you can upload only 100 files at a time
-
[1.11]More problems with custom item
https://github.com/Villfuk02/Archeology should be working now
-
[1.11]More problems with custom item
I don't really know how GitHub works but i'll try something
-
[1.11]More problems with custom item
Ok, i'll look at capabilities, but now i need the damage to work please look at that
-
[1.11]More problems with custom item
The code gets to it i think, because i have few Utils.getLogger() lines scattered trough the code and they all execute properly and how do i store FIELDS in ItemStack?
-
[1.11]More problems with custom item
No, there's the problem - the damageItem doesn't work And how should i store the fields?
-
[1.11]More problems with custom item
still nobody?
-
Multipart Model
ok... but it worked fine until i changed this to multipart i had just this: { "parent": "item/torch", "overrides": [ { "predicate": { "found": 0.0}, "model": "archeology:item/detector_test"}, { "predicate": { "found": 1.0}, "model": "archeology:item/detector_test_lit"} ] } and i register the model like this: in preInit i call proxy.registerRenders(), which calls methods for all the item/ block categories for example ModTools.registerRenders(), and there is registerRender(metal_detector) here's the log: 2017-02-03 08:49:26,231 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-02-03 08:49:26,234 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [08:49:26] [main/INFO] [GradleStart]: Extra: [] [08:49:27] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Villfuk/.gradle/caches/minecraft/assets, --assetIndex, 1.11, --accessToken{REDACTED}, --version, 1.11.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [08:49:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [08:49:27] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [08:49:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [08:49:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [08:49:27] [main/INFO] [FML]: Forge Mod Loader version 13.20.0.2210 for Minecraft 1.11.2 loading [08:49:27] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_111, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_111 [08:49:27] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [08:49:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [08:49:28] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [08:49:28] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [08:49:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [08:49:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [08:49:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [08:49:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [08:49:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [08:49:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [08:49:29] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [08:49:39] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [08:49:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [08:49:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [08:49:43] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker 2017-02-03 08:49:44,096 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-02-03 08:49:44,269 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-02-03 08:49:44,277 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [08:49:44] [main/INFO] [GradleStart]: Remapping AccessTransformer rules... [08:49:44] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [08:49:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [08:49:44] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [08:49:50] [Client thread/INFO]: Setting user: Player375 [08:50:09] [Client thread/WARN]: Skipping bad option: lastServer: [08:50:09] [Client thread/INFO]: LWJGL Version: 2.9.4 [08:50:14] [Client thread/INFO]: [STDOUT]: ---- Minecraft Crash Report ---- // I just don't know what went wrong :( Time: 2/3/17 8:50 AM Description: Loading screen debug info This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.11.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_111, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 1961661384 bytes (1870 MB) / 2130051072 bytes (2031 MB) up to 2130051072 bytes (2031 MB) JVM Flags: 3 total; -Xincgc -Xmx2048M -Xms2048M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 369.09' Renderer: 'GeForce GT 610/PCIe/SSE2' [08:50:14] [Client thread/INFO] [FML]: MinecraftForge v13.20.0.2210 Initialized [08:50:14] [Client thread/INFO] [FML]: Replaced 232 ore recipes [08:50:16] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [08:50:16] [Client thread/INFO] [FML]: Searching C:\Users\Villfuk\Desktop\ancient\run\mods for mods [08:50:22] [Client thread/INFO] [FML]: Forge Mod Loader has identified 6 mods to load [08:50:24] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, archeology, jei] at CLIENT [08:50:24] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, archeology, jei] at SERVER [08:50:27] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Archeology, FMLFileResourcePack:Just Enough Items [08:50:28] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [08:50:28] [Client thread/INFO] [FML]: Found 444 ObjectHolder annotations [08:50:28] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations [08:50:28] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations [08:50:28] [Client thread/INFO] [FML]: Applying holder lookups [08:50:28] [Client thread/INFO] [FML]: Holder lookups applied [08:50:28] [Client thread/INFO] [FML]: Applying holder lookups [08:50:28] [Client thread/INFO] [FML]: Holder lookups applied [08:50:28] [Client thread/INFO] [FML]: Applying holder lookups [08:50:28] [Client thread/INFO] [FML]: Holder lookups applied [08:50:28] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [08:50:28] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [08:50:28] [Client thread/INFO] [archeology]: PreInitializing [08:50:29] [Client thread/INFO] [archeology]: RegisteredBlock: archeology_dirt [08:50:29] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Found status: BETA_OUTDATED Target: 13.20.0.2226 [08:50:30] [Client thread/INFO] [FML]: Applying holder lookups [08:50:30] [Client thread/INFO] [FML]: Holder lookups applied [08:50:30] [Client thread/INFO] [FML]: Injecting itemstacks [08:50:30] [Client thread/INFO] [FML]: Itemstack injection complete [08:51:24] [Sound Library Loader/INFO]: Starting up SoundSystem... [08:51:25] [Thread-8/INFO]: Initializing LWJGL OpenAL [08:51:25] [Thread-8/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [08:51:25] [Thread-8/INFO]: OpenAL initialized. [08:51:25] [Sound Library Loader/INFO]: Sound engine started [08:51:47] [Client thread/INFO] [FML]: Max texture size: 16384 [08:51:47] [Client thread/INFO]: Created: 16x16 textures-atlas [08:51:52] [Client thread/INFO] [archeology]: Initializing [08:51:52] [Client thread/INFO] [FML]: Injecting itemstacks [08:51:52] [Client thread/INFO] [FML]: Itemstack injection complete [08:51:52] [Client thread/INFO] [archeology]: PostInitializing [08:51:52] [Client thread/INFO] [jei]: Starting JEI... [08:51:53] [Client thread/INFO] [jei]: Registering plugin: mezz.jei.plugins.vanilla.VanillaPlugin ... [08:51:53] [Client thread/INFO] [jei]: Registered plugin: mezz.jei.plugins.vanilla.VanillaPlugin in 454 ms [08:51:53] [Client thread/INFO] [jei]: Registering plugin: mezz.jei.plugins.jei.JEIInternalPlugin ... [08:51:53] [Client thread/INFO] [jei]: Registered plugin: mezz.jei.plugins.jei.JEIInternalPlugin in 25 ms [08:51:53] [Client thread/INFO] [jei]: Building recipe registry... [08:51:54] [Client thread/INFO] [jei]: Built recipe registry in 329 ms [08:51:54] [Client thread/INFO] [jei]: Building item filter... [08:51:55] [Client thread/INFO] [jei]: Built item filter in 960 ms [08:51:55] [Client thread/INFO] [jei]: Building runtime... [08:51:55] [Client thread/INFO] [jei]: Built runtime in 356 ms [08:51:55] [Client thread/INFO] [jei]: Sending runtime to plugin: mezz.jei.plugins.vanilla.VanillaPlugin ... [08:51:55] [Client thread/INFO] [jei]: Sending runtime to plugin: mezz.jei.plugins.jei.JEIInternalPlugin ... [08:51:55] [Client thread/INFO] [jei]: Finished Starting JEI in 3099 ms [08:51:55] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 6 mods [08:51:55] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Archeology, FMLFileResourcePack:Just Enough Items [08:52:10] [Client thread/INFO]: SoundSystem shutting down... [08:52:10] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [08:52:10] [Sound Library Loader/INFO]: Starting up SoundSystem... [08:52:10] [Thread-10/INFO]: Initializing LWJGL OpenAL [08:52:10] [Thread-10/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [08:52:10] [Thread-10/INFO]: OpenAL initialized. [08:52:10] [Sound Library Loader/INFO]: Sound engine started [08:52:29] [Client thread/INFO] [FML]: Max texture size: 16384 [08:52:30] [Client thread/INFO]: Created: 512x512 textures-atlas [08:52:35] [Client thread/WARN]: Skipping bad option: lastServer: [08:52:44] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id
-
Multipart Model
Ok metal_detector.json { "multipart": [ {"apply": { "model": "archeology:detector_base"} }, {"apply": { "model": "archeology:item/detector_base"} }, {"when": {"found": "0.0"}, "apply": { "model": "archeology:item/detector_not_found"} }, {"when": {"found": "1.0"}, "apply": { "model": "archeology:item/detector_found"} } ], "display": { "head": { "rotation": [ 0, 90, 0 ], "translation": [ 0, 29, 0 ], "scale": [ 2.8, 2.8, 2.8 ] }, "gui": { "rotation": [ 30, 310, 0 ], "translation": [ 0, 1, 0], "scale":[ 1.325, 1.325, 1.325 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0], "scale":[ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 0, 0 ], "translation": [ 5, 5, 0], "scale":[ 1.6, 1.6, 1.6 ] }, "thirdperson_righthand": { "rotation": [ 83, 90, -10 ], "translation": [ 0, 8, -3], "scale": [ 1.4, 1.4, 1.4 ] }, "thirdperson_lefthand": { "rotation": [ 83, 270, 10 ], "translation": [ 0, 8, -3], "scale": [ 1.4, 1.4, 1.4 ] }, "firstperson_righthand": { "rotation": [ 45, 90, 0 ], "translation": [ -4, 7, -1 ], "scale": [ 1.5, 1.5, 1.5 ] }, "firstperson_lefthand": { "rotation": [ 45, 270, 0 ], "translation": [ -4, 7, -1 ], "scale": [ 1.5, 1.5, 1.5 ] } } } detector_base.json { "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", "textures": { "0": "blocks/iron_block", "1": "blocks/gold_block", "2": "blocks/anvil_base" }, "elements": [ { "name": "Coil1", "from": [ 6.500000007450581, 0.0, 6.500000007450581 ], "to": [ 7.500000007450581, 1.0, 8.50000000745058 ], "faces": { "north": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "east": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "south": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "up": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ], "rotation": 90 }, "down": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ], "rotation": 90 } } }, { "name": "Coil2", "from": [ 7.500000007450581, 0.0, 6.500000007450581 ], "to": [ 9.50000000745058, 1.0, 7.500000007450581 ], "faces": { "north": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "east": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "south": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "up": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ], "rotation": 180 }, "down": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] } } }, { "name": "Coil3", "from": [ 8.50000000745058, 0.0, 7.500000007450581 ], "to": [ 9.50000000745058, 1.0, 9.50000000745058 ], "faces": { "north": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "east": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "south": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "up": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ], "rotation": 270 }, "down": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ], "rotation": 270 } } }, { "name": "Coil4", "from": [ 6.499999992549419, 0.0, 8.49999999254942 ], "to": [ 8.49999999254942, 1.0, 9.49999999254942 ], "faces": { "north": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "east": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "south": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 1.0, 4.0, 4.0 ] }, "up": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "down": { "texture": "#0", "uv": [ 1.0, 1.0, 7.0, 4.0 ], "rotation": 180 } } }, { "name": "Rod", "from": [ 6.299999989569187, 1.0, 7.500000007450581 ], "to": [ 7.299999989569187, 11.0, 8.50000000745058 ], "rotation": { "origin": [ 8.0, 1.0, 8.0 ], "axis": "z", "angle": 22.5 }, "faces": { "north": { "texture": "#1", "uv": [ 1.0, 0.0, 5.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 1.0, 0.0, 5.0, 16.0 ] }, "south": { "texture": "#1", "uv": [ 1.0, 0.0, 5.0, 16.0 ] }, "west": { "texture": "#1", "uv": [ 1.0, 0.0, 5.0, 16.0 ] }, "up": { "texture": "#1", "uv": [ 1.0, 1.0, 5.0, 5.0 ] }, "down": { "texture": "#1", "uv": [ 4.0, 4.0, 8.0, 8.0 ] } } }, { "name": "Handle1", "from": [ 5.0, 5.0, 7.0 ], "to": [ 7.0, 6.0, 9.0 ], "faces": { "north": { "texture": "#2", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, "east": { "texture": "#2", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, "south": { "texture": "#2", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, "west": { "texture": "#2", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 8.0, 8.0 ] } } }, { "name": "Handle2", "from": [ 0.7999999970197678, 8.799999997019768, 7.4000000059604645 ], "to": [ 3.7999999970197678, 10.0, 8.600000008940697 ], "faces": { "north": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 4.0 ] }, "east": { "texture": "#2", "uv": [ 0.0, 0.0, 4.0, 4.0 ] }, "south": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 4.0 ] }, "west": { "texture": "#2", "uv": [ 0.0, 0.0, 4.0, 4.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 4.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 4.0 ] } } } ] } detector_found.json { "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", "textures": { "3": "blocks/redstone_block" }, "elements": [ { "name": "Display", "from": [ 4.199999988079071, 10.299999989569187, 6.500000007450581 ], "to": [ 6.199999988079071, 11.299999989569187, 9.50000000745058 ], "shade": false, "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "z", "angle": 22.5 }, "faces": { "north": { "texture": "#3", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "east": { "texture": "#3", "uv": [ 1.0, 1.0, 10.0, 4.0 ] }, "south": { "texture": "#3", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "west": { "texture": "#3", "uv": [ 1.0, 1.0, 10.0, 4.0 ] }, "up": { "texture": "#3", "uv": [ 2.0, 4.0, 14.0, 12.0 ], "rotation": 90 }, "down": { "texture": "#3", "uv": [ 2.0, 4.0, 14.0, 12.0 ], "rotation": 90 } } } ], "display": { "head": { "rotation": [ 0, 90, 0 ], "translation": [ 0, 29, 0 ], "scale": [ 2.8, 2.8, 2.8 ] }, "gui": { "rotation": [ 30, 310, 0 ], "translation": [ 0, 1, 0], "scale":[ 1.325, 1.325, 1.325 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0], "scale":[ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 0, 0 ], "translation": [ 5, 5, 0], "scale":[ 1.6, 1.6, 1.6 ] }, "thirdperson_righthand": { "rotation": [ 83, 90, -10 ], "translation": [ 0, 8, -3], "scale": [ 1.4, 1.4, 1.4 ] }, "thirdperson_lefthand": { "rotation": [ 83, 270, 10 ], "translation": [ 0, 8, -3], "scale": [ 1.4, 1.4, 1.4 ] }, "firstperson_righthand": { "rotation": [ 45, 90, 0 ], "translation": [ -4, 7, -1 ], "scale": [ 1.5, 1.5, 1.5 ] }, "firstperson_lefthand": { "rotation": [ 45, 270, 0 ], "translation": [ -4, 7, -1 ], "scale": [ 1.5, 1.5, 1.5 ] } } } detector_not_found.json { "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", "textures": { "3": "blocks/furnace_top" }, "elements": [ { "name": "Display", "from": [ 4.199999988079071, 10.299999989569187, 6.500000007450581 ], "to": [ 6.199999988079071, 11.299999989569187, 9.50000000745058 ], "shade": false, "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "z", "angle": 22.5 }, "faces": { "north": { "texture": "#3", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "east": { "texture": "#3", "uv": [ 1.0, 1.0, 10.0, 4.0 ] }, "south": { "texture": "#3", "uv": [ 1.0, 1.0, 7.0, 4.0 ] }, "west": { "texture": "#3", "uv": [ 1.0, 1.0, 10.0, 4.0 ] }, "up": { "texture": "#3", "uv": [ 2.0, 4.0, 14.0, 12.0 ], "rotation": 90 }, "down": { "texture": "#3", "uv": [ 2.0, 4.0, 14.0, 12.0 ], "rotation": 90 } } } ], "display": { "head": { "rotation": [ 0, 90, 0 ], "translation": [ 0, 29, 0 ], "scale": [ 2.8, 2.8, 2.8 ] }, "gui": { "rotation": [ 30, 310, 0 ], "translation": [ 0, 1, 0], "scale":[ 1.325, 1.325, 1.325 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0], "scale":[ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 0, 0 ], "translation": [ 5, 5, 0], "scale":[ 1.6, 1.6, 1.6 ] }, "thirdperson_righthand": { "rotation": [ 83, 90, -10 ], "translation": [ 0, 8, -3], "scale": [ 1.4, 1.4, 1.4 ] }, "thirdperson_lefthand": { "rotation": [ 83, 270, 10 ], "translation": [ 0, 8, -3], "scale": [ 1.4, 1.4, 1.4 ] }, "firstperson_righthand": { "rotation": [ 45, 90, 0 ], "translation": [ -4, 7, -1 ], "scale": [ 1.5, 1.5, 1.5 ] }, "firstperson_lefthand": { "rotation": [ 45, 270, 0 ], "translation": [ -4, 7, -1 ], "scale": [ 1.5, 1.5, 1.5 ] } } }
-
Multipart Model
So i made multipart model for my item, and it just shows nothing here are the files: detector_base.json detector_found.json detector_not_found.json metal_detector.json
-
[1.11]More problems with custom item
Is anyone looking trough the code? It also may be bug in forge, because it's 1.11.2 Beta
-
[1.11]More problems with custom item
the problem is in the line i showed you, or something somewhere else blocks it, because other lines of code right before this execute properly. and for the testing i used detector with 30 damage taken, coil 3, rod 3, display 3 and battery 3 package vms.archeology.items; import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants.NBT; import vms.archeology.Reference; import vms.archeology.blocks.ArcheologyDirt; import vms.archeology.handlers.EnumHandler; import vms.archeology.init.ModBlocks; import vms.archeology.util.Utils; public class Detector extends Item{ private List<BlockPos> modifiers = new ArrayList(); private BlockPos scanBlock; public Detector(String unlocalizedName){ this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); this.setMaxDamage(200000); this.addPropertyOverride(new ResourceLocation("found"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if(nbt.hasKey("found")){ if (nbt.getBoolean("found")){ return 1.0F; } } } return 0; } }); this.addPropertyOverride(new ResourceLocation("coil"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if (nbt.hasKey("coil")) return ((float)nbt.getInteger("coil"))/10; } return 0; } }); this.addPropertyOverride(new ResourceLocation("battery"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if (nbt.hasKey("battery")) return ((float)nbt.getInteger("battery"))/10; } return 0; } }); this.addPropertyOverride(new ResourceLocation("rod"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if (nbt.hasKey("rod")) return ((float)nbt.getInteger("rod"))/10; } return 0; } }); this.addPropertyOverride(new ResourceLocation("display"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if (nbt.hasKey("display")) return ((float)nbt.getInteger("display"))/10; } return 0; } }); this.addPropertyOverride(new ResourceLocation("distance"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if (nbt.hasKey("distance_squared")) return ((float)nbt.getDouble("distance_squared"))/10000; } return 0; } }); this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter(){ @Override public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null){ if (nbt.hasKey("type")) return (((float)nbt.getInteger("type")) + 1)/10; } return 0; } }); } @Override public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) { if(stack.getTagCompound() != null || !(stack.hasTagCompound())){ NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("coil", 3); nbt.setInteger("battery", 3); nbt.setInteger("rod", 3); nbt.setInteger("display", 3); nbt.setBoolean("found", false); nbt.setInteger("type", -1); nbt.setDouble("distance_squared", 0.0); nbt.setInteger("direction", 0); stack.setTagCompound(nbt); } super.onCreated(stack, worldIn, playerIn); } @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound nbt = stack.getTagCompound(); if (nbt != null){ nbt.setBoolean("found", false); stack.setTagCompound(nbt); } int x = 0; int y = 0; int z = 0; modifiers.clear(); if(nbt != null){ if(nbt.hasKey("coil") && nbt.hasKey("battery")){ int batteryMulti = 0; int coilMulti = 0; Utils.getLogger().info("Damage: " + stack.getItemDamage()); if (stack.getItemDamage() < 199500){ switch(nbt.getInteger("coil")){ case 1: generateScan(0, 1, 2); generateScan(-1, 1, 1); Scan(pos, worldIn, false, stack); coilMulti = 1; break; case 2: generateScan(0, 2, 3); generateScan(-1, 1, 2); generateScan(-2, 0, 0); Scan(pos, worldIn, false, stack); coilMulti = 2; break; case 3: generateScan(0, 3, 4); generateScan(-1, 2, 3); generateScan(-2, 1, 2); Scan(pos, worldIn, false, stack); coilMulti = 4; break; case 4: generateScan(2, 1, 2); generateScan(1, 2, 3); generateScan(0, 2, 3); generateScan(-1, 2, 3); generateScan(-2, 1, 2); Scan(pos, worldIn, false, stack); coilMulti = 5; break; case 5: generateScan(0, 2, 3); generateScan(-1, 1, 2); generateScan(-2, 0, 0); Scan(pos, worldIn, true, stack); coilMulti = 4; break; case 6: generateScan(0, 1, 2); generateScan(-1, 1, 2); generateScan(-2, 1, 2); generateScan(-3, 1, 1); generateScan(-4, 1, 1); generateScan(-5, 0, 0); Scan(pos, worldIn, false, stack); coilMulti = 4; break; } Utils.getLogger().info("Coil multi: " + coilMulti); switch(nbt.getInteger("battery")){ case 1: batteryMulti = 100; break; case 2: batteryMulti = 25; break; case 3: batteryMulti = 10; break; case 4: batteryMulti = 4; break; case 5: batteryMulti = 8; break; case 6: batteryMulti = 34; break; case 7: batteryMulti = 18; break; } Utils.getLogger().info("Battery multi: " + batteryMulti); Utils.getLogger().info("Total multi: " + batteryMulti * coilMulti); stack.damageItem(batteryMulti * coilMulti, player); } else { stack.damageItem(199999 - stack.getItemDamage(), player); } } } return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); } public void generateScan(int y, int radius, int max){ for(int x = 0 - radius; x <= radius; x++){ for(int z = 0 - radius; z <= radius; z++){ if(Math.abs(x) + Math.abs(z) <= max) modifiers.add(new BlockPos(x, y, z)); } } } public void Scan(BlockPos pos, World world, Boolean ultraSound, ItemStack stack){ NBTTagCompound nbt = stack.getTagCompound(); for (int i = 0; i < modifiers.size(); i++) { scanBlock = new BlockPos(pos.getX() + modifiers.get(i).getX(), pos.getY() + modifiers.get(i).getY(), pos.getZ() + modifiers.get(i).getZ()); if (world.getBlockState(scanBlock).getBlock().equals(ModBlocks.archeology_dirt)){ if(ultraSound && ArcheologyDirt.getIntFromState(world.getBlockState(scanBlock)) != 0 && ArcheologyDirt.getIntFromState(world.getBlockState(scanBlock)) != 14){ nbt.setBoolean("found", true); nbt.setDouble("distance_squared", scanBlock.distanceSqToCenter(pos.getX(), pos.getY(), pos.getZ())); nbt.setInteger("type", EnumHandler.Types.getTypeId(ArcheologyDirt.getTypeFromMeta(ArcheologyDirt.getIntFromState((world.getBlockState(scanBlock)))))); nbt.setInteger("direction", getDirection(modifiers.get(i))); stack.setTagCompound(nbt); } else if(ArcheologyDirt.getMetalFromMeta(ArcheologyDirt.getIntFromState(world.getBlockState(scanBlock)))){ nbt.setBoolean("found", true); nbt.setDouble("distance_squared", scanBlock.distanceSqToCenter(pos.getX(), pos.getY(), pos.getZ())); nbt.setInteger("type", EnumHandler.Types.getTypeId(ArcheologyDirt.getTypeFromMeta(ArcheologyDirt.getIntFromState((world.getBlockState(scanBlock)))))); nbt.setInteger("direction", getDirection(modifiers.get(i))); stack.setTagCompound(nbt); } } } } @Override public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null && !(nbt.hasNoTags())){ if (nbt.hasKey("coil")) tooltip.add("Coil: " + String.valueOf(nbt.getInteger("coil"))); else tooltip.add("Needs coil"); if (nbt.hasKey("battery")) tooltip.add("Battery: " + String.valueOf(nbt.getInteger("battery"))); else tooltip.add("Needs battery"); if (nbt.hasKey("display")) tooltip.add("Display: " + String.valueOf(nbt.getInteger("display"))); else tooltip.add("Needs display"); if (nbt.hasKey("rod")) tooltip.add("Rod: " + String.valueOf(nbt.getInteger("rod"))); else tooltip.add("Needs rod"); if (nbt.hasKey("found")) tooltip.add("Found something: " + String.valueOf(nbt.getBoolean("found"))); } super.addInformation(stack, playerIn, tooltip, advanced); } public int getDirection(BlockPos pos){ int x = pos.getX(); int z = pos.getZ(); if(x == 0){ if (z == 0) return 0; if (z > 0) return 1; if (z < 0); return 5; } float d = Math.abs((float)z)/((float)x); if (d > 2.4){ if (z > 0) return 1; return 5; } if (d < 0.4){ if (x > 0) return 3; return 7; } if (x > 0){ if (z > 0) return 2; return 4; } if (z > 0) return 8; return 6; } @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { if (oldStack.getItem().equals(newStack.getItem())){ //return false; } return super.shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } }
-
[1.11]More problems with custom item
stack.damageItem(batteryMulti * coilMulti, player); I'm using this to damage the item inside the onItemUse method, but it doesn't damage the item pls help
-
[1.11]More problems with custom item
how to apply the damage?
IPS spam blocked by CleanTalk.