Skip to content

Commit

Permalink
explicitly sync player inventory after filling
Browse files Browse the repository at this point in the history
  • Loading branch information
benblank committed Feb 14, 2016
1 parent 4bc3e36 commit 421020e
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
package com.five35.minecraft.ice.inventorymanager;

import java.util.List;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

public class VanillaInventoryManager extends GeneralInventoryManager {
@Override
public List<ItemStack> fillSlots(EntityPlayer player, Map<Integer, ItemStack> slots) {
List<ItemStack> leftovers = super.fillSlots(player, slots);

// Simply marking the player's inventory as dirty doesn't actually
// cause the server to synchronize it to the client.
if (player instanceof EntityPlayerMP) {
((EntityPlayerMP) player).sendContainerToPlayer(player.inventoryContainer);
}

return leftovers;
}

@Override
protected IInventory getInventory(EntityPlayer player) {
return player.inventory;
Expand Down

0 comments on commit 421020e

Please sign in to comment.