Thank you!!! I think I'm confused about how to do it on both sides then. Here's what I've got that's relevant:
MyFirstMod.java (init code):
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
/*
CONTAINER INDEX ORDER:
0: CRAFTING RESULTS SLOT
1-4: CRAFTING MATRIX
5-8: ARMOR SLOTS
*/
PlayerEntity player = event.getPlayer();
List<Slot> slots = player.container.inventorySlots;
slots.set(5, new LockableSlot(player.inventory, 39, 8, 8 * 18));
}
LockableSlot.java:
public class LockableSlot extends Slot {
public LockableSlot(IInventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
}
@Override
public boolean canTakeStack(PlayerEntity playerIn) {
return false;
}
}
I've messed around with a ton of other functions but canTakeStack is the only one that I can get to actually do anything. If you could help me fix the syncing it would be incredible thank you!!! Idk if I have to block PlayerContainer.slotClick() somehow?
EDIT: I should clarify that even though the class is called LockableSlot, I'm just trying to make something that's permanently locked right now, and am planning on implementing that functionality once I've got that sorted out
EDIT #2: also, yes I am using the vanilla inventory, not sure which non-vanilla inventories you're referring to but I assume you mean from another mod