Jump to content

Recommended Posts

Posted

I want to overwrite the vanilla ender chest container that the enderchest uses the double chest container.

I looked in the enderchest class vanilla uses PlayerEntity#getInventoryEnderChest

to open the gui so my question how to creat my own enderchest gui with 54 slots?

 

I know that I have to create my own capability. do I have to create a completely new one or can I use IItemHandler in my TileEntity?

because in the forge doc to capabilities it says that I can use persisting capabilities.

if I can use an existing capability, is this capability unique for each player?

(this is the first time that i use capabilities so i have no experience with them).

Posted
2 hours ago, diesieben07 said:

So you need to make an interface that extends IItemHandler

do I have to overwrite any method?

 

2 hours ago, diesieben07 said:

So you have to use a capability that's attached to the player.

using the AttachCapabilitiesEvent?

Posted
34 minutes ago, diesieben07 said:

No, you just need a separate interface because you can't have two capabilities with the same interface.

Now i have my custom Interfacce and a class which extends ItemStackHandler and implements my interface

now i have to create a new capability like forge doc:

@CapabilityInject(MyInterface.class)
public static Capability<MyInterface> ITEM_HANDLER_CAPABILITY = null;

but should the class in which i created the capability extends / implements another class

Posted
1 minute ago, diesieben07 said:

I'm not sure I understand what you mean by this. Which class are you referring to?

I created the classes as described above.

how do I create or register the capability?

Posted
17 minutes ago, diesieben07 said:

This is described in the docs on capabilities.

i just read this, and i created this but i'm not sure if this is correct:

 

public class ModCapability {
	
	public ModCapability() {
		
		CapabilityManager.INSTANCE.register(IModItemHandler.class, new Storage(), null);
		
	}
	
	private static class Storage implements IStorage<IModItemHandler> {

		@Override
		public INBT writeNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side) {
			
			return null;
			
		}

		@Override
		public void readNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side, INBT nbt) {
			
			
		}
		
	}
	
}

 

Posted
20 minutes ago, diesieben07 said:

The last parameter for register must not be null.

do i need the factory?

and what's wrong with the factory?

	public ModCapability() {
		
		CapabilityManager.INSTANCE.register(IModItemHandler.class, new Storage(), new Factory());
		
	}
	
	private static class Storage implements IStorage<IModItemHandler> {

		@Override
		public INBT writeNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side) {
			
			return null;
			
		}

		@Override
		public void readNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side, INBT nbt) {
			
			
		}
		
	}
	
	private static class Factory implements Callable<IModItemHandler> {

		@Override
		public IModItemHandler call() throws Exception {
			// what is here wrong?
			return new IModItemHandler();
			
		}
		
	}

 

Posted
5 minutes ago, diesieben07 said:

The Storage and Factory will most likely go away in the future, it was a flawed concept.

You can just make them throw exceptions.

this is now my complet class is this corect:

	@CapabilityInject(IModItemHandler.class)
	public static Capability<IModItemHandler> ITEM_HANDLER_CAPABILITY = null;
	
	public ModCapability() {
		
		CapabilityManager.INSTANCE.register(IModItemHandler.class, new Storage(), new Factory());
		
	}
	
	private static class Storage implements IStorage<IModItemHandler> {

		@Override
		public INBT writeNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side) {
			
			return null;
			
		}

		@Override
		public void readNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side, INBT nbt) {
			
			
		}
		
	}
	
	private static class Factory implements Callable<IModItemHandler> {

		@Override
		public IModItemHandler call() throws Exception {
			
			return null;
			
		}
		
	}

 

Posted
5 minutes ago, diesieben07 said:

That's not what I meant by make it throw an exception, but I guess it'll work.

do I have to register the capability or will it be registered automatically when I add it to the player

Posted (edited)
17 hours ago, diesieben07 said:

You already register it...

Another question how to add the extendsEnderChestGui (Generic9x3 ChestContainer) to the Capability (with this two methode \/ )

do I have to synchronize the gui between the server and the client and if so how do I do it since I looked at a few mods on github that use SimpleChannel and an interface is there another way to do this?

 

		@Override
		public INBT writeNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side) {
			
			CompoundNBT nbt = new CompoundNBT();
			return nbt;
			
		}

		@Override
		public void readNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side, INBT nbt) {
			
			
			
		}

 

Edited by Luis_ST
Posted (edited)
1 hour ago, diesieben07 said:

Also, please keep this forum in English.

Sorry I forgot i translate it into english

 

1 hour ago, diesieben07 said:

No. Container already does this for you.

okay thanks, if I don't want to overwrite the block (ender chest).

can I open the gui with the PlayerInteractEvent#RightClickBlock (using NetworkHooks)

the container and when closing save them in the capability?

 

do i have to creat a container with screen or an inventory because the ender chest use an inventory

Edited by Luis_ST
Posted
7 minutes ago, diesieben07 said:

The Container will already modify the capability (IItemHandler) directly.

so i just have to open the container / inventory and forge saves the gui from automatically?

 

22 minutes ago, Luis_ST said:

do i have to creat a container with screen or an inventory because the ender chest use an inventory

?

 

and where i have to put the container/inventory into the capability because when i use the AttachCapabilitiesEvent i got an NullPointerException:

event:

	@SubscribeEvent
	public static void AttachCapabilities(AttachCapabilitiesEvent<Entity> event) {
		
		if (event.getObject() instanceof PlayerEntity && !(event.getObject() instanceof FakePlayer)) {
			
			event.addCapability(new ResourceLocation("cave:extended_enderchest_gui"), new ModCapability.Provider());
			
		}
		
	}

 

and error log:

[10:38:50] [Server thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: null
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: class net.luis.cave.events.capability.OnAttachCapabilitiesEvent AttachCapabilities(Lnet/minecraftforge/event/AttachCapabilitiesEvent;)V
java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:208)
	at net.luis.cave.init.ModCapability$Provider.<init>(ModCapability.java:59)
	at net.luis.cave.events.capability.OnAttachCapabilitiesEvent.AttachCapabilities(OnAttachCapabilitiesEvent.java:21)
	at net.minecraftforge.eventbus.ASMEventHandler_16_OnAttachCapabilitiesEvent_AttachCapabilities_AttachCapabilitiesEvent.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:579)
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:573)
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:48)
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:44)
	at net.minecraft.entity.Entity.<init>(Entity.java:221)
	at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:207)
	at net.minecraft.entity.player.PlayerEntity.<init>(PlayerEntity.java:160)
	at net.minecraft.entity.player.ServerPlayerEntity.<init>(ServerPlayerEntity.java:182)
	at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:419)
	at net.minecraft.network.login.ServerLoginNetHandler.tryAcceptPlayer(ServerLoginNetHandler.java:122)
	at net.minecraft.network.login.ServerLoginNetHandler.tick(ServerLoginNetHandler.java:66)
	at net.minecraft.network.NetworkManager.tick(NetworkManager.java:244)
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:151)
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:898)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:820)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:84)
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:663)
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233)
	at java.base/java.lang.Thread.run(Thread.java:832)

[10:38:50] [Server thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID 3dbca5d1-2854-4053-a647-dfa6633d91c6
[10:38:50] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Ticking memory connection
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:154) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:898) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:820) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:84) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:663) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:832) [?:?] {}
Caused by: java.lang.NullPointerException
	at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?] {}
	at net.luis.cave.init.ModCapability$Provider.<init>(ModCapability.java:59) ~[main/:?] {re:classloading}
	at net.luis.cave.events.capability.OnAttachCapabilitiesEvent.AttachCapabilities(OnAttachCapabilitiesEvent.java:21) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_16_OnAttachCapabilitiesEvent_AttachCapabilities_AttachCapabilitiesEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:579) ~[forge:?] {re:classloading}
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:573) ~[forge:?] {re:classloading}
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:48) ~[forge:?] {re:classloading}
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:44) ~[forge:?] {re:classloading}
	at net.minecraft.entity.Entity.<init>(Entity.java:221) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:207) ~[forge:?] {re:classloading}
	at net.minecraft.entity.player.PlayerEntity.<init>(PlayerEntity.java:160) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.player.ServerPlayerEntity.<init>(ServerPlayerEntity.java:182) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:419) ~[forge:?] {re:classloading}
	at net.minecraft.network.login.ServerLoginNetHandler.tryAcceptPlayer(ServerLoginNetHandler.java:122) ~[forge:?] {re:classloading}
	at net.minecraft.network.login.ServerLoginNetHandler.tick(ServerLoginNetHandler.java:66) ~[forge:?] {re:classloading}
	at net.minecraft.network.NetworkManager.tick(NetworkManager.java:244) ~[forge:?] {re:classloading}
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:151) ~[forge:?] {re:classloading}
	... 6 more

 

Posted
3 minutes ago, diesieben07 said:

The container is completely unrelated to the capability. The inventory (i.e. IItemHandler) is the capability implementation.

so i have to use IItemHandler to get and open the gui inside there:

NetworkHooks.openGui(serverPlayer, /*here*/, pos);

 

and:

public class ModCapability {
	
	@CapabilityInject(IModItemHandler.class)
	public static Capability<IModItemHandler> CAPABILITY = null;
	
	public ModCapability() {
		
		CapabilityManager.INSTANCE.register(IModItemHandler.class, new Storage(), new Factory());
		
	}
	
	public static class Storage implements IStorage<IModItemHandler> {
		@Override
		public INBT writeNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side) {
			return null;
		}

		@Override
		public void readNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side, INBT nbt) {
		}
	}
	
	public static class Factory implements Callable<IModItemHandler> {
		@Override
		public IModItemHandler call() throws Exception {
			return null;
		}
	}
	
	public static class Provider implements ICapabilityProvider {

		private final LazyOptional<IModItemHandler> lazyOptional = LazyOptional.of(CAPABILITY::getDefaultInstance);
		
		@Override
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return cap == CAPABILITY ? lazyOptional.cast() : LazyOptional.empty();
			
		}
		
	}
	
}

 

Posted
9 minutes ago, diesieben07 said:

No, you need to implement INamedContainerProvider.

do i only have to implement Named ContainerProvider because i currently extends Chest Container / Container and i think thats wrong

 

34 minutes ago, diesieben07 said:

Obviously you can't do this if your default factory returns null. Use a normal constructor.

so like this:

	public static class Provider implements ICapabilityProvider {
		
		@Override
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return null;
			
		}
		
	}

 

Posted (edited)
3 hours ago, diesieben07 said:

You need both. You need a Container (and the corresponding ContainerType and ScreenFactory) and you need to implement INamedContainerProvider for openGui.

I already have that, but how do I open the container in my event?

what do I have to hand over to the method at "null"?

	@SubscribeEvent
	public static void PlayerInteract(PlayerInteractEvent.RightClickBlock event) {
		
		PlayerEntity player = event.getPlayer();
		BlockPos pos = event.getPos();
		World world = event.getWorld();
		BlockState state = world.getBlockState(pos);
		EnderChestInventory enderChestInventory = player.getInventoryEnderChest();
		
		if (state.getBlock() == Blocks.ENDER_CHEST) {
			
			if (!enderChestInventory.isEmpty()) {
				
				InventoryHelper.dropInventoryItems(world, pos, enderChestInventory);
				
			} else {
				
				if (player instanceof ServerPlayerEntity) {
					
					event.setCanceled(true);
					ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
					NetworkHooks.openGui(serverPlayer, null, pos);
					
				}
				
			}
			
		}

	}

 

3 hours ago, diesieben07 said:

No... Not at all.

you say I should use a constructor, what must be in the constructor and what should the method "getCapability" return

Edited by Luis_ST
Posted
2 hours ago, diesieben07 said:

A new instance of your INamedContainerProvider implementation.

then like this:

					NetworkHooks.openGui(serverPlayer, new SimpleNamedContainerProvider((id, inventory, playerIn) -> {
						return new ModEnderChestContainer(id, inventory);
					}, ModEnderChestContainer.getContainerName()), pos);

 

2 hours ago, diesieben07 said:

Why do you do this?

This checks whether the player's Enderchest inventory is already in use, as the player may add the mod later. If this is the case,

the existing inventory will be dropped and the new one will be opened with the next click.

 

2 hours ago, diesieben07 said:

This is a class that extends ItemStackHandler, just add the same constructors that that class has and call the super constructors. Your IDE should do this for you automatically.

i dont get a constructor

so this is my complet class:

package net.luis.cave.init;

import java.util.concurrent.Callable;

import net.luis.cave.api.capability.IModItemHandler;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.INBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.common.util.NonNullSupplier;

public class ModCapability {
	
	@CapabilityInject(IModItemHandler.class)
	public static Capability<IModItemHandler> CAPABILITY = null;
	
	public ModCapability() {
		
		CapabilityManager.INSTANCE.register(IModItemHandler.class, new Storage(), new Factory());
		
	}
	
	public static class Storage implements IStorage<IModItemHandler> {
		@Override
		public INBT writeNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side) {
			return null;
		}

		@Override
		public void readNBT(Capability<IModItemHandler> capability, IModItemHandler instance, Direction side, INBT nbt) {
		}
	}
	
	public static class Factory implements Callable<IModItemHandler> {
		@Override
		public IModItemHandler call() throws Exception {
			return null;
		}
	}
	
	public static class Provider implements ICapabilityProvider {
		
		@Override
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return cap == CAPABILITY ? LazyOptional.of(() -> null) : LazyOptional.empty();
			
		}
		
	}
	
}

 

2 hours ago, diesieben07 said:

you need to check if the queried capability is yours and if so return the LazyOptional containing your capability instance. Otherwise return the empty LazyOptional.

what do I have to replace null with

Posted
34 minutes ago, diesieben07 said:

Or... you could just make your inventory an extension of the ender chest inventory (just like how chests that are next to each other merge together). That way their existing inventory (if any) stays and if they uninstall the mod at least the "normal" part still stays.

Like I already suggested...

what do I have to change so that it works like a double chest inventory?

 

50 minutes ago, Luis_ST said:

This is a class that extends ItemStackHandler, just add the same constructors that that class has and call the super constructors. Your IDE should do this for you automatically.

36 minutes ago, diesieben07 said:

I have no idea what you mean by this.

which class did you mean?

 

39 minutes ago, diesieben07 said:

You have to replace it with the instance of your capability (i.e. your inventory).

like this? (this doesent work -> "Cannot make a static reference to the non-static method getInventory() from the type Container")

	public static class Provider implements ICapabilityProvider {
		
		@Override
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return cap == CAPABILITY ? LazyOptional.of(ModEnderChestContainer::getInventory) : LazyOptional.empty();
			
		}
		
	}

 

Posted
35 minutes ago, diesieben07 said:

Use CombinedInvHandler to combine the two into one.

where and when do I have to use this in the container class or when I interact with the block

 

31 minutes ago, diesieben07 said:

What on earth are you talking about?

i fixed it (it was a question about the error log)

 

32 minutes ago, diesieben07 said:

This makes zero sense. Why would the container store the inventory. Your ICapabiltyProvider needs to store and save the capability.

i don't understand what i have to set there, i tried a lot but every time i get an error

Posted
12 hours ago, diesieben07 said:

Your ICapabiltiyProvider needs a field that holds your capability instance (the inventory). It also needs a field that holds a LazyOptional to be returned from getCapability.

like this?

	public static class Provider implements ICapabilityProvider {
		
		private static IModItemHandler inventory = new ModItemStackHandler();
		
		@Override
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return cap == CAPABILITY ? (LazyOptional<T>) LazyOptional.of(() -> inventory) : LazyOptional.empty();
			
		}
		
	}

 

Posted (edited)
3 minutes ago, diesieben07 said:

Yes, but do not make a new LazyOptional every time, like I already told you.

so I store save them in a field?

and there is no "CombinedInvHandler" do you mean "CombinedInvWrapper"

Edited by Luis_ST
Posted
12 minutes ago, diesieben07 said:

Yes and yes.

this is now my ICapabilityProvider:

	public static class Provider implements ICapabilityProvider {
		
		private static IModItemHandler inventory = new ModItemStackHandler();
		private static LazyOptional<IModItemHandler> optional = LazyOptional.of(() -> inventory);
		
		@Override
		@SuppressWarnings("unchecked")
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return cap == CAPABILITY ? (LazyOptional<T>) optional : LazyOptional.empty();
			
		}
		
	}

 

and how do I add my extended enderchest inventory and that of the enderchest beacuse when i try this:

CombinedInvWrapper invWrapper = new CombinedInvWrapper(inventory);			

1. i got an error: "The constructor CombinedInvWrapper(IModItemHandler) is undefined"

2, how to get the ernderchest inventory?

Posted
1 hour ago, diesieben07 said:

PlayerEntity#getInventoryEnderChest

i know about this methode but what i mean how o get the InventoryEnderChest whitout a player or can i get beacuse i dont have a player inside the class:

or is there a way to get the player?

	public static class Provider implements ICapabilityProvider {
		
		private static IModItemHandler inventory = new ModItemStackHandler();
		private static LazyOptional<IModItemHandler> optional = LazyOptional.of(() -> inventory);
		
		@Override
		@SuppressWarnings("unchecked")
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			CombinedInvWrapper invWrapper = new CombinedInvWrapper(inventory);			
			return cap == CAPABILITY ? (LazyOptional<T>) optional : LazyOptional.empty();
			
		}
		
	}

 

Posted
47 minutes ago, diesieben07 said:

How would you get the ender chest without a player?

i add an constructor an remove the static of the LazyOptional so this is now my Provider:

but i can't combined the Inventories in this way.

	public static class Provider implements ICapabilityProvider {
		
		private static IModItemHandler inventory = new ModItemStackHandler();
		private LazyOptional<IModItemHandler> optional = LazyOptional.of(() -> inventory);
		
		public Provider(PlayerEntity player) {
			
			EnderChestInventory enderChestInventory = player.getInventoryEnderChest();
											/*Here is an Error*/
			CombinedInvWrapper invWrapper = new CombinedInvWrapper(inventory, enderChestInventory);
			IItemHandlerModifiable itemHandlerModifiable = invWrapper;
			
		}
		
		@Override
		@SuppressWarnings({ "unchecked", "unused" })
		public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
			
			return cap == CAPABILITY ? (LazyOptional<T>) optional : LazyOptional.empty();
			
		}
		
	}

 

Posted
1 hour ago, diesieben07 said:

Do you know what static means?

I know what was meant by static i forgot it to remove

 

1 hour ago, diesieben07 said:

/*Here is an Error*/

i got an error: "The constructor CombinedInvWrapper(IModItemHandler, EnderChestInventory) is undefined".

 

1 hour ago, diesieben07 said:

Also: You still completely ignore the CombinedInvWrapper that you create.

1. What do I have to do with it or how do I create IItemHandlerModifiable
2. I have to add the container that I have created to my IModItemHandler.

because I have not yet passed anything to the IModItemHandler (it is empty) or I think that it is empty

Posted
2 hours ago, diesieben07 said:

What?

2 hours ago, diesieben07 said:

You have to return it from getCapability... obviously. You want to use it in your container.

has dealt with the question

 

i try it thanks

 

Posted
16 hours ago, diesieben07 said:

Yes... I told you how to fix it right below. In a quote, because I already told you this previously.

i dont understand when i only use my capility it work when i add the ender chest inventory i got this error

 

16 hours ago, diesieben07 said:

You have to return it from getCapability... obviously. You want to use it in your container.

then i have to creat a field?

I have to do the following:
1. Combination of inventories
2. Creat a IItemHandlerModifiable from the combination
3. Retrun the IItemHandlerModifiable in getCapability

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.