本文整理汇总了Java中net.minecraft.network.play.server.SPacketChunkData类的典型用法代码示例。如果您正苦于以下问题:Java SPacketChunkData类的具体用法?Java SPacketChunkData怎么用?Java SPacketChunkData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SPacketChunkData类属于net.minecraft.network.play.server包,在下文中一共展示了SPacketChunkData类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: finishChunks
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
public void finishChunks() {
PlayerChunkMap playerChunkMap = serverWorld.getPlayerChunkMap();
if (playerChunkMap == null) {
return;
}
for (Chunk chunk : modifiedChunks) {
chunk.setModified(true);
chunk.generateSkylightMap(); //This is where this falls short. It can calculate basic sky lighting for blocks exposed to the sky but thats it.
PlayerChunkMapEntry watcher = playerChunkMap.getEntry(chunk.xPosition, chunk.zPosition);
if (watcher != null) {
watcher.sendPacket(new SPacketChunkData(chunk, 65535));
}
}
modifiedChunks.clear();
}
示例2: performOperation
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
@Override
public int performOperation(Region region, PositionIterator chunk, World world, Chunk c, VectorMap<BlockData> blockMap,
MutableVectorMap<IBlockState> hitStore) {
// send the whole chunk again
PlayerChunkMapEntry entry = ((WorldServer) world).getPlayerChunkMap().getEntry(c.x, c.z);
if (entry != null) {
entry.sendPacket(new SPacketChunkData(c, SPCD_SEND_ALL));
}
return 1;
}
示例3: handleChunkData
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
/**
* Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation
*/
public void handleChunkData(SPacketChunkData packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (packetIn.doChunkLoad())
{
this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), true);
}
this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15);
Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.fillChunk(packetIn.getReadBuffer(), packetIn.getExtractedSize(), packetIn.doChunkLoad());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15);
if (!packetIn.doChunkLoad() || !(this.clientWorldController.provider instanceof WorldProviderSurface))
{
chunk.resetRelightChecks();
}
for (NBTTagCompound nbttagcompound : packetIn.getTileEntityTags())
{
BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
TileEntity tileentity = this.clientWorldController.getTileEntity(blockpos);
if (tileentity != null)
{
tileentity.readFromNBT(nbttagcompound);
}
}
}
示例4: sendToPlayers
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
public boolean sendToPlayers()
{
if (this.sentToPlayers)
{
return true;
}
else if (this.chunk == null)
{
return false;
}
else if (!this.chunk.isPopulated())
{
return false;
}
else
{
this.changes = 0;
this.changedSectionFilter = 0;
this.sentToPlayers = true;
Packet<?> packet = new SPacketChunkData(this.chunk, 65535);
for (EntityPlayerMP entityplayermp : this.players)
{
entityplayermp.connection.sendPacket(packet);
this.playerChunkMap.getWorldServer().getEntityTracker().sendLeashedEntitiesInChunk(entityplayermp, this.chunk);
}
return true;
}
}
示例5: sendNearbySpecialEntities
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
/**
* Send packets to player for:
* - nearby tile entities
* - nearby entities that are leashed
* - nearby entities with
*/
public void sendNearbySpecialEntities(EntityPlayerMP player)
{
if (this.sentToPlayers)
{
player.connection.sendPacket(new SPacketChunkData(this.chunk, 65535));
this.playerChunkMap.getWorldServer().getEntityTracker().sendLeashedEntitiesInChunk(player, this.chunk);
}
}
示例6: handleChunkData
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
/**
* Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation
*/
public void handleChunkData(SPacketChunkData packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (packetIn.doChunkLoad())
{
this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), true);
}
this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15);
Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.fillChunk(packetIn.getReadBuffer(), packetIn.getExtractedSize(), packetIn.doChunkLoad());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15);
if (!packetIn.doChunkLoad() || !(this.clientWorldController.provider instanceof WorldProviderSurface))
{
chunk.resetRelightChecks();
}
for (NBTTagCompound nbttagcompound : packetIn.getTileEntityTags())
{
BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
TileEntity tileentity = this.clientWorldController.getTileEntity(blockpos);
if (tileentity != null)
{
tileentity.handleUpdateTag(nbttagcompound);
}
}
}
示例7: sentToPlayers
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
public boolean sentToPlayers()
{
if (this.sentToPlayers)
{
return true;
}
else if (this.chunk == null)
{
return false;
}
else if (!this.chunk.isPopulated())
{
return false;
}
else
{
this.changes = 0;
this.changedSectionFilter = 0;
this.sentToPlayers = true;
Packet<?> packet = new SPacketChunkData(this.chunk, 65535);
for (EntityPlayerMP entityplayermp : this.players)
{
entityplayermp.connection.sendPacket(packet);
this.playerChunkMap.getWorldServer().getEntityTracker().sendLeashedEntitiesInChunk(entityplayermp, this.chunk);
// chunk watch event - delayed to here as the chunk wasn't ready in addPlayer
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.pos, entityplayermp));
}
return true;
}
}
示例8: notifyChunk
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
/**
* Notify all nearby players about chunk changes
* @param chunk Chunk to notify
*/
public void notifyChunk(Chunk chunk) {
for (EntityPlayer player : world.playerEntities) {
if (player instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) player;
if ( Math.abs(playerMP.chunkCoordX - chunk.xPosition) <= 32 &&
Math.abs(playerMP.chunkCoordZ - chunk.zPosition) <= 32) {
playerMP.connection.sendPacket(new SPacketChunkData(chunk, 65535));
}
}
}
}
示例9: notifyChunk
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
/**
* Notify all nearby players about chunk changes
* @param chunk Chunk to notify
*/
public void notifyChunk(Chunk chunk) {
for (EntityPlayer player : world.playerEntities) {
if (player instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) player;
if ( Math.abs(playerMP.chunkCoordX - chunk.x) <= 32 &&
Math.abs(playerMP.chunkCoordZ - chunk.z) <= 32) {
playerMP.connection.sendPacket(new SPacketChunkData(chunk, 65535));
}
}
}
}
示例10: update
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
public void update()
{
if (this.sentToPlayers && this.chunk != null)
{
if (this.changes != 0)
{
if (this.changes == 1)
{
int i = (this.changedBlocks[0] >> 12 & 15) + this.pos.chunkXPos * 16;
int j = this.changedBlocks[0] & 255;
int k = (this.changedBlocks[0] >> 8 & 15) + this.pos.chunkZPos * 16;
BlockPos blockpos = new BlockPos(i, j, k);
this.sendPacket(new SPacketBlockChange(this.playerChunkMap.getWorldServer(), blockpos));
if (this.playerChunkMap.getWorldServer().getBlockState(blockpos).getBlock().hasTileEntity())
{
this.sendBlockEntity(this.playerChunkMap.getWorldServer().getTileEntity(blockpos));
}
}
else if (this.changes == 64)
{
this.sendPacket(new SPacketChunkData(this.chunk, this.changedSectionFilter));
}
else
{
this.sendPacket(new SPacketMultiBlockChange(this.changes, this.changedBlocks, this.chunk));
for (int l = 0; l < this.changes; ++l)
{
int i1 = (this.changedBlocks[l] >> 12 & 15) + this.pos.chunkXPos * 16;
int j1 = this.changedBlocks[l] & 255;
int k1 = (this.changedBlocks[l] >> 8 & 15) + this.pos.chunkZPos * 16;
BlockPos blockpos1 = new BlockPos(i1, j1, k1);
if (this.playerChunkMap.getWorldServer().getBlockState(blockpos1).getBlock().hasTileEntity())
{
this.sendBlockEntity(this.playerChunkMap.getWorldServer().getTileEntity(blockpos1));
}
}
}
this.changes = 0;
this.changedSectionFilter = 0;
}
}
}
示例11: execute
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] params)
{
EntityPlayerMP player;
try {
player = getCommandSenderAsPlayer(sender);
} catch (PlayerNotFoundException e) {
return;
}
if(!player.isCreative())
return;
WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.getDimension());
if(player.getEntityWorld().provider.getDimension() == 0 && params.length == 1)
{
int radius = Integer.parseInt(params[0]);
for(int i = -radius; i <= radius; i++)
{
for(int k = -radius; k <= radius; k++)
{
int x = (((int)player.posX+i*16) >> 4);
int z = (((int)player.posZ+k*16) >> 4);
ChunkProviderServer cps = world.getChunkProvider();
Chunk c = cps.chunkGenerator.provideChunk(x, z);
Chunk old = world.getChunkProvider().provideChunk(x, z);
old.setStorageArrays(c.getBlockStorageArray());
c.setTerrainPopulated(false);
c.onChunkLoad();
c.setChunkModified();
c.checkLight();
cps.chunkGenerator.populate(c.xPosition, c.zPosition);
net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(c.xPosition, c.zPosition, world, cps.chunkGenerator, world.getChunkProvider());
c.setChunkModified();
player.connection.sendPacket(new SPacketChunkData(cps.provideChunk(x, z), 0xffffffff));
}
}
/*for(int i = -radius; i <= radius; i++)
{
for(int k = -radius; k <= radius; k++)
{
int x = (((int)player.posX+i*16) >> 4);
int z = (((int)player.posZ+k*16) >> 4);
ChunkProviderServer cps = world.getChunkProvider();
Chunk c = cps.chunkGenerator.provideChunk(x, z);
Chunk old = world.getChunkProvider().provideChunk(x, z);
old.populateChunk(cps, cps.chunkGenerator);
if (c.isTerrainPopulated())
{
if (cps.chunkGenerator.generateStructures(c, c.xPosition, c.zPosition))
{
c.setChunkModified();
}
}
else
{
c.checkLight();
cps.chunkGenerator.populate(c.xPosition, c.zPosition);
net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(c.xPosition, c.zPosition, world, cps.chunkGenerator, world.getChunkProvider());
c.setChunkModified();
}
player.connection.sendPacket(new SPacketChunkData(cps.provideChunk(x, z), 0xffffffff));
}
}*/
}
else if(player.getEntityWorld().provider.getDimension() == 0 && params.length == 2 && params[1].equalsIgnoreCase("hex"))
{
execute(server, sender, new String[] {params[0]});
IslandMap map = Core.getMapForWorld(world, player.getPosition());
HexGenRegistry.generate(Core.getMapForWorld(world, player.getPosition()), map.getClosestCenter(player.getPosition()), world);
}
}
示例12: handleChunkData
import net.minecraft.network.play.server.SPacketChunkData; //导入依赖的package包/类
/**
* Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation
*/
void handleChunkData(SPacketChunkData packetIn);