Jump to content

[1.8.9] Bow Pull Back Help


Monstrous_Apple

Recommended Posts

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

Oh so I need to just move my json files to block states instead?

 

Either use a blockstates file (like your current

ModelResourceLocation

s point to) or change your

ModelResourceLocation

s to point to the existing item models.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

new ModelResourceLocation("<domain>:<path>", "<variant>")

produces a

ModelResourceLocation

in the format

<domain>:<path>#<variant>

.

 

For item variants, this

ModelResourceLocation

can either point to the item model assets/<domain>/models/item/<path>.json or the blockstates file assets/<domain>/blockstates/<path>.json.

<variant>

should be

inventory

for standard item models or the variant of the blockstates file to use the model of.

 

Your models are currently at

<modid>:IronBow#inventory

,

<modid>:IronBow_pulling_0#inventory

, etc.; but you're telling Minecraft to load and use

<modid>:<registryName>#IronBow

,

<modid>:<registryName>#IronBow_pulling_0

, etc. (Where

<modid>

is your mod ID and

<registryName>

is the registry name of

MAItems.IronBow

).

 

If you're using item models, each item variant should have a unique

<domain>

and

<path>

pointing to a model and have

<variant>

set to

inventory

. If you're using a blockstates file, each item variant should have the same

<domain>

and

<path>

pointing to the blockstates file and a unique

<variant>

.

 

Edit: Replace

ResourceLocation

-style file paths (in bold) with actual file paths.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I've edited my previous post to make the file paths more clear.

 

You can see how I register the item variants for my mod's bow here and here. These point to this blockstates file.

 

You can see the implementation of the

ItemModBow#getModelLocation

method and the override of

Item#getModel

here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks for all the help, and i did what you said but I got an error here:

String locationBow = MAItems.ObsidianBow.getModelLocation();

and here:

registerItemModel(MAItems.ObsidianBow, new ModelResourceLocation(locationBow, "standby"));

 

Also:

 

ClientProxy:

import com.MonstrousApple.mod.items.MAItems;
import com.MonstrousApple.mod.render.MABlockRender;
import com.MonstrousApple.mod.render.MAGemRender;
import com.MonstrousApple.mod.render.MAItemRender;
import com.MonstrousApple.mod.render.MAOreRender;

import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {

public void preInit(FMLPreInitializationEvent preEvent) {

	super.preInit(preEvent);
	ModelBakery.registerItemVariants(MAItems.ObsidianBow, new ModelResourceLocation(MAItems.ObsidianBow.getRegistryName(), "ObsidianBow"));

	ModelBakery.registerItemVariants(MAItems.ObsidianBow, new ModelResourceLocation(MAItems.ObsidianBow.getRegistryName(), "ObsidianBow_pulling_0"));
	ModelBakery.registerItemVariants(MAItems.ObsidianBow, new ModelResourceLocation(MAItems.ObsidianBow.getRegistryName(), "ObsidianBow_pulling_1"));
	ModelBakery.registerItemVariants(MAItems.ObsidianBow, new ModelResourceLocation(MAItems.ObsidianBow.getRegistryName(), "ObsidianBow_pulling_2"));
}


	private void registerItemModels() {
		String locationBow = MAItems.ObsidianBow.getModelLocation();
		for (int stage = 0; stage < 3; stage++) { // Add a variant for each stage's model
			ModelBakery.registerItemVariants(MAItems.ObsidianBow, new ModelResourceLocation(locationBow, "pulling_" + stage));

		}

		registerItemModel(MAItems.ObsidianBow, new ModelResourceLocation(locationBow, "standby"));


}

public void init(FMLInitializationEvent event) {

	super.init(event);

	MABlockRender.registerBlockRender();
	MAItemRender.registerItemRender();
	MAOreRender.registerOreRender();	
	MAGemRender.registerGemRender();
}

public void postInit(FMLPostInitializationEvent postEvent) {

	super.postInit(postEvent);

}

}

 

 

Blockstates: (What would I change "testmod3" to?

{
    "forge_marker": 1,
    "defaults": {
        "model": "testmod3:simple_model"
    },
    "variants": {
        "standby": [
            {
                "textures": {
                    "layer0": "items/bow_standby"
                }
            }
        ],
        "pulling_0": [
            {
                "textures": {
                    "layer0": "items/bow_pulling_0"
                }
            }
        ],
        "pulling_1": [
            {
                "textures": {
                    "layer0": "items/bow_pulling_1"
                }
            }
        ],
        "pulling_2": [
            {
                "textures": {
                    "layer0": "items/bow_pulling_2"
                }
            }
        ]
    }
}

 

 

Bow Class: (MAObsidianBow.java)

package com.MonstrousApple.mod.items.rangedweapons;

import com.MonstrousApple.mod.MACreativeTabRangingWeapons;
import com.MonstrousApple.mod.MAGlobal;
import com.MonstrousApple.mod.items.MAItems;

import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class MAObsidianBow extends Item {

public MAObsidianBow(String unlocalizedName) {
	this.setUnlocalizedName(unlocalizedName);
	this.setCreativeTab(MAGlobal.maCreativeTabRangingWeapons);

	//Maximum Amount In One Slot - Stack Size
	this.maxStackSize = 1;

	//Durability - How many uses
	this.setMaxDamage(2341);
}

/**
 * Get the location of the blockstates file used for this item's models
 *
 * @return The location
 */
public String getModelLocation() {
	return getRegistryName();
}

@SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
	if (player.isUsingItem()) {
		int useTime = stack.getMaxItemUseDuration() - useRemaining;

		if (useTime >= 18) {
			return new ModelResourceLocation(getModelLocation(), "pulling_2");
		} else if (useTime > 13) {
			return new ModelResourceLocation(getModelLocation(), "pulling_1");
		} else if (useTime > 0) {
			return new ModelResourceLocation(getModelLocation(), "pulling_0");
		}
	}

	return null;
}

//{
    //final String[] bowPullIconNameArray = new String[] {"bow_pulling_0", "bow_pulling_1", "bow_pulling_2"};

    //}

    /**
     * Called when the player stops using an Item (stops holding the right mouse button).
     */
    public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
    {
        boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;

        if (flag || playerIn.inventory.hasItem(MAItems.ObsidianArrow))
        {
            int i = this.getMaxItemUseDuration(stack) - timeLeft;
            net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i);
            if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
            i = event.charge;
            float f = (float)i / 20.0F;
            f = (f * f + f * 2.0F) / 3.0F;

            if ((double)f < 0.1D)
            {
                return;
            }

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F);

            if (f == 1.0F)
            {
                entityarrow.setIsCritical(true);
            }

            int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);

            if (j > 0)
            {
                entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D);
            }

            int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);

            if (k > 0)
            {
                entityarrow.setKnockbackStrength(k);
            }

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
            {
                entityarrow.setFire(100);
            }

            stack.damageItem(1, playerIn);
            worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F); //  /(itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

            if (flag)
            {
                entityarrow.canBePickedUp = 2;
            }
            else
            {
                playerIn.inventory.consumeInventoryItem(MAItems.ObsidianArrow);
            }

            //playerIn.triggerAchievement(StatList.objectUseStats[item.getIdFromItem(this)]);

            if (!worldIn.isRemote)
            {
                worldIn.spawnEntityInWorld(entityarrow);
            }
        }
    }

    /**
     * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
     * the Item before the action is complete.
     */
    public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
    {
        return stack;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack stack)
    {
        return 72000;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack stack)
    {
        return EnumAction.BOW;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
    {
        net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn);
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result;

        if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(MAItems.ObsidianArrow))
        {
            playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
        }

        return itemStackIn;
    }

    /**
     * Return the enchantability factor of the item, most of the time is based on material.
     */
    public int getItemEnchantability()
    {
        return 1;
    }
}

 

Link to comment
Share on other sites

You posted

ClientProxy

twice instead of posting

MAObsidianBow

.

 

"I got an error" is pretty vague, be more specific. I suspect the error is that you're trying to call methods that don't exist. The solution is to understand what my code is doing and implement it yourself instead of copy-pasting.

 

testmod3

is my mod's resource domain (lowercase mod ID). Replace it with your mod's resource domain.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Sorry my bad I changed it to MAObsidianBow now also I copied it in and am trying to understand it but I'm finding this part hard :/

 

Edit:

 

getModelLocation

and

registerItemModel

are to two parts I'm getting an error on, it's asking me to "Add cast to method receiver" for the first error and for the second it's asking me to "Create method 'registerItemModel(Item, ModelResourceLocation)' "

Link to comment
Share on other sites

Post the errors, not the suggested fixes.

 

There is no

registerItemModel

method because you haven't created one. Look at the class I linked to see what that method does.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Okay sorry and it didn't crash or anything even when shooting the bow, but I'll show you what the console said:

 

 

2016-05-12 18:38:25,841 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-05-12 18:38:25,842 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[18:38:25] [main/INFO] [GradleStart]: Extra: []

[18:38:25] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Reece/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken{REDACTED}, --version, 1.8.9, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

[18:38:25] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[18:38:25] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[18:38:25] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker

[18:38:25] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[18:38:25] [main/INFO] [FML]: Forge Mod Loader version 11.15.1.1722 for Minecraft 1.8.9 loading

[18:38:25] [main/INFO] [FML]: Java is Java HotSpot Client VM, version 1.8.0_91, running on Windows 10:x86:10.0, installed at C:\Program Files (x86)\Java\jre1.8.0_91

[18:38:25] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[18:38:26] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker

[18:38:26] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[18:38:26] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[18:38:26] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[18:38:26] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[18:38:26] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[18:38:26] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[18:38:26] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[18:38:26] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[18:38:26] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[18:38:27] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[18:38:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[18:38:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[18:38:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[18:38:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[18:38:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[18:38:27] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

2016-05-12 18:38:28,270 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-05-12 18:38:28,295 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-05-12 18:38:28,297 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[18:38:28] [Client thread/INFO]: Setting user: Player41

[18:38:32] [Client thread/INFO]: LWJGL Version: 2.9.4

[18:38:32] [Client thread/WARN] [FML]: =============================================================

[18:38:32] [Client thread/WARN] [FML]: MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!

[18:38:32] [Client thread/WARN] [FML]: Offendor: com/sun/jna/Native.main([Ljava/lang/String;)V

[18:38:32] [Client thread/WARN] [FML]: Use FMLCommonHandler.exitJava instead

[18:38:32] [Client thread/WARN] [FML]: =============================================================

[18:38:32] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:246]: ---- Minecraft Crash Report ----

// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]

 

Time: 12/05/16 18:38

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.8.9

Operating System: Windows 10 (x86) version 10.0

Java Version: 1.8.0_91, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 693869016 bytes (661 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML:

Loaded coremods (and transformers):

GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 353.82' Renderer: 'GeForce GT 640/PCIe/SSE2'

[18:38:33] [Client thread/INFO] [FML]: MinecraftForge v11.15.1.1722 Initialized

[18:38:33] [Client thread/INFO] [FML]: Replaced 204 ore recipies

[18:38:33] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer

[18:38:33] [Client thread/INFO] [FML]: Searching C:\Users\Reece\Desktop\Minecraft 1.8.9 Mod\1.8.9 Production\run\mods for mods

[18:38:34] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[18:38:34] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, ma] at CLIENT

[18:38:34] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, ma] at SERVER

[18:38:34] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Monstrous Apple's Mod

[18:38:34] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[18:38:34] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[18:38:34] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations

[18:38:34] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations

[18:38:35] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[18:38:35] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json

[18:38:35] [Client thread/INFO] [FML]: Applying holder lookups

[18:38:35] [Client thread/INFO] [FML]: Holder lookups applied

[18:38:35] [Client thread/INFO] [FML]: Injecting itemstacks

[18:38:35] [Client thread/INFO] [FML]: Itemstack injection complete

[18:38:35] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: UP_TO_DATE Target: null

[18:38:35] [Client thread/INFO] [sTDOUT]: [tv.twitch.StandardCoreAPI:<init>:16]: If on Windows, make sure to provide all of the necessary dll's as specified in the twitchsdk README. Also, make sure to set the PATH environment variable to point to the directory containing the dll's.

[18:38:35] [Client thread/ERROR]: Couldn't initialize twitch stream

[18:38:35] [sound Library Loader/INFO]: Starting up SoundSystem...

[18:38:35] [Thread-9/INFO]: Initializing LWJGL OpenAL

[18:38:35] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[18:38:35] [Thread-9/INFO]: OpenAL initialized.

[18:38:35] [sound Library Loader/INFO]: Sound engine started

[18:38:41] [Client thread/INFO] [FML]: Max texture size: 16384

[18:38:41] [Client thread/INFO]: Created: 16x16 textures-atlas

[18:38:41] [Client thread/ERROR] [FML]: Exception loading model for variant ma:NetherArrow#inventory

java.lang.Exception: Could not load model definition for variant ma:NetherArrow#inventory

at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:219) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItems(ModelLoader.java:256) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:120) ~[ModelLoader.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:120) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:515) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:360) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model ma:blockstates/NetherArrow.json

at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:165) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?]

... 19 more

Caused by: java.io.FileNotFoundException: ma:blockstates/NetherArrow.json

at net.minecraft.client.resources.FallbackResourceManager.getAllResources(FallbackResourceManager.java:93) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:78) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:143) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?]

... 19 more

[18:38:41] [Client thread/ERROR] [FML]: Model definition for location ma:CherryPlant#inventory not found

[18:38:41] [Client thread/ERROR] [FML]: Model definition for location ma:NetherArrow#inventory not found

[18:38:41] [Client thread/ERROR] [FML]: Model definition for location ma:BananaPlant#inventory not found

[18:38:42] [Client thread/INFO] [FML]: Injecting itemstacks

[18:38:42] [Client thread/INFO] [FML]: Itemstack injection complete

[18:38:42] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[18:38:42] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Monstrous Apple's Mod

[18:38:42] [Client thread/INFO]: SoundSystem shutting down...

[18:38:42] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[18:38:42] [sound Library Loader/INFO]: Starting up SoundSystem...

[18:38:42] [Thread-11/INFO]: Initializing LWJGL OpenAL

[18:38:42] [Thread-11/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[18:38:42] [Thread-11/INFO]: OpenAL initialized.

[18:38:43] [sound Library Loader/INFO]: Sound engine started

[18:38:48] [Client thread/INFO] [FML]: Max texture size: 16384

[18:38:48] [Client thread/INFO]: Created: 512x512 textures-atlas

[18:38:49] [Client thread/ERROR] [FML]: Exception loading model for variant ma:NetherArrow#inventory

java.lang.Exception: Could not load model definition for variant ma:NetherArrow#inventory

at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:219) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItems(ModelLoader.java:256) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:120) ~[ModelLoader.class:?]

at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:130) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:111) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:772) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:326) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:532) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:360) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model ma:blockstates/NetherArrow.json

at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:165) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?]

... 22 more

Caused by: java.io.FileNotFoundException: ma:blockstates/NetherArrow.json

at net.minecraft.client.resources.FallbackResourceManager.getAllResources(FallbackResourceManager.java:93) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:78) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:143) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?]

... 22 more

[18:38:49] [Client thread/ERROR] [FML]: Model definition for location ma:CherryPlant#inventory not found

[18:38:49] [Client thread/ERROR] [FML]: Model definition for location ma:NetherArrow#inventory not found

[18:38:49] [Client thread/ERROR] [FML]: Model definition for location ma:BananaPlant#inventory not found

[18:38:49] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[18:38:51] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[18:38:53] [server thread/INFO]: Starting integrated minecraft server version 1.8.9

[18:38:53] [server thread/INFO]: Generating keypair

[18:38:53] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[18:38:53] [server thread/INFO] [FML]: Applying holder lookups

[18:38:53] [server thread/INFO] [FML]: Holder lookups applied

[18:38:53] [server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@d7e8b1)

[18:38:53] [server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@d7e8b1)

[18:38:53] [server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@d7e8b1)

[18:38:53] [server thread/INFO]: Preparing start region for level 0

[18:38:54] [server thread/INFO]: Preparing spawn area: 90%

[18:38:55] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[18:38:55] [server thread/INFO]: Changing view distance to 7, from 10

[18:38:55] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2

[18:38:55] [Netty Server IO #1/INFO] [FML]: Client protocol version 2

[18:38:55] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : [email protected],ma@Version 0.1 (1.8.9),[email protected],[email protected]

[18:38:55] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established

[18:38:55] [server thread/INFO] [FML]: [server thread] Server side modded connection established

[18:38:55] [server thread/INFO]: Player41[local:E:9a28f961] logged in with entity id 446 at (208.81875703699941, 67.0, 261.5446121834142)

[18:38:55] [server thread/INFO]: Player41 joined the game

[18:38:56] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@1bbab7d[id=1d49d7a1-2179-35b6-bce8-e6b16ddd4f41,name=Player41,properties={},legacy=false]

com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time

at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:65) ~[YggdrasilAuthenticationService.class:?]

at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:175) [YggdrasilMinecraftSessionService.class:?]

at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:59) [YggdrasilMinecraftSessionService$1.class:?]

at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:56) [YggdrasilMinecraftSessionService$1.class:?]

at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?]

at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?]

at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:165) [YggdrasilMinecraftSessionService.class:?]

at net.minecraft.client.Minecraft.func_181037_M(Minecraft.java:2915) [Minecraft.class:?]

at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:130) [skinManager$3.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_91]

at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_91]

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_91]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_91]

at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]

[18:39:06] [server thread/INFO]: Player41 has just earned the achievement [Taking Inventory]

[18:39:06] [Client thread/INFO]: [CHAT] Player41 has just earned the achievement [Taking Inventory]

[18:39:22] [server thread/INFO]: Saving and pausing game...

[18:39:22] [server thread/INFO]: Saving chunks for level 'New World'/Overworld

[18:39:22] [server thread/INFO]: Saving chunks for level 'New World'/Nether

[18:39:22] [server thread/INFO]: Saving chunks for level 'New World'/The End

[18:39:23] [server thread/INFO]: Stopping server

[18:39:23] [server thread/INFO]: Saving players

[18:39:23] [server thread/INFO]: Saving worlds

[18:39:23] [server thread/INFO]: Saving chunks for level 'New World'/Overworld

[18:39:23] [server thread/INFO]: Saving chunks for level 'New World'/Nether

[18:39:23] [server thread/INFO]: Saving chunks for level 'New World'/The End

[18:39:24] [server thread/INFO] [FML]: Unloading dimension 0

[18:39:24] [server thread/INFO] [FML]: Unloading dimension -1

[18:39:24] [server thread/INFO] [FML]: Unloading dimension 1

[18:39:24] [server thread/INFO] [FML]: Applying holder lookups

[18:39:24] [server thread/INFO] [FML]: Holder lookups applied

[18:39:24] [Client thread/INFO]: Stopping!

[18:39:24] [Client thread/INFO]: SoundSystem shutting down...

[18:39:25] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[18:39:25] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

Java HotSpot Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

 

Also when hovering over the errors in eclipse it says for the first error: "The method getModelLocation() is underfined for the type Item" and for the second "The method registerItemModel(Item, ResourceLocation) is undefined for the type ClientProxy"

Link to comment
Share on other sites

"The method getModelLocation() is underfined for the type Item"

MAItems.ObsidianBow

is a field of type

Item

, which doesn't have a

getModelLocation

method. Even though it currently contains an instance of

MAObsidianBow

(which does have that method), you haven't guaranteed that. It could contain an instance of

Item

or any subclass, so Java only lets you use methods that exist in the

Item

class.

 

Either change the type of the field or cast the field's value before calling the method.

 

"The method registerItemModel(Item, ResourceLocation) is undefined for the type ClientProxy"

Create the method as I described in my previous post.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

For the first part can you give me a bit more detail like a example or something? I'm not good at this sorry and for the second part is this what's needed?:

 

private void registerItemModel(Item item, ModelResourceLocation modelResourceLocation) {

	}

 

If it is what do I put inside it and if not then I'm clueless again, sorry.

Link to comment
Share on other sites

For the first part can you give me a bit more detail like a example or something? I'm not good at this sorry

Change the type of the

MAItems.ObsidianBow

field from

Item

to

MAObsidianBow

.

 

 

and for the second part is this what's needed?:

 

private void registerItemModel(Item item, ModelResourceLocation modelResourceLocation) {

	}

 

If it is what do I put inside it and if not then I'm clueless again, sorry.

That's the right method signature, yes.

 

Inside the method, you need to register the model using either

ModelLoader.setCustomModelResourceLocation

(with metadata 0 since the item is damageable) or

ModelLoader.setCustomMeshDefinition

(with an

ItemMeshDefinition

that always returns the same

ModelResourceLocation

).

 

Look at the code I linked in my previous post to see my implementation.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Why take an

Item

argument if you're going to completely ignore it and hardcode the

Item

argument of

ModelLoader.setCustomModelResourceLocation

?

 

I already told you how

ModelResourceLocation

s are translated into model paths. I suggest you re-read that post and try to figure it out yourself.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Is any of these correct for the "model" part?

 

private void registerItemModel(Item item, ModelResourceLocation modelResourceLocation) {
	ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, modelResourceLocation = assets.ma.models/item/ObsidianBow_pulling_0.json);

	}

 

or:

 

private void registerItemModel(Item item, ModelResourceLocation modelResourceLocation) {
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, Model == assets.ma.models/item/ObsidianBow_pulling_0.json);
	}

Link to comment
Share on other sites

Neither of those are even valid Java. You seem to be struggling with basic concepts like creating objects and passing arguments to methods.

 

Again you're ignoring the arguments passed to the method and hardcoding the arguments of

ModelLoader.setCustomModelResourceLocation

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

registerItemModel

should pass its arguments directly to

ModelLoader.setCustomModelResourceLocation

. Call

registerItemModel

with the item and model location for each item.

 

To use the assets/ma/models/item/ObsidianBow_pulling_0.json model, pass

new ModelResourceLocation("ma:ObsidianBow_pulling_0", "inventory")

as the second argument of

registerItemModel

. I explained the mapping between

ModelResourceLocation

s and model files in my previous post.

 

You need to have a solid understanding of Java and OO programming in general before you can make a mod.

 

Edit: The first paragraph is about

registerItemModel

not

MAItems.ObsidianBow

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Sorry I plan to learn Java full on soon it's just I started modding with different tutorials and got far into my mod and when I got around to making bows I was completely stuck on rendering though I managed to figure out how to get my bow to shoot properly after a while xD

 

But yeah I have this now and there's no errors on this part:

private void registerItemModel(Item item, ModelResourceLocation modelResourceLocation) {
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_standby", "inventory"));
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_pulling_0", "inventory"));
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_pulling_1", "inventory"));
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_pulling_2", "inventory"));
	}

 

 

However I still have the first error:

 

String locationBow = MAItems.ObsidianBow.getModelLocation();

on this part

getModelLocation

 

It's the one saying "The method getModelLocation() is undefined for the type Item"

Link to comment
Share on other sites

But yeah I have this now and there's no errors on this part:

private void registerItemModel(Item item, ModelResourceLocation modelResourceLocation) {
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_standby", "inventory"));
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_pulling_0", "inventory"));
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_pulling_1", "inventory"));
		ModelLoader.setCustomModelResourceLocation(MAItems.ObsidianBow, 0, new ModelResourceLocation("ma:ObsidianBow_pulling_2", "inventory"));
	}

 

I made a mistake in the first paragraph of post #69, I suggest re-reading the post now that I've corrected it.

 

Each call to

ModelLoader.setCustomModelResourceLocation

with the same

Item

and metadata is overwriting the previous

ModelResouceLocation

. You only need to call this method for the standby model, the pulling models are handled through

Item#getModel

.

 

However I still have the first error:

 

String locationBow = MAItems.ObsidianBow.getModelLocation();

on this part

getModelLocation

 

It's the one saying "The method getModelLocation() is undefined for the type Item"

I explained this in post #60.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




×
×
  • Create New...

Important Information

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