use of me.desht.pneumaticcraft.common.entity.living.EntityDrone.DroneFakePlayer in project pnc-repressurized by TeamPneumatic.
the class TileEntityProgrammableController method initializeFakePlayer.
private void initializeFakePlayer() {
fakePlayer = new DroneFakePlayer((WorldServer) getWorld(), new GameProfile(getOwnerUUID(), ownerName), this);
fakePlayer.connection = new NetHandlerPlayServer(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.SERVERBOUND), fakePlayer);
fakePlayer.inventory = new InventoryPlayer(fakePlayer) {
private ItemStack oldStack = ItemStack.EMPTY;
@Override
public int getSizeInventory() {
return getDroneSlots();
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
super.setInventorySlotContents(slot, stack);
if (slot == 0) {
for (EntityEquipmentSlot ee : EntityEquipmentSlot.values()) {
if (!oldStack.isEmpty()) {
getFakePlayer().getAttributeMap().removeAttributeModifiers(oldStack.getAttributeModifiers(ee));
}
if (!stack.isEmpty()) {
getFakePlayer().getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers(ee));
}
}
oldStack = stack;
}
}
};
}
Aggregations