This commit is contained in:
eaglercraft 2024-11-20 20:24:20 -08:00
commit 8b8ae0669a
30 changed files with 169 additions and 198 deletions

View file

@ -600,10 +600,11 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback {
}
i = applyEaglerScale(scaleFac, i * this.width / this.mc.displayWidth, this.width);
j = applyEaglerScale(scaleFac, this.height - j * this.height / this.mc.displayHeight - 1, this.height);
float si = Touch.getEventTouchRadiusX(t) * this.width / this.mc.displayWidth / scaleFac;
float rad = Touch.getEventTouchRadiusMixed(t);
float si = rad * this.width / this.mc.displayWidth / scaleFac;
if (si < 1.0f)
si = 1.0f;
float sj = Touch.getEventTouchRadiusY(t) * this.height / this.mc.displayHeight / scaleFac;
float sj = rad * this.height / this.mc.displayHeight / scaleFac;
if (sj < 1.0f)
sj = 1.0f;
int[] ck = touchStarts.remove(u);

View file

@ -92,7 +92,6 @@ public class ChunkRenderWorker {
this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer,
generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer),
generator.getRenderChunk(), compiledchunk);
generator.getRenderChunk().setCompiledChunk(compiledchunk);
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
}
}
@ -107,7 +106,6 @@ public class ChunkRenderWorker {
.getWorldRendererByLayer(EnumWorldBlockLayer.REALISTIC_WATER),
generator.getRenderChunk(), compiledchunk);
}
generator.getRenderChunk().setCompiledChunk(compiledchunk);
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
}

View file

@ -1,5 +1,6 @@
package net.minecraft.client.renderer.chunk;
import java.util.Arrays;
import java.util.List;
import com.google.common.collect.Lists;
@ -30,7 +31,7 @@ import net.minecraft.util.EnumWorldBlockLayer;
*
*/
public class CompiledChunk {
public static final CompiledChunk DUMMY = new CompiledChunk() {
public static final CompiledChunk DUMMY = new CompiledChunk(null) {
protected void setLayerUsed(EnumWorldBlockLayer layer) {
throw new UnsupportedOperationException();
}
@ -43,6 +44,7 @@ public class CompiledChunk {
return true;
}
};
private final RenderChunk chunk;
private final boolean[] layersUsed = new boolean[EnumWorldBlockLayer._VALUES.length];
private final boolean[] layersStarted = new boolean[EnumWorldBlockLayer._VALUES.length];
private boolean empty = true;
@ -51,6 +53,20 @@ public class CompiledChunk {
private WorldRenderer.State state;
private WorldRenderer.State stateWater;
public CompiledChunk(RenderChunk chunk) {
this.chunk = chunk;
}
public void reset() {
Arrays.fill(layersUsed, false);
Arrays.fill(layersStarted, false);
empty = true;
tileEntities.clear();
setVisibility.setAllVisible(false);
setState(null);
setStateRealisticWater(null);
}
public boolean isEmpty() {
return this.empty;
}
@ -93,6 +109,9 @@ public class CompiledChunk {
}
public void setState(WorldRenderer.State stateIn) {
if (this.state != stateIn && this.state != null) {
this.state.release();
}
this.state = stateIn;
}
@ -101,6 +120,9 @@ public class CompiledChunk {
}
public void setStateRealisticWater(WorldRenderer.State stateIn) {
if (this.stateWater != stateIn && this.stateWater != null) {
this.stateWater.release();
}
this.stateWater = stateIn;
}
}

View file

@ -131,7 +131,11 @@ public class RenderChunk {
}
public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator) {
CompiledChunk compiledchunk = new CompiledChunk();
if (compiledChunk == CompiledChunk.DUMMY) {
compiledChunk = new CompiledChunk(this);
} else {
compiledChunk.reset();
}
boolean flag = true;
BlockPos blockpos = this.position;
BlockPos blockpos1 = blockpos.add(15, 15, 15);
@ -142,7 +146,7 @@ public class RenderChunk {
}
regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
generator.setCompiledChunk(compiledchunk);
generator.setCompiledChunk(compiledChunk);
VisGraph visgraph = new VisGraph();
HashSet hashset = Sets.newHashSet();
@ -163,7 +167,7 @@ public class RenderChunk {
TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance
.getSpecialRenderer(tileentity);
if (tileentity != null && tileentityspecialrenderer != null) {
compiledchunk.addTileEntity(tileentity);
compiledChunk.addTileEntity(tileentity);
if (tileentityspecialrenderer.func_181055_a()) {
hashset.add(tileentity);
}
@ -174,8 +178,8 @@ public class RenderChunk {
int i = enumworldblocklayer1.ordinal();
if (block.getRenderType() != -1) {
WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(i);
if (!compiledchunk.isLayerStarted(enumworldblocklayer1)) {
compiledchunk.setLayerStarted(enumworldblocklayer1);
if (!compiledChunk.isLayerStarted(enumworldblocklayer1)) {
compiledChunk.setLayerStarted(enumworldblocklayer1);
this.preRenderBlocks(worldrenderer, blockpos);
}
@ -186,8 +190,8 @@ public class RenderChunk {
enumworldblocklayer1 = EnumWorldBlockLayer.GLASS_HIGHLIGHTS;
worldrenderer = generator.getRegionRenderCacheBuilder()
.getWorldRendererByLayerId(enumworldblocklayer1.ordinal());
if (!compiledchunk.isLayerStarted(enumworldblocklayer1)) {
compiledchunk.setLayerStarted(enumworldblocklayer1);
if (!compiledChunk.isLayerStarted(enumworldblocklayer1)) {
compiledChunk.setLayerStarted(enumworldblocklayer1);
this.preRenderBlocks(worldrenderer, blockpos);
}
@ -201,18 +205,18 @@ public class RenderChunk {
for (int i = 0; i < layers.length; ++i) {
EnumWorldBlockLayer enumworldblocklayer = layers[i];
if (aboolean[enumworldblocklayer.ordinal()]) {
compiledchunk.setLayerUsed(enumworldblocklayer);
compiledChunk.setLayerUsed(enumworldblocklayer);
}
if (compiledchunk.isLayerStarted(enumworldblocklayer)) {
if (compiledChunk.isLayerStarted(enumworldblocklayer)) {
this.postRenderBlocks(enumworldblocklayer, x, y, z,
generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer),
compiledchunk);
compiledChunk);
}
}
}
compiledchunk.setVisibility(visgraph.computeVisibility());
compiledChunk.setVisibility(visgraph.computeVisibility());
HashSet hashset1 = Sets.newHashSet(hashset);
HashSet hashset2 = Sets.newHashSet(this.field_181056_j);
@ -287,13 +291,13 @@ public class RenderChunk {
return this.compiledChunk;
}
public void setCompiledChunk(CompiledChunk compiledChunkIn) {
this.compiledChunk = compiledChunkIn;
}
public void stopCompileTask() {
this.finishCompileTask();
this.compiledChunk = CompiledChunk.DUMMY;
if (this.compiledChunk != CompiledChunk.DUMMY) {
this.compiledChunk.setState(null);
this.compiledChunk.setStateRealisticWater(null);
this.compiledChunk = CompiledChunk.DUMMY;
}
}
public void deleteGlResources() {

View file

@ -213,7 +213,7 @@ public class GameSettings {
public boolean hasShownProfanityFilter = false;
public float touchControlOpacity = 1.0f;
public boolean hideDefaultUsernameWarning = false;
public boolean hideVideoSettingsWarning = false;
public boolean hideVideoSettingsWarning = EagRuntime.getPlatformType() == EnumPlatformType.DESKTOP;
public int voiceListenRadius = 16;
public float voiceListenVolume = 0.5f;

View file

@ -115,7 +115,8 @@ public abstract class TileEntity {
tileentity = (TileEntity) oclass.get();
}
} catch (Exception exception) {
logger.error("Could not create TileEntity", exception);
logger.error("Could not create TileEntity");
logger.error(exception);
}
if (tileentity != null) {

View file

@ -61,7 +61,7 @@ public class BlockPos extends Vec3i {
}
public BlockPos(Vec3i source) {
this(source.getX(), source.getY(), source.getZ());
this(source.x, source.y, source.z);
}
/**+

View file

@ -1929,7 +1929,7 @@ public abstract class World implements IBlockAccess {
public void setTileEntity(BlockPos pos, TileEntity tileEntityIn) {
if (tileEntityIn != null && !tileEntityIn.isInvalid()) {
if (this.processingLoadedTiles) {
tileEntityIn.setPos(pos);
tileEntityIn.setPos(new BlockPos(pos));
Iterator iterator = this.addedTileEntityList.iterator();
while (iterator.hasNext()) {

View file

@ -261,6 +261,9 @@ public class Chunk {
}
private void recheckGaps(boolean parFlag) {
if (!this.worldObj.isRemote) {
++EaglerMinecraftServer.counterLightUpdate;
}
if (this.worldObj.isAreaLoaded(new BlockPos(this.xPosition * 16 + 8, 0, this.zPosition * 16 + 8), 16)) {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
@ -766,11 +769,12 @@ public class Chunk {
public TileEntity getTileEntity(BlockPos blockpos, Chunk.EnumCreateEntityType chunk$enumcreateentitytype) {
TileEntity tileentity = (TileEntity) this.chunkTileEntityMap.get(blockpos);
if (tileentity == null) {
BlockPos pos2 = new BlockPos(blockpos);
if (chunk$enumcreateentitytype == Chunk.EnumCreateEntityType.IMMEDIATE) {
tileentity = this.createNewTileEntity(blockpos);
this.worldObj.setTileEntity(blockpos, tileentity);
tileentity = this.createNewTileEntity(pos2);
this.worldObj.setTileEntity(pos2, tileentity);
} else if (chunk$enumcreateentitytype == Chunk.EnumCreateEntityType.QUEUED) {
this.tileEntityPosQueue.add(blockpos);
this.tileEntityPosQueue.add(pos2);
}
} else if (tileentity.isInvalid()) {
this.chunkTileEntityMap.remove(blockpos);
@ -790,6 +794,7 @@ public class Chunk {
public void addTileEntity(BlockPos blockpos, TileEntity tileentity) {
tileentity.setWorldObj(this.worldObj);
blockpos = new BlockPos(blockpos);
tileentity.setPos(blockpos);
if (this.getBlock(blockpos) instanceof ITileEntityProvider) {
if (this.chunkTileEntityMap.containsKey(blockpos)) {