Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey guys, i got this code from 1.12 for taming im trying to update to 1.15 here.. got some errors thou (i cant find a replament for the 'hand' variable and others):

PS- this is question about the code only, im not asking questions about MCreator..

 

//TAME CODE
    public void setTamed(boolean tamed)
    {
    	super.setTamed(tamed);
       //whatever you want your mob to do when it's tamed e.g. the wolf's class uses this to increase the mob's max health to 20 if it's tamed

    }

	public boolean processInteract(PlayerEntity player, Hand handIn)
	{
	  ItemStack itemstack = player.getHeldItem(hand);
	  if (!this.isTamed() && itemstack.getItem() == Items.APPLE && !this.isBreedingItem(itemstack))
	    {
	      if (!player.capabilities.isCreativeSettings)
	        {
	            itemstack.shrink(1);
	        }
	     if (!this.world.isRemote)
	        {
	            if (this.rand.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player))
	            {
	                this.setTamedBy(player);
	                this.navigator.clearPath();
	                this.setAttackTarget((LivingEntity)null);
	                this.sitGoal.setSitting(true);
	                this.setHealth(8.0F);
	                this.playTameEffect(true);
	                this.world.setEntityState(this, (byte)7);
	            }
	            else
	            {
	                this.playTameEffect(false);
	                this.world.setEntityState(this, (byte)6);
	            }
	        }
	        return true;
	    }
	
	    else if (this.isOwner(player) && !this.world.isRemote && !this.isBreedingItem(itemstack))
	    {
	         this.sitGoal.setSitting(!this.isSitting()); 
	         this.isJumping = false;
	         this.navigator.clearPath();
	         this.setAttackTarget((LivingEntity)null); 
	         return true;
	    }
	
	    return super.processInteract(player, hand);
	}

		//TAME CODE END

here is the 4 errors:

java:175: error: cannot find symbol 
     ItemStack itemstack = player.getHeldItem(hand); 
                                              ^ 
  symbol:   variable hand 
  location: class CustomEntity

java:178: error: capabilities has private access in CapabilityProvider 
         if (!player.capabilities.isCreativeSettings)

java:178: error: cannot find symbol 
         if (!player.capabilities.isCreativeSettings)

java:212: error: cannot find symbol 
       return super.processInteract(player, hand); 
                                            ^ 
  symbol:   variable hand 
  location: class CustomEntity 
4 errors 
> Task :compileJava FAILED

 

Edited by ninjawizard

  • Author
  On 6/13/2020 at 8:52 PM, diesieben07 said:
  • First of all, please use @Override when overriding methods.
  • The first and last errors are basic Java syntax problems, you are referring to a variable that does not exist. Please learn basic Java before modding.
  • Have you tried looking at the vanilla "tame this animal" code, in e.g. WoflEntity? It is pretty obvious how to change your code.

yes i look on the cow file for the taming code.. im kinda new on this im very sorry for that, im trying to learn it.... i would be greateful if you could teach me what i need to change :)

  • Author

well sir just basic, i know the variables, the functions and such, im trying to learn java for my mod, this is my situation; i got this mod for 1.12 with 60,000 downloads and these kids really want the 1.15 version, and i dont want to let them down.. the little fellows have a blast with that mod.. so i really want to update it, i use to be able to edit the code to do pretty much all i wanted on 1.12, but i had to be away for personal disease problems so i lost track off all coding changes... im trying to find a site or something that shows all new commands and such, like for example the scale mob thing i manage to fix with some help, but they removed GlState and now you scale with ms.scale.. things like that... i just cant find basic info for that..

 

the info i need help with for my mod is how to set the new variable names (like 'hand') and the one for capabilties class..

or if you could point me a tutorial for making tameable mobs for 1.15 would be great too... i really apreciate some help thou, im having a really hard time to find help.

 

PS- sorry my english im from Brazil

  • Author
  On 6/13/2020 at 9:05 PM, diesieben07 said:

The variable hand does not exist.

Did you mean "handIn"? Seriously... this is basic programming...

that was what i talking about.. the hand variable does not exist on 1.15 but was on 1.12, thats my problem. So  i replace for hand for 'handIn' ?

  • Author

also if there is a section for begginers i will be glad in posting there... is this for advanced help only? sorry again im new on this forum too.

  • Author
  On 6/13/2020 at 9:26 PM, diesieben07 said:

It is YOUR CODE. The Minecraft version is irrelevant.

you are you so agressive with me man? its my first time on this forum i dont know all your rules...

anyway i guess that handIn thing fix it, now i still got 2 errors:

 


error: capabilities has private access in CapabilityProvider 
         if (!player.capabilities.isCreativeSettings)

error: cannot find symbol 
         if (!player.capabilities.isCreativeSettings) 
                                 ^ 
  symbol:   variable isCreativeSettings 
  location: variable capabilities of type CapabilityDispatcher 
2 errors

now i know is something on that capabilities thing there... can you help me? i will credit you on my mod i promisse... i got 3 mods on minecraft btw, if you want i can link them so you can take a look, maybe we can make a co-op work!

Edited by ninjawizard

  • Author
  On 6/13/2020 at 10:20 PM, diesieben07 said:

I am "aggressive", because you are lacking basic understanding of programming.

 

I already told you, please look at the vanilla tame code. It is very easy to see how to replace your current code.

yes! i figger it out thanks! was this the correct:

!player.abilities.isCreativeMode instead of !player.capabilities.isCreativeSettings

they changed CreativeSettings to CreativeMode... you see that was what i was talking about; they change all these functions and variables from version to version, i need a place where i can see what they changed, do they make such logs? that would help a lot them i would not have to bother people cause i want to learn.

 

Now i need to make the model Sit when tamed, i got the model code ready and such, as before it worked on 1.12, now i need to update it too.. should i post it here or start a new topic?

 

thanks again!

  • Author

I need to update this 1.12 code here for 1.15:

 

public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTickTime)
     {
        CapuchinBlondEntity entitycapuchinBlond = (CapuchinBlondEntity)entitylivingbaseIn;

        
        if (entitycapuchinBlond.isSitting())
        {
            this.Head.setRotationPoint(0.5F, 17F, -1F);
			this.Body.setRotationPoint(0F, 18.5F, -0.5F);
          ...............

its a IF to make the monkey model to sit, i know i need to change EntityLivingBase and entitylivingbaseIn and maybe more, can you help me? thanks!

  • Author

i was using the wolf file as model (sit animation) and i end with this code... no luck yet

 

public void setLivingAnimations(entityIn, float limbSwing, float limbSwingAmount, float partialTick) {
        
        	if (entityIn.isSitting()) {

 

there is a 'T' before entityIn on the wolf file, but if i put it, and make the changes for it, it also dont work

  • Author
public class ModelCapuchin<T extends CapuchinBlondEntity> extends AgeableModel<T> {
	//public static class ModelCapuchin extends EntityModel<Entity> {

when i do like the wolf mob, with that 'T', i change like the wolf on this part too, but also gimme errors :(

 

 

  • Author
  On 6/14/2020 at 6:01 PM, loordgek said:

learn java

my friend dont be rude with me, this is a forum to help others learn how to code java for minecraft isnt it?

Edited by ninjawizard

  On 6/14/2020 at 9:30 PM, ninjawizard said:

my friend dont be rude with me, this is a forum to help others learn how to code java for minecraft isnt it?

Telling you to learn Java before modding is not rude; it is a prerequisite for modding, and you cannot mod Minecraft without knowing Java.

This is not a Java forum; if you need help learning Java, try some of the other programming-specific forums out there (i.e. StackOverflow).

 

Some tips:

Reveal hidden contents

 

  • Author
  On 6/15/2020 at 6:47 AM, loordgek said:

no you are expected to have (basic) java knowledge

and you think i dont because i use Mcreator... you are just a hater my friend. and a Mcreator-phobic

and because you use MCreator you got this far and are now bitching because you can't get something to work and you feel we should just do the work for you when you haven't even put in the effort to learn Java.

There is a reason we dislike MCreator and you are only reinforcing that opinion.

 

Learn Java.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Reveal hidden contents

 

  On 6/16/2020 at 2:07 AM, ninjawizard said:

and you think i dont because i use Mcreator... you are just a hater my friend. and a Mcreator-phobic

Sorry but someone had to say it so ima say it. You created a mod with MCreator or what ever it’s called. Now you want to make it work with 1.15 or what ever version you desire. The sad thing is I looked at “the code” and instantly knew how to fix the issues. Just an fwi I don’t even know the java basics and code mods for the memes. To me it seems you know nothing about java or coding for Minecraft if you want to call it that. So you come here asking people what do I gotta type here to make error go away???? All you know is how to open up an ide and paste what the internet tells you. Maybe you know what a Boolean is. Error pops up and keyboard goes brrrrr(obviously typing on safari for help).

Before I will start commenting, I will share my words of wisdom: MCreator is NOT SUPPORTED in this forum.

 

Well there are really people like this. They think that people will just flat hand type the code for them as if magic. Well sorry to disappoint you, this is the reality. We programmers basically spent a considerable portion of our time learning this and you... you just... oh never mind. I hate MCreator and you just made that hate stronger with your toxic attitude. Go back after you are done learning basic java.

  • Author

aight guys chill out i do want to learn Java (only for MC) AND use Mcreator.. sorry but its a good tool, even for vet modders, but i understand your points there, but notice just one thing please, i never asked for Mcreator suport here, just CODE questions, i hope you can apreciate that.

 

This topic is already solved, i manage to edit the code with some help now i need just help with one code line, i will be posting another topic for it.

  On 6/16/2020 at 5:40 AM, ninjawizard said:

AND use Mcreator

Stop using that pile of trash immediately, if you want to learn to code stick to Java and ONLY Java. I can't describe how bad the code that abomination generates is.

Edited by Novârch

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.