use of net.minecraft.inventory.container.IContainerListener in project Overloaded by CJ-MC-Mods.
the class InstantFurnaceContainer method broadcastChanges.
@Override
public void broadcastChanges() {
int j;
for (j = 0; j < this.slots.size(); ++j) {
ItemStack itemstack = this.slots.get(j).getItem();
itemstack = itemstack.isEmpty() ? ItemStack.EMPTY : itemstack.copy();
this.lastSlots.set(j, itemstack);
for (IContainerListener icontainerlistener : this.containerListeners) {
icontainerlistener.slotChanged(this, j, itemstack);
}
}
ContainerDataMessage message = new ContainerDataMessage(this.containerId);
for (j = 0; j < this.dataSlots.size(); ++j) {
IntReferenceHolder intreferenceholder = this.dataSlots.get(j);
if (intreferenceholder.checkAndClearUpdateFlag()) {
message.addData(j, intreferenceholder.get());
}
}
if (!message.getData().isEmpty()) {
for (IContainerListener listener : this.containerListeners) {
if (listener instanceof ServerPlayerEntity) {
Overloaded.proxy.networkWrapper.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) listener), message);
}
}
}
}
Aggregations