use of pneumaticCraft.common.ai.FakePlayerItemInWorldManager in project PneumaticCraft by MineMaarten.
the class EntityDrone method initializeFakePlayer.
private void initializeFakePlayer() {
fakePlayer = new DroneFakePlayer((WorldServer) worldObj, new GameProfile(playerUUID != null ? UUID.fromString(playerUUID) : null, playerName), new FakePlayerItemInWorldManager(worldObj, fakePlayer, this), this);
fakePlayer.playerNetServerHandler = new NetHandlerPlayServer(MinecraftServer.getServer(), new NetworkManager(false), fakePlayer);
fakePlayer.inventory = new InventoryFakePlayer(fakePlayer);
}
use of pneumaticCraft.common.ai.FakePlayerItemInWorldManager in project PneumaticCraft by MineMaarten.
the class TileEntityProgrammableController method initializeFakePlayer.
private void initializeFakePlayer() {
String playerUUID = null;
String playerName = "Drone";
fakePlayer = new DroneFakePlayer((WorldServer) worldObj, new GameProfile(playerUUID != null ? UUID.fromString(playerUUID) : null, playerName), new FakePlayerItemInWorldManager(worldObj, fakePlayer, this), this);
fakePlayer.playerNetServerHandler = new NetHandlerPlayServer(MinecraftServer.getServer(), new NetworkManager(false), fakePlayer);
fakePlayer.inventory = new InventoryPlayer(fakePlayer) {
private ItemStack oldStack;
@Override
public int getSizeInventory() {
return getDroneSlots();
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
super.setInventorySlotContents(slot, stack);
if (slot == 0) {
if (oldStack != null) {
getFakePlayer().getAttributeMap().removeAttributeModifiers(oldStack.getAttributeModifiers());
}
if (stack != null) {
getFakePlayer().getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers());
}
oldStack = stack;
}
}
};
}
Aggregations