mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 04:32:23 +00:00
40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
/**
|
|
* This class was created by <Vazkii>. It's distributed as
|
|
* part of the Botania Mod. Get the Source Code in github:
|
|
* https://github.com/Vazkii/Botania
|
|
*
|
|
* Botania is Open Source and distributed under the
|
|
* Botania License: http://botaniamod.net/license.php
|
|
*
|
|
* File Created @ [Apr 9, 2015, 9:38:44 PM (GMT)]
|
|
*/
|
|
package vazkii.botania.api.internal;
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.WorldServer;
|
|
|
|
public final class VanillaPacketDispatcher {
|
|
|
|
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
|
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
|
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
|
|
}
|
|
|
|
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
|
|
TileEntity tile = world.getTileEntity(pos);
|
|
if(tile != null)
|
|
dispatchTEToNearbyPlayers(tile);
|
|
}
|
|
|
|
public static float pointDistancePlane(double x1, double y1, double x2, double y2) {
|
|
return (float) Math.hypot(x1 - x2, y1 - y2);
|
|
}
|
|
|
|
}
|