Jump to content

Recommended Posts

Posted

EntityPlayer#inventory is an instance of InventoryPlayer, which implements IInventory.

 

Whenever something isn't working, you need to post code. We can't help you if we can't see what you changed.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
1 minute ago, larsgerrits said:

EntityPlayer#inventory is an instance of InventoryPlayer, which implements IInventory.

 

Whenever something isn't working, you need to post code. We can't help you if we can't see what you changed.

This is the code snippet I'm currently working with:

	ContainerPestle(TileEntityPestle tileentity, EntityPlayer player) { //CustomSlots
		this.tileentity = tileentity;
		this.addSlotToContainer(new SlotItemHandler(tileentity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null), 0, 32, 25));
		this.addSlotToContainer(new SlotItemHandler(tileentity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null), 1, 67, 44));
		this.addSlotToContainer(new SlotPestleOutput(player, player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null), 2, 124, 35));
		
		for(int y = 0; y < 3; ++y) { //Player Inv
			for(int x = 0; x < 9; ++x) {
				this.addSlotToContainer(new Slot((IInventory) player, x + y * 9 + 9, 8 + x * 18, 84 + y * 18));
			}
		}
		
		for(int x = 0; x < 9; ++x) //Hotbar
			this.addSlotToContainer(new Slot((IInventory) player, x, 8 + x * 18, 142 ));
		
	}

I've changed it like so, replacing every appearance of IInventory with InventoryPlayer and/or EntityPlayer#inventory. Since Minecraft does not seem to follow Java as I've been taught, in this instance (mainly just the GUI and Custom Crafting thing I'm trying to get going), I really have absolutely no clue what I'm doing. I can't find any tutorials or examples that may be able to help me out, so I'm mostly just going with advice here, and trying to figure everything out myself.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Posted (edited)
1 hour ago, ModMCdl said:

I've changed it like so, replacing every appearance of IInventory with InventoryPlayer and/or EntityPlayer#inventory. Since Minecraft does not seem to follow Java as I've been taught

What, no. You should not need to do this.

Looking at some old code of mine, you shouldn't even need a cast:

https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/industry/inventory/ContainerFilter.java#L34-L40

Called from:

https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/industry/GuiHandler.java#L29

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.

  • 2 weeks later...
Posted
On 1/15/2018 at 11:14 AM, ModMCdl said:

If I do that, Eclipse wants me to change it to IInventory. Should I implement it elsewhere in the code, or could you provide and example. It's totally possible I just don't understand where you want me to change it.

I don't think you understood. Replace the (IInventory) player with player.inventory ;) 

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.