Search in sources :

Example 1 with TargetPoint

use of net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint in project ImmersiveEngineering by BluSunrize.

the class TileEntityBelljar method sendSyncPacket.

protected void sendSyncPacket(int type) {
    NBTTagCompound nbt = new NBTTagCompound();
    if (type == 0) {
        nbt.setFloat("growth", growth);
        nbt.setInteger("energy", energyStorage.getEnergyStored());
        nbt.setBoolean("renderActive", renderActive);
    } else if (type == 1) {
        nbt.setInteger("fertilizerAmount", fertilizerAmount);
        nbt.setFloat("fertilizerMod", fertilizerMod);
    } else if (type == 2)
        nbt.setTag("tank", tank.writeToNBT(new NBTTagCompound()));
    ImmersiveEngineering.packetHandler.sendToAllAround(new MessageTileSync(this, nbt), new TargetPoint(worldObj.provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 128));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) MessageTileSync(blusunrize.immersiveengineering.common.util.network.MessageTileSync)

Example 2 with TargetPoint

use of net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint in project ImmersiveEngineering by BluSunrize.

the class TileEntityBucketWheel method update.

@Override
public void update() {
    if (!formed || pos != 24)
        return;
    if (active) {
        rotation += IEConfig.Machines.excavator_speed;
        rotation %= 360;
    }
    if (worldObj.isRemote) {
        if (particleStack != null) {
            ImmersiveEngineering.proxy.spawnBucketWheelFX(this, particleStack);
            particleStack = null;
        }
    } else if (active && worldObj.getTotalWorldTime() % 20 == 0) {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setFloat("rotation", rotation);
        MessageTileSync sync = new MessageTileSync(this, nbt);
        ImmersiveEngineering.packetHandler.sendToAllAround(sync, new TargetPoint(worldObj.provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 100));
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) MessageTileSync(blusunrize.immersiveengineering.common.util.network.MessageTileSync)

Aggregations

MessageTileSync (blusunrize.immersiveengineering.common.util.network.MessageTileSync)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)2