use of net.minecraft.network.play.server.SOpenHorseWindowPacket in project Arclight by IzzelAliz.
the class ServerPlayerEntityMixin method openHorseInventory.
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void openHorseInventory(final AbstractHorseEntity entityhorseabstract, final IInventory iinventory) {
this.nextContainerCounter();
Container container = new HorseInventoryContainer(this.currentWindowId, this.inventory, iinventory, entityhorseabstract);
((ContainerBridge) container).bridge$setTitle(entityhorseabstract.getDisplayName());
container = CraftEventFactory.callInventoryOpenEvent((ServerPlayerEntity) (Object) this, container);
if (container == null) {
iinventory.closeInventory((ServerPlayerEntity) (Object) this);
return;
}
if (this.openContainer != this.container) {
this.closeScreen();
}
this.connection.sendPacket(new SOpenHorseWindowPacket(this.currentWindowId, iinventory.getSizeInventory(), entityhorseabstract.getEntityId()));
(this.openContainer = container).addListener((ServerPlayerEntity) (Object) this);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open((ServerPlayerEntity) (Object) this, this.openContainer));
}
Aggregations