[Tutorial] How to animate custom bow pulling (for 1.16)!

Started by Sajevius on

Topic category: User side tutorials

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] How to animate custom bow pulling (for 1.16)!
Sun, 05/30/2021 - 11:47 (edited)

Custom bow pulling animations. Until now, they still aren't in MCreator. But just because MCreator's generator doesn't support them yet doesn't mean they're entirely impossible to make, coz this possibility can actually be unlocked through code. 

This tutorial is meant to be an extension of a tutorial made by our favorite fox XD TheLuxureSlime on how to do the same thing for 1.15 and below; however, this one’s for Forge 1.16 as said in the title. So if you're only interested in animating bows for 1.15 & below, make sure to check the mentioned tutorial instead (huge thanks to it for required JSON code that we'll be talking about!) There’s a handful of code involved now that we're modding 1.16, so this is going to be harder than how it used to be in prior versions. But hopefully, you can follow along and be able to successfully animate your bow!


PREPARATIONS:

  • Mod workspace for Forge 1.16.5
  • Bow mod element that uses any ammo
  • JSON knowledge, more specifically for item models
  • Java knowledge
  • 3 pulling textures for your bow (1st stage, 2nd stage, 3rd stage)
    • 1st stage example: "example_bow_pulling_0"
    • 2nd stage example: "example_bow_pulling_1"
    • 3rd stage example: "example_bow_pulling_2"
  • Memorization of the following:
    • your mod ID
    • your bow item class name

ADVANTAGES:

  • Bow pulling will now be animated, making it look better
  • Players can no longer spam right-click to use your bows instantly

DISADVANTAGES:

  • Slightly harder than on previous MC versions
  • Still plays the animation even if the bow is out of ammo for some weird reason (even if the pull isn't animated, MCreator ranged items still play their respective animation somehow when used without ammo, which is weird...)

STEP 1 of 3: Editing JSON Item Model

Make sure that you've already imported the 3 pulling textures for your bow. Remember what you named each of them, because you'll be referring to each one in the JSON code! 

Go to your mod's workspace folder, either through clicking "Workspace -> Open Workspace Folder" or browsing it yourself via your file explorer. In the folder, navigate to src/main/resources/assets/mod_id/models/item. You should see the JSON file of your bow there.

  • Example: example_bow.json

Duplicate the file and rename the duplicated file to something that has "pulling_0".

  • Example: example_bow_pulling_0.json

Open that file, and replace everything with these lines:

{
    "parent": "item/bow",
    "textures": 
    {
        "layer0": "mod_id:items/example_bow_pulling_0"
    }
}

Remember to always replace "example_bow_pulling" with the appropriate texture name of the pulling bow! For example, if your bow's "pulling_0" texture is named "cool_bow_pulling_0", then make sure that it should be exactly like that. Also replace "mod_id" with the appropriate mod ID that you specified when creating your workspace (you can always check workspace settings to view your mod ID.) And then save it! 

Keep the "pulling_0" file open, then replace "pulling_0" with "pulling_1" 

  • Example: from "example_bow_pulling_0" to "example_bow_pulling_1"

and save the file as "example_bow_pulling_1.json".

Lastly, change it to "pulling_2"

  • Example: from "example_bow_pulling_1" to "example_bow_pulling_2"

And save it as "example_bow_pulling_2", then close your text/code editor.

Go back to MCreator and lock the code of your bow. Then double-click it; you should see three file options pop out.
Choose the last option which ends with ".json". Once you open yours, you should see something that looks similar to this:
 

{
  "parent": "item/generated",
  "textures": {
    "layer0": "mod_id:items/example_bow"
  },
  "display": {
    "thirdperson_righthand": {
      "rotation": [
        -80,
        260,
        -40
      ],
      "translation": [
        -1,
        -2,
        2.5
      ],
      "scale": [
        1,
        1,
        1
      ]
    },
    "thirdperson_lefthand": {
      "rotation": [
        -80,
        -280,
        40
      ],
      "translation": [
        -1,
        -2,
        2.5
      ],
      "scale": [
        1,
        1,
        1
      ]
    },
    "firstperson_righthand": {
      "rotation": [
        0,
        -90,
        25
      ],
      "translation": [
        1.13,
        3.2,
        1.13
      ],
      "scale": [
        1,
        1,
        1
      ]
    },
    "firstperson_lefthand": {
      "rotation": [
        0,
        90,
        -25
      ],
      "translation": [
        1.13,
        3.2,
        1.13
      ],
      "scale": [
        1,
        1,
        1
      ]
    }
  }
}

Find the second to the last closed curly bracket '}' in there, which is near the end of the file, then add these lines:

,
  "overrides": [
    {
      "predicate": {
        "pulling": 1
      },
      "model": "mod_id:item/example_bow_pulling_0"
    },
    {
      "predicate": {
        "pulling": 1,
        "pull": 0.65
      },
      "model": "mod_id:item/example_bow_pulling_1"
    },
    {
      "predicate": {
        "pulling": 1,
        "pull": 0.9
      },
      "model": "mod_id:item/example_bow_pulling_2"
    }
  ]

Final result should look like this:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "mod_id:items/example_bow"
  },
  "display": {
    "thirdperson_righthand": {
      "rotation": [
        -80,
        260,
        -40
      ],
      "translation": [
        -1,
        -2,
        2.5
      ],
      "scale": [
        1,
        1,
        1
      ]
    },
    "thirdperson_lefthand": {
      "rotation": [
        -80,
        -280,
        40
      ],
      "translation": [
        -1,
        -2,
        2.5
      ],
      "scale": [
        1,
        1,
        1
      ]
    },
    "firstperson_righthand": {
      "rotation": [
        0,
        -90,
        25
      ],
      "translation": [
        1.13,
        3.2,
        1.13
      ],
      "scale": [
        1,
        1,
        1
      ]
    },
    "firstperson_lefthand": {
      "rotation": [
        0,
        90,
        -25
      ],
      "translation": [
        1.13,
        3.2,
        1.13
      ],
      "scale": [
        1,
        1,
        1
      ]
    }
  },
  "overrides": [
    {
      "predicate": {
        "pulling": 1
      },
      "model": "mod_id:item/example_bow_pulling_0"
    },
    {
      "predicate": {
        "pulling": 1,
        "pull": 0.65
      },
      "model": "mod_id:item/example_bow_pulling_1"
    },
    {
      "predicate": {
        "pulling": 1,
        "pull": 0.9
      },
      "model": "mod_id:item/example_bow_pulling_2"
    }
  ]
}

Then save and close it! That makes us done with step 1!

 

STEP 2 of 3: Modifying Bow Code

Remember how we locked the bow's code in the previous step? This time, go to the bow item's Java class. Again, double-click bow element, but select the first option, which you'll know because it has ".java" as a file extension.

  • Example: ExampleBowItem.java

First things first, look for this line:

public static class ItemRanged extends Item {

We don't want our bow to simply extend the Item class, because bows use a special method called getArrowVelocity() that's exclusive to them; it isn't available for a normal item, which is what MCreator's default ranged weapons extend from, so if we use that method when our bow extends Item, there will be errors. So let's change it to extend BowItem instead by replacing Item with BowItem (such that the code looks exactly like this):

public static class ItemRanged extends BowItem {

The following are the last things to modify about the bow. So search for this line:

@Override
public void onPlayerStoppedUsing(ItemStack itemstack, World world, LivingEntity entityLiving, int timeLeft) {

Under that are the checks and methods that determine the result after the player stops using the item (when player lets go of the right mouse button.) 

Let's assume that you made a bow which uses arrow as ammo. In that case, its code usually looks like this:

@Override
		public void onPlayerStoppedUsing(ItemStack itemstack, World world, LivingEntity entityLiving, int timeLeft) {
			if (!world.isRemote && entityLiving instanceof ServerPlayerEntity) {
				ServerPlayerEntity entity = (ServerPlayerEntity) entityLiving;
				double x = entity.getPosX();
				double y = entity.getPosY();
				double z = entity.getPosZ();
				if (true) {
					ItemStack stack = ShootableItem.getHeldAmmo(entity, e -> e.getItem() == new ItemStack(Items.ARROW, (int) (1)).getItem());
					if (stack == ItemStack.EMPTY) {
						for (int i = 0; i < entity.inventory.mainInventory.size(); i++) {
							ItemStack teststack = entity.inventory.mainInventory.get(i);
							if (teststack != null && teststack.getItem() == new ItemStack(Items.ARROW, (int) (1)).getItem()) {
								stack = teststack;
								break;
							}
						}
					}
					if (entity.abilities.isCreativeMode || stack != ItemStack.EMPTY) {
						ArrowCustomEntity entityarrow = shoot(world, entity, random, 1f, 4, 0);
						itemstack.damageItem(1, entity, e -> e.sendBreakAnimation(entity.getActiveHand()));
						if (entity.abilities.isCreativeMode) {
							entityarrow.pickupStatus = AbstractArrowEntity.PickupStatus.CREATIVE_ONLY;
						} else {
							if (new ItemStack(Items.ARROW, (int) (1)).isDamageable()) {
								if (stack.attemptDamageItem(1, random, entity)) {
									stack.shrink(1);
									stack.setDamage(0);
									if (stack.isEmpty())
										entity.inventory.deleteStack(stack);
								}
							} else {
								stack.shrink(1);
								if (stack.isEmpty())
									entity.inventory.deleteStack(stack);
							}
						}
					}
				}
			}
		}

This is not very organized and is also missing a few lines of code that react to the player pulling the bow, so we don't want to stay with this.
Instead, let's change it to:

@Override
		public void onPlayerStoppedUsing(ItemStack itemstack, World world, LivingEntity entityLiving, int timeLeft) {
			if (!world.isRemote && entityLiving instanceof ServerPlayerEntity) {
				ServerPlayerEntity entity = (ServerPlayerEntity) entityLiving;
				double x = entity.getPosX();
				double y = entity.getPosY();
				double z = entity.getPosZ();
				boolean flag = entity.abilities.isCreativeMode;
				ItemStack stack = ShootableItem.getHeldAmmo(entity, e -> e.getItem() == new ItemStack(Items.ARROW, (int) (1)).getItem());
				int h = this.getUseDuration(itemstack) - timeLeft;
				h = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(itemstack, world, entity, h, flag || stack != ItemStack.EMPTY);
				if (h < 0)
					return;
				if (stack == ItemStack.EMPTY) {
					for (int i = 0; i < entity.inventory.mainInventory.size(); i++) {
						ItemStack teststack = entity.inventory.mainInventory.get(i);
						if (teststack != null && teststack.getItem() == new ItemStack(Items.ARROW, (int) (1)).getItem()) {
							stack = teststack;
							break;
						}
					}
				}
				if (flag || stack != ItemStack.EMPTY) {
					float j = getArrowVelocity(h);
					if (!((double) j < 0.1D)) {
						ArrowCustomEntity entityarrow = shoot(world, entity, random, 1f, 4, 0);
						itemstack.damageItem(1, entity, e -> e.sendBreakAnimation(entity.getActiveHand()));
						if (entity.abilities.isCreativeMode) {
							entityarrow.pickupStatus = AbstractArrowEntity.PickupStatus.CREATIVE_ONLY;
						} else {
							if (new ItemStack(Items.ARROW, (int) (1)).isDamageable()) {
								if (stack.attemptDamageItem(1, random, entity)) {
									stack.shrink(1);
									stack.setDamage(0);
									if (stack.isEmpty())
										entity.inventory.deleteStack(stack);
								}
							} else {
								stack.shrink(1);
								if (stack.isEmpty())
									entity.inventory.deleteStack(stack);
							}
						}
					}
				}
			}
		}

EXPLANATION:

  • boolean flag = entity.abilities.isCreativeMode - this variable is either true or false, depending on the player's current gamemode. if player is in creative mode, this equals to true; otherwise, this equals to false in other gamemodes.
  • int h = this.getUseDuration(itemstack) - timeLeft - this variable is used to store the charge/pull of the bow, which is an integer (whole number).
  • h = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(itemstack, world, entity, h, flag || stack != ItemStack.EMPTY) - here, we are copying the value of the bow's charge to the variable "h".
  • float j = getArrowVelocity(h) - this variable is equal to the velocity of the arrow, which is determined by "h" or the bow's charge.
  • if (!((double) j < 0.1D)) - this checks if the variable "j" is not less than 0.1. If yes, it continues executing code; otherwise, if it's less than 0.1, the bow won't shoot the arrow. What's good about this is that it actually prevents the player from spamming right-click to instantly shoot!

Finally, use Ctrl + W, which most likely fixes the entire code by organizing it and adding required imports.

(If you're curious, the only additional import we need is:)

import net.minecraft.item.BowItem;

Everything good? No build errors? Then let's proceed to the 3rd and final step! :D

(If there were errors, feel free to consult me!)

 

STEP 3 of 3: Creating Mod Client Setup

This is the final step before going in-game to test if everything works. This is mandatory, as the animation technically won't exist without this, so take note!

Click the plus icon and create a new custom element. Let's use this format for naming the custom element:

Mod name (without spaces) + "Client"

  • Example: ExampleModClient.java

Erase everything in there, as we don't need them. Instead, code the following:

package net.mcreator.example_mod;

import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.util.ResourceLocation;
import net.minecraft.item.ItemModelsProperties;

import net.mcreator.example_mod.item.ExampleBowItem;

@Mod.EventBusSubscriber(modid = "example_mod", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ExampleModClient {
	@SubscribeEvent
	public static void setModelProperties(FMLClientSetupEvent event) {
		ItemModelsProperties.registerProperty((ExampleBowItem.block), new ResourceLocation("pull"), (itemstack, world, entity) -> {
			if (entity == null) {
				return 0.0F;
			} else {
				return entity.getActiveItemStack() != itemstack ? 0.0F : (float) (itemstack.getUseDuration() - entity.getItemInUseCount()) / 20.0F;
			}
		});
		ItemModelsProperties.registerProperty((ExampleBowItem.block), new ResourceLocation("pulling"),
				(itemstack, world, entity) -> entity != null && entity.isHandActive() && entity.getActiveItemStack() == itemstack ? 1.0F : 0.0F);
	}
}

EXPLANATION:

  • ItemModelsProperties.registerProperty((ExampleBowItem.block), new ResourceLocation("pull"), (itemstack, world, entity) -> {//code here})}  - This is a lambda expression that takes the custom bow you specified (example here: ExampleBowItem.block) and registers a property for it by creating a new ResourceLocation with the name pull, which value is equal to the bow's charge/pull amount. Then, (itemstack, world, entity) are the three parameters used for the bow, the "->" arrow is the lambda operator, and the rest under it is the body that's necessary for determining the value of that property. 
  • ItemModelsProperties.registerProperty((ExampleBowItem.block), new ResourceLocation("pulling"), (itemstack, world, entity) -> // code here - This one, unlike the previous, registers a property with the name pulling, which is different because this acts like true/false, depending on whether the player is pulling the bow or not.

Here's a sample workspace to finish off & show the nitty-gritty parts of this tutorial!

And that's it for this one. I'm proud of you for making it this far!

If there were any errors, please let me know! This tutorial is open to changes in case I accidentally wrote bad code/forgot to include something... because I openly admit: even if this tutorial works, I still kinda suck at coding, coz maybe I miss including some things or perhaps write code that isn't very efficient. So feedback from someone with decent Java knowledge would be very much appreciated to avoid potential bad coding practices in the future, if any!


Special thanks to:

  • TheLuxureSlime, for the original tutorial which is for Forge 1.15 ( you're a legend :D )
  • akisephila, for inspiring me to find a solution for 1.16, the version most people are modding right now
  • Frostygames0, for making me aware that 1.16 property overrides are registered in client setup event, which helped complete this tutorial
  • Gobber (mod by kwpugh) source code, for greatly inspiring the code in the client setup event class we made
Edited by Sajevius on Sun, 05/30/2021 - 11:47
Last seen on 14:30, 11. Feb 2024
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I solve it? …
Thu, 10/07/2021 - 19:14

How can I solve it?

 
Executing Gradle task: build 
Build info: MCreator 2021.2.35315, forge-1.16.5, 64-bit, 7110 MB, Windows 8.1, JVM 11.0.11, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk 
> Task :compileJava 
C:\Users\Usuario\Desktop\ carpeta)\ carpeta \ carpeta \MCreatorWorkspaces\meteors\src\main\java\net\mcreator\meteors\ArcoDeMeteoritoFuegoModClient.java:11: error: package com.mcreator.simples_meteorites.item does not exist 
import com.mcreator.simples_meteorites.item.ArcoDeMeteoritoDeFuegoItem; 
                                           ^ 
C:\Users\Usuario\Desktop\ carpeta \ carpeta \carpeta \MCreatorWorkspaces\meteors\src\main\java\net\mcreator\meteors\ArcoDeMeteoritoFuegoModClient.java:19: error: cannot find symbol 
      ItemModelsProperties.registerProperty((ArcoDeMeteoritoDeFuegoItem.block), new ResourceLocation("pull"), (itemstack, world, entity) -> { 
                                             ^ 
  symbol:   variable ArcoDeMeteoritoDeFuegoItem 
  location: class com.mcreator.simples_meteorites.ArcoDeMeteoritoFuegoModClient 
C:\Users\Usuario\Desktop\ carpeta\ carpeta \ carpeta \MCreatorWorkspaces\meteors\src\main\java\net\mcreator\meteors\ArcoDeMeteoritoFuegoModClient.java:19: error: illegal start of type 
      ItemModelsProperties.registerProperty((ArcoDeMeteoritoDeFuegoItem.block), new ResourceLocation("pull"), (itemstack, world, entity) -> { 
                                            ^ 
C:\Users\Usuario\Desktop\carpeta \ carpeta\carpeta \MCreatorWorkspaces\meteors\src\main\java\net\mcreator\meteors\ArcoDeMeteoritoFuegoModClient.java:26: error: cannot find symbol 
      ItemModelsProperties.registerProperty((ArcoDeMeteoritoDeFuegoItem.block), new ResourceLocation("pulling"), 
                                             ^ 
  symbol:   variable ArcoDeMeteoritoDeFuegoItem 
  location: class com.mcreator.simples_meteorites.ArcoDeMeteoritoFuegoModClient 
C:\Users\Usuario\Desktop\carpeta \carpeta\ carpeta \MCreatorWorkspaces\meteors\src\main\java\net\mcreator\meteors\ArcoDeMeteoritoFuegoModClient.java:26: error: illegal start of type 
      ItemModelsProperties.registerProperty((ArcoDeMeteoritoDeFuegoItem.block), new ResourceLocation("pulling"), 
                                            ^ 
5 errors 
> Task :compileJava FAILED 
FAILURE: Build failed with an exception. 
* What went wrong: 
Execution failed for task ':compileJava'. 
> Compilation failed; see the compiler error output for details. 
* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. 
* Get more help at https://help.gradle.org 
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. 
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. 
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings 
BUILD FAILED in 8s 
1 actionable task: 1 executed 
BUILD FAILED

And also someone would help me, have I done this well? I think this is the problem, but I don't know how to solve it? help

package com.mcreator.simples_meteorites;

import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.util.ResourceLocation;
import net.minecraft.item.ItemModelsProperties;

import com.mcreator.simples_meteorites.item.ArcoDeMeteoritoDeFuegoItem;

@Mod.EventBusSubscriber(modid = "simples_meteorites", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ArcoDeMeteoritoFuegoModClient {
	@SubscribeEvent
	public static void setModelProperties(FMLClientSetupEvent event) {
		// set the properties of all necessary item models (i.e. bows and crossbows)
		// here
		ItemModelsProperties.registerProperty((ArcoDeMeteoritoDeFuegoItem.block), new ResourceLocation("pull"), (itemstack, world, entity) -> {
			if (entity == null) {
				return 0.0F;
			} else {
				return entity.getActiveItemStack() != itemstack ? 0.0F : (float) (itemstack.getUseDuration() - entity.getItemInUseCount()) / 20.0F;
			}
		});
		ItemModelsProperties.registerProperty((ArcoDeMeteoritoDeFuegoItem.block), new ResourceLocation("pulling"),
				(itemstack, world, entity) -> entity != null && entity.isHandActive() && entity.getActiveItemStack() == itemstack ? 1.0F : 0.0F);
	}
}

 

Last seen on 23:57, 8. Dec 2021
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have no clue what I've…
Fri, 10/15/2021 - 18:59

I have no clue what I've done wrong here :/


Executing Gradle task: runClient 
Build info: MCreator 2021.2.36710, forge-1.16.5, 64-bit, 16310 MB, Windows 10, JVM 11.0.11, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk 
> Task :compileJava FAILED 
C:\Users\IE\MCreatorWorkspaces\jadescoria\src\main\java\net\mcreator\jadescoria\JadescoriaClient.java:13: error: cannot find symbol 
@Mod.EventBusSubscriber(jadescoria = "Jadescoria", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) 
                                     ^ 
  symbol:   method jadescoria() 
  location: @interface net.minecraftforge.fml.common.Mod.EventBusSubscriber 
C:\Users\IE\MCreatorWorkspaces\jadescoria\src\main\java\net\mcreator\jadescoria\item\PhantomBowItem.java:45: error: cannot find symbol 
   public static final EntityType arrow = (EntityType.Builder.<ArrowCustomEntity>create(ArrowCustomEntity::new, EntityClassification.MISC) 
                                                               ^ 
  symbol:   class ArrowCustomEntity 
  location: class net.mcreator.jadescoria.item.PhantomBowItem 
C:\Users\IE\MCreatorWorkspaces\jadescoria\src\main\java\net\mcreator\jadescoria\item\PhantomBowItem.java:45: error: cannot find symbol 
   public static final EntityType arrow = (EntityType.Builder.<ArrowCustomEntity>create(ArrowCustomEntity::new, EntityClassification.MISC) 
                                                                                        ^ 
  symbol:   class ArrowCustomEntity 
  location: class net.mcreator.jadescoria.item.PhantomBowItem 
C:\Users\IE\MCreatorWorkspaces\jadescoria\src\main\java\net\mcreator\jadescoria\item\PhantomBowItem.java:46: error: cannot find symbol 
         .setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(ArrowCustomEntity::new) 
                                                                                                                 ^ 
  symbol:   class ArrowCustomEntity 
  location: class net.mcreator.jadescoria.item.PhantomBowItem 
4 errors 
FAILURE: Build failed with an exception. 
* What went wrong: 
Execution failed for task ':compileJava'. 
> Compilation failed; see the compiler error output for details. 
* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. 
* Get more help at https://help.gradle.org 
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. 
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. 
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings 
BUILD FAILED in 2s 
1 actionable task: 1 executed 
BUILD FAILED 
Task completed in 3 seconds

 

Last seen on 17:55, 19. Nov 2021
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I followed the tutorial, and…
Thu, 11/11/2021 - 23:48

I followed the tutorial, and it dind't worked,the log says this:

Executing Gradle task: runClient
Build info: MCreator 2021.2.36710, forge-1.16.5, 64-bit, 8127 MB, Windows 10, JVM 11.0.11, JAVA_HOME: D:\Program Files (x86)\MCreator\jdk
> Task :compileJava FAILED
D:\Documentos\mymods\src\main\java\net\mcreator\projetolk\item\CrystalExterminatorItem.java:48: error: invalid method declaration; return type required public CrystalExterminatorItem(ProjetolkModElements instance) {
^
D:\Documentos\mymods\src\main\java\net\mcreator\projetolk\item\CrystalExterminatorItem.java:204: error: reached end of file while parsing }
^
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec…
BUILD FAILED in 2s
1 actionable task: 1 executed
BUILD FAILED
Task completed in 3 seconds

 

 

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hm, for the first error it…
Fri, 11/12/2021 - 03:52

hm, for the first error it looks like there's something wrong with the CrystalExterminatorItem(ProjetolkModElements instance) { constructor (it needs to be public, kindly recheck it) and for the 2nd one you must've added one too many closed curly bracket '}'. may i see your code? 

 

P.S. this goes out to anyone asking for support: pls share your code somewhere (the ones that have the errors), be it on Pastebin or just here. otherwise it'd be hard to help you guys

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
alright LkS_, it seems you…
Sat, 11/13/2021 - 01:16

alright LkS_, it seems you missed a single '}' after line 122:

https://user-images.githubusercontent.com/71295972/141600067-74b37b4b-0c4c-4eeb-9c36-74d4eed35370.png

other than that, your constructor:

public CrystalExterminatorItem(ProjetolkModElements instance) {
		super(instance, 8);
		FMLJavaModLoadingContext.get().getModEventBus().register(new CrystalExterminatorRenderer.ModelRegisterHandler());
	}

looks correct to me. try fixing that closed curly bracket error first and see if it somehow fixes this error:

invalid method declaration; return type required public

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Jose4T5Y, in case you haven…
Sat, 11/13/2021 - 01:28

Jose4T5Y, in case you haven't solved the error yet (and if you're still updated w/ this topic), I've finally found the problem in your code after reviewing it very, very carefully. turns out, it was a typo in the package name:

import com.mcreator.simples_meteorites.item.ArcoDeMeteoritoDeFuegoItem; 

change "com" to "net"

your mod is using MCreator's default package name of net.mcreator.(modname). so you need to follow it strictly or else Java won't be able to find the package name you typed in

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oh, and also change the "com…
Sat, 11/13/2021 - 01:29

oh, and also change the "com" over here (the package name declaration) to "net":

package com.mcreator.simples_meteorites;

 

Last seen on 17:55, 19. Nov 2021
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It worked, thank you so much!
Sat, 11/13/2021 - 04:05

It worked, thank you so much!

Last seen on 16:24, 4. May 2024
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm using arrow as my ammo…
Mon, 11/15/2021 - 23:28

I'm using arrow as my ammo but i cant' seem to find the onPlayerStoppedUsing piece of code

Last seen on 07:41, 22. Dec 2021
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi, I have a problem where…
Tue, 12/21/2021 - 19:46

Hi,

I have a problem where no texture is loading on my bow, only shows that purple and black block texture. 

I done everything from your tutorial, I even compared every code with your tutorial.

And I have all 3 pulling textures and the normal textures.

Please help!

Last seen on 20:17, 3. May 2024
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello, thank Sajevius about…
Sat, 03/12/2022 - 15:42

Hello, thank Sajevius about this guide, but what i need do if mcreator not load texture for bow? Could you me pls help?

 

Last seen on 14:53, 11. Jul 2022
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could someone update this to…
Sat, 05/21/2022 - 14:54

Could someone update this to mcreator 2022.1?

Last seen on 13:56, 19. Dec 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you make a tutorial for…
Tue, 06/14/2022 - 13:44

Can you make a tutorial for crossbows please?