Dynamic Lights
This commit is contained in:
parent
577e01f0ac
commit
8452864d1e
73829
javascript/classes.js
73829
javascript/classes.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -418,4 +418,15 @@ public class Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isDynamicLights() {
|
||||||
|
return Minecraft.getMinecraft().gameSettings.ofDynamicLights != 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDynamicLightsFast() {
|
||||||
|
return Minecraft.getMinecraft().gameSettings.ofDynamicLights == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDynamicHandLight() {
|
||||||
|
return !isDynamicLights() ? false : true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
157
src/main/java/net/PeytonPlayz585/shadow/DynamicLight.java
Normal file
157
src/main/java/net/PeytonPlayz585/shadow/DynamicLight.java
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
package net.PeytonPlayz585.shadow;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import net.minecraft.client.renderer.chunk.CompiledChunk;
|
||||||
|
import net.minecraft.client.renderer.chunk.RenderChunk;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class DynamicLight {
|
||||||
|
private Entity entity = null;
|
||||||
|
private double offsetY = 0.0D;
|
||||||
|
private double lastPosX = -2.147483648E9D;
|
||||||
|
private double lastPosY = -2.147483648E9D;
|
||||||
|
private double lastPosZ = -2.147483648E9D;
|
||||||
|
private int lastLightLevel = 0;
|
||||||
|
private boolean underwater = false;
|
||||||
|
private long timeCheckMs = 0L;
|
||||||
|
private Set < BlockPos > setLitChunkPos = new HashSet();
|
||||||
|
private BlockPos.MutableBlockPos blockPosMutable = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
public DynamicLight(Entity p_i36_1_) {
|
||||||
|
this.entity = p_i36_1_;
|
||||||
|
this.offsetY = (double) p_i36_1_.getEyeHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(RenderGlobal p_update_1_) {
|
||||||
|
if (Config.isDynamicLightsFast()) {
|
||||||
|
long i = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if (i < this.timeCheckMs + 500L) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.timeCheckMs = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
double d6 = this.entity.posX - 0.5D;
|
||||||
|
double d0 = this.entity.posY - 0.5D + this.offsetY;
|
||||||
|
double d1 = this.entity.posZ - 0.5D;
|
||||||
|
int j = DynamicLights.getLightLevel(this.entity);
|
||||||
|
double d2 = d6 - this.lastPosX;
|
||||||
|
double d3 = d0 - this.lastPosY;
|
||||||
|
double d4 = d1 - this.lastPosZ;
|
||||||
|
double d5 = 0.1D;
|
||||||
|
|
||||||
|
if (Math.abs(d2) > d5 || Math.abs(d3) > d5 || Math.abs(d4) > d5 || this.lastLightLevel != j) {
|
||||||
|
this.lastPosX = d6;
|
||||||
|
this.lastPosY = d0;
|
||||||
|
this.lastPosZ = d1;
|
||||||
|
this.lastLightLevel = j;
|
||||||
|
this.underwater = false;
|
||||||
|
World world = p_update_1_.getWorld();
|
||||||
|
|
||||||
|
if (world != null) {
|
||||||
|
this.blockPosMutable.func_181079_c(MathHelper.floor_double(d6), MathHelper.floor_double(d0), MathHelper.floor_double(d1));
|
||||||
|
IBlockState iblockstate = world.getBlockState(this.blockPosMutable);
|
||||||
|
Block block = iblockstate.getBlock();
|
||||||
|
this.underwater = block == Blocks.water;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set < BlockPos > set = new HashSet();
|
||||||
|
|
||||||
|
if (j > 0) {
|
||||||
|
EnumFacing enumfacing2 = (MathHelper.floor_double(d6) & 15) >= 8 ? EnumFacing.EAST : EnumFacing.WEST;
|
||||||
|
EnumFacing enumfacing = (MathHelper.floor_double(d0) & 15) >= 8 ? EnumFacing.UP : EnumFacing.DOWN;
|
||||||
|
EnumFacing enumfacing1 = (MathHelper.floor_double(d1) & 15) >= 8 ? EnumFacing.SOUTH : EnumFacing.NORTH;
|
||||||
|
BlockPos blockpos = new BlockPos(d6, d0, d1);
|
||||||
|
RenderChunk renderchunk = p_update_1_.viewFrustum.getRenderChunk(blockpos);
|
||||||
|
RenderChunk renderchunk1 = p_update_1_.viewFrustum.getRenderChunk(renderchunk, enumfacing2);
|
||||||
|
RenderChunk renderchunk2 = p_update_1_.viewFrustum.getRenderChunk(renderchunk, enumfacing1);
|
||||||
|
RenderChunk renderchunk3 = p_update_1_.viewFrustum.getRenderChunk(renderchunk1, enumfacing1);
|
||||||
|
RenderChunk renderchunk4 = p_update_1_.viewFrustum.getRenderChunk(renderchunk, enumfacing);
|
||||||
|
RenderChunk renderchunk5 = p_update_1_.viewFrustum.getRenderChunk(renderchunk4, enumfacing2);
|
||||||
|
RenderChunk renderchunk6 = p_update_1_.viewFrustum.getRenderChunk(renderchunk4, enumfacing1);
|
||||||
|
RenderChunk renderchunk7 = p_update_1_.viewFrustum.getRenderChunk(renderchunk5, enumfacing1);
|
||||||
|
this.updateChunkLight(renderchunk, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk1, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk2, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk3, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk4, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk5, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk6, this.setLitChunkPos, set);
|
||||||
|
this.updateChunkLight(renderchunk7, this.setLitChunkPos, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateLitChunks(p_update_1_);
|
||||||
|
this.setLitChunkPos = set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set < BlockPos > p_updateChunkLight_2_, Set < BlockPos > p_updateChunkLight_3_) {
|
||||||
|
if (p_updateChunkLight_1_ != null) {
|
||||||
|
CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk();
|
||||||
|
|
||||||
|
if (compiledchunk != null && !compiledchunk.isEmpty()) {
|
||||||
|
p_updateChunkLight_1_.setNeedsUpdate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockPos blockpos = p_updateChunkLight_1_.getPosition();
|
||||||
|
|
||||||
|
if (p_updateChunkLight_2_ != null) {
|
||||||
|
p_updateChunkLight_2_.remove(blockpos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_updateChunkLight_3_ != null) {
|
||||||
|
p_updateChunkLight_3_.add(blockpos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLitChunks(RenderGlobal p_updateLitChunks_1_) {
|
||||||
|
for (BlockPos blockpos: this.setLitChunkPos) {
|
||||||
|
RenderChunk renderchunk = p_updateLitChunks_1_.viewFrustum.getRenderChunk(blockpos);
|
||||||
|
this.updateChunkLight(renderchunk, (Set < BlockPos > ) null, (Set < BlockPos > ) null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastPosX() {
|
||||||
|
return this.lastPosX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastPosY() {
|
||||||
|
return this.lastPosY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastPosZ() {
|
||||||
|
return this.lastPosZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastLightLevel() {
|
||||||
|
return this.lastLightLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUnderwater() {
|
||||||
|
return this.underwater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getOffsetY() {
|
||||||
|
return this.offsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "Entity: " + this.entity + ", offsetY: " + this.offsetY;
|
||||||
|
}
|
||||||
|
}
|
262
src/main/java/net/PeytonPlayz585/shadow/DynamicLights.java
Normal file
262
src/main/java/net/PeytonPlayz585/shadow/DynamicLights.java
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
package net.PeytonPlayz585.shadow;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.shadow.math.IntegerCache;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||||
|
import net.minecraft.entity.monster.EntityBlaze;
|
||||||
|
import net.minecraft.entity.monster.EntityCreeper;
|
||||||
|
import net.minecraft.entity.monster.EntityMagmaCube;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.projectile.EntityFireball;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class DynamicLights {
|
||||||
|
private static Map < Integer, DynamicLight > mapDynamicLights = new HashMap();
|
||||||
|
private static long timeUpdateMs = 0L;
|
||||||
|
private static final double MAX_DIST = 7.5D;
|
||||||
|
private static final double MAX_DIST_SQ = 56.25D;
|
||||||
|
private static final int LIGHT_LEVEL_MAX = 15;
|
||||||
|
private static final int LIGHT_LEVEL_FIRE = 15;
|
||||||
|
private static final int LIGHT_LEVEL_BLAZE = 10;
|
||||||
|
private static final int LIGHT_LEVEL_MAGMA_CUBE = 8;
|
||||||
|
private static final int LIGHT_LEVEL_MAGMA_CUBE_CORE = 13;
|
||||||
|
private static final int LIGHT_LEVEL_GLOWSTONE_DUST = 8;
|
||||||
|
private static final int LIGHT_LEVEL_PRISMARINE_CRYSTALS = 8;
|
||||||
|
|
||||||
|
public static void entityAdded(Entity p_entityAdded_0_, RenderGlobal p_entityAdded_1_) {}
|
||||||
|
|
||||||
|
public static void entityRemoved(Entity p_entityRemoved_0_, RenderGlobal p_entityRemoved_1_) {
|
||||||
|
synchronized(mapDynamicLights) {
|
||||||
|
DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.remove(IntegerCache.valueOf(p_entityRemoved_0_.getEntityId()));
|
||||||
|
|
||||||
|
if (dynamiclight != null) {
|
||||||
|
dynamiclight.updateLitChunks(p_entityRemoved_1_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void update(RenderGlobal p_update_0_) {
|
||||||
|
long i = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if (i >= timeUpdateMs + 50L) {
|
||||||
|
timeUpdateMs = i;
|
||||||
|
|
||||||
|
synchronized(mapDynamicLights) {
|
||||||
|
updateMapDynamicLights(p_update_0_);
|
||||||
|
|
||||||
|
if (mapDynamicLights.size() > 0) {
|
||||||
|
for (DynamicLight dynamiclight: mapDynamicLights.values()) {
|
||||||
|
dynamiclight.update(p_update_0_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void updateMapDynamicLights(RenderGlobal p_updateMapDynamicLights_0_) {
|
||||||
|
World world = p_updateMapDynamicLights_0_.getWorld();
|
||||||
|
|
||||||
|
if (world != null) {
|
||||||
|
for (Entity entity: world.getLoadedEntityList()) {
|
||||||
|
int i = getLightLevel(entity);
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
Integer integer = IntegerCache.valueOf(entity.getEntityId());
|
||||||
|
DynamicLight dynamiclight = (DynamicLight) mapDynamicLights.get(integer);
|
||||||
|
|
||||||
|
if (dynamiclight == null) {
|
||||||
|
dynamiclight = new DynamicLight(entity);
|
||||||
|
mapDynamicLights.put(integer, dynamiclight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Integer integer1 = IntegerCache.valueOf(entity.getEntityId());
|
||||||
|
DynamicLight dynamiclight1 = (DynamicLight) mapDynamicLights.remove(integer1);
|
||||||
|
|
||||||
|
if (dynamiclight1 != null) {
|
||||||
|
dynamiclight1.updateLitChunks(p_updateMapDynamicLights_0_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCombinedLight(BlockPos p_getCombinedLight_0_, int p_getCombinedLight_1_) {
|
||||||
|
double d0 = getLightLevel(p_getCombinedLight_0_);
|
||||||
|
p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_);
|
||||||
|
return p_getCombinedLight_1_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCombinedLight(Entity p_getCombinedLight_0_, int p_getCombinedLight_1_) {
|
||||||
|
double d0 = (double) getLightLevel(p_getCombinedLight_0_);
|
||||||
|
p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_);
|
||||||
|
return p_getCombinedLight_1_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCombinedLight(double p_getCombinedLight_0_, int p_getCombinedLight_2_) {
|
||||||
|
if (p_getCombinedLight_0_ > 0.0D) {
|
||||||
|
int i = (int)(p_getCombinedLight_0_ * 16.0D);
|
||||||
|
int j = p_getCombinedLight_2_ & 255;
|
||||||
|
|
||||||
|
if (i > j) {
|
||||||
|
p_getCombinedLight_2_ = p_getCombinedLight_2_ & -256;
|
||||||
|
p_getCombinedLight_2_ = p_getCombinedLight_2_ | i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return p_getCombinedLight_2_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getLightLevel(BlockPos p_getLightLevel_0_) {
|
||||||
|
double d0 = 0.0D;
|
||||||
|
|
||||||
|
synchronized(mapDynamicLights) {
|
||||||
|
for (DynamicLight dynamiclight: mapDynamicLights.values()) {
|
||||||
|
int i = dynamiclight.getLastLightLevel();
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
double d1 = dynamiclight.getLastPosX();
|
||||||
|
double d2 = dynamiclight.getLastPosY();
|
||||||
|
double d3 = dynamiclight.getLastPosZ();
|
||||||
|
double d4 = (double) p_getLightLevel_0_.getX() - d1;
|
||||||
|
double d5 = (double) p_getLightLevel_0_.getY() - d2;
|
||||||
|
double d6 = (double) p_getLightLevel_0_.getZ() - d3;
|
||||||
|
double d7 = d4 * d4 + d5 * d5 + d6 * d6;
|
||||||
|
|
||||||
|
if (dynamiclight.isUnderwater() && !Config.isClearWater()) {
|
||||||
|
i = Config.limit(i - 2, 0, 15);
|
||||||
|
d7 *= 2.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d7 <= 56.25D) {
|
||||||
|
double d8 = Math.sqrt(d7);
|
||||||
|
double d9 = 1.0D - d8 / 7.5D;
|
||||||
|
double d10 = d9 * (double) i;
|
||||||
|
|
||||||
|
if (d10 > d0) {
|
||||||
|
d0 = d10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double d11 = Config.limit(d0, 0.0D, 15.0D);
|
||||||
|
return d11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getLightLevel(ItemStack p_getLightLevel_0_) {
|
||||||
|
if (p_getLightLevel_0_ == null) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
Item item = p_getLightLevel_0_.getItem();
|
||||||
|
|
||||||
|
if (item instanceof ItemBlock) {
|
||||||
|
ItemBlock itemblock = (ItemBlock) item;
|
||||||
|
Block block = itemblock.getBlock();
|
||||||
|
|
||||||
|
if (block != null) {
|
||||||
|
return block.getLightValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return item == Items.lava_bucket ? Blocks.lava.getLightValue() : (item != Items.blaze_rod && item != Items.blaze_powder ? (item == Items.glowstone_dust ? 8 : (item == Items.prismarine_crystals ? 8 : (item == Items.magma_cream ? 8 : (item == Items.nether_star ? Blocks.beacon.getLightValue() / 2 : 0)))) : 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getLightLevel(Entity p_getLightLevel_0_) {
|
||||||
|
if (p_getLightLevel_0_ == Minecraft.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight()) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if (p_getLightLevel_0_ instanceof EntityPlayer) {
|
||||||
|
EntityPlayer entityplayer = (EntityPlayer) p_getLightLevel_0_;
|
||||||
|
|
||||||
|
if (entityplayer.isSpectator()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_getLightLevel_0_.isBurning()) {
|
||||||
|
return 15;
|
||||||
|
} else if (p_getLightLevel_0_ instanceof EntityFireball) {
|
||||||
|
return 15;
|
||||||
|
} else if (p_getLightLevel_0_ instanceof EntityTNTPrimed) {
|
||||||
|
return 15;
|
||||||
|
} else if (p_getLightLevel_0_ instanceof EntityBlaze) {
|
||||||
|
EntityBlaze entityblaze = (EntityBlaze) p_getLightLevel_0_;
|
||||||
|
return entityblaze.func_70845_n() ? 15 : 10;
|
||||||
|
} else if (p_getLightLevel_0_ instanceof EntityMagmaCube) {
|
||||||
|
EntityMagmaCube entitymagmacube = (EntityMagmaCube) p_getLightLevel_0_;
|
||||||
|
return (double) entitymagmacube.squishFactor > 0.6D ? 13 : 8;
|
||||||
|
} else {
|
||||||
|
if (p_getLightLevel_0_ instanceof EntityCreeper) {
|
||||||
|
EntityCreeper entitycreeper = (EntityCreeper) p_getLightLevel_0_;
|
||||||
|
|
||||||
|
if ((double) entitycreeper.getCreeperFlashIntensity(0.0F) > 0.001D) {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_getLightLevel_0_ instanceof EntityLivingBase) {
|
||||||
|
EntityLivingBase entitylivingbase = (EntityLivingBase) p_getLightLevel_0_;
|
||||||
|
ItemStack itemstack2 = entitylivingbase.getHeldItem();
|
||||||
|
int i = getLightLevel(itemstack2);
|
||||||
|
ItemStack itemstack1 = entitylivingbase.getEquipmentInSlot(4);
|
||||||
|
int j = getLightLevel(itemstack1);
|
||||||
|
return Math.max(i, j);
|
||||||
|
} else if (p_getLightLevel_0_ instanceof EntityItem) {
|
||||||
|
EntityItem entityitem = (EntityItem) p_getLightLevel_0_;
|
||||||
|
ItemStack itemstack = getItemStack(entityitem);
|
||||||
|
return getLightLevel(itemstack);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeLights(RenderGlobal p_removeLights_0_) {
|
||||||
|
synchronized(mapDynamicLights) {
|
||||||
|
Collection < DynamicLight > collection = mapDynamicLights.values();
|
||||||
|
Iterator iterator = collection.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
DynamicLight dynamiclight = (DynamicLight) iterator.next();
|
||||||
|
iterator.remove();
|
||||||
|
dynamiclight.updateLitChunks(p_removeLights_0_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
synchronized(mapDynamicLights) {
|
||||||
|
mapDynamicLights.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCount() {
|
||||||
|
synchronized(mapDynamicLights) {
|
||||||
|
return mapDynamicLights.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getItemStack(EntityItem p_getItemStack_0_) {
|
||||||
|
ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10);
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ public class GuiQuality extends GuiScreen {
|
||||||
protected String title;
|
protected String title;
|
||||||
private GameSettings settings;
|
private GameSettings settings;
|
||||||
//private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.AF_LEVEL, GameSettings.Options.AA_LEVEL, GameSettings.Options.CLEAR_WATER, GameSettings.Options.RANDOM_MOBS, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_COLORS, GameSettings.Options.SWAMP_COLORS, GameSettings.Options.SMOOTH_BIOMES, GameSettings.Options.CONNECTED_TEXTURES, GameSettings.Options.NATURAL_TEXTURES, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.CUSTOM_ITEMS, GameSettings.Options.DYNAMIC_LIGHTS};
|
//private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.AF_LEVEL, GameSettings.Options.AA_LEVEL, GameSettings.Options.CLEAR_WATER, GameSettings.Options.RANDOM_MOBS, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_COLORS, GameSettings.Options.SWAMP_COLORS, GameSettings.Options.SMOOTH_BIOMES, GameSettings.Options.CONNECTED_TEXTURES, GameSettings.Options.NATURAL_TEXTURES, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.CUSTOM_ITEMS, GameSettings.Options.DYNAMIC_LIGHTS};
|
||||||
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.CUSTOM_SKY};
|
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.DYNAMIC_LIGHTS};
|
||||||
|
|
||||||
public GuiQuality(GuiScreen p_i53_1_) {
|
public GuiQuality(GuiScreen p_i53_1_) {
|
||||||
this.prevScreen = p_i53_1_;
|
this.prevScreen = p_i53_1_;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package net.PeytonPlayz585.shadow.math;
|
||||||
|
|
||||||
|
public class IntegerCache {
|
||||||
|
private static final int CACHE_SIZE = 4096;
|
||||||
|
private static final Integer[] cache = makeCache(4096);
|
||||||
|
|
||||||
|
private static Integer[] makeCache(int p_makeCache_0_) {
|
||||||
|
Integer[] ainteger = new Integer[p_makeCache_0_];
|
||||||
|
|
||||||
|
for (int i = 0; i < p_makeCache_0_; ++i) {
|
||||||
|
ainteger[i] = new Integer(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ainteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer valueOf(int p_valueOf_0_) {
|
||||||
|
return p_valueOf_0_ >= 0 && p_valueOf_0_ < 4096 ? cache[p_valueOf_0_] : new Integer(p_valueOf_0_);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package net.minecraft.client.multiplayer;
|
package net.minecraft.client.multiplayer;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.shadow.Config;
|
||||||
|
import net.PeytonPlayz585.shadow.DynamicLights;
|
||||||
import net.PeytonPlayz585.shadow.other.PlayerControllerOF;
|
import net.PeytonPlayz585.shadow.other.PlayerControllerOF;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -435,6 +437,17 @@ public class WorldClient extends World {
|
||||||
super.setWorldTime(i);
|
super.setWorldTime(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCombinedLight(BlockPos pos, int lightValue) {
|
||||||
|
int i = super.getCombinedLight(pos, lightValue);
|
||||||
|
|
||||||
|
if (Config.isDynamicLights()) {
|
||||||
|
i = DynamicLights.getCombinedLight(pos, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to
|
* Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to
|
||||||
* clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client
|
* clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.minecraft.client.renderer;
|
||||||
|
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.shadow.Config;
|
||||||
|
import net.PeytonPlayz585.shadow.DynamicLights;
|
||||||
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||||
|
@ -108,11 +110,15 @@ public class ItemRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void func_178109_a(AbstractClientPlayer clientPlayer) {
|
private void func_178109_a(AbstractClientPlayer clientPlayer) {
|
||||||
int i = this.mc.theWorld.getCombinedLight(new BlockPos(clientPlayer.posX,
|
int i = this.mc.theWorld.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
|
||||||
clientPlayer.posY + (double) clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
|
|
||||||
float f = (float) (i & '\uffff');
|
if (Config.isDynamicLights()) {
|
||||||
float f1 = (float) (i >> 16);
|
i = DynamicLights.getCombinedLight(this.mc.getRenderViewEntity(), i);
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
|
}
|
||||||
|
|
||||||
|
float f = (float)(i & 65535);
|
||||||
|
float f1 = (float)(i >> 16);
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
|
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.minecraft.client.renderer;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.shadow.Config;
|
||||||
|
import net.PeytonPlayz585.shadow.DynamicLights;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -50,15 +52,21 @@ public class RegionRenderCache extends ChunkCache {
|
||||||
return this.chunkArray[i][j].getTileEntity(blockpos, Chunk.EnumCreateEntityType.QUEUED);
|
return this.chunkArray[i][j].getTileEntity(blockpos, Chunk.EnumCreateEntityType.QUEUED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCombinedLight(BlockPos blockpos, int i) {
|
public int getCombinedLight(BlockPos pos, int lightValue) {
|
||||||
int j = this.getPositionIndex(blockpos);
|
int i = this.getPositionIndex(pos);
|
||||||
int k = this.combinedLights[j];
|
int j = this.combinedLights[i];
|
||||||
if (k == -1) {
|
|
||||||
k = super.getCombinedLight(blockpos, i);
|
|
||||||
this.combinedLights[j] = k;
|
|
||||||
}
|
|
||||||
|
|
||||||
return k;
|
if (j == -1) {
|
||||||
|
j = super.getCombinedLight(pos, lightValue);
|
||||||
|
|
||||||
|
if (Config.isDynamicLights() && !this.getBlockState(pos).getBlock().isOpaqueCube()) {
|
||||||
|
j = DynamicLights.getCombinedLight(pos, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.combinedLights[i] = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBlockState getBlockState(BlockPos blockpos) {
|
public IBlockState getBlockState(BlockPos blockpos) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import net.PeytonPlayz585.shadow.Config;
|
import net.PeytonPlayz585.shadow.Config;
|
||||||
import net.PeytonPlayz585.shadow.CustomSky;
|
import net.PeytonPlayz585.shadow.CustomSky;
|
||||||
|
import net.PeytonPlayz585.shadow.DynamicLights;
|
||||||
import net.PeytonPlayz585.shadow.opengl.OpenGLManager;
|
import net.PeytonPlayz585.shadow.opengl.OpenGLManager;
|
||||||
import net.PeytonPlayz585.shadow.other.CloudRenderer;
|
import net.PeytonPlayz585.shadow.other.CloudRenderer;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||||
|
@ -138,7 +139,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
*/
|
*/
|
||||||
private List<RenderGlobal.ContainerLocalRenderInformation> renderInfos = Lists.newArrayListWithCapacity(69696);
|
private List<RenderGlobal.ContainerLocalRenderInformation> renderInfos = Lists.newArrayListWithCapacity(69696);
|
||||||
private final Set<TileEntity> field_181024_n = Sets.newHashSet();
|
private final Set<TileEntity> field_181024_n = Sets.newHashSet();
|
||||||
private ViewFrustum viewFrustum;
|
public ViewFrustum viewFrustum;
|
||||||
/**+
|
/**+
|
||||||
* The star GL Call list
|
* The star GL Call list
|
||||||
*/
|
*/
|
||||||
|
@ -379,6 +380,11 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
this.frustumUpdatePosChunkZ = Integer.MIN_VALUE;
|
this.frustumUpdatePosChunkZ = Integer.MIN_VALUE;
|
||||||
this.renderManager.set(worldClientIn);
|
this.renderManager.set(worldClientIn);
|
||||||
this.theWorld = worldClientIn;
|
this.theWorld = worldClientIn;
|
||||||
|
|
||||||
|
if (Config.isDynamicLights()) {
|
||||||
|
DynamicLights.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (worldClientIn != null) {
|
if (worldClientIn != null) {
|
||||||
worldClientIn.addWorldAccess(this);
|
worldClientIn.addWorldAccess(this);
|
||||||
this.loadRenderers();
|
this.loadRenderers();
|
||||||
|
@ -402,6 +408,11 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
Blocks.leaves.setGraphicsLevel(mc.gameSettings.shaders || mc.gameSettings.fancyGraphics);
|
Blocks.leaves.setGraphicsLevel(mc.gameSettings.shaders || mc.gameSettings.fancyGraphics);
|
||||||
Blocks.leaves2.setGraphicsLevel(mc.gameSettings.shaders || mc.gameSettings.fancyGraphics);
|
Blocks.leaves2.setGraphicsLevel(mc.gameSettings.shaders || mc.gameSettings.fancyGraphics);
|
||||||
BlockModelRenderer.updateAoLightValue();
|
BlockModelRenderer.updateAoLightValue();
|
||||||
|
|
||||||
|
if (Config.isDynamicLights()) {
|
||||||
|
DynamicLights.clear();
|
||||||
|
}
|
||||||
|
|
||||||
this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks;
|
this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks;
|
||||||
this.renderDistance = this.renderDistanceChunks * 16;
|
this.renderDistance = this.renderDistanceChunks * 16;
|
||||||
this.renderDistanceSq = this.renderDistance * this.renderDistance;
|
this.renderDistanceSq = this.renderDistance * this.renderDistance;
|
||||||
|
@ -848,6 +859,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
this.viewFrustum.updateChunkPositions(viewEntity.posX, viewEntity.posZ);
|
this.viewFrustum.updateChunkPositions(viewEntity.posX, viewEntity.posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config.isDynamicLights()) {
|
||||||
|
DynamicLights.update(this);
|
||||||
|
}
|
||||||
|
|
||||||
this.theWorld.theProfiler.endStartSection("renderlistcamera");
|
this.theWorld.theProfiler.endStartSection("renderlistcamera");
|
||||||
double d3 = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
|
double d3 = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
|
||||||
double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
||||||
|
@ -2235,6 +2250,11 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
* tracker.
|
* tracker.
|
||||||
*/
|
*/
|
||||||
public void onEntityAdded(Entity var1) {
|
public void onEntityAdded(Entity var1) {
|
||||||
|
|
||||||
|
if (Config.isDynamicLights()) {
|
||||||
|
DynamicLights.entityAdded(var1, this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
@ -2244,6 +2264,11 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
* entity tracker.
|
* entity tracker.
|
||||||
*/
|
*/
|
||||||
public void onEntityRemoved(Entity var1) {
|
public void onEntityRemoved(Entity var1) {
|
||||||
|
|
||||||
|
if (Config.isDynamicLights()) {
|
||||||
|
DynamicLights.entityRemoved(var1, this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
@ -2532,4 +2557,8 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
||||||
return "" + Minecraft.getDebugFPS() + "fps | C: " + j + "/" + i + ", E: " + this.countEntitiesRendered + "+" + k
|
return "" + Minecraft.getDebugFPS() + "fps | C: " + j + "/" + i + ", E: " + this.countEntitiesRendered + "+" + k
|
||||||
+ ", " + renderDispatcher.getDebugInfo();
|
+ ", " + renderDispatcher.getDebugInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorldClient getWorld() {
|
||||||
|
return this.theWorld;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ package net.minecraft.client.renderer;
|
||||||
import net.minecraft.client.renderer.chunk.IRenderChunkFactory;
|
import net.minecraft.client.renderer.chunk.IRenderChunkFactory;
|
||||||
import net.minecraft.client.renderer.chunk.RenderChunk;
|
import net.minecraft.client.renderer.chunk.RenderChunk;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -141,7 +142,7 @@ public class ViewFrustum {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RenderChunk getRenderChunk(BlockPos pos) {
|
public RenderChunk getRenderChunk(BlockPos pos) {
|
||||||
int i = MathHelper.bucketInt(pos.getX(), 16);
|
int i = MathHelper.bucketInt(pos.getX(), 16);
|
||||||
int j = MathHelper.bucketInt(pos.getY(), 16);
|
int j = MathHelper.bucketInt(pos.getY(), 16);
|
||||||
int k = MathHelper.bucketInt(pos.getZ(), 16);
|
int k = MathHelper.bucketInt(pos.getZ(), 16);
|
||||||
|
@ -162,4 +163,13 @@ public class ViewFrustum {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RenderChunk getRenderChunk(RenderChunk p_getRenderChunk_1_, EnumFacing p_getRenderChunk_2_) {
|
||||||
|
if (p_getRenderChunk_1_ == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
BlockPos blockpos = p_getRenderChunk_1_.func_181701_a(p_getRenderChunk_2_);
|
||||||
|
return getRenderChunk(blockpos);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@ import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.PeytonPlayz585.shadow.Config;
|
import net.PeytonPlayz585.shadow.Config;
|
||||||
import net.PeytonPlayz585.shadow.CustomSky;
|
import net.PeytonPlayz585.shadow.CustomSky;
|
||||||
|
import net.PeytonPlayz585.shadow.DynamicLights;
|
||||||
import net.PeytonPlayz585.shadow.shaders.Shaders;
|
import net.PeytonPlayz585.shadow.shaders.Shaders;
|
||||||
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
|
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
@ -195,6 +196,7 @@ public class GameSettings {
|
||||||
public boolean ofCustomSky = true;
|
public boolean ofCustomSky = true;
|
||||||
public boolean ofClearWater = false;
|
public boolean ofClearWater = false;
|
||||||
public int ofBetterGrass = 3;
|
public int ofBetterGrass = 3;
|
||||||
|
public int ofDynamicLights = 3;
|
||||||
|
|
||||||
//Detail Settings
|
//Detail Settings
|
||||||
/** Clouds flag */
|
/** Clouds flag */
|
||||||
|
@ -230,6 +232,11 @@ public class GameSettings {
|
||||||
//Shaders
|
//Shaders
|
||||||
public int profile = 1;
|
public int profile = 1;
|
||||||
|
|
||||||
|
|
||||||
|
//Other...
|
||||||
|
private static final int[] OF_DYNAMIC_LIGHTS = new int[] {3, 1, 2};
|
||||||
|
private static final String[] KEYS_DYNAMIC_LIGHTS = new String[] {"options.off", "options.graphics.fast", "options.graphics.fancy"};
|
||||||
|
|
||||||
public GameSettings(Minecraft mcIn) {
|
public GameSettings(Minecraft mcIn) {
|
||||||
this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem,
|
this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem,
|
||||||
this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump,
|
this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump,
|
||||||
|
@ -650,6 +657,11 @@ public class GameSettings {
|
||||||
this.mc.renderGlobal.resetClouds();
|
this.mc.renderGlobal.resetClouds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parOptions == GameSettings.Options.DYNAMIC_LIGHTS) {
|
||||||
|
this.ofDynamicLights = nextValue(this.ofDynamicLights, OF_DYNAMIC_LIGHTS);
|
||||||
|
DynamicLights.removeLights(this.mc.renderGlobal);
|
||||||
|
}
|
||||||
|
|
||||||
this.saveOptions();
|
this.saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,6 +922,9 @@ public class GameSettings {
|
||||||
default:
|
default:
|
||||||
return s + "Default";
|
return s + "Default";
|
||||||
}
|
}
|
||||||
|
} else if (parOptions == GameSettings.Options.DYNAMIC_LIGHTS) {
|
||||||
|
int k = indexOf(this.ofDynamicLights, OF_DYNAMIC_LIGHTS);
|
||||||
|
return s + getTranslation(KEYS_DYNAMIC_LIGHTS, k);
|
||||||
} else {
|
} else {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -1323,6 +1338,11 @@ public class GameSettings {
|
||||||
this.ofCloudsHeight = Config.limit(this.ofCloudsHeight, 0.0F, 1.0F);
|
this.ofCloudsHeight = Config.limit(this.ofCloudsHeight, 0.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (astring[0].equals("ofDynamicLights") && astring.length >= 2) {
|
||||||
|
this.ofDynamicLights = Integer.valueOf(astring[1]).intValue();
|
||||||
|
this.ofDynamicLights = limit(this.ofDynamicLights, OF_DYNAMIC_LIGHTS);
|
||||||
|
}
|
||||||
|
|
||||||
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
|
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
|
||||||
|
|
||||||
for (SoundCategory soundcategory : SoundCategory.values()) {
|
for (SoundCategory soundcategory : SoundCategory.values()) {
|
||||||
|
@ -1459,6 +1479,7 @@ public class GameSettings {
|
||||||
printwriter.println("ofChunkUpdates:" + this.ofChunkUpdates);
|
printwriter.println("ofChunkUpdates:" + this.ofChunkUpdates);
|
||||||
printwriter.println("ofClouds:" + this.ofClouds);
|
printwriter.println("ofClouds:" + this.ofClouds);
|
||||||
printwriter.println("ofCloudsHeight:" + this.ofCloudsHeight);
|
printwriter.println("ofCloudsHeight:" + this.ofCloudsHeight);
|
||||||
|
printwriter.println("ofDynamicLights:" + this.ofDynamicLights);
|
||||||
|
|
||||||
for (KeyBinding keybinding : this.keyBindings) {
|
for (KeyBinding keybinding : this.keyBindings) {
|
||||||
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
|
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
|
||||||
|
@ -1625,7 +1646,8 @@ public class GameSettings {
|
||||||
SMOOTH_FPS("Smooth FPS", false, false),
|
SMOOTH_FPS("Smooth FPS", false, false),
|
||||||
CHUNK_UPDATES("Chunk Updates", false, false),
|
CHUNK_UPDATES("Chunk Updates", false, false),
|
||||||
CLOUDS("Clouds", false, false),
|
CLOUDS("Clouds", false, false),
|
||||||
CLOUD_HEIGHT("Cloud Height", true, false);
|
CLOUD_HEIGHT("Cloud Height", true, false),
|
||||||
|
DYNAMIC_LIGHTS("Dynamic Lights", false, false);
|
||||||
|
|
||||||
private final boolean enumFloat;
|
private final boolean enumFloat;
|
||||||
private final boolean enumBoolean;
|
private final boolean enumBoolean;
|
||||||
|
@ -1706,6 +1728,37 @@ public class GameSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int limit(int p_limit_0_, int[] p_limit_1_) {
|
||||||
|
int i = indexOf(p_limit_0_, p_limit_1_);
|
||||||
|
return i < 0 ? p_limit_1_[0] : p_limit_0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int indexOf(int p_indexOf_0_, int[] p_indexOf_1_) {
|
||||||
|
for (int i = 0; i < p_indexOf_1_.length; ++i) {
|
||||||
|
if (p_indexOf_1_[i] == p_indexOf_0_) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int nextValue(int p_nextValue_0_, int[] p_nextValue_1_) {
|
||||||
|
int i = indexOf(p_nextValue_0_, p_nextValue_1_);
|
||||||
|
|
||||||
|
if (i < 0) {
|
||||||
|
return p_nextValue_1_[0];
|
||||||
|
} else {
|
||||||
|
++i;
|
||||||
|
|
||||||
|
if (i >= p_nextValue_1_.length) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p_nextValue_1_[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setAllAnimations(boolean p_setAllAnimations_1_) {
|
public void setAllAnimations(boolean p_setAllAnimations_1_) {
|
||||||
int i = p_setAllAnimations_1_ ? 0 : 2;
|
int i = p_setAllAnimations_1_ ? 0 : 2;
|
||||||
this.ofAnimatedWater = i;
|
this.ofAnimatedWater = i;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user