Jump to content

Recommended Posts

Posted (edited)

hai there

 

im trying to make a item thats the only way to harvest bananas from the banana bunch but when u brake the banana bunch it brakes the block not return to age 0 (ive used parms harvest craft code for refrance)

so tryed to make the item do the same thing as right click harvest only on right clicking its doing nothing :(  anybody got a idea on to y the block brakes insted or turning back to age 0 OR y the banana picker is doing nothing on right click?

 

https://github.com/monkeybee11/monkeysmod/blob/master/src/main/java/com/monkeybee11/monkeysmod/item/ItemBananaPicker.java  banana pickers code 

 

https://github.com/monkeybee11/monkeysmod/blob/master/src/main/java/com/monkeybee11/monkeysmod/block/BlockBananaBunch.java banana bunch code 

Edited by monkeybee
forgot no 1 uses a lefthanded mouse ¬.¬
Posted
56 minutes ago, monkeybee said:

on left clicking its doing nothing

Quote

PlayerInteractEvent.RightClickBlock event

I wonder why indeed... 

This is not what you use events for. Events are when you need to hook into existing behaviour, not when you need to create a completely new one. Just override Block#onBlockActivated, check if the item in the player's hand is your item and do what you need to do.

 

if (!(state.getValue(AGE) != 3)) {

		}

What is the purpose of this code? The condition will never be true and even if it was it does nothing.

 

56 minutes ago, monkeybee said:

y the block brakes insted or turning back to age 0

Well so far you've done absolutely nothing to change the default breaking behaviour, thus it breaks as all other blocks.

 

Posted (edited)
29 minutes ago, V0idWa1k3r said:

I wonder why indeed... 

This is not what you use events for. Events are when you need to hook into existing behaviour, not when you need to create a completely new one. Just override Block#onBlockActivated, check if the item in the player's hand is your item and do what you need to do.

 


if (!(state.getValue(AGE) != 3)) {

		}

What is the purpose of this code? The condition will never be true and even if it was it does nothing.

 

Well so far you've done absolutely nothing to change the default breaking behaviour, thus it breaks as all other blocks.

 

MY BAD!!!! ive used a hard wired left handed mouse since ive used a pc so the buttions are swaped for me >.<
on right click then sry :P

im not 100% sure what the code dose was using parms code as a very close refraces bc befor had tryed to code it my self with only vanilla cocoa as refrance and it didt turn out well so something in parms mite have 3 ages insted of 2?

Edited by monkeybee
Posted
11 minutes ago, monkeybee said:

im not 100% sure what the code dose was using parms code as a very close refraces bc befor had tryed to code it

Well you should then inspect your code and actually understand what it is doing. Programming without a clear understanding of what the code does is like trying to assemble a rocket without a manual or assembly markers.

 

What behaviour do you actually want? Afaik when you break a fruit in pam's it breaks like a normal block and doesn't revert to age 0. Pam's fruits are harvested by right-clicking.

Posted
1 minute ago, V0idWa1k3r said:

Well you should then inspect your code and actually understand what it is doing. Programming without a clear understanding of what the code does is like trying to assemble a rocket without a manual or assembly markers.

 

What behaviour do you actually want? Afaik when you break a fruit in pam's it breaks like a normal block and doesn't revert to age 0. Pam's fruits are harvested by right-clicking.

im lurning JAVA as im going along do better learning something by doing then sitting there watching/reading/taking lessens 

 

ive not used parms harvest craft since 1.5mc back then when the fruit was fully grown u punched it and it woud return to the 1st growth state (age 0) and drop its fruit

if u tryed to brake the fruit befor it was fully grown u woud still get a fruit BUT the "block" woud get destroyed

im trying to get something like that but 
1 it can only be harvested by the banana picker item
2 if u try to harvest it with anything else it will just not brake the block and send a message to the players chat (me know thats not even in my code im just trying to get part 1 working 1st) 

Posted

Override Block#removedByPlayer, it fires when the block is broken by the player. Check whether the player is holding your picker item and if they aren't send your message and return false, otherwise invoke the base implementation(return super.removedByPlayer). That is if you want it harvested by breaking the block.

 

If you want to harvest the block with a right click then do what I've said earlier:

50 minutes ago, V0idWa1k3r said:

Just override Block#onBlockActivated, check if the item in the player's hand is your item and do what you need to do.

And by "do what you need to do" in this case I mean drop the item and set the block to air.

Posted
2 hours ago, V0idWa1k3r said:

The condition will never be true

Yes it will, it's just ridiculous.

@monkeybee Just say value == 3

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
14 minutes ago, Animefan8888 said:

Yes it will, it's just ridiculous.

@monkeybee Just say value == 3

 

        if (!(state.getValue(AGE) !==3)) {


Syntax error on token "=", delete this token 
 

if ureplace the ! with a 1 it says the same error but on token "1"

Edited by monkeybee
Posted
10 hours ago, monkeybee said:

im lurning JAVA as im going along do better learning something by doing then sitting there watching/reading/taking lessens 

Learning java through modding Minecraft is really painful, I suggest getting a basic understanding of java or at least OOP (Object Oriented Programming) in general first

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
8 hours ago, Cadiboo said:

Learning java through modding Minecraft is really painful, I suggest getting a basic understanding of java or at least OOP (Object Oriented Programming) in general first

the thing is as me said me learn stuff better by doing then learning minecraft is really the only thing vie got to "play about with" thats java ? 
the other stuff ive messed about with "coding" is
dont starve togeather modding (lua)
computercraft (lua)

nintendo labo (but thats more logic gate stuff so.....)

having a quick google on what OOP is .....guess nintendo labo coud be classed as that if not....mcreator did use that program befor giving up on how limmited it is to ppl who dont understand java and moving on to eclips

 

but HEY at leace ive got to the point of being able to add item blocks and custom 3d json models on my own now so baby steps XD

Posted
56 minutes ago, monkeybee said:

but HEY at leace ive got to the point of being able to add item blocks and custom 3d json models on my own now so baby steps XD

Baby steps are the right way to go. However, instead of starting off with modding minecraft you could have started off with something like a calculator or a very simple game that will teach you the basics of Java itself instead of trying to make a modification to an already existing application via an external API.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

ok so the thing me want to happen still aint happerning ive removed all the cote from banana picker so its just a plain item and added 

 

	public boolean onBlockActivated(NonNullList<ItemStack> drops, IBlockAccess world, EntityPlayer playerIn, BlockPos pos, IBlockState state,int fortune) {
		ItemStack itm = playerIn.getHeldItemMainhand();
		if(!itm.equals(TutorialItems.BANANA_PICKER) == true)
			return true;
			drops.add(new ItemStack(TutorialItems.BASIC_ITEM, 6));
			
			if(!itm.equals(TutorialItems.BANANA_PICKER) == false); {
				playerIn.sendMessage(new TextComponentString("cant reach that from here if only there was a banana picker"));
			return false;
			}
		
	}

to banana bunch and // out the code for itemdrop but.....it dose nothing ?

right click is doing nothing

and braking the block is making the stem drop now ima confused monkey

https://github.com/monkeybee11/monkeysmod/blob/master/src/main/java/com/monkeybee11/monkeysmod/block/BlockBananaBunch.java

Posted
2 hours ago, monkeybee said:

if(!itm.equals(TutorialItems.BANANA_PICKER) == true)

An ItemStack will never be equal to an item. Also that is not how you make a condition.

 

2 hours ago, monkeybee said:

drops.add(new ItemStack(TutorialItems.BASIC_ITEM, 6));

What is this mysterious drops object and how does it work?

 

2 hours ago, monkeybee said:

if(!itm.equals(TutorialItems.BANANA_PICKER) == false); { playerIn.sendMessage(new TextComponentString("cant reach that from here if only there was a banana picker")); return false; }

Again, this is a horrific way of making conditions. There is so much unnecessary stuff in it. Also you terminated whatever the condition was supposed to control with a ; meaning that the code in your brackets will get executed regardless.

Posted
1 hour ago, V0idWa1k3r said:

An ItemStack will never be equal to an item. Also that is not how you make a condition.

 

What is this mysterious drops object and how does it work?

 

Again, this is a horrific way of making conditions. There is so much unnecessary stuff in it. Also you terminated whatever the condition was supposed to control with a ; meaning that the code in your brackets will get executed regardless.

1 ah ok

 

2....dont know makes the itemdrop?

 

3 ive got nothing to say just trying my best :s

Posted

You should have a basic grasp of java before making a mod.

On 10/11/2018 at 1:39 AM, Animefan8888 said:

Baby steps are the right way to go. However, instead of starting off with modding minecraft you could have started off with something like a calculator or a very simple game that will teach you the basics of Java itself instead of trying to make a modification to an already existing application via an external API.

 

onBlockActivated(params...) {

  if(age==fully grown) {

    if (stack.getItem() == ModItems.BANANA_PICKER) {

      drops.add(new ItemStack(ModItems.BANANA));

    } else {

      //tell player they need to use a banana picker

    }

  }

}

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
14 hours ago, Cadiboo said:

You should have a basic grasp of java before making a mod.

now the confusing part of telling me this

ppl say that after u start but the  u have dw20 vaskii amadeus laxmanos?(think notsure) on the minecraft modded pannel at minecraft earth who say modding minecraft is a good place to start so im like.....who the heck do u baleave :s

Posted
18 minutes ago, monkeybee said:

now the confusing part of telling me this

ppl say that after u start but the  u have dw20 vaskii amadeus laxmanos?(think notsure) on the minecraft modded pannel at minecraft earth who say modding minecraft is a good place to start so im like.....who the heck do u baleave :s

Do you understand the basic concepts of Object Oriented Programming? Do you understand basic java? Minecrafts code is badly and confusingly written and forge is complicated. You should have a good basic understanding of both before starting Modding. I’ve been programming for a few years and decided to learn java through modding and it was pretty (very) hard to just jump in and learn the basics, not to mention all the special stuff and intricacies of modding. It’s possible, but you need to be receptive and read a bunch of documentation and take baby steps. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
1 hour ago, monkeybee said:

say modding minecraft is a good place to start

Nobody is saying that modding is a good place to start if you know nothing about programming or the language. It really isn't. Modding expects you to know quite a lot about how java functions. Minecraft isn't a good place to learn how to code in java. It's too complicated for it's own good and in a lot of cases is plain bad as in it teaches you bad practices. It is a fine place to start if you have the basics nailed down. Or at least know other programming languages which feature OOP.

Posted
1 hour ago, V0idWa1k3r said:

Nobody is saying that modding is a good place to start if you know nothing about programming or the language. It really isn't. Modding expects you to know quite a lot about how java functions. Minecraft isn't a good place to learn how to code in java. It's too complicated for it's own good and in a lot of cases is plain bad as in it teaches you bad practices. It is a fine place to start if you have the basics nailed down. Or at least know other programming languages which feature OOP.

dont want this to go off topic im just posting my sorce of ppl saying modding mc is a good place to start
and sry it wasent laxmanos it was king lemmin

 



 

Spoiler

 

but like me said dont want it to go of topic now ive posted the sorce of my info S:

 

 

image.png

Posted (edited)

Just because it worked for one person does not mean that it's:

a) a good idea

b) going to work for you

 

(Thinking otherwise is called Survivorship Bias)

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.