admin 管理员组文章数量: 887021
2024年1月18日发(作者:免费网络课程平台)
我的世界java代码_我的世界源代码(转载:java)public class ExtendedBlockStorage{/** Contains the bottom-most Y block represented by this ExtendedBlockStorage. Typically a multiple of 16. */private int yBase;/** A total count of the number of non-air blocks in this block storage's Chunk. */private int blockRefCount;/*** Contains the number of blocks in this block storage's parent chunk that require random ticking. Used to cull the* Chunk from random tick updates for performance reasons.*/private int tickRefCount;private char[] data;/** The NibbleArray containing a block of Block-light data. */private NibbleArray blocklightArray;/** The NibbleArray containing a block of Sky-light data. */private NibbleArray skylightArray;public ExtendedBlockStorage(int y, boolean storeSkylight){ = y; = new char[4096];ightArray = new NibbleArray();if (storeSkylight){htArray = new NibbleArray();}}public IBlockState get(int x, int y, int z){IBlockState iblockstate = (IBlockState)_STATE_alue([y << 8 | z << 4 | x]);return iblockstate != null ? iblockstate : aultState();}public void set(int x, int y, int z, IBlockState state){
if (state instanceof dedBlockState)state = ((dedBlockState) state).getClean();IBlockState iblockstate1 = (x, y, z);Block block = ck();Block block1 = ck();if (block != ){--efCount;if (kRandomly()){--fCount;}}if (block1 != ){++efCount;if (kRandomly()){++fCount;}}[y << 8 | z << 4 | x] = (char)_STATE_(state);}/*** Returns the block for a location in a chunk, with the extended ID merged from a byte array and a NibbleArray to* form a full 12-bit block ID.*/public Block getBlockByExtId(int x, int y, int z){return (x, y, z).getBlock();}/*** Returns the metadata associated with the block at the given coordinates in this ExtendedBlockStorage.*/
public int getExtBlockMetadata(int x, int y, int z){IBlockState iblockstate = (x, y, z);return ck().getMetaFromState(iblockstate);}/*** Returns whether or not this block storage's Chunk is fully empty, based on its internal reference count.*/public boolean isEmpty(){return efCount == 0;}/*** Returns whether or not this block storage's Chunk will require random ticking, used to avoid looping through* random block ticks when there are no blocks that would randomly tick.*/public boolean getNeedsRandomTick(){return fCount > 0;}/*** Returns the Y location of this ExtendedBlockStorage.*/public int getYLocation(){return ;}/*** Sets the saved Sky-light value in the extended block storage structure.*/public void setExtSkylightValue(int x, int y, int z, int value){(x, y, z, value);}
/*** Gets the saved Sky-light value in the extended block storage structure.*/public int getExtSkylightValue(int x, int y, int z){return (x, y, z);}/*** Sets the saved Block-light value in the extended block storage structure.*/public void setExtBlocklightValue(int x, int y, int z, int value){(x, y, z, value);}/*** Gets the saved Block-light value in the extended block storage structure.*/public int getExtBlocklightValue(int x, int y, int z){return (x, y, z);}public void removeInvalidBlocks(){efCount = 0;fCount = 0;for (int i = 0; i < 16; ++i){for (int j = 0; j < 16; ++j){for (int k = 0; k < 16; ++k){Block block = ckByExtId(i, j, k);if (block != ){
++efCount;if (kRandomly()){++fCount;}}}}}}public char[] getData(){return ;}public void setData(char[] dataArray){ = dataArray;}/*** Returns the NibbleArray instance containing Block-light data.*/public NibbleArray getBlocklightArray(){return ightArray;}/*** Returns the NibbleArray instance containing Sky-light data.*/public NibbleArray getSkylightArray(){return htArray;}/*** Sets the NibbleArray instance used for Block-light values in this particular storage block.
{boolean flag = true;boolean flag1 = true;boolean flag2 = true;boolean flag3 = true;int i = 0;rMessage("tingTerrain");byte b0 = 0;("Preparing start region for level " + b0);WorldServer worldserver = ld(b0);BlockPos blockpos = wnPoint();long j = getCurrentTimeMillis();for (int k = -192; k <= 192 && erRunning(); k += 16){for (int l = -192; l <= 192 && erRunning(); l += 16){long i1 = getCurrentTimeMillis();if (i1 - j > 1000L){PercentRemaining("Preparing spawn area", i * 100 / 625);j = i1;}++i;unk(() + k >> 4, () + l >> 4);}}urrentTask();}对应PlayerInstance中的public void addPlayer(EntityPlayerMP playerMP){if (ns(playerMP)){
("Failed to add player. {} already is in chunk {}, {}", new Object[] {playerMP,f(Pos), f(Pos)});}else{if (y()){usWorldTime = alWorldTime();}(playerMP);Runnable playerRunnable = null;if (){(oords);}else{final EntityPlayerMP tmp = playerMP;playerRunnable = new Runnable(){public void run(){(oords);}};ecraftServer().unk(Pos,Pos, playerRunnable);}(playerMP, playerRunnable);}Chunk加载对应的回调函数/*** Called when this Chunk is loaded by the ChunkProvider*/public void onChunkLoad()
{kLoaded = true;eEntities(());for (int i = 0; i < ; ++i){Iterator iterator = Lists[i].iterator();while (t()){Entity entity = (Entity)();kLoad();}tities((Lists[i]));}_(new (this));}
版权声明:本文标题:我的世界java代码_我的世界源代码(转载:java) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1705535669h488952.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论