minor light cleanup
This commit is contained in:
parent
aaad753263
commit
375a67d10f
23 changed files with 53 additions and 215 deletions
|
@ -13,7 +13,6 @@ import java.util.Set;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.collect.ImmutableList;
|
||||
import common.collect.ImmutableMap;
|
||||
|
@ -1057,18 +1056,6 @@ public class Block {
|
|||
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getLightmapValue(IWorldAccess world, BlockPos pos) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
int light = world.getCombinedLight(pos, block.getLight());
|
||||
if(light == 0 && block instanceof BlockSlab) {
|
||||
pos = pos.down();
|
||||
block = world.getState(pos).getBlock();
|
||||
return world.getCombinedLight(pos, block.getLight());
|
||||
}
|
||||
return light;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean hasTransparency() {
|
||||
return false;
|
||||
|
|
|
@ -212,17 +212,6 @@ public abstract class BlockLiquid extends Block
|
|||
return this.flowRate >= 0 ? this.flowRate : (worldIn.isLavaFaster(pos) ? (-this.flowRate / 3) : (-this.flowRate));
|
||||
}
|
||||
|
||||
public int getLightmapValue(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
int i = worldIn.getCombinedLight(pos, 0);
|
||||
int j = worldIn.getCombinedLight(pos.up(), 0);
|
||||
int k = i & 255;
|
||||
int l = j & 255;
|
||||
int i1 = i >> 16 & 255;
|
||||
int j1 = j >> 16 & 255;
|
||||
return (k > l ? k : l) | (i1 > j1 ? i1 : j1) << 16;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean hasTransparency() {
|
||||
return !this.opaque;
|
||||
|
|
|
@ -1104,21 +1104,6 @@ public abstract class Entity
|
|||
}
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
|
||||
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, 0) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
public float getBrightness(float partialTicks)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
|
||||
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the reference to the World object.
|
||||
*/
|
||||
|
|
|
@ -111,7 +111,7 @@ public class EntityMouse extends EntityAnimal {
|
|||
|
||||
public float getBlockPathWeight(BlockPos pos)
|
||||
{
|
||||
return 0.5F - this.worldObj.getLightBrightness(pos);
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
public void setCustomNameTag(String name) {
|
||||
|
|
|
@ -30,31 +30,15 @@ import common.item.consumable.ItemFood;
|
|||
import common.item.material.ItemDye;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Color;
|
||||
import common.vars.Vars;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityWolf extends EntityTameable
|
||||
{
|
||||
/** Float used to smooth the rotation of the wolf head */
|
||||
private float headRotationCourse;
|
||||
private float headRotationCourseOld;
|
||||
|
||||
/** true is the wolf is wet else false */
|
||||
private boolean isWet;
|
||||
|
||||
/** True if the wolf is shaking else False */
|
||||
private boolean isShaking;
|
||||
|
||||
/**
|
||||
* This time increases while wolf is shaking and emitting water particles.
|
||||
*/
|
||||
private float timeWolfIsShaking;
|
||||
private float prevTimeWolfIsShaking;
|
||||
|
||||
public EntityWolf(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
|
@ -185,14 +169,6 @@ public class EntityWolf extends EntityTameable
|
|||
{
|
||||
super.onLivingUpdate();
|
||||
|
||||
if (!this.worldObj.client && this.isWet && !this.isShaking && !this.hasPath() && this.onGround)
|
||||
{
|
||||
this.isShaking = true;
|
||||
this.timeWolfIsShaking = 0.0F;
|
||||
this.prevTimeWolfIsShaking = 0.0F;
|
||||
this.worldObj.setEntityState(this, (byte)8);
|
||||
}
|
||||
|
||||
if (!this.worldObj.client && this.getAttackTarget() == null && this.isAngry())
|
||||
{
|
||||
this.setAngry(false);
|
||||
|
@ -215,77 +191,6 @@ public class EntityWolf extends EntityTameable
|
|||
{
|
||||
this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F;
|
||||
}
|
||||
|
||||
if (this.isWet())
|
||||
{
|
||||
this.isWet = true;
|
||||
this.isShaking = false;
|
||||
this.timeWolfIsShaking = 0.0F;
|
||||
this.prevTimeWolfIsShaking = 0.0F;
|
||||
}
|
||||
else if ((this.isWet || this.isShaking) && this.isShaking)
|
||||
{
|
||||
if (this.timeWolfIsShaking == 0.0F)
|
||||
{
|
||||
this.playSound(SoundEvent.WOLF_SHAKE, this.getSoundVolume());
|
||||
}
|
||||
|
||||
this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
|
||||
this.timeWolfIsShaking += 0.05F;
|
||||
|
||||
if (this.prevTimeWolfIsShaking >= 2.0F)
|
||||
{
|
||||
this.isWet = false;
|
||||
this.isShaking = false;
|
||||
this.prevTimeWolfIsShaking = 0.0F;
|
||||
this.timeWolfIsShaking = 0.0F;
|
||||
}
|
||||
|
||||
if (this.timeWolfIsShaking > 0.4F)
|
||||
{
|
||||
float f = (float)this.getEntityBoundingBox().minY;
|
||||
int i = (int)(ExtMath.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F);
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
float f1 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F;
|
||||
float f2 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F;
|
||||
this.worldObj.clientParticle(ParticleType.SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the wolf is wet
|
||||
*/
|
||||
public boolean isWolfWet()
|
||||
{
|
||||
return this.isWet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when calculating the amount of shading to apply while the wolf is wet.
|
||||
*/
|
||||
public float getShadingWhileWet(float p_70915_1_)
|
||||
{
|
||||
return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F;
|
||||
}
|
||||
|
||||
public float getShakeAngle(float p_70923_1_, float p_70923_2_)
|
||||
{
|
||||
float f = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F;
|
||||
|
||||
if (f < 0.0F)
|
||||
{
|
||||
f = 0.0F;
|
||||
}
|
||||
else if (f > 1.0F)
|
||||
{
|
||||
f = 1.0F;
|
||||
}
|
||||
|
||||
return ExtMath.sin(f * (float)Math.PI) * ExtMath.sin(f * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI;
|
||||
}
|
||||
|
||||
public float getInterestedAngle(float p_70917_1_)
|
||||
|
@ -430,21 +335,6 @@ public class EntityWolf extends EntityTameable
|
|||
return super.interact(player);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 8)
|
||||
{
|
||||
this.isShaking = true;
|
||||
this.timeWolfIsShaking = 0.0F;
|
||||
this.prevTimeWolfIsShaking = 0.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
super.handleStatusUpdate(id);
|
||||
}
|
||||
}
|
||||
|
||||
public float getTailRotation()
|
||||
{
|
||||
return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - (float)this.dataWatcher.getWatchableObjectInt(18)) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F));
|
||||
|
|
|
@ -85,23 +85,6 @@ public class EntityXp extends Entity implements IObjectData
|
|||
return this.dataWatcher.getWatchableObjectInt(1);
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
{
|
||||
float f = 0.5F;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
int i = super.getBrightnessForRender(partialTicks);
|
||||
int j = i & 255;
|
||||
int k = i >> 16 & 255;
|
||||
j = j + (int)(f * 15.0F * 16.0F);
|
||||
|
||||
if (j > 240)
|
||||
{
|
||||
j = 240;
|
||||
}
|
||||
|
||||
return j | k << 16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
|
|
|
@ -20,9 +20,7 @@ public class EntityArachnoid extends EntityNPC {
|
|||
}
|
||||
|
||||
public boolean continueExecuting() {
|
||||
float f = this.attacker.getBrightness(1.0F);
|
||||
|
||||
if(f >= 0.5F && this.attacker.getRNG().chance(100)) {
|
||||
if(this.attacker.getRNG().chance(100)) {
|
||||
this.attacker.setAttackTarget((EntityLiving)null);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -349,19 +349,6 @@ public abstract class EntityProjectile extends Entity
|
|||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
public float getBrightness(float partialTicks)
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
{
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
public int getTrackingRange() {
|
||||
return 64;
|
||||
|
|
|
@ -93,7 +93,7 @@ public abstract class EntityAnimal extends EntityLiving
|
|||
|
||||
public float getBlockPathWeight(BlockPos pos)
|
||||
{
|
||||
return this.worldObj.getState(pos.down()).getBlock() == Blocks.grass ? 10.0F : this.worldObj.getLightBrightness(pos) - 0.5F;
|
||||
return this.worldObj.getState(pos.down()).getBlock() == Blocks.grass ? 10.0F : 0.5F;
|
||||
}
|
||||
|
||||
public void writeEntity(TagObject tagCompound)
|
||||
|
|
|
@ -100,7 +100,6 @@ public enum SoundEvent {
|
|||
WOLF_GROWL("wolf_growl1", "wolf_growl2", "wolf_growl3"),
|
||||
WOLF_HURT("wolf_hurt1", "wolf_hurt2", "wolf_hurt3"),
|
||||
WOLF_PANTING("wolf_panting"),
|
||||
WOLF_SHAKE("wolf_shake"),
|
||||
WOLF_WHINE("wolf_whine"),
|
||||
|
||||
FOX_DEATH("fox_death"),
|
||||
|
|
|
@ -2,9 +2,11 @@ package common.world;
|
|||
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
|
||||
public interface IWorldAccess extends IBlockAccess
|
||||
{
|
||||
TileEntity getTileEntity(BlockPos pos);
|
||||
@Clientside
|
||||
int getCombinedLight(BlockPos pos, int lightValue);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import common.tileentity.TileEntity;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ChunkPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
|
@ -405,6 +406,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getCombinedLight(BlockPos pos, int lightValue) {
|
||||
int i = this.getLightFromNeighborsFor(LightType.SKY, pos);
|
||||
int j = this.getLightFromNeighborsFor(LightType.BLOCK, pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue