cpw.mods.fml.common.network.PacketDispatcher Java Examples

The following examples show how to use cpw.mods.fml.common.network.PacketDispatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiBusFluidImport.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int sizeX, int sizeY)
{
	PacketDispatcher.sendPacketToServer(new PacketBusFluidImport(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, 0, player.username).makePacket());
	Minecraft.getMinecraft().renderEngine.bindTexture(guiTexture);

	if (tileentity != null)
	{
		WidgetRedstoneModes redstoneSwitch = (WidgetRedstoneModes) buttonList.get(0);
		redstoneSwitch.setRedstoneMode(tileentity.getRedstoneMode());
		WidgetFluidModes fluidSwitch = (WidgetFluidModes) buttonList.get(1);
		fluidSwitch.setFluidMode(tileentity.getFluidMode());
	}

	this.fontRenderer.drawString(BlockEnum.FLUIDIMPORT.getStatName(), 5, 0, 0x000000);
}
 
Example #2
Source File: TileEntityTerminalFluid.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void setGrid(IGridInterface gi)
{
	if (!worldObj.isRemote)
	{
		grid = gi;
		if (gi != null)
		{
			IMEInventoryHandler cellArray = gi.getCellArray();
			if (cellArray != null)
				updateFluids(cellArray.getAvailableItems());
		} else
		{
			setPowerStatus(false);
		}
		PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	}
}
 
Example #3
Source File: TileEntityTerminalFluid.java    From ExtraCells1 with MIT License 6 votes vote down vote up
public void updateFluids(IItemList currentItems)
{
	fluidsInNetwork = new ArrayList<SpecialFluidStack>();

	if (grid != null)
	{
		for (IAEItemStack itemstack : currentItems)
		{
			if (itemstack.getItem() == FLUIDDISPLAY.getItemInstance() && itemstack.getStackSize() > 0)
			{
				fluidsInNetwork.add(new SpecialFluidStack(itemstack.getItemDamage(), itemstack.getStackSize()));
			}
		}
	}

	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
}
 
Example #4
Source File: TileEntityTerminalFluid.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@ForgeSubscribe
public void onNetworkPatternChange(GridPatternUpdateEvent e)
{
	if (grid != null)
	{
		IMEInventoryHandler inventoryHandler = grid.getCraftableArray();
		if (inventoryHandler != null)
		{
			craftableFluidsInNetwork = new ArrayList<Fluid>();
			for (IAEItemStack stack : inventoryHandler.getAvailableItems())
			{
				if (stack.getItem() == FLUIDDISPLAY.getItemInstance())
				{
					craftableFluidsInNetwork.add(FluidRegistry.getFluid(stack.getItemDamage()));
				}
			}
		}
	}
	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
}
 
Example #5
Source File: TileEntityMonitorStorageFluid.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void onNetworkInventoryChange(IItemList iss)
{
	long lastAmount = fluidAmount;
	fluidAmount = 0;
	if (fluid != null)
	{
		for (IAEItemStack stack : iss)
		{
			if (stack != null && stack.getItem() == ItemEnum.FLUIDDISPLAY.getItemInstance() && stack.getItemDamage() == fluid.getID())
			{
				fluidAmount += stack.getStackSize();
			}
		}
	}
	if (lastAmount != fluidAmount)
	{
		lastAmount = fluidAmount;
		PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	}
}
 
Example #6
Source File: BlockBusFluidStorage.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighbourID)
{
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityBusFluidStorage)
	{
		TileEntityBusFluidStorage storageBus = (TileEntityBusFluidStorage) blockTE;
		if (!world.isRemote)
		{
			storageBus.updateGrid();
			PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
			MinecraftForge.EVENT_BUS.post(new GridStorageUpdateEvent(world, new WorldCoord(x, y, z), storageBus.getGrid()));
		}
		ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));

		TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
		storageBus.setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
	}
}
 
Example #7
Source File: TileEntityMonitorStorageFluid.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void setGrid(IGridInterface gi)
{
	if (!worldObj.isRemote)
	{
		grid = gi;
		if (gi != null)
		{
			IMEInventoryHandler cellArray = gi.getCellArray();
			if (cellArray != null)
				onNetworkInventoryChange(cellArray.getAvailableItems());
		} else
		{
			setPowerStatus(false);
		}
		PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	}
}
 
Example #8
Source File: BlockBusFluidImport.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
	super.onNeighborBlockChange(world, x, y, z, neighborID);
	if (!world.isRemote)
	{
		if (world.getBlockTileEntity(x, y, z) instanceof TileEntityBusFluidImport)
			((TileEntityBusFluidImport) world.getBlockTileEntity(x, y, z)).setRedstoneStatus(world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z));
		PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
	}
	ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityBusFluidImport)
	{
		TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
		((TileEntityBusFluidImport) blockTE).setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
	}
}
 
Example #9
Source File: BlockBusFluidExport.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
	super.onNeighborBlockChange(world, x, y, z, neighborID);
	if (!world.isRemote)
	{
		if (world.getBlockTileEntity(x, y, z) instanceof TileEntityBusFluidExport)
			PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
		((TileEntityBusFluidExport) world.getBlockTileEntity(x, y, z)).setRedstoneStatus(world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z));
	}
	ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityBusFluidExport)
	{
		TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
		((TileEntityBusFluidExport) blockTE).setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
	}
}
 
Example #10
Source File: GuiBusFluidExport.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
	PacketDispatcher.sendPacketToServer(new PacketBusFluidExport(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, 0, player.username).makePacket());

	Minecraft.getMinecraft().renderEngine.bindTexture(guiTexture);

	if (tileentity != null)
	{
		WidgetRedstoneModes redstoneSwitch = (WidgetRedstoneModes) buttonList.get(0);
		redstoneSwitch.setRedstoneMode(tileentity.getRedstoneMode());
		WidgetFluidModes fluidSwitch = (WidgetFluidModes) buttonList.get(1);
		fluidSwitch.setFluidMode(tileentity.getFluidMode());
	}

	this.fontRenderer.drawString(BlockEnum.FLUIDEXPORT.getStatName(), 5, 0, 0x000000);
}
 
Example #11
Source File: GuiBusFluidStorage.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
protected void keyTyped(char key, int par2)
{
	if (textFieldPriority.isFocused())
	{
		textFieldPriority.textboxKeyTyped(key, par2);
		if (!textFieldPriority.getText().isEmpty())
		{
			try
			{
				int priority = Integer.valueOf(textFieldPriority.getText());
				PacketDispatcher.sendPacketToServer(new PacketBusFluidStorage(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, priority).makePacket());
			} catch (NumberFormatException e)
			{
			}

		}
	} else
	{
		super.keyTyped(key, par2);
	}
}
 
Example #12
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void sendStateInfo(EntityPlayer player, int state)
{
    // server sending state info. first packet int: 1 then int state

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(1));
        data.writeInt(Integer.valueOf(state));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;
    PacketDispatcher.sendPacketToPlayer(packet, (Player) player);

}
 
Example #13
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Used to synchronize the two bytes between server and client Used for the
 * MoCEntityG
 * 
 * @param ID
 *            = entity ID
 * @param dimension
 *            = worldDimension
 * @param slot
 *            = which slot in the array
 * @param value
 *            = the value to pass
 */
public static void sendTwoBytes(int ID, int dimension, byte slot, byte value)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(14));
        data.writeInt(Integer.valueOf(ID));
        data.writeByte(Byte.valueOf(slot));
        data.writeByte(Byte.valueOf(value));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);
}
 
Example #14
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * server sends the Appear horse command to each client
 * 
 * @param ID
 *            : Entity Horse ID
 * @param dimension
 *            : world dimension (this.worldObj.provider.dimensionId);)
 */
public static void sendAppearPacket(int ID, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(3));
        data.writeInt(Integer.valueOf(ID));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);
}
 
Example #15
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * server sends the Appear vanish command to each client
 * 
 * @param ID
 *            : Entity Horse ID
 * @param dimension
 *            : world dimension (this.worldObj.provider.dimensionId);)
 */
public static void sendVanishPacket(int ID, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(4));
        data.writeInt(Integer.valueOf(ID));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);

}
 
Example #16
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * server sends the Ogre explode command to each client
 * 
 * @param ID
 *            : Ogre entity ID
 * @param dimension
 *            : world dimension (this.worldObj.provider.dimensionId);)
 */
public static void sendExplodePacket(int ID, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(5));
        data.writeInt(Integer.valueOf(ID));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);

}
 
Example #17
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 
 * @param player
 * @param entityId
 */
public static void sendNameGUI(EntityPlayerMP player, int entityId)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(7));
        data.writeInt(Integer.valueOf(entityId));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
}
 
Example #18
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Used to synchronize Zebra shuffling counters/animations
 * 
 * @param ID
 *            : Entity Horse (Zebra) ID
 * @param dimension
 *            : world dimension (this.worldObj.provider.dimensionId);
 */
public static void sendShufflePacket(int ID, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(8));
        data.writeInt(Integer.valueOf(ID));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);

}
 
Example #19
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Stops the shuffle animation in Client Zebras
 * 
 * @param ID
 * @param dimension
 */
public static void sendStopShuffle(int ID, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(9));
        data.writeInt(Integer.valueOf(ID));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);

}
 
Example #20
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Used for heart breeding animation
 * 
 * @param ID
 * @param dimension
 */
public static void sendHeartPacket(int ID, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(10));
        data.writeInt(Integer.valueOf(ID));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);
}
 
Example #21
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Used to synchronize the attack animation
 * 
 * @param ID
 * @param dimension
 */
public static void sendAnimationPacket(int ID, int dimension, int animationType)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(11));
        data.writeInt(Integer.valueOf(ID));
        data.writeInt(Integer.valueOf(animationType));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);
}
 
Example #22
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void sendAttachedEntity(Entity source, Entity target, int dimension)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(13));
        data.writeInt(Integer.valueOf(source.entityId));
        data.writeInt(Integer.valueOf(target.entityId));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;
    //System.out.println("MOCServerHandler sending packet with sourceId " + source.entityId + ", entityId " + target.entityId);
    PacketDispatcher.sendPacketToAllInDimension(packet, dimension);
}
 
Example #23
Source File: MoCServerPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sends message to player
 * 
 * @param player
 * @param message
 */
public static void sendMsgToPlayer(EntityPlayerMP player, String message)
{
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(15));
        data.writeUTF(message);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
}
 
Example #24
Source File: GuiMEBattery.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void updateScreen()
{
	PacketDispatcher.sendPacketToServer(new PacketMEBattery(world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, player.username).makePacket());

	if (world.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) instanceof TileEntityMEBattery)
	{
		TileEntityMEBattery battery = (TileEntityMEBattery) world.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
		currentEnergy = battery.getMECurrentPower();
		maxEnergy = battery.getMEMaxPower();
	}
}
 
Example #25
Source File: TileEntityLevelEmitterFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void setAmount(long filterAmount)
{
	this.filterAmount += filterAmount;
	if (this.filterAmount < 0)
		this.filterAmount = 0;
	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
}
 
Example #26
Source File: TileEntityLevelEmitterFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void updateRedstoneStates()
{
	for (ForgeDirection currentSide : ForgeDirection.values())
	{
		Block neighbor = Block.blocksList[worldObj.getBlockId(xCoord + currentSide.offsetX, yCoord + currentSide.offsetY, zCoord + currentSide.offsetZ)];
		if (neighbor != null)
			neighbor.onNeighborBlockChange(worldObj, xCoord + currentSide.offsetX, yCoord + currentSide.offsetY, zCoord + currentSide.offsetZ, BlockEnum.FLUIDLEVELEMITTER.getBlockInstance().blockID);
	}
	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
 
Example #27
Source File: TileEntityMonitorStorageFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void setNetworkReady(boolean isReady)
{
	networkReady = isReady;

	if (getGrid() != null)
	{
		IMEInventoryHandler cellArray = getGrid().getCellArray();
		if (cellArray != null)
			onNetworkInventoryChange(cellArray.getAvailableItems());
	}

	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
}
 
Example #28
Source File: GuiLevelEmitterFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void actionPerformed(GuiButton button)
{
	switch (button.id)
	{
	case 0:
		modifyAmount(-1);
		break;
	case 1:
		modifyAmount(-10);
		break;
	case 2:
		modifyAmount(-100);
		break;
	case 3:
		modifyAmount(+1);
		break;
	case 4:
		modifyAmount(+10);
		break;
	case 5:
		modifyAmount(+100);
		break;
	case 6:
		PacketDispatcher.sendPacketToServer(new PacketLevelEmitterFluid(tileentity.worldObj, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord).makePacket());
		break;

	}
}
 
Example #29
Source File: TileEntityMonitorStorageFluid.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void setPowerStatus(boolean hasPower)
{
	powerStatus = hasPower;
	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
 
Example #30
Source File: WidgetFluidSelector.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void mouseClicked(int posX, int posY, int mouseX, int mouseY)
{
	if (fluid != null && isPointInRegion(posX, posY, sizeX, sizeY, mouseX, mouseY))
	{
		TileEntityTerminalFluid terminalFluid = guiTerminalFluid.tileEntity;
		PacketDispatcher.sendPacketToServer(new PacketTerminalFluid(terminalFluid.worldObj, terminalFluid.xCoord, terminalFluid.yCoord, terminalFluid.zCoord, fluid).makePacket());
		selected = true;
		guiTerminalFluid.updateSelected(this);
		guiTerminalFluid.currentFluidAmount = amount;
		guiTerminalFluid.currentFluidName = fluid.getLocalizedName();
	}
}