Fixed tile data params not being sent correctly
package com.raoulvdberge.refinedstorage.tile.data;
import com.raoulvdberge.refinedstorage.RS;
-import com.raoulvdberge.refinedstorage.container.ContainerBase;
import com.raoulvdberge.refinedstorage.network.MessageTileDataParameter;
import com.raoulvdberge.refinedstorage.network.MessageTileDataParameterUpdate;
-import com.raoulvdberge.refinedstorage.tile.TileBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.inventory.Container;
import net.minecraft.tileentity.TileEntity;
import java.util.ArrayList;
@@ -81,26 +78,14 @@ public class TileDataManager {
}
public void sendParametersTo(EntityPlayerMP player) {
- for (TileDataParameter parameter : parameters) {
- sendParameter(player, parameter);
+ parameters.forEach(p -> sendParameter(player, p));
}
+
+ public void sendParameterToWatchers(TileDataParameter<?> parameter) {
+ watchers.forEach(p -> sendParameter((EntityPlayerMP) p, parameter));
}
public void sendParameter(EntityPlayerMP player, TileDataParameter<?> parameter) {
RS.INSTANCE.network.sendTo(new MessageTileDataParameter(tile, parameter), player);
}
-
- public void sendParameterToWatchers(TileDataParameter<?> parameter) {
- for (EntityPlayer player : tile.getWorld().playerEntities) {
- Container container = player.openContainer;
-
- if (container instanceof ContainerBase) {
- TileBase tile = ((ContainerBase) container).getTile();
-
- if (tile != null && tile.getPos().equals(this.tile.getPos())) {
- sendParameter((EntityPlayerMP) player, parameter);
- }
- }
- }
- }
}
