diff --git a/src/main/java/net/minecraft/block/BlockCactus.java b/src/main/java/net/minecraft/block/BlockCactus.java
deleted file mode 100644
index eef1fe120..000000000
--- a/src/main/java/net/minecraft/block/BlockCactus.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package net.minecraft.block;
-
-import java.util.Random;
-
-import net.minecraft.block.material.Material;
-import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.PropertyInteger;
-import net.minecraft.block.state.BlockFaceShape;
-import net.minecraft.block.state.BlockStateContainer;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.Entity;
-//import net.minecraft.init.Blocks;
-import net.minecraft.util.BlockRenderLayer;
-import net.minecraft.util.DamageSource;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-
-public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable
-{
- public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
- protected static final AxisAlignedBB CACTUS_COLLISION_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D);
- protected static final AxisAlignedBB CACTUS_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D);
-
- protected BlockCactus()
- {
- super(Material.CACTUS);
- this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
- this.setTickRandomly(true);
- this.setCreativeTab(CreativeTabs.DECORATIONS);
- }
-
- @Override
- public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
- {
- if (!worldIn.isAreaLoaded(pos, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
- BlockPos blockpos = pos.up();
-
- if (worldIn.isAirBlock(blockpos))
- {
- int i;
-
- for (i = 1; worldIn.getBlockState(pos.down(i)).getBlock() == this; ++i)
- {
- ;
- }
-
- if (i < 3)
- {
- int j = state.getValue(AGE).intValue();
-
- if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, blockpos, state, true))
- {
- if (j == 15)
- {
- worldIn.setBlockState(blockpos, this.getDefaultState());
- IBlockState iblockstate = state.withProperty(AGE, Integer.valueOf(0));
- worldIn.setBlockState(pos, iblockstate, 4);
- iblockstate.neighborChanged(worldIn, blockpos, this, pos);
- }
- else
- {
- worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4);
- }
- net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos));
- }
- }
- }
- }
-
- @Override
- public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
- {
- return CACTUS_COLLISION_AABB;
- }
-
- /**
- * Return an AABB (in world coords!) that should be highlighted when the player is targeting this Block
- */
- @Override
- @SideOnly(Side.CLIENT)
- public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos)
- {
- return CACTUS_AABB.offset(pos);
- }
-
- @Override
- public boolean isFullCube(IBlockState state)
- {
- return false;
- }
-
- /**
- * Used to determine ambient occlusion and culling when rebuilding chunks for render
- */
- @Override
- public boolean isOpaqueCube(IBlockState state)
- {
- return false;
- }
-
- /**
- * Checks if this block can be placed exactly at the given position.
- */
- @Override
- public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
- {
- return super.canPlaceBlockAt(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false;
- }
-
- /**
- * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
- * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
- * block, etc.
- */
- @Override
- public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
- {
- // XXX this was changed as a proof of concept
- //if (!this.canBlockStay(worldIn, pos))
- //{
- // worldIn.destroyBlock(pos, true);
- //}
- }
-
- public boolean canBlockStay(World worldIn, BlockPos pos)
- {
- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
- {
- Material material = worldIn.getBlockState(pos.offset(enumfacing)).getMaterial();
-
- if (material.isSolid() || material == Material.LAVA)
- {
- return false;
- }
- }
-
- IBlockState state = worldIn.getBlockState(pos.down());
- return state.getBlock().canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).getMaterial().isLiquid();
- }
-
- /**
- * Called When an Entity Collided with the Block
- */
- @Override
- public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
- {
- entityIn.attackEntityFrom(DamageSource.CACTUS, 1.0F);
- }
-
- /**
- * Convert the given metadata into a BlockState for this Block
- */
- @Override
- public IBlockState getStateFromMeta(int meta)
- {
- return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta));
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public BlockRenderLayer getBlockLayer()
- {
- return BlockRenderLayer.CUTOUT;
- }
-
- /**
- * Convert the BlockState into the correct metadata value
- */
- @Override
- public int getMetaFromState(IBlockState state)
- {
- return state.getValue(AGE).intValue();
- }
-
- @Override
- public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
- {
- return net.minecraftforge.common.EnumPlantType.Desert;
- }
-
- @Override
- public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
- {
- return getDefaultState();
- }
-
- @Override
- protected BlockStateContainer createBlockState()
- {
- return new BlockStateContainer(this, new IProperty[] {AGE});
- }
-
- /**
- * Get the geometry of the queried face at the given position and state. This is used to decide whether things like
- * buttons are allowed to be placed on the face, or how glass panes connect to the face, among other things.
- *
- * Common values are {@code SOLID}, which is the default, and {@code UNDEFINED}, which represents something that
- * does not fit the other descriptions and will generally cause other things not to connect to the face.
- *
- * @return an approximation of the form of the given face
- */
- @Override
- public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
- {
- return BlockFaceShape.UNDEFINED;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/client/renderer/EntityRenderer.java b/src/main/java/net/minecraft/client/renderer/EntityRenderer.java
deleted file mode 100644
index a97936bf8..000000000
--- a/src/main/java/net/minecraft/client/renderer/EntityRenderer.java
+++ /dev/null
@@ -1,2189 +0,0 @@
-package net.minecraft.client.renderer;
-
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import java.awt.image.ImageObserver;
-import java.io.IOException;
-import java.nio.FloatBuffer;
-import java.util.List;
-import java.util.Random;
-
-import javax.annotation.Nullable;
-import javax.imageio.ImageIO;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GLContext;
-import org.lwjgl.util.glu.Project;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.gson.JsonSyntaxException;
-
-import backsun.lod.util.CustomRenderer;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.AbstractClientPlayer;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.MapItemRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.particle.ParticleManager;
-import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
-import net.minecraft.client.renderer.culling.ClippingHelperImpl;
-import net.minecraft.client.renderer.culling.Frustum;
-import net.minecraft.client.renderer.culling.ICamera;
-import net.minecraft.client.renderer.texture.DynamicTexture;
-import net.minecraft.client.renderer.texture.TextureMap;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.resources.IResourceManager;
-import net.minecraft.client.resources.IResourceManagerReloadListener;
-import net.minecraft.client.shader.ShaderGroup;
-import net.minecraft.client.shader.ShaderLinkHelper;
-import net.minecraft.crash.CrashReport;
-import net.minecraft.crash.CrashReportCategory;
-import net.minecraft.crash.ICrashReportDetail;
-import net.minecraft.enchantment.EnchantmentHelper;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityItemFrame;
-import net.minecraft.entity.monster.EntityCreeper;
-import net.minecraft.entity.monster.EntityEnderman;
-import net.minecraft.entity.monster.EntitySpider;
-import net.minecraft.entity.passive.EntityAnimal;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.MobEffects;
-import net.minecraft.init.SoundEvents;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockRenderLayer;
-import net.minecraft.util.EntitySelectors;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.EnumParticleTypes;
-import net.minecraft.util.MouseFilter;
-import net.minecraft.util.ReportedException;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.ScreenShotHelper;
-import net.minecraft.util.SoundCategory;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.MathHelper;
-import net.minecraft.util.math.RayTraceResult;
-import net.minecraft.util.math.Vec3d;
-import net.minecraft.world.GameType;
-import net.minecraft.world.World;
-import net.minecraft.world.biome.Biome;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-
-@SuppressWarnings("deprecation")
-@SideOnly(Side.CLIENT)
-public class EntityRenderer implements IResourceManagerReloadListener
-{
- private static final Logger LOGGER = LogManager.getLogger();
- private static final ResourceLocation RAIN_TEXTURES = new ResourceLocation("textures/environment/rain.png");
- private static final ResourceLocation SNOW_TEXTURES = new ResourceLocation("textures/environment/snow.png");
- public static boolean anaglyphEnable;
- /** Anaglyph field (0=R, 1=GB) */
- public static int anaglyphField;
- /** A reference to the Minecraft object. */
- private final Minecraft mc;
- private final IResourceManager resourceManager;
- private final Random random = new Random();
- private float farPlaneDistance;
- public final ItemRenderer itemRenderer;
- private final MapItemRenderer mapItemRenderer;
- /** Entity renderer update count */
- private int rendererUpdateCount;
- /** Pointed entity */
- private Entity pointedEntity;
- private final MouseFilter mouseFilterXAxis = new MouseFilter();
- private final MouseFilter mouseFilterYAxis = new MouseFilter();
- /** Previous third person distance */
- private float thirdPersonDistancePrev = 4.0F;
- /** Smooth cam yaw */
- private float smoothCamYaw;
- /** Smooth cam pitch */
- private float smoothCamPitch;
- /** Smooth cam filter X */
- private float smoothCamFilterX;
- /** Smooth cam filter Y */
- private float smoothCamFilterY;
- /** Smooth cam partial ticks */
- private float smoothCamPartialTicks;
- /** FOV modifier hand */
- private float fovModifierHand;
- /** FOV modifier hand prev */
- private float fovModifierHandPrev;
- private float bossColorModifier;
- private float bossColorModifierPrev;
- /** Cloud fog mode */
- private boolean cloudFog;
- private boolean renderHand = true;
- private boolean drawBlockOutline = true;
- private long timeWorldIcon;
- /** Previous frame time in milliseconds */
- private long prevFrameTime = Minecraft.getSystemTime();
- /** The texture id of the blocklight/skylight texture used for lighting effects */
- private final DynamicTexture lightmapTexture;
- /** Colors computed in updateLightmap() and loaded into the lightmap emptyTexture */
- private final int[] lightmapColors;
- private final ResourceLocation locationLightMap;
- /** Is set, updateCameraAndRender() calls updateLightmap(); set by updateTorchFlicker() */
- private boolean lightmapUpdateNeeded;
- /** Torch flicker X */
- private float torchFlickerX;
- private float torchFlickerDX;
- /** Rain sound counter */
- private int rainSoundCounter;
- private final float[] rainXCoords = new float[1024];
- private final float[] rainYCoords = new float[1024];
- /** Fog color buffer */
- private final FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16);
- private float fogColorRed;
- private float fogColorGreen;
- private float fogColorBlue;
- /** Fog color 2 */
- private float fogColor2;
- /** Fog color 1 */
- private float fogColor1;
- private int debugViewDirection;
- private boolean debugView;
- private double cameraZoom = 1.0D;
- private double cameraYaw;
- private double cameraPitch;
- private ItemStack itemActivationItem;
- private int itemActivationTicks;
- private float itemActivationOffX;
- private float itemActivationOffY;
- private ShaderGroup shaderGroup;
- private static final ResourceLocation[] SHADERS_TEXTURES = new ResourceLocation[] {new ResourceLocation("shaders/post/notch.json"), new ResourceLocation("shaders/post/fxaa.json"), new ResourceLocation("shaders/post/art.json"), new ResourceLocation("shaders/post/bumpy.json"), new ResourceLocation("shaders/post/blobs2.json"), new ResourceLocation("shaders/post/pencil.json"), new ResourceLocation("shaders/post/color_convolve.json"), new ResourceLocation("shaders/post/deconverge.json"), new ResourceLocation("shaders/post/flip.json"), new ResourceLocation("shaders/post/invert.json"), new ResourceLocation("shaders/post/ntsc.json"), new ResourceLocation("shaders/post/outline.json"), new ResourceLocation("shaders/post/phosphor.json"), new ResourceLocation("shaders/post/scan_pincushion.json"), new ResourceLocation("shaders/post/sobel.json"), new ResourceLocation("shaders/post/bits.json"), new ResourceLocation("shaders/post/desaturate.json"), new ResourceLocation("shaders/post/green.json"), new ResourceLocation("shaders/post/blur.json"), new ResourceLocation("shaders/post/wobble.json"), new ResourceLocation("shaders/post/blobs.json"), new ResourceLocation("shaders/post/antialias.json"), new ResourceLocation("shaders/post/creeper.json"), new ResourceLocation("shaders/post/spider.json")};
- public static final int SHADER_COUNT = SHADERS_TEXTURES.length;
- private int shaderIndex;
- private boolean useShader;
- private int frameCount;
-
- public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn)
- {
- this.shaderIndex = SHADER_COUNT;
- this.mc = mcIn;
- this.resourceManager = resourceManagerIn;
- this.itemRenderer = mcIn.getItemRenderer();
- this.mapItemRenderer = new MapItemRenderer(mcIn.getTextureManager());
- this.lightmapTexture = new DynamicTexture(16, 16);
- this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture);
- this.lightmapColors = this.lightmapTexture.getTextureData();
- this.shaderGroup = null;
-
- for (int i = 0; i < 32; ++i)
- {
- for (int j = 0; j < 32; ++j)
- {
- float f = j - 16;
- float f1 = i - 16;
- float f2 = MathHelper.sqrt(f * f + f1 * f1);
- this.rainXCoords[i << 5 | j] = -f1 / f2;
- this.rainYCoords[i << 5 | j] = f / f2;
- }
- }
- }
-
- public boolean isShaderActive()
- {
- return OpenGlHelper.shadersSupported && this.shaderGroup != null;
- }
-
- public void stopUseShader()
- {
- if (this.shaderGroup != null)
- {
- this.shaderGroup.deleteShaderGroup();
- }
-
- this.shaderGroup = null;
- this.shaderIndex = SHADER_COUNT;
- }
-
- public void switchUseShader()
- {
- this.useShader = !this.useShader;
- }
-
- /**
- * What shader to use when spectating this entity
- */
- public void loadEntityShader(@Nullable Entity entityIn)
- {
- if (OpenGlHelper.shadersSupported)
- {
- if (this.shaderGroup != null)
- {
- this.shaderGroup.deleteShaderGroup();
- }
-
- this.shaderGroup = null;
-
- if (entityIn instanceof EntityCreeper)
- {
- this.loadShader(new ResourceLocation("shaders/post/creeper.json"));
- }
- else if (entityIn instanceof EntitySpider)
- {
- this.loadShader(new ResourceLocation("shaders/post/spider.json"));
- }
- else if (entityIn instanceof EntityEnderman)
- {
- this.loadShader(new ResourceLocation("shaders/post/invert.json"));
- }
- else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(entityIn, this);
- }
- }
-
- public void loadShader(ResourceLocation resourceLocationIn)
- {
- try
- {
- this.shaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn);
- this.shaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
- this.useShader = true;
- }
- catch (IOException ioexception)
- {
- LOGGER.warn("Failed to load shader: {}", resourceLocationIn, ioexception);
- this.shaderIndex = SHADER_COUNT;
- this.useShader = false;
- }
- catch (JsonSyntaxException jsonsyntaxexception)
- {
- LOGGER.warn("Failed to load shader: {}", resourceLocationIn, jsonsyntaxexception);
- this.shaderIndex = SHADER_COUNT;
- this.useShader = false;
- }
- }
-
- @Override
- public void onResourceManagerReload(IResourceManager resourceManager)
- {
- if (this.shaderGroup != null)
- {
- this.shaderGroup.deleteShaderGroup();
- }
-
- this.shaderGroup = null;
-
- if (this.shaderIndex == SHADER_COUNT)
- {
- this.loadEntityShader(this.mc.getRenderViewEntity());
- }
- else
- {
- this.loadShader(SHADERS_TEXTURES[this.shaderIndex]);
- }
- }
-
- /**
- * Updates the entity renderer
- */
- public void updateRenderer()
- {
- if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null)
- {
- ShaderLinkHelper.setNewStaticShaderLinkHelper();
- }
-
- this.updateFovModifierHand();
- this.updateTorchFlicker();
- this.fogColor2 = this.fogColor1;
- this.thirdPersonDistancePrev = 4.0F;
-
- if (this.mc.gameSettings.smoothCamera)
- {
- float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
- float f1 = f * f * f * 8.0F;
- this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1);
- this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1);
- this.smoothCamPartialTicks = 0.0F;
- this.smoothCamYaw = 0.0F;
- this.smoothCamPitch = 0.0F;
- }
- else
- {
- this.smoothCamFilterX = 0.0F;
- this.smoothCamFilterY = 0.0F;
- this.mouseFilterXAxis.reset();
- this.mouseFilterYAxis.reset();
- }
-
- if (this.mc.getRenderViewEntity() == null)
- {
- this.mc.setRenderViewEntity(this.mc.player);
- }
-
- float f3 = this.mc.world.getLightBrightness(new BlockPos(this.mc.getRenderViewEntity().getPositionEyes(1F))); // Forge: fix MC-51150
- float f4 = this.mc.gameSettings.renderDistanceChunks / 32.0F;
- float f2 = f3 * (1.0F - f4) + f4;
- this.fogColor1 += (f2 - this.fogColor1) * 0.1F;
- ++this.rendererUpdateCount;
- this.itemRenderer.updateEquippedItem();
- this.addRainParticles();
- this.bossColorModifierPrev = this.bossColorModifier;
-
- if (this.mc.ingameGUI.getBossOverlay().shouldDarkenSky())
- {
- this.bossColorModifier += 0.05F;
-
- if (this.bossColorModifier > 1.0F)
- {
- this.bossColorModifier = 1.0F;
- }
- }
- else if (this.bossColorModifier > 0.0F)
- {
- this.bossColorModifier -= 0.0125F;
- }
-
- if (this.itemActivationTicks > 0)
- {
- --this.itemActivationTicks;
-
- if (this.itemActivationTicks == 0)
- {
- this.itemActivationItem = null;
- }
- }
- }
-
- public ShaderGroup getShaderGroup()
- {
- return this.shaderGroup;
- }
-
- public void updateShaderGroupSize(int width, int height)
- {
- if (OpenGlHelper.shadersSupported)
- {
- if (this.shaderGroup != null)
- {
- this.shaderGroup.createBindFramebuffers(width, height);
- }
-
- this.mc.renderGlobal.createBindEntityOutlineFbs(width, height);
- }
- }
-
- /**
- * Gets the block or object that is being moused over.
- */
- public void getMouseOver(float partialTicks)
- {
- Entity entity = this.mc.getRenderViewEntity();
-
- if (entity != null)
- {
- if (this.mc.world != null)
- {
- this.mc.mcProfiler.startSection("pick");
- this.mc.pointedEntity = null;
- double d0 = this.mc.playerController.getBlockReachDistance();
- this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks);
- Vec3d vec3d = entity.getPositionEyes(partialTicks);
- boolean flag = false;
- double d1 = d0;
-
- if (this.mc.playerController.extendedReach())
- {
- d1 = 6.0D;
- d0 = d1;
- }
- else
- {
- if (d0 > 3.0D)
- {
- flag = true;
- }
- }
-
- if (this.mc.objectMouseOver != null)
- {
- d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3d);
- }
-
- Vec3d vec3d1 = entity.getLook(1.0F);
- Vec3d vec3d2 = vec3d.addVector(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0);
- this.pointedEntity = null;
- Vec3d vec3d3 = null;
- List list = this.mc.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().expand(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0).grow(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate()
- {
- @Override
- public boolean apply(@Nullable Entity p_apply_1_)
- {
- return p_apply_1_ != null && p_apply_1_.canBeCollidedWith();
- }
- }));
- double d2 = d1;
-
- for (int j = 0; j < list.size(); ++j)
- {
- Entity entity1 = list.get(j);
- AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(entity1.getCollisionBorderSize());
- RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2);
-
- if (axisalignedbb.contains(vec3d))
- {
- if (d2 >= 0.0D)
- {
- this.pointedEntity = entity1;
- vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec;
- d2 = 0.0D;
- }
- }
- else if (raytraceresult != null)
- {
- double d3 = vec3d.distanceTo(raytraceresult.hitVec);
-
- if (d3 < d2 || d2 == 0.0D)
- {
- if (entity1.getLowestRidingEntity() == entity.getLowestRidingEntity() && !entity1.canRiderInteract())
- {
- if (d2 == 0.0D)
- {
- this.pointedEntity = entity1;
- vec3d3 = raytraceresult.hitVec;
- }
- }
- else
- {
- this.pointedEntity = entity1;
- vec3d3 = raytraceresult.hitVec;
- d2 = d3;
- }
- }
- }
- }
-
- if (this.pointedEntity != null && flag && vec3d.distanceTo(vec3d3) > 3.0D)
- {
- this.pointedEntity = null;
- this.mc.objectMouseOver = new RayTraceResult(RayTraceResult.Type.MISS, vec3d3, (EnumFacing)null, new BlockPos(vec3d3));
- }
-
- if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null))
- {
- this.mc.objectMouseOver = new RayTraceResult(this.pointedEntity, vec3d3);
-
- if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame)
- {
- this.mc.pointedEntity = this.pointedEntity;
- }
- }
-
- this.mc.mcProfiler.endSection();
- }
- }
- }
-
- /**
- * Update FOV modifier hand
- */
- private void updateFovModifierHand()
- {
- float f = 1.0F;
-
- if (this.mc.getRenderViewEntity() instanceof AbstractClientPlayer)
- {
- AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer)this.mc.getRenderViewEntity();
- f = abstractclientplayer.getFovModifier();
- }
-
- this.fovModifierHandPrev = this.fovModifierHand;
- this.fovModifierHand += (f - this.fovModifierHand) * 0.5F;
-
- if (this.fovModifierHand > 1.5F)
- {
- this.fovModifierHand = 1.5F;
- }
-
- if (this.fovModifierHand < 0.1F)
- {
- this.fovModifierHand = 0.1F;
- }
- }
-
- /**
- * Changes the field of view of the player depending on if they are underwater or not
- */
- private float getFOVModifier(float partialTicks, boolean useFOVSetting)
- {
- if (this.debugView)
- {
- return 90.0F;
- }
- else
- {
- Entity entity = this.mc.getRenderViewEntity();
- float f = 70.0F;
-
- if (useFOVSetting)
- {
- f = this.mc.gameSettings.fovSetting;
- f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks);
- }
-
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F)
- {
- float f1 = ((EntityLivingBase)entity).deathTime + partialTicks;
- f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
- }
-
- IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.world, entity, partialTicks);
-
- if (iblockstate.getMaterial() == Material.WATER)
- {
- f = f * 60.0F / 70.0F;
- }
-
- return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, iblockstate, partialTicks, f);
- }
- }
-
- private void hurtCameraEffect(float partialTicks)
- {
- if (this.mc.getRenderViewEntity() instanceof EntityLivingBase)
- {
- EntityLivingBase entitylivingbase = (EntityLivingBase)this.mc.getRenderViewEntity();
- float f = entitylivingbase.hurtTime - partialTicks;
-
- if (entitylivingbase.getHealth() <= 0.0F)
- {
- float f1 = entitylivingbase.deathTime + partialTicks;
- GlStateManager.rotate(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F);
- }
-
- if (f < 0.0F)
- {
- return;
- }
-
- f = f / entitylivingbase.maxHurtTime;
- f = MathHelper.sin(f * f * f * f * (float)Math.PI);
- float f2 = entitylivingbase.attackedAtYaw;
- GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(-f * 14.0F, 0.0F, 0.0F, 1.0F);
- GlStateManager.rotate(f2, 0.0F, 1.0F, 0.0F);
- }
- }
-
- /**
- * Updates the bobbing render effect of the player.
- */
- private void applyBobbing(float partialTicks)
- {
- if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
- {
- EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
- float f = entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified;
- float f1 = -(entityplayer.distanceWalkedModified + f * partialTicks);
- float f2 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * partialTicks;
- float f3 = entityplayer.prevCameraPitch + (entityplayer.cameraPitch - entityplayer.prevCameraPitch) * partialTicks;
- GlStateManager.translate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 0.5F, -Math.abs(MathHelper.cos(f1 * (float)Math.PI) * f2), 0.0F);
- GlStateManager.rotate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 3.0F, 0.0F, 0.0F, 1.0F);
- GlStateManager.rotate(Math.abs(MathHelper.cos(f1 * (float)Math.PI - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F);
- GlStateManager.rotate(f3, 1.0F, 0.0F, 0.0F);
- }
- }
-
- /**
- * sets up player's eye (or camera in third person mode)
- */
- private void orientCamera(float partialTicks)
- {
- Entity entity = this.mc.getRenderViewEntity();
- float f = entity.getEyeHeight();
- double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
- double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks + f;
- double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
-
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPlayerSleeping())
- {
- f = (float)(f + 1.0D);
- GlStateManager.translate(0.0F, 0.3F, 0.0F);
-
- if (!this.mc.gameSettings.debugCamEnable)
- {
- BlockPos blockpos = new BlockPos(entity);
- IBlockState iblockstate = this.mc.world.getBlockState(blockpos);
- net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.world, blockpos, iblockstate, entity);
-
- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F);
- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F);
- }
- }
- else if (this.mc.gameSettings.thirdPersonView > 0)
- {
- double d3 = this.thirdPersonDistancePrev + (4.0F - this.thirdPersonDistancePrev) * partialTicks;
-
- if (this.mc.gameSettings.debugCamEnable)
- {
- GlStateManager.translate(0.0F, 0.0F, (float)(-d3));
- }
- else
- {
- float f1 = entity.rotationYaw;
- float f2 = entity.rotationPitch;
-
- if (this.mc.gameSettings.thirdPersonView == 2)
- {
- f2 += 180.0F;
- }
-
- double d4 = -MathHelper.sin(f1 * 0.017453292F) * MathHelper.cos(f2 * 0.017453292F) * d3;
- double d5 = MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f2 * 0.017453292F) * d3;
- double d6 = (-MathHelper.sin(f2 * 0.017453292F)) * d3;
-
- for (int i = 0; i < 8; ++i)
- {
- float f3 = (i & 1) * 2 - 1;
- float f4 = (i >> 1 & 1) * 2 - 1;
- float f5 = (i >> 2 & 1) * 2 - 1;
- f3 = f3 * 0.1F;
- f4 = f4 * 0.1F;
- f5 = f5 * 0.1F;
- RayTraceResult raytraceresult = this.mc.world.rayTraceBlocks(new Vec3d(d0 + f3, d1 + f4, d2 + f5), new Vec3d(d0 - d4 + f3 + f5, d1 - d6 + f4, d2 - d5 + f5));
-
- if (raytraceresult != null)
- {
- double d7 = raytraceresult.hitVec.distanceTo(new Vec3d(d0, d1, d2));
-
- if (d7 < d3)
- {
- d3 = d7;
- }
- }
- }
-
- if (this.mc.gameSettings.thirdPersonView == 2)
- {
- GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
- }
-
- GlStateManager.rotate(entity.rotationPitch - f2, 1.0F, 0.0F, 0.0F);
- GlStateManager.rotate(entity.rotationYaw - f1, 0.0F, 1.0F, 0.0F);
- GlStateManager.translate(0.0F, 0.0F, (float)(-d3));
- GlStateManager.rotate(f1 - entity.rotationYaw, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(f2 - entity.rotationPitch, 1.0F, 0.0F, 0.0F);
- }
- }
- else
- {
- GlStateManager.translate(0.0F, 0.0F, 0.05F);
- }
-
- if (!this.mc.gameSettings.debugCamEnable)
- {
- float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F;
- float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
- float roll = 0.0F;
- if (entity instanceof EntityAnimal)
- {
- EntityAnimal entityanimal = (EntityAnimal)entity;
- yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F;
- }
- IBlockState state = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.world, entity, partialTicks);
- net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, partialTicks, yaw, pitch, roll);
- net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
- GlStateManager.rotate(event.getRoll(), 0.0F, 0.0F, 1.0F);
- GlStateManager.rotate(event.getPitch(), 1.0F, 0.0F, 0.0F);
- GlStateManager.rotate(event.getYaw(), 0.0F, 1.0F, 0.0F);
- }
-
- GlStateManager.translate(0.0F, -f, 0.0F);
- d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
- d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks + f;
- d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
- this.cloudFog = this.mc.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks);
- }
-
- /**
- * sets up projection, view effects, camera position/rotation
- */
- private void setupCameraTransform(float partialTicks, int pass)
- {
- this.farPlaneDistance = this.mc.gameSettings.renderDistanceChunks * 16;
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
-
- if (this.mc.gameSettings.anaglyph)
- {
- GlStateManager.translate((-(pass * 2 - 1)) * 0.07F, 0.0F, 0.0F);
- }
-
- if (this.cameraZoom != 1.0D)
- {
- GlStateManager.translate((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F);
- GlStateManager.scale(this.cameraZoom, this.cameraZoom, 1.0D);
- }
-
- Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2);
- GlStateManager.matrixMode(5888);
- GlStateManager.loadIdentity();
-
- if (this.mc.gameSettings.anaglyph)
- {
- GlStateManager.translate((pass * 2 - 1) * 0.1F, 0.0F, 0.0F);
- }
-
- this.hurtCameraEffect(partialTicks);
-
- if (this.mc.gameSettings.viewBobbing)
- {
- this.applyBobbing(partialTicks);
- }
-
- float f1 = this.mc.player.prevTimeInPortal + (this.mc.player.timeInPortal - this.mc.player.prevTimeInPortal) * partialTicks;
-
- if (f1 > 0.0F)
- {
- int i = 20;
-
- if (this.mc.player.isPotionActive(MobEffects.NAUSEA))
- {
- i = 7;
- }
-
- float f2 = 5.0F / (f1 * f1 + 5.0F) - f1 * 0.04F;
- f2 = f2 * f2;
- GlStateManager.rotate((this.rendererUpdateCount + partialTicks) * i, 0.0F, 1.0F, 1.0F);
- GlStateManager.scale(1.0F / f2, 1.0F, 1.0F);
- GlStateManager.rotate(-(this.rendererUpdateCount + partialTicks) * i, 0.0F, 1.0F, 1.0F);
- }
-
- this.orientCamera(partialTicks);
-
- if (this.debugView)
- {
- switch (this.debugViewDirection)
- {
- case 0:
- GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
- break;
- case 1:
- GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
- break;
- case 2:
- GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
- break;
- case 3:
- GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
- break;
- case 4:
- GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
- }
- }
- }
-
- /**
- * Render player hand
- */
- private void renderHand(float partialTicks, int pass)
- {
- if (!this.debugView)
- {
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
-
- if (this.mc.gameSettings.anaglyph)
- {
- GlStateManager.translate((-(pass * 2 - 1)) * 0.07F, 0.0F, 0.0F);
- }
-
- Project.gluPerspective(this.getFOVModifier(partialTicks, false), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F);
- GlStateManager.matrixMode(5888);
- GlStateManager.loadIdentity();
-
- if (this.mc.gameSettings.anaglyph)
- {
- GlStateManager.translate((pass * 2 - 1) * 0.1F, 0.0F, 0.0F);
- }
-
- GlStateManager.pushMatrix();
- this.hurtCameraEffect(partialTicks);
-
- if (this.mc.gameSettings.viewBobbing)
- {
- this.applyBobbing(partialTicks);
- }
-
- boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping();
-
- if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(mc.renderGlobal, partialTicks, pass))
- if (this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator())
- {
- this.enableLightmap();
- this.itemRenderer.renderItemInFirstPerson(partialTicks);
- this.disableLightmap();
- }
-
- GlStateManager.popMatrix();
-
- if (this.mc.gameSettings.thirdPersonView == 0 && !flag)
- {
- this.itemRenderer.renderOverlays(partialTicks);
- this.hurtCameraEffect(partialTicks);
- }
-
- if (this.mc.gameSettings.viewBobbing)
- {
- this.applyBobbing(partialTicks);
- }
- }
- }
-
- public void disableLightmap()
- {
- GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
- GlStateManager.disableTexture2D();
- GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
- }
-
- public void enableLightmap()
- {
- GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
- GlStateManager.matrixMode(5890);
- GlStateManager.loadIdentity();
- GlStateManager.scale(0.00390625F, 0.00390625F, 0.00390625F);
- GlStateManager.translate(8.0F, 8.0F, 8.0F);
- GlStateManager.matrixMode(5888);
- this.mc.getTextureManager().bindTexture(this.locationLightMap);
- GlStateManager.glTexParameteri(3553, 10241, 9729);
- GlStateManager.glTexParameteri(3553, 10240, 9729);
- GlStateManager.glTexParameteri(3553, 10242, 10496);
- GlStateManager.glTexParameteri(3553, 10243, 10496);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.enableTexture2D();
- GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
- }
-
- /**
- * Recompute a random value that is applied to block color in updateLightmap()
- */
- private void updateTorchFlicker()
- {
- this.torchFlickerDX = (float)(this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random());
- this.torchFlickerDX = (float)(this.torchFlickerDX * 0.9D);
- this.torchFlickerX += this.torchFlickerDX - this.torchFlickerX;
- this.lightmapUpdateNeeded = true;
- }
-
- private void updateLightmap(float partialTicks)
- {
- if (this.lightmapUpdateNeeded)
- {
- this.mc.mcProfiler.startSection("lightTex");
- World world = this.mc.world;
-
- if (world != null)
- {
- float f = world.getSunBrightness(1.0F);
- float f1 = f * 0.95F + 0.05F;
-
- for (int i = 0; i < 256; ++i)
- {
- float f2 = world.provider.getLightBrightnessTable()[i / 16] * f1;
- float f3 = world.provider.getLightBrightnessTable()[i % 16] * (this.torchFlickerX * 0.1F + 1.5F);
-
- if (world.getLastLightningBolt() > 0)
- {
- f2 = world.provider.getLightBrightnessTable()[i / 16];
- }
-
- float f4 = f2 * (f * 0.65F + 0.35F);
- float f5 = f2 * (f * 0.65F + 0.35F);
- float f6 = f3 * ((f3 * 0.6F + 0.4F) * 0.6F + 0.4F);
- float f7 = f3 * (f3 * f3 * 0.6F + 0.4F);
- float f8 = f4 + f3;
- float f9 = f5 + f6;
- float f10 = f2 + f7;
- f8 = f8 * 0.96F + 0.03F;
- f9 = f9 * 0.96F + 0.03F;
- f10 = f10 * 0.96F + 0.03F;
-
- if (this.bossColorModifier > 0.0F)
- {
- float f11 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks;
- f8 = f8 * (1.0F - f11) + f8 * 0.7F * f11;
- f9 = f9 * (1.0F - f11) + f9 * 0.6F * f11;
- f10 = f10 * (1.0F - f11) + f10 * 0.6F * f11;
- }
-
- if (world.provider.getDimensionType().getId() == 1)
- {
- f8 = 0.22F + f3 * 0.75F;
- f9 = 0.28F + f6 * 0.75F;
- f10 = 0.25F + f7 * 0.75F;
- }
-
- float[] colors = {f8, f9, f10};
- world.provider.getLightmapColors(partialTicks, f, f2, f3, colors);
- f8 = colors[0]; f9 = colors[1]; f10 = colors[2];
-
- // Forge: fix MC-58177
- f8 = MathHelper.clamp(f8, 0f, 1f);
- f9 = MathHelper.clamp(f9, 0f, 1f);
- f10 = MathHelper.clamp(f10, 0f, 1f);
-
- if (this.mc.player.isPotionActive(MobEffects.NIGHT_VISION))
- {
- float f15 = this.getNightVisionBrightness(this.mc.player, partialTicks);
- float f12 = 1.0F / f8;
-
- if (f12 > 1.0F / f9)
- {
- f12 = 1.0F / f9;
- }
-
- if (f12 > 1.0F / f10)
- {
- f12 = 1.0F / f10;
- }
-
- f8 = f8 * (1.0F - f15) + f8 * f12 * f15;
- f9 = f9 * (1.0F - f15) + f9 * f12 * f15;
- f10 = f10 * (1.0F - f15) + f10 * f12 * f15;
- }
-
- if (f8 > 1.0F)
- {
- f8 = 1.0F;
- }
-
- if (f9 > 1.0F)
- {
- f9 = 1.0F;
- }
-
- if (f10 > 1.0F)
- {
- f10 = 1.0F;
- }
-
- float f16 = this.mc.gameSettings.gammaSetting;
- float f17 = 1.0F - f8;
- float f13 = 1.0F - f9;
- float f14 = 1.0F - f10;
- f17 = 1.0F - f17 * f17 * f17 * f17;
- f13 = 1.0F - f13 * f13 * f13 * f13;
- f14 = 1.0F - f14 * f14 * f14 * f14;
- f8 = f8 * (1.0F - f16) + f17 * f16;
- f9 = f9 * (1.0F - f16) + f13 * f16;
- f10 = f10 * (1.0F - f16) + f14 * f16;
- f8 = f8 * 0.96F + 0.03F;
- f9 = f9 * 0.96F + 0.03F;
- f10 = f10 * 0.96F + 0.03F;
-
- if (f8 > 1.0F)
- {
- f8 = 1.0F;
- }
-
- if (f9 > 1.0F)
- {
- f9 = 1.0F;
- }
-
- if (f10 > 1.0F)
- {
- f10 = 1.0F;
- }
-
- if (f8 < 0.0F)
- {
- f8 = 0.0F;
- }
-
- if (f9 < 0.0F)
- {
- f9 = 0.0F;
- }
-
- if (f10 < 0.0F)
- {
- f10 = 0.0F;
- }
-
- int k = (int)(f8 * 255.0F);
- int l = (int)(f9 * 255.0F);
- int i1 = (int)(f10 * 255.0F);
- this.lightmapColors[i] = -16777216 | k << 16 | l << 8 | i1;
- }
-
- this.lightmapTexture.updateDynamicTexture();
- this.lightmapUpdateNeeded = false;
- this.mc.mcProfiler.endSection();
- }
- }
- }
-
- private float getNightVisionBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks)
- {
- int i = entitylivingbaseIn.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration();
- return i > 200 ? 1.0F : 0.7F + MathHelper.sin((i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F;
- }
-
- public void updateCameraAndRender(float partialTicks, long nanoTime)
- {
- boolean flag = Display.isActive();
-
- if (!flag && this.mc.gameSettings.pauseOnLostFocus && (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1)))
- {
- if (Minecraft.getSystemTime() - this.prevFrameTime > 500L)
- {
- this.mc.displayInGameMenu();
- }
- }
- else
- {
- this.prevFrameTime = Minecraft.getSystemTime();
- }
-
- this.mc.mcProfiler.startSection("mouse");
-
- if (flag && Minecraft.IS_RUNNING_ON_MAC && this.mc.inGameHasFocus && !Mouse.isInsideWindow())
- {
- Mouse.setGrabbed(false);
- Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2 - 20);
- Mouse.setGrabbed(true);
- }
-
- if (this.mc.inGameHasFocus && flag)
- {
- this.mc.mouseHelper.mouseXYChange();
- this.mc.getTutorial().handleMouse(this.mc.mouseHelper);
- float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
- float f1 = f * f * f * 8.0F;
- float f2 = this.mc.mouseHelper.deltaX * f1;
- float f3 = this.mc.mouseHelper.deltaY * f1;
- int i = 1;
-
- if (this.mc.gameSettings.invertMouse)
- {
- i = -1;
- }
-
- if (this.mc.gameSettings.smoothCamera)
- {
- this.smoothCamYaw += f2;
- this.smoothCamPitch += f3;
- float f4 = partialTicks - this.smoothCamPartialTicks;
- this.smoothCamPartialTicks = partialTicks;
- f2 = this.smoothCamFilterX * f4;
- f3 = this.smoothCamFilterY * f4;
- this.mc.player.turn(f2, f3 * i);
- }
- else
- {
- this.smoothCamYaw = 0.0F;
- this.smoothCamPitch = 0.0F;
- this.mc.player.turn(f2, f3 * i);
- }
- }
-
- this.mc.mcProfiler.endSection();
-
- if (!this.mc.skipRenderWorld)
- {
- anaglyphEnable = this.mc.gameSettings.anaglyph;
- final ScaledResolution scaledresolution = new ScaledResolution(this.mc);
- int i1 = scaledresolution.getScaledWidth();
- int j1 = scaledresolution.getScaledHeight();
- final int k1 = Mouse.getX() * i1 / this.mc.displayWidth;
- final int l1 = j1 - Mouse.getY() * j1 / this.mc.displayHeight - 1;
- int i2 = this.mc.gameSettings.limitFramerate;
-
- if (this.mc.world != null)
- {
- this.mc.mcProfiler.startSection("level");
- int j = Math.min(Minecraft.getDebugFPS(), i2);
- j = Math.max(j, 60);
- long k = System.nanoTime() - nanoTime;
- long l = Math.max(1000000000 / j / 4 - k, 0L);
- this.renderWorld(partialTicks, System.nanoTime() + l);
-
- if (this.mc.isSingleplayer() && this.timeWorldIcon < Minecraft.getSystemTime() - 1000L)
- {
- this.timeWorldIcon = Minecraft.getSystemTime();
-
- if (!this.mc.getIntegratedServer().isWorldIconSet())
- {
- this.createWorldIcon();
- }
- }
-
- if (OpenGlHelper.shadersSupported)
- {
- this.mc.renderGlobal.renderEntityOutlineFramebuffer();
-
- if (this.shaderGroup != null && this.useShader)
- {
- GlStateManager.matrixMode(5890);
- GlStateManager.pushMatrix();
- GlStateManager.loadIdentity();
- this.shaderGroup.render(partialTicks);
- GlStateManager.popMatrix();
- }
-
- this.mc.getFramebuffer().bindFramebuffer(true);
- }
-
- this.mc.mcProfiler.endStartSection("gui");
-
- if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null)
- {
- GlStateManager.alphaFunc(516, 0.1F);
- this.setupOverlayRendering();
- this.renderItemActivation(i1, j1, partialTicks);
- this.mc.ingameGUI.renderGameOverlay(partialTicks);
- }
-
- this.mc.mcProfiler.endSection();
- }
- else
- {
- GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- GlStateManager.matrixMode(5888);
- GlStateManager.loadIdentity();
- this.setupOverlayRendering();
- // Forge: Fix MC-112292
- net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.instance.renderEngine = this.mc.getTextureManager();
- // Forge: also fix rendering text before entering world (not part of MC-112292, but the same reason)
- net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.instance.fontRenderer = this.mc.fontRenderer;
- }
-
- if (this.mc.currentScreen != null)
- {
- GlStateManager.clear(256);
-
- try
- {
- net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, k1, l1, this.mc.getTickLength());
- }
- catch (Throwable throwable)
- {
- CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering screen");
- CrashReportCategory crashreportcategory = crashreport.makeCategory("Screen render details");
- crashreportcategory.addDetail("Screen name", new ICrashReportDetail()
- {
- @Override
- public String call() throws Exception
- {
- return EntityRenderer.this.mc.currentScreen.getClass().getCanonicalName();
- }
- });
- crashreportcategory.addDetail("Mouse location", new ICrashReportDetail()
- {
- @Override
- public String call() throws Exception
- {
- return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", k1, l1, Mouse.getX(), Mouse.getY());
- }
- });
- crashreportcategory.addDetail("Screen size", new ICrashReportDetail()
- {
- @Override
- public String call() throws Exception
- {
- return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight(), EntityRenderer.this.mc.displayWidth, EntityRenderer.this.mc.displayHeight, scaledresolution.getScaleFactor());
- }
- });
- throw new ReportedException(crashreport);
- }
- }
- }
- }
-
- private void createWorldIcon()
- {
- if (this.mc.renderGlobal.getRenderedChunks() > 10 && this.mc.renderGlobal.hasNoChunkUpdates() && !this.mc.getIntegratedServer().isWorldIconSet())
- {
- BufferedImage bufferedimage = ScreenShotHelper.createScreenshot(this.mc.displayWidth, this.mc.displayHeight, this.mc.getFramebuffer());
- int i = bufferedimage.getWidth();
- int j = bufferedimage.getHeight();
- int k = 0;
- int l = 0;
-
- if (i > j)
- {
- k = (i - j) / 2;
- i = j;
- }
- else
- {
- l = (j - i) / 2;
- }
-
- try
- {
- BufferedImage bufferedimage1 = new BufferedImage(64, 64, 1);
- Graphics graphics = bufferedimage1.createGraphics();
- graphics.drawImage(bufferedimage, 0, 0, 64, 64, k, l, k + i, l + i, (ImageObserver)null);
- graphics.dispose();
- ImageIO.write(bufferedimage1, "png", this.mc.getIntegratedServer().getWorldIconFile());
- }
- catch (IOException ioexception)
- {
- LOGGER.warn("Couldn't save auto screenshot", ioexception);
- }
- }
- }
-
- public void renderStreamIndicator(float partialTicks)
- {
- this.setupOverlayRendering();
- }
-
- private boolean isDrawBlockOutline()
- {
- if (!this.drawBlockOutline)
- {
- return false;
- }
- else
- {
- Entity entity = this.mc.getRenderViewEntity();
- boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI;
-
- if (flag && !((EntityPlayer)entity).capabilities.allowEdit)
- {
- ItemStack itemstack = ((EntityPlayer)entity).getHeldItemMainhand();
-
- if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
- {
- BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
- Block block = this.mc.world.getBlockState(blockpos).getBlock();
-
- if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
- {
- flag = block.hasTileEntity(this.mc.world.getBlockState(blockpos)) && this.mc.world.getTileEntity(blockpos) instanceof IInventory;
- }
- else
- {
- flag = !itemstack.isEmpty() && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block));
- }
- }
- }
-
- return flag;
- }
- }
-
- public void renderWorld(float partialTicks, long finishTimeNano)
- {
- this.updateLightmap(partialTicks);
-
- if (this.mc.getRenderViewEntity() == null)
- {
- this.mc.setRenderViewEntity(this.mc.player);
- }
-
- this.getMouseOver(partialTicks);
- GlStateManager.enableDepth();
- GlStateManager.enableAlpha();
- GlStateManager.alphaFunc(516, 0.5F);
- this.mc.mcProfiler.startSection("center");
-
- if (this.mc.gameSettings.anaglyph)
- {
- anaglyphField = 0;
- GlStateManager.colorMask(false, true, true, false);
- this.renderWorldPass(0, partialTicks, finishTimeNano);
- anaglyphField = 1;
- GlStateManager.colorMask(true, false, false, false);
- this.renderWorldPass(1, partialTicks, finishTimeNano);
- GlStateManager.colorMask(true, true, true, false);
- }
- else
- {
- this.renderWorldPass(2, partialTicks, finishTimeNano);
- }
-
- this.mc.mcProfiler.endSection();
- }
-
- /**
- * XXX
- * @param pass
- * @param partialTicks
- * @param finishTimeNano
- */
- private void renderWorldPass(int pass, float partialTicks, long finishTimeNano)
- {
- RenderGlobal renderglobal = this.mc.renderGlobal;
- ParticleManager particlemanager = this.mc.effectRenderer;
- boolean flag = this.isDrawBlockOutline();
- GlStateManager.enableCull();
- this.mc.mcProfiler.endStartSection("clear");
- GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
- this.updateFogColor(partialTicks);
- GlStateManager.clear(16640);
- this.mc.mcProfiler.endStartSection("camera");
- this.setupCameraTransform(partialTicks, pass);
- ActiveRenderInfo.updateRenderInfo(this.mc.getRenderViewEntity(), this.mc.gameSettings.thirdPersonView == 2); //Forge: MC-46445 Spectator mode particles and sounds computed from where you have been before
- this.mc.mcProfiler.endStartSection("frustum");
- ClippingHelperImpl.getInstance();
- this.mc.mcProfiler.endStartSection("culling");
- ICamera icamera = new Frustum();
- Entity entity = this.mc.getRenderViewEntity();
- double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
- double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
- double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;
- icamera.setPosition(d0, d1, d2);
-
- if (this.mc.gameSettings.renderDistanceChunks >= 4)
- {
- this.setupFog(-1, partialTicks);
- this.mc.mcProfiler.endStartSection("sky");
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F);
- GlStateManager.matrixMode(5888);
- renderglobal.renderSky(partialTicks, pass);
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2);
- GlStateManager.matrixMode(5888);
- }
-
- this.setupFog(0, partialTicks);
- GlStateManager.shadeModel(7425);
-
- if (entity.posY + entity.getEyeHeight() < 128.0D)
- {
- this.renderCloudsCheck(renderglobal, partialTicks, pass, d0, d1, d2);
- }
-
- this.mc.mcProfiler.endStartSection("prepareterrain");
- this.setupFog(0, partialTicks);
- this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
- RenderHelper.disableStandardItemLighting();
- this.mc.mcProfiler.endStartSection("terrain_setup");
- renderglobal.setupTerrain(entity, partialTicks, icamera, this.frameCount++, this.mc.player.isSpectator());
-
- if (pass == 0 || pass == 2)
- {
- this.mc.mcProfiler.endStartSection("updatechunks");
- this.mc.renderGlobal.updateChunks(finishTimeNano);
- }
-
- this.mc.mcProfiler.endStartSection("terrain");
- GlStateManager.matrixMode(5888);
- GlStateManager.pushMatrix();
- GlStateManager.disableAlpha();
-
-
- // TODO
- CustomRenderer.drawTest(d0,d1,d2);
-
- // XXX
- // totally opaque blocks
- renderglobal.renderBlockLayer(BlockRenderLayer.SOLID, partialTicks, pass, entity);
- GlStateManager.enableAlpha();
- this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, this.mc.gameSettings.mipmapLevels > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
- // blocks with a transparent texture component (grass on dirt counts)
- renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT_MIPPED, partialTicks, pass, entity);
- this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
- this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
- // blocks with a transparent texture component (grass on dirt counts)
- renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT, partialTicks, pass, entity);
- this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
- GlStateManager.shadeModel(7424);
- GlStateManager.alphaFunc(516, 0.1F);
-
- if (!this.debugView)
- {
- GlStateManager.matrixMode(5888);
- GlStateManager.popMatrix();
- GlStateManager.pushMatrix();
- RenderHelper.enableStandardItemLighting();
- this.mc.mcProfiler.endStartSection("entities");
- net.minecraftforge.client.ForgeHooksClient.setRenderPass(0);
- renderglobal.renderEntities(entity, icamera, partialTicks);
- net.minecraftforge.client.ForgeHooksClient.setRenderPass(0);
- RenderHelper.disableStandardItemLighting();
- this.disableLightmap();
- }
-
- GlStateManager.matrixMode(5888);
- GlStateManager.popMatrix();
-
- if (flag && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.WATER))
- {
- EntityPlayer entityplayer = (EntityPlayer)entity;
- GlStateManager.disableAlpha();
- this.mc.mcProfiler.endStartSection("outline");
- if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, partialTicks))
- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
- GlStateManager.enableAlpha();
- }
-
- if (this.mc.debugRenderer.shouldRender())
- {
- this.mc.debugRenderer.renderDebug(partialTicks, finishTimeNano);
- }
-
- this.mc.mcProfiler.endStartSection("destroyProgress");
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
- renderglobal.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getBuffer(), entity, partialTicks);
- this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
- GlStateManager.disableBlend();
-
- if (!this.debugView)
- {
- this.enableLightmap();
- this.mc.mcProfiler.endStartSection("litParticles");
- particlemanager.renderLitParticles(entity, partialTicks);
- RenderHelper.disableStandardItemLighting();
- this.setupFog(0, partialTicks);
- this.mc.mcProfiler.endStartSection("particles");
- particlemanager.renderParticles(entity, partialTicks);
- this.disableLightmap();
- }
-
- GlStateManager.depthMask(false);
- GlStateManager.enableCull();
- this.mc.mcProfiler.endStartSection("weather");
- this.renderRainSnow(partialTicks);
- GlStateManager.depthMask(true);
- renderglobal.renderWorldBorder(entity, partialTicks);
- GlStateManager.disableBlend();
- GlStateManager.enableCull();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- GlStateManager.alphaFunc(516, 0.1F);
- this.setupFog(0, partialTicks);
- GlStateManager.enableBlend();
- GlStateManager.depthMask(false);
- this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
- GlStateManager.shadeModel(7425);
- this.mc.mcProfiler.endStartSection("translucent");
- renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, partialTicks, pass, entity);
- if (!this.debugView) //Only render if render pass 0 happens as well.
- {
- RenderHelper.enableStandardItemLighting();
- this.mc.mcProfiler.endStartSection("entities");
- net.minecraftforge.client.ForgeHooksClient.setRenderPass(1);
- renderglobal.renderEntities(entity, icamera, partialTicks);
- // restore blending function changed by RenderGlobal.preRenderDamagedBlocks
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1);
- RenderHelper.disableStandardItemLighting();
- }
- GlStateManager.shadeModel(7424);
- GlStateManager.depthMask(true);
- GlStateManager.enableCull();
- GlStateManager.disableBlend();
- GlStateManager.disableFog();
-
- if (entity.posY + entity.getEyeHeight() >= 128.0D)
- {
- this.mc.mcProfiler.endStartSection("aboveClouds");
- this.renderCloudsCheck(renderglobal, partialTicks, pass, d0, d1, d2);
- }
-
- this.mc.mcProfiler.endStartSection("forge_render_last");
- net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks);
-
- this.mc.mcProfiler.endStartSection("hand");
-
- if (this.renderHand)
- {
- GlStateManager.clear(256);
- this.renderHand(partialTicks, pass);
- }
-
- }
-
-
-
-
- private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass, double x, double y, double z)
- {
- if (this.mc.gameSettings.shouldRenderClouds() != 0)
- {
- this.mc.mcProfiler.endStartSection("clouds");
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F);
- GlStateManager.matrixMode(5888);
- GlStateManager.pushMatrix();
- this.setupFog(0, partialTicks);
- renderGlobalIn.renderClouds(partialTicks, pass, x, y, z);
- GlStateManager.disableFog();
- GlStateManager.popMatrix();
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2);
- GlStateManager.matrixMode(5888);
- }
- }
-
- private void addRainParticles()
- {
- float f = this.mc.world.getRainStrength(1.0F);
-
- if (!this.mc.gameSettings.fancyGraphics)
- {
- f /= 2.0F;
- }
-
- if (f != 0.0F)
- {
- this.random.setSeed(this.rendererUpdateCount * 312987231L);
- Entity entity = this.mc.getRenderViewEntity();
- World world = this.mc.world;
- BlockPos blockpos = new BlockPos(entity);
- double d0 = 0.0D;
- double d1 = 0.0D;
- double d2 = 0.0D;
- int j = 0;
- int k = (int)(100.0F * f * f);
-
- if (this.mc.gameSettings.particleSetting == 1)
- {
- k >>= 1;
- }
- else if (this.mc.gameSettings.particleSetting == 2)
- {
- k = 0;
- }
-
- for (int l = 0; l < k; ++l)
- {
- BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.nextInt(10) - this.random.nextInt(10), 0, this.random.nextInt(10) - this.random.nextInt(10)));
- Biome biome = world.getBiome(blockpos1);
- BlockPos blockpos2 = blockpos1.down();
- IBlockState iblockstate = world.getBlockState(blockpos2);
-
- if (blockpos1.getY() <= blockpos.getY() + 10 && blockpos1.getY() >= blockpos.getY() - 10 && biome.canRain() && biome.getTemperature(blockpos1) >= 0.15F)
- {
- double d3 = this.random.nextDouble();
- double d4 = this.random.nextDouble();
- AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(world, blockpos2);
-
- if (iblockstate.getMaterial() != Material.LAVA && iblockstate.getBlock() != Blocks.MAGMA)
- {
- if (iblockstate.getMaterial() != Material.AIR)
- {
- ++j;
-
- if (this.random.nextInt(j) == 0)
- {
- d0 = blockpos2.getX() + d3;
- d1 = blockpos2.getY() + 0.1F + axisalignedbb.maxY - 1.0D;
- d2 = blockpos2.getZ() + d4;
- }
-
- this.mc.world.spawnParticle(EnumParticleTypes.WATER_DROP, blockpos2.getX() + d3, blockpos2.getY() + 0.1F + axisalignedbb.maxY, blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
- }
- }
- else
- {
- this.mc.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, blockpos1.getX() + d3, blockpos1.getY() + 0.1F - axisalignedbb.minY, blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
- }
- }
- }
-
- if (j > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
- {
- this.rainSoundCounter = 0;
-
- if (d1 > blockpos.getY() + 1 && world.getPrecipitationHeight(blockpos).getY() > MathHelper.floor(blockpos.getY()))
- {
- this.mc.world.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN_ABOVE, SoundCategory.WEATHER, 0.1F, 0.5F, false);
- }
- else
- {
- this.mc.world.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN, SoundCategory.WEATHER, 0.2F, 1.0F, false);
- }
- }
- }
- }
-
- /**
- * Render rain and snow
- */
- protected void renderRainSnow(float partialTicks)
- {
- net.minecraftforge.client.IRenderHandler renderer = this.mc.world.provider.getWeatherRenderer();
- if (renderer != null)
- {
- renderer.render(partialTicks, this.mc.world, mc);
- return;
- }
-
- float f = this.mc.world.getRainStrength(partialTicks);
-
- if (f > 0.0F)
- {
- this.enableLightmap();
- Entity entity = this.mc.getRenderViewEntity();
- World world = this.mc.world;
- int i = MathHelper.floor(entity.posX);
- int j = MathHelper.floor(entity.posY);
- int k = MathHelper.floor(entity.posZ);
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- GlStateManager.disableCull();
- GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- GlStateManager.alphaFunc(516, 0.1F);
- double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
- double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
- double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;
- int l = MathHelper.floor(d1);
- int i1 = 5;
-
- if (this.mc.gameSettings.fancyGraphics)
- {
- i1 = 10;
- }
-
- int j1 = -1;
- float f1 = this.rendererUpdateCount + partialTicks;
- bufferbuilder.setTranslation(-d0, -d1, -d2);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
-
- for (int k1 = k - i1; k1 <= k + i1; ++k1)
- {
- for (int l1 = i - i1; l1 <= i + i1; ++l1)
- {
- int i2 = (k1 - k + 16) * 32 + l1 - i + 16;
- double d3 = this.rainXCoords[i2] * 0.5D;
- double d4 = this.rainYCoords[i2] * 0.5D;
- blockpos$mutableblockpos.setPos(l1, 0, k1);
- Biome biome = world.getBiome(blockpos$mutableblockpos);
-
- if (biome.canRain() || biome.getEnableSnow())
- {
- int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY();
- int k2 = j - i1;
- int l2 = j + i1;
-
- if (k2 < j2)
- {
- k2 = j2;
- }
-
- if (l2 < j2)
- {
- l2 = j2;
- }
-
- int i3 = j2;
-
- if (j2 < l)
- {
- i3 = l;
- }
-
- if (k2 != l2)
- {
- this.random.setSeed(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761);
- blockpos$mutableblockpos.setPos(l1, k2, k1);
- float f2 = biome.getTemperature(blockpos$mutableblockpos);
-
- if (world.getBiomeProvider().getTemperatureAtHeight(f2, j2) >= 0.15F)
- {
- if (j1 != 0)
- {
- if (j1 >= 0)
- {
- tessellator.draw();
- }
-
- j1 = 0;
- this.mc.getTextureManager().bindTexture(RAIN_TEXTURES);
- bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
- }
-
- double d5 = -((double)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.nextDouble());
- double d6 = l1 + 0.5F - entity.posX;
- double d7 = k1 + 0.5F - entity.posZ;
- float f3 = MathHelper.sqrt(d6 * d6 + d7 * d7) / i1;
- float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f;
- blockpos$mutableblockpos.setPos(l1, i3, k1);
- int j3 = world.getCombinedLight(blockpos$mutableblockpos, 0);
- int k3 = j3 >> 16 & 65535;
- int l3 = j3 & 65535;
- bufferbuilder.pos(l1 - d3 + 0.5D, l2, k1 - d4 + 0.5D).tex(0.0D, k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
- bufferbuilder.pos(l1 + d3 + 0.5D, l2, k1 + d4 + 0.5D).tex(1.0D, k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
- bufferbuilder.pos(l1 + d3 + 0.5D, k2, k1 + d4 + 0.5D).tex(1.0D, l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
- bufferbuilder.pos(l1 - d3 + 0.5D, k2, k1 - d4 + 0.5D).tex(0.0D, l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
- }
- else
- {
- if (j1 != 1)
- {
- if (j1 >= 0)
- {
- tessellator.draw();
- }
-
- j1 = 1;
- this.mc.getTextureManager().bindTexture(SNOW_TEXTURES);
- bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
- }
-
- double d8 = -((this.rendererUpdateCount & 511) + partialTicks) / 512.0F;
- double d9 = this.random.nextDouble() + f1 * 0.01D * ((float)this.random.nextGaussian());
- double d10 = this.random.nextDouble() + f1 * (float)this.random.nextGaussian() * 0.001D;
- double d11 = l1 + 0.5F - entity.posX;
- double d12 = k1 + 0.5F - entity.posZ;
- float f6 = MathHelper.sqrt(d11 * d11 + d12 * d12) / i1;
- float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f;
- blockpos$mutableblockpos.setPos(l1, i3, k1);
- int i4 = (world.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4;
- int j4 = i4 >> 16 & 65535;
- int k4 = i4 & 65535;
- bufferbuilder.pos(l1 - d3 + 0.5D, l2, k1 - d4 + 0.5D).tex(0.0D + d9, k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
- bufferbuilder.pos(l1 + d3 + 0.5D, l2, k1 + d4 + 0.5D).tex(1.0D + d9, k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
- bufferbuilder.pos(l1 + d3 + 0.5D, k2, k1 + d4 + 0.5D).tex(1.0D + d9, l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
- bufferbuilder.pos(l1 - d3 + 0.5D, k2, k1 - d4 + 0.5D).tex(0.0D + d9, l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
- }
- }
- }
- }
- }
-
- if (j1 >= 0)
- {
- tessellator.draw();
- }
-
- bufferbuilder.setTranslation(0.0D, 0.0D, 0.0D);
- GlStateManager.enableCull();
- GlStateManager.disableBlend();
- GlStateManager.alphaFunc(516, 0.1F);
- this.disableLightmap();
- }
- }
-
- /**
- * Setup orthogonal projection for rendering GUI screen overlays
- */
- public void setupOverlayRendering()
- {
- ScaledResolution scaledresolution = new ScaledResolution(this.mc);
- GlStateManager.clear(256);
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
- GlStateManager.matrixMode(5888);
- GlStateManager.loadIdentity();
- GlStateManager.translate(0.0F, 0.0F, -2000.0F);
- }
-
- /**
- * calculates fog and calls glClearColor
- */
- private void updateFogColor(float partialTicks)
- {
- World world = this.mc.world;
- Entity entity = this.mc.getRenderViewEntity();
- float f = 0.25F + 0.75F * this.mc.gameSettings.renderDistanceChunks / 32.0F;
- f = 1.0F - (float)Math.pow(f, 0.25D);
- Vec3d vec3d = world.getSkyColor(this.mc.getRenderViewEntity(), partialTicks);
- float f1 = (float)vec3d.x;
- float f2 = (float)vec3d.y;
- float f3 = (float)vec3d.z;
- Vec3d vec3d1 = world.getFogColor(partialTicks);
- this.fogColorRed = (float)vec3d1.x;
- this.fogColorGreen = (float)vec3d1.y;
- this.fogColorBlue = (float)vec3d1.z;
-
- if (this.mc.gameSettings.renderDistanceChunks >= 4)
- {
- double d0 = MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) > 0.0F ? -1.0D : 1.0D;
- Vec3d vec3d2 = new Vec3d(d0, 0.0D, 0.0D);
- float f5 = (float)entity.getLook(partialTicks).dotProduct(vec3d2);
-
- if (f5 < 0.0F)
- {
- f5 = 0.0F;
- }
-
- if (f5 > 0.0F)
- {
- float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks);
-
- if (afloat != null)
- {
- f5 = f5 * afloat[3];
- this.fogColorRed = this.fogColorRed * (1.0F - f5) + afloat[0] * f5;
- this.fogColorGreen = this.fogColorGreen * (1.0F - f5) + afloat[1] * f5;
- this.fogColorBlue = this.fogColorBlue * (1.0F - f5) + afloat[2] * f5;
- }
- }
- }
-
- this.fogColorRed += (f1 - this.fogColorRed) * f;
- this.fogColorGreen += (f2 - this.fogColorGreen) * f;
- this.fogColorBlue += (f3 - this.fogColorBlue) * f;
- float f8 = world.getRainStrength(partialTicks);
-
- if (f8 > 0.0F)
- {
- float f4 = 1.0F - f8 * 0.5F;
- float f10 = 1.0F - f8 * 0.4F;
- this.fogColorRed *= f4;
- this.fogColorGreen *= f4;
- this.fogColorBlue *= f10;
- }
-
- float f9 = world.getThunderStrength(partialTicks);
-
- if (f9 > 0.0F)
- {
- float f11 = 1.0F - f9 * 0.5F;
- this.fogColorRed *= f11;
- this.fogColorGreen *= f11;
- this.fogColorBlue *= f11;
- }
-
- IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.world, entity, partialTicks);
-
- if (this.cloudFog)
- {
- Vec3d vec3d3 = world.getCloudColour(partialTicks);
- this.fogColorRed = (float)vec3d3.x;
- this.fogColorGreen = (float)vec3d3.y;
- this.fogColorBlue = (float)vec3d3.z;
- }
- else
- {
- //Forge Moved to Block.
- Vec3d viewport = ActiveRenderInfo.projectViewFromEntity(entity, partialTicks);
- BlockPos viewportPos = new BlockPos(viewport);
- IBlockState viewportState = this.mc.world.getBlockState(viewportPos);
- Vec3d inMaterialColor = viewportState.getBlock().getFogColor(this.mc.world, viewportPos, viewportState, entity, new Vec3d(fogColorRed, fogColorGreen, fogColorBlue), partialTicks);
- this.fogColorRed = (float)inMaterialColor.x;
- this.fogColorGreen = (float)inMaterialColor.y;
- this.fogColorBlue = (float)inMaterialColor.z;
- }
-
- float f13 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * partialTicks;
- this.fogColorRed *= f13;
- this.fogColorGreen *= f13;
- this.fogColorBlue *= f13;
- double d1 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) * world.provider.getVoidFogYFactor();
-
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS))
- {
- int i = ((EntityLivingBase)entity).getActivePotionEffect(MobEffects.BLINDNESS).getDuration();
-
- if (i < 20)
- {
- d1 *= 1.0F - i / 20.0F;
- }
- else
- {
- d1 = 0.0D;
- }
- }
-
- if (d1 < 1.0D)
- {
- if (d1 < 0.0D)
- {
- d1 = 0.0D;
- }
-
- d1 = d1 * d1;
- this.fogColorRed = (float)(this.fogColorRed * d1);
- this.fogColorGreen = (float)(this.fogColorGreen * d1);
- this.fogColorBlue = (float)(this.fogColorBlue * d1);
- }
-
- if (this.bossColorModifier > 0.0F)
- {
- float f14 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks;
- this.fogColorRed = this.fogColorRed * (1.0F - f14) + this.fogColorRed * 0.7F * f14;
- this.fogColorGreen = this.fogColorGreen * (1.0F - f14) + this.fogColorGreen * 0.6F * f14;
- this.fogColorBlue = this.fogColorBlue * (1.0F - f14) + this.fogColorBlue * 0.6F * f14;
- }
-
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.NIGHT_VISION))
- {
- float f15 = this.getNightVisionBrightness((EntityLivingBase)entity, partialTicks);
- float f6 = 1.0F / this.fogColorRed;
-
- if (f6 > 1.0F / this.fogColorGreen)
- {
- f6 = 1.0F / this.fogColorGreen;
- }
-
- if (f6 > 1.0F / this.fogColorBlue)
- {
- f6 = 1.0F / this.fogColorBlue;
- }
-
- // Forge: fix MC-4647 and MC-10480
- if (Float.isInfinite(f6)) f6 = Math.nextAfter(f6, 0.0);
-
- this.fogColorRed = this.fogColorRed * (1.0F - f15) + this.fogColorRed * f6 * f15;
- this.fogColorGreen = this.fogColorGreen * (1.0F - f15) + this.fogColorGreen * f6 * f15;
- this.fogColorBlue = this.fogColorBlue * (1.0F - f15) + this.fogColorBlue * f6 * f15;
- }
-
- if (this.mc.gameSettings.anaglyph)
- {
- float f16 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F;
- float f17 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F;
- float f7 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F;
- this.fogColorRed = f16;
- this.fogColorGreen = f17;
- this.fogColorBlue = f7;
- }
-
- net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue);
- net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
-
- this.fogColorRed = event.getRed();
- this.fogColorGreen = event.getGreen();
- this.fogColorBlue = event.getBlue();
-
- GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
- }
-
- /**
- * Sets up the fog to be rendered. If the arg passed in is -1 the fog starts at 0 and goes to 80% of far plane
- * distance and is used for sky rendering.
- */
- private void setupFog(int startCoords, float partialTicks)
- {
- Entity entity = this.mc.getRenderViewEntity();
- this.setupFogColor(false);
- GlStateManager.glNormal3f(0.0F, -1.0F, 0.0F);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.world, entity, partialTicks);
- float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, iblockstate, partialTicks, 0.1F);
- if (hook >= 0) GlStateManager.setFogDensity(hook);
- else
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS))
- {
- float f1 = 5.0F;
- int i = ((EntityLivingBase)entity).getActivePotionEffect(MobEffects.BLINDNESS).getDuration();
-
- if (i < 20)
- {
- f1 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - i / 20.0F);
- }
-
- GlStateManager.setFog(GlStateManager.FogMode.LINEAR);
-
- if (startCoords == -1)
- {
- GlStateManager.setFogStart(0.0F);
- GlStateManager.setFogEnd(f1 * 0.8F);
- }
- else
- {
- GlStateManager.setFogStart(f1 * 0.25F);
- GlStateManager.setFogEnd(f1);
- }
-
- if (GLContext.getCapabilities().GL_NV_fog_distance)
- {
- GlStateManager.glFogi(34138, 34139);
- }
- }
- else if (this.cloudFog)
- {
- GlStateManager.setFog(GlStateManager.FogMode.EXP);
- GlStateManager.setFogDensity(0.1F);
- }
- else if (iblockstate.getMaterial() == Material.WATER)
- {
- GlStateManager.setFog(GlStateManager.FogMode.EXP);
-
- if (entity instanceof EntityLivingBase)
- {
- if (((EntityLivingBase)entity).isPotionActive(MobEffects.WATER_BREATHING))
- {
- GlStateManager.setFogDensity(0.01F);
- }
- else
- {
- GlStateManager.setFogDensity(0.1F - EnchantmentHelper.getRespirationModifier((EntityLivingBase)entity) * 0.03F);
- }
- }
- else
- {
- GlStateManager.setFogDensity(0.1F);
- }
- }
- else if (iblockstate.getMaterial() == Material.LAVA)
- {
- GlStateManager.setFog(GlStateManager.FogMode.EXP);
- GlStateManager.setFogDensity(2.0F);
- }
- else
- {
- float f = this.farPlaneDistance;
- GlStateManager.setFog(GlStateManager.FogMode.LINEAR);
-
- if (startCoords == -1)
- {
- GlStateManager.setFogStart(0.0F);
- GlStateManager.setFogEnd(f);
- }
- else
- {
- GlStateManager.setFogStart(f * 0.75F);
- GlStateManager.setFogEnd(f);
- }
-
- if (GLContext.getCapabilities().GL_NV_fog_distance)
- {
- GlStateManager.glFogi(34138, 34139);
- }
-
- if (this.mc.world.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ) || this.mc.ingameGUI.getBossOverlay().shouldCreateFog())
- {
- GlStateManager.setFogStart(f * 0.05F);
- GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F);
- }
- net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, iblockstate, partialTicks, startCoords, f);
- }
-
- GlStateManager.enableColorMaterial();
- GlStateManager.enableFog();
- GlStateManager.colorMaterial(1028, 4608);
- }
-
- public void setupFogColor(boolean black)
- {
- if (black)
- {
- GlStateManager.glFog(2918, this.setFogColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
- }
- else
- {
- GlStateManager.glFog(2918, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F));
- }
- }
-
- /**
- * Update and return fogColorBuffer with the RGBA values passed as arguments
- */
- private FloatBuffer setFogColorBuffer(float red, float green, float blue, float alpha)
- {
- this.fogColorBuffer.clear();
- this.fogColorBuffer.put(red).put(green).put(blue).put(alpha);
- this.fogColorBuffer.flip();
- return this.fogColorBuffer;
- }
-
- public void resetData()
- {
- this.itemActivationItem = null;
- this.mapItemRenderer.clearLoadedMaps();
- }
-
- public MapItemRenderer getMapItemRenderer()
- {
- return this.mapItemRenderer;
- }
-
- public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking)
- {
- GlStateManager.pushMatrix();
- GlStateManager.translate(x, y, z);
- GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(-viewerYaw, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate((isThirdPersonFrontal ? -1 : 1) * viewerPitch, 1.0F, 0.0F, 0.0F);
- GlStateManager.scale(-0.025F, -0.025F, 0.025F);
- GlStateManager.disableLighting();
- GlStateManager.depthMask(false);
-
- if (!isSneaking)
- {
- GlStateManager.disableDepth();
- }
-
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- int i = fontRendererIn.getStringWidth(str) / 2;
- GlStateManager.disableTexture2D();
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
- bufferbuilder.pos(-i - 1, -1 + verticalShift, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- bufferbuilder.pos(-i - 1, 8 + verticalShift, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- bufferbuilder.pos(i + 1, 8 + verticalShift, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- bufferbuilder.pos(i + 1, -1 + verticalShift, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- tessellator.draw();
- GlStateManager.enableTexture2D();
-
- if (!isSneaking)
- {
- fontRendererIn.drawString(str, -fontRendererIn.getStringWidth(str) / 2, verticalShift, 553648127);
- GlStateManager.enableDepth();
- }
-
- GlStateManager.depthMask(true);
- fontRendererIn.drawString(str, -fontRendererIn.getStringWidth(str) / 2, verticalShift, isSneaking ? 553648127 : -1);
- GlStateManager.enableLighting();
- GlStateManager.disableBlend();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.popMatrix();
- }
-
- public void displayItemActivation(ItemStack stack)
- {
- this.itemActivationItem = stack;
- this.itemActivationTicks = 40;
- this.itemActivationOffX = this.random.nextFloat() * 2.0F - 1.0F;
- this.itemActivationOffY = this.random.nextFloat() * 2.0F - 1.0F;
- }
-
- private void renderItemActivation(int p_190563_1_, int p_190563_2_, float p_190563_3_)
- {
- if (this.itemActivationItem != null && this.itemActivationTicks > 0)
- {
- int i = 40 - this.itemActivationTicks;
- float f = (i + p_190563_3_) / 40.0F;
- float f1 = f * f;
- float f2 = f * f1;
- float f3 = 10.25F * f2 * f1 + -24.95F * f1 * f1 + 25.5F * f2 + -13.8F * f1 + 4.0F * f;
- float f4 = f3 * (float)Math.PI;
- float f5 = this.itemActivationOffX * (p_190563_1_ / 4);
- float f6 = this.itemActivationOffY * (p_190563_2_ / 4);
- GlStateManager.enableAlpha();
- GlStateManager.pushMatrix();
- GlStateManager.pushAttrib();
- GlStateManager.enableDepth();
- GlStateManager.disableCull();
- RenderHelper.enableStandardItemLighting();
- GlStateManager.translate(p_190563_1_ / 2 + f5 * MathHelper.abs(MathHelper.sin(f4 * 2.0F)), p_190563_2_ / 2 + f6 * MathHelper.abs(MathHelper.sin(f4 * 2.0F)), -50.0F);
- float f7 = 50.0F + 175.0F * MathHelper.sin(f4);
- GlStateManager.scale(f7, -f7, f7);
- GlStateManager.rotate(900.0F * MathHelper.abs(MathHelper.sin(f4)), 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(6.0F * MathHelper.cos(f * 8.0F), 1.0F, 0.0F, 0.0F);
- GlStateManager.rotate(6.0F * MathHelper.cos(f * 8.0F), 0.0F, 0.0F, 1.0F);
- this.mc.getRenderItem().renderItem(this.itemActivationItem, ItemCameraTransforms.TransformType.FIXED);
- GlStateManager.popAttrib();
- GlStateManager.popMatrix();
- RenderHelper.disableStandardItemLighting();
- GlStateManager.enableCull();
- GlStateManager.disableDepth();
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java
deleted file mode 100644
index 73391eb35..000000000
--- a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java
+++ /dev/null
@@ -1,2657 +0,0 @@
-package net.minecraft.client.renderer;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Random;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.lwjgl.util.vector.Vector3f;
-import org.lwjgl.util.vector.Vector4f;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Queues;
-import com.google.common.collect.Sets;
-import com.google.gson.JsonSyntaxException;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockChest;
-import net.minecraft.block.BlockEnderChest;
-import net.minecraft.block.BlockSign;
-import net.minecraft.block.BlockSkull;
-import net.minecraft.block.SoundType;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.audio.ISound;
-import net.minecraft.client.audio.PositionedSoundRecord;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.client.particle.Particle;
-import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher;
-import net.minecraft.client.renderer.chunk.CompiledChunk;
-import net.minecraft.client.renderer.chunk.IRenderChunkFactory;
-import net.minecraft.client.renderer.chunk.ListChunkFactory;
-import net.minecraft.client.renderer.chunk.RenderChunk;
-import net.minecraft.client.renderer.chunk.VboChunkFactory;
-import net.minecraft.client.renderer.chunk.VisGraph;
-import net.minecraft.client.renderer.culling.ClippingHelper;
-import net.minecraft.client.renderer.culling.ClippingHelperImpl;
-import net.minecraft.client.renderer.culling.Frustum;
-import net.minecraft.client.renderer.culling.ICamera;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.client.renderer.texture.TextureMap;
-import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.renderer.vertex.VertexBuffer;
-import net.minecraft.client.renderer.vertex.VertexFormat;
-import net.minecraft.client.renderer.vertex.VertexFormatElement;
-import net.minecraft.client.resources.IResourceManager;
-import net.minecraft.client.resources.IResourceManagerReloadListener;
-import net.minecraft.client.shader.Framebuffer;
-import net.minecraft.client.shader.ShaderGroup;
-import net.minecraft.client.shader.ShaderLinkHelper;
-import net.minecraft.crash.CrashReport;
-import net.minecraft.crash.CrashReportCategory;
-import net.minecraft.crash.ICrashReportDetail;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.init.SoundEvents;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemDye;
-import net.minecraft.item.ItemRecord;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityChest;
-import net.minecraft.util.BlockRenderLayer;
-import net.minecraft.util.ClassInheritanceMultiMap;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.EnumParticleTypes;
-import net.minecraft.util.ReportedException;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.SoundCategory;
-import net.minecraft.util.SoundEvent;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.MathHelper;
-import net.minecraft.util.math.RayTraceResult;
-import net.minecraft.util.math.Vec3d;
-import net.minecraft.world.IWorldEventListener;
-import net.minecraft.world.World;
-import net.minecraft.world.border.WorldBorder;
-import net.minecraft.world.chunk.Chunk;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-
-/**
- * The only change was removing some unused variables
- * @version 04-16-2020
- */
-@SuppressWarnings("deprecation")
-@SideOnly(Side.CLIENT)
-public class RenderGlobal implements IWorldEventListener, IResourceManagerReloadListener
-{
- private static final Logger LOGGER = LogManager.getLogger();
- private static final ResourceLocation MOON_PHASES_TEXTURES = new ResourceLocation("textures/environment/moon_phases.png");
- private static final ResourceLocation SUN_TEXTURES = new ResourceLocation("textures/environment/sun.png");
- private static final ResourceLocation CLOUDS_TEXTURES = new ResourceLocation("textures/environment/clouds.png");
- private static final ResourceLocation END_SKY_TEXTURES = new ResourceLocation("textures/environment/end_sky.png");
- private static final ResourceLocation FORCEFIELD_TEXTURES = new ResourceLocation("textures/misc/forcefield.png");
- /** A reference to the Minecraft object. */
- private final Minecraft mc;
- /** The RenderEngine instance used by RenderGlobal */
- private final TextureManager renderEngine;
- private final RenderManager renderManager;
- private WorldClient world;
- private Set chunksToUpdate = Sets.newLinkedHashSet();
- /** List of OpenGL lists for the current render pass */
- private List renderInfos = Lists.newArrayListWithCapacity(69696);
- /** Global tile entities, always rendered (beacon, end teleporter, structures) */
- private final Set setTileEntities = Sets.newHashSet();
- private ViewFrustum viewFrustum;
- /** The star GL Call list */
- private int starGLCallList = -1;
- /** OpenGL sky list */
- private int glSkyList = -1;
- /** OpenGL sky list 2 */
- private int glSkyList2 = -1;
- private final VertexFormat vertexBufferFormat;
- private VertexBuffer starVBO;
- private VertexBuffer skyVBO;
- private VertexBuffer sky2VBO;
- /** counts the cloud render updates. Used with mod to stagger some updates */
- private int cloudTickCounter;
- /**
- * Stores blocks currently being broken. Key is entity ID of the thing doing the breaking. Value is a
- * DestroyBlockProgress
- */
- private final Map damagedBlocks = Maps.newHashMap();
- /** Currently playing sounds. Type: HashMap */
- private final Map mapSoundPositions = Maps.newHashMap();
- private final TextureAtlasSprite[] destroyBlockIcons = new TextureAtlasSprite[10];
- private Framebuffer entityOutlineFramebuffer;
- /** Stores the shader group for the entity_outline shader */
- private ShaderGroup entityOutlineShader;
- private double frustumUpdatePosX = Double.MIN_VALUE;
- private double frustumUpdatePosY = Double.MIN_VALUE;
- private double frustumUpdatePosZ = Double.MIN_VALUE;
- private int frustumUpdatePosChunkX = Integer.MIN_VALUE;
- private int frustumUpdatePosChunkY = Integer.MIN_VALUE;
- private int frustumUpdatePosChunkZ = Integer.MIN_VALUE;
- private double lastViewEntityX = Double.MIN_VALUE;
- private double lastViewEntityY = Double.MIN_VALUE;
- private double lastViewEntityZ = Double.MIN_VALUE;
- private double lastViewEntityPitch = Double.MIN_VALUE;
- private double lastViewEntityYaw = Double.MIN_VALUE;
- private ChunkRenderDispatcher renderDispatcher;
- private ChunkRenderContainer renderContainer;
- private int renderDistanceChunks = -1;
- /** Render entities startup counter (init value=2) */
- private int renderEntitiesStartupCounter = 2;
- /** Count entities total */
- private int countEntitiesTotal;
- /** Count entities rendered */
- private int countEntitiesRendered;
- /** Count entities hidden */
- private int countEntitiesHidden;
- private boolean debugFixTerrainFrustum;
- private ClippingHelper debugFixedClippingHelper;
- private final Vector4f[] debugTerrainMatrix = new Vector4f[8];
- private final Vector3d debugTerrainFrustumPosition = new Vector3d();
- private boolean vboEnabled;
- IRenderChunkFactory renderChunkFactory;
- private double prevRenderSortX;
- private double prevRenderSortY;
- private double prevRenderSortZ;
- private boolean displayListEntitiesDirty = true;
- private boolean entityOutlinesRendered;
- private final Set setLightUpdates = Sets.newHashSet();
-
- public RenderGlobal(Minecraft mcIn)
- {
- this.mc = mcIn;
- this.renderManager = mcIn.getRenderManager();
- this.renderEngine = mcIn.getTextureManager();
- this.renderEngine.bindTexture(FORCEFIELD_TEXTURES);
- GlStateManager.glTexParameteri(3553, 10242, 10497);
- GlStateManager.glTexParameteri(3553, 10243, 10497);
- GlStateManager.bindTexture(0);
- this.updateDestroyBlockIcons();
- this.vboEnabled = OpenGlHelper.useVbo();
-
- if (this.vboEnabled)
- {
- this.renderContainer = new VboRenderList();
- this.renderChunkFactory = new VboChunkFactory();
- }
- else
- {
- this.renderContainer = new RenderList();
- this.renderChunkFactory = new ListChunkFactory();
- }
-
- this.vertexBufferFormat = new VertexFormat();
- this.vertexBufferFormat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
- this.generateStars();
- this.generateSky();
- this.generateSky2();
- }
-
- @Override
- public void onResourceManagerReload(IResourceManager resourceManager)
- {
- this.updateDestroyBlockIcons();
- }
-
- private void updateDestroyBlockIcons()
- {
- TextureMap texturemap = this.mc.getTextureMapBlocks();
-
- for (int i = 0; i < this.destroyBlockIcons.length; ++i)
- {
- this.destroyBlockIcons[i] = texturemap.getAtlasSprite("minecraft:blocks/destroy_stage_" + i);
- }
- }
-
- /**
- * Creates the entity outline shader to be stored in RenderGlobal.entityOutlineShader
- */
- public void makeEntityOutlineShader()
- {
- if (OpenGlHelper.shadersSupported)
- {
- if (ShaderLinkHelper.getStaticShaderLinkHelper() == null)
- {
- ShaderLinkHelper.setNewStaticShaderLinkHelper();
- }
-
- ResourceLocation resourcelocation = new ResourceLocation("shaders/post/entity_outline.json");
-
- try
- {
- this.entityOutlineShader = new ShaderGroup(this.mc.getTextureManager(), this.mc.getResourceManager(), this.mc.getFramebuffer(), resourcelocation);
- this.entityOutlineShader.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
- this.entityOutlineFramebuffer = this.entityOutlineShader.getFramebufferRaw("final");
- }
- catch (IOException ioexception)
- {
- LOGGER.warn("Failed to load shader: {}", resourcelocation, ioexception);
- this.entityOutlineShader = null;
- this.entityOutlineFramebuffer = null;
- }
- catch (JsonSyntaxException jsonsyntaxexception)
- {
- LOGGER.warn("Failed to load shader: {}", resourcelocation, jsonsyntaxexception);
- this.entityOutlineShader = null;
- this.entityOutlineFramebuffer = null;
- }
- }
- else
- {
- this.entityOutlineShader = null;
- this.entityOutlineFramebuffer = null;
- }
- }
-
- public void renderEntityOutlineFramebuffer()
- {
- if (this.isRenderEntityOutlines())
- {
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
- this.entityOutlineFramebuffer.framebufferRenderExt(this.mc.displayWidth, this.mc.displayHeight, false);
- GlStateManager.disableBlend();
- }
- }
-
- protected boolean isRenderEntityOutlines()
- {
- return this.entityOutlineFramebuffer != null && this.entityOutlineShader != null && this.mc.player != null;
- }
-
- private void generateSky2()
- {
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
-
- if (this.sky2VBO != null)
- {
- this.sky2VBO.deleteGlBuffers();
- }
-
- if (this.glSkyList2 >= 0)
- {
- GLAllocation.deleteDisplayLists(this.glSkyList2);
- this.glSkyList2 = -1;
- }
-
- if (this.vboEnabled)
- {
- this.sky2VBO = new VertexBuffer(this.vertexBufferFormat);
- this.renderSky(bufferbuilder, -16.0F, true);
- bufferbuilder.finishDrawing();
- bufferbuilder.reset();
- this.sky2VBO.bufferData(bufferbuilder.getByteBuffer());
- }
- else
- {
- this.glSkyList2 = GLAllocation.generateDisplayLists(1);
- GlStateManager.glNewList(this.glSkyList2, 4864);
- this.renderSky(bufferbuilder, -16.0F, true);
- tessellator.draw();
- GlStateManager.glEndList();
- }
- }
-
- private void generateSky()
- {
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
-
- if (this.skyVBO != null)
- {
- this.skyVBO.deleteGlBuffers();
- }
-
- if (this.glSkyList >= 0)
- {
- GLAllocation.deleteDisplayLists(this.glSkyList);
- this.glSkyList = -1;
- }
-
- if (this.vboEnabled)
- {
- this.skyVBO = new VertexBuffer(this.vertexBufferFormat);
- this.renderSky(bufferbuilder, 16.0F, false);
- bufferbuilder.finishDrawing();
- bufferbuilder.reset();
- this.skyVBO.bufferData(bufferbuilder.getByteBuffer());
- }
- else
- {
- this.glSkyList = GLAllocation.generateDisplayLists(1);
- GlStateManager.glNewList(this.glSkyList, 4864);
- this.renderSky(bufferbuilder, 16.0F, false);
- tessellator.draw();
- GlStateManager.glEndList();
- }
- }
-
- private void renderSky(BufferBuilder bufferBuilderIn, float posY, boolean reverseX)
- {
- bufferBuilderIn.begin(7, DefaultVertexFormats.POSITION);
-
- for (int k = -384; k <= 384; k += 64)
- {
- for (int l = -384; l <= 384; l += 64)
- {
- float f = k;
- float f1 = k + 64;
-
- if (reverseX)
- {
- f1 = k;
- f = k + 64;
- }
-
- bufferBuilderIn.pos(f, posY, l).endVertex();
- bufferBuilderIn.pos(f1, posY, l).endVertex();
- bufferBuilderIn.pos(f1, posY, l + 64).endVertex();
- bufferBuilderIn.pos(f, posY, l + 64).endVertex();
- }
- }
- }
-
- private void generateStars()
- {
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
-
- if (this.starVBO != null)
- {
- this.starVBO.deleteGlBuffers();
- }
-
- if (this.starGLCallList >= 0)
- {
- GLAllocation.deleteDisplayLists(this.starGLCallList);
- this.starGLCallList = -1;
- }
-
- if (this.vboEnabled)
- {
- this.starVBO = new VertexBuffer(this.vertexBufferFormat);
- this.renderStars(bufferbuilder);
- bufferbuilder.finishDrawing();
- bufferbuilder.reset();
- this.starVBO.bufferData(bufferbuilder.getByteBuffer());
- }
- else
- {
- this.starGLCallList = GLAllocation.generateDisplayLists(1);
- GlStateManager.pushMatrix();
- GlStateManager.glNewList(this.starGLCallList, 4864);
- this.renderStars(bufferbuilder);
- tessellator.draw();
- GlStateManager.glEndList();
- GlStateManager.popMatrix();
- }
- }
-
- private void renderStars(BufferBuilder bufferBuilderIn)
- {
- Random random = new Random(10842L);
- bufferBuilderIn.begin(7, DefaultVertexFormats.POSITION);
-
- for (int i = 0; i < 1500; ++i)
- {
- double d0 = random.nextFloat() * 2.0F - 1.0F;
- double d1 = random.nextFloat() * 2.0F - 1.0F;
- double d2 = random.nextFloat() * 2.0F - 1.0F;
- double d3 = 0.15F + random.nextFloat() * 0.1F;
- double d4 = d0 * d0 + d1 * d1 + d2 * d2;
-
- if (d4 < 1.0D && d4 > 0.01D)
- {
- d4 = 1.0D / Math.sqrt(d4);
- d0 = d0 * d4;
- d1 = d1 * d4;
- d2 = d2 * d4;
- double d5 = d0 * 100.0D;
- double d6 = d1 * 100.0D;
- double d7 = d2 * 100.0D;
- double d8 = Math.atan2(d0, d2);
- double d9 = Math.sin(d8);
- double d10 = Math.cos(d8);
- double d11 = Math.atan2(Math.sqrt(d0 * d0 + d2 * d2), d1);
- double d12 = Math.sin(d11);
- double d13 = Math.cos(d11);
- double d14 = random.nextDouble() * Math.PI * 2.0D;
- double d15 = Math.sin(d14);
- double d16 = Math.cos(d14);
-
- for (int j = 0; j < 4; ++j)
- {
- double d18 = ((j & 2) - 1) * d3;
- double d19 = ((j + 1 & 2) - 1) * d3;
- double d21 = d18 * d16 - d19 * d15;
- double d22 = d19 * d16 + d18 * d15;
- double d23 = d21 * d12 + 0.0D * d13;
- double d24 = 0.0D * d12 - d21 * d13;
- double d25 = d24 * d9 - d22 * d10;
- double d26 = d22 * d9 + d24 * d10;
- bufferBuilderIn.pos(d5 + d25, d6 + d23, d7 + d26).endVertex();
- }
- }
- }
- }
-
- /**
- * set null to clear
- */
- public void setWorldAndLoadRenderers(@Nullable WorldClient worldClientIn)
- {
- if (this.world != null)
- {
- this.world.removeEventListener(this);
- }
-
- this.frustumUpdatePosX = Double.MIN_VALUE;
- this.frustumUpdatePosY = Double.MIN_VALUE;
- this.frustumUpdatePosZ = Double.MIN_VALUE;
- this.frustumUpdatePosChunkX = Integer.MIN_VALUE;
- this.frustumUpdatePosChunkY = Integer.MIN_VALUE;
- this.frustumUpdatePosChunkZ = Integer.MIN_VALUE;
- this.renderManager.setWorld(worldClientIn);
- this.world = worldClientIn;
-
- if (worldClientIn != null)
- {
- worldClientIn.addEventListener(this);
- this.loadRenderers();
- }
- else
- {
- this.chunksToUpdate.clear();
- this.renderInfos.clear();
-
- if (this.viewFrustum != null)
- {
- this.viewFrustum.deleteGlResources();
- this.viewFrustum = null;
- }
-
- if (this.renderDispatcher != null)
- {
- this.renderDispatcher.stopWorkerThreads();
- }
-
- this.renderDispatcher = null;
- }
- }
-
- /**
- * Loads all the renderers and sets up the basic settings usage
- */
- public void loadRenderers()
- {
- if (this.world != null)
- {
- if (this.renderDispatcher == null)
- {
- this.renderDispatcher = new ChunkRenderDispatcher();
- }
-
- this.displayListEntitiesDirty = true;
- Blocks.LEAVES.setGraphicsLevel(this.mc.gameSettings.fancyGraphics);
- Blocks.LEAVES2.setGraphicsLevel(this.mc.gameSettings.fancyGraphics);
- this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks;
- boolean flag = this.vboEnabled;
- this.vboEnabled = OpenGlHelper.useVbo();
-
- if (flag && !this.vboEnabled)
- {
- this.renderContainer = new RenderList();
- this.renderChunkFactory = new ListChunkFactory();
- }
- else if (!flag && this.vboEnabled)
- {
- this.renderContainer = new VboRenderList();
- this.renderChunkFactory = new VboChunkFactory();
- }
-
- if (flag != this.vboEnabled)
- {
- this.generateStars();
- this.generateSky();
- this.generateSky2();
- }
-
- if (this.viewFrustum != null)
- {
- this.viewFrustum.deleteGlResources();
- }
-
- this.stopChunkUpdates();
-
- synchronized (this.setTileEntities)
- {
- this.setTileEntities.clear();
- }
-
- this.viewFrustum = new ViewFrustum(this.world, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory);
-
- if (this.world != null)
- {
- Entity entity = this.mc.getRenderViewEntity();
-
- if (entity != null)
- {
- this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ);
- }
- }
-
- this.renderEntitiesStartupCounter = 2;
- }
- }
-
- protected void stopChunkUpdates()
- {
- this.chunksToUpdate.clear();
- this.renderDispatcher.stopChunkUpdates();
- }
-
- public void createBindEntityOutlineFbs(int width, int height)
- {
- if (OpenGlHelper.shadersSupported)
- {
- if (this.entityOutlineShader != null)
- {
- this.entityOutlineShader.createBindFramebuffers(width, height);
- }
- }
- }
-
- public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks)
- {
- int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass();
- if (this.renderEntitiesStartupCounter > 0)
- {
- if (pass > 0) return;
- --this.renderEntitiesStartupCounter;
- }
- else
- {
- double d0 = renderViewEntity.prevPosX + (renderViewEntity.posX - renderViewEntity.prevPosX) * partialTicks;
- double d1 = renderViewEntity.prevPosY + (renderViewEntity.posY - renderViewEntity.prevPosY) * partialTicks;
- double d2 = renderViewEntity.prevPosZ + (renderViewEntity.posZ - renderViewEntity.prevPosZ) * partialTicks;
- this.world.profiler.startSection("prepare");
- TileEntityRendererDispatcher.instance.prepare(this.world, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.getRenderViewEntity(), this.mc.objectMouseOver, partialTicks);
- this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRenderer, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks);
- if(pass == 0)
- {
- this.countEntitiesTotal = 0;
- this.countEntitiesRendered = 0;
- this.countEntitiesHidden = 0;
- }
- Entity entity = this.mc.getRenderViewEntity();
- double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
- double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
- double d5 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;
- TileEntityRendererDispatcher.staticPlayerX = d3;
- TileEntityRendererDispatcher.staticPlayerY = d4;
- TileEntityRendererDispatcher.staticPlayerZ = d5;
- this.renderManager.setRenderPosition(d3, d4, d5);
- this.mc.entityRenderer.enableLightmap();
- this.world.profiler.endStartSection("global");
- List list = this.world.getLoadedEntityList();
- if (pass == 0)
- {
- this.countEntitiesTotal = list.size();
- }
-
- for (int i = 0; i < this.world.weatherEffects.size(); ++i)
- {
- Entity entity1 = this.world.weatherEffects.get(i);
- if (!entity1.shouldRenderInPass(pass)) continue;
- ++this.countEntitiesRendered;
-
- if (entity1.isInRangeToRender3d(d0, d1, d2))
- {
- this.renderManager.renderEntityStatic(entity1, partialTicks, false);
- }
- }
-
- this.world.profiler.endStartSection("entities");
- List list1 = Lists.newArrayList();
- List list2 = Lists.newArrayList();
- BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
-
- for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation : this.renderInfos)
- {
- Chunk chunk = this.world.getChunkFromBlockCoords(renderglobal$containerlocalrenderinformation.renderChunk.getPosition());
- ClassInheritanceMultiMap classinheritancemultimap = chunk.getEntityLists()[renderglobal$containerlocalrenderinformation.renderChunk.getPosition().getY() / 16];
-
- if (!classinheritancemultimap.isEmpty())
- {
- for (Entity entity2 : classinheritancemultimap)
- {
- if(!entity2.shouldRenderInPass(pass)) continue;
- boolean flag = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.isRidingOrBeingRiddenBy(this.mc.player);
-
- if (flag)
- {
- boolean flag1 = this.mc.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping() : false;
-
- if ((entity2 != this.mc.getRenderViewEntity() || this.mc.gameSettings.thirdPersonView != 0 || flag1) && (entity2.posY < 0.0D || entity2.posY >= 256.0D || this.world.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(entity2))))
- {
- ++this.countEntitiesRendered;
- this.renderManager.renderEntityStatic(entity2, partialTicks, false);
-
- if (this.isOutlineActive(entity2, entity, camera))
- {
- list1.add(entity2);
- }
-
- if (this.renderManager.isRenderMultipass(entity2))
- {
- list2.add(entity2);
- }
- }
- }
- }
- }
- }
-
- blockpos$pooledmutableblockpos.release();
-
- if (!list2.isEmpty())
- {
- for (Entity entity3 : list2)
- {
- this.renderManager.renderMultipass(entity3, partialTicks);
- }
- }
-
- if(pass == 0)
- if (this.isRenderEntityOutlines() && (!list1.isEmpty() || this.entityOutlinesRendered))
- {
- this.world.profiler.endStartSection("entityOutlines");
- this.entityOutlineFramebuffer.framebufferClear();
- this.entityOutlinesRendered = !list1.isEmpty();
-
- if (!list1.isEmpty())
- {
- GlStateManager.depthFunc(519);
- GlStateManager.disableFog();
- this.entityOutlineFramebuffer.bindFramebuffer(false);
- RenderHelper.disableStandardItemLighting();
- this.renderManager.setRenderOutlines(true);
-
- for (int j = 0; j < list1.size(); ++j)
- {
- this.renderManager.renderEntityStatic(list1.get(j), partialTicks, false);
- }
-
- this.renderManager.setRenderOutlines(false);
- RenderHelper.enableStandardItemLighting();
- GlStateManager.depthMask(false);
- this.entityOutlineShader.render(partialTicks);
- GlStateManager.enableLighting();
- GlStateManager.depthMask(true);
- GlStateManager.enableFog();
- GlStateManager.enableBlend();
- GlStateManager.enableColorMaterial();
- GlStateManager.depthFunc(515);
- GlStateManager.enableDepth();
- GlStateManager.enableAlpha();
- }
-
- this.mc.getFramebuffer().bindFramebuffer(false);
- }
-
- this.world.profiler.endStartSection("blockentities");
- RenderHelper.enableStandardItemLighting();
-
- TileEntityRendererDispatcher.instance.preDrawBatch();
- for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfos)
- {
- List list3 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk().getTileEntities();
-
- if (!list3.isEmpty())
- {
- for (TileEntity tileentity2 : list3)
- {
- if (!tileentity2.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue;
- TileEntityRendererDispatcher.instance.render(tileentity2, partialTicks, -1);
- }
- }
- }
-
- synchronized (this.setTileEntities)
- {
- for (TileEntity tileentity : this.setTileEntities)
- {
- if (!tileentity.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue;
- TileEntityRendererDispatcher.instance.render(tileentity, partialTicks, -1);
- }
- }
- TileEntityRendererDispatcher.instance.drawBatch(pass);
-
- this.preRenderDamagedBlocks();
-
- for (DestroyBlockProgress destroyblockprogress : this.damagedBlocks.values())
- {
- BlockPos blockpos = destroyblockprogress.getPosition();
-
- if (this.world.getBlockState(blockpos).getBlock().hasTileEntity())
- {
- TileEntity tileentity1 = this.world.getTileEntity(blockpos);
-
- if (tileentity1 instanceof TileEntityChest)
- {
- TileEntityChest tileentitychest = (TileEntityChest)tileentity1;
-
- if (tileentitychest.adjacentChestXNeg != null)
- {
- blockpos = blockpos.offset(EnumFacing.WEST);
- tileentity1 = this.world.getTileEntity(blockpos);
- }
- else if (tileentitychest.adjacentChestZNeg != null)
- {
- blockpos = blockpos.offset(EnumFacing.NORTH);
- tileentity1 = this.world.getTileEntity(blockpos);
- }
- }
-
- IBlockState iblockstate = this.world.getBlockState(blockpos);
-
- if (tileentity1 != null && iblockstate.hasCustomBreakingProgress())
- {
- TileEntityRendererDispatcher.instance.render(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage());
- }
- }
- }
-
- this.postRenderDamagedBlocks();
- this.mc.entityRenderer.disableLightmap();
- this.mc.mcProfiler.endSection();
- }
- }
-
- /**
- * Checks if the given entity should have an outline rendered.
- */
- private boolean isOutlineActive(Entity entityIn, Entity viewer, ICamera camera)
- {
- boolean flag = viewer instanceof EntityLivingBase && ((EntityLivingBase)viewer).isPlayerSleeping();
-
- if (entityIn == viewer && this.mc.gameSettings.thirdPersonView == 0 && !flag)
- {
- return false;
- }
- else if (entityIn.isGlowing())
- {
- return true;
- }
- else if (this.mc.player.isSpectator() && this.mc.gameSettings.keyBindSpectatorOutlines.isKeyDown() && entityIn instanceof EntityPlayer)
- {
- return entityIn.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entityIn.getEntityBoundingBox()) || entityIn.isRidingOrBeingRiddenBy(this.mc.player);
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Gets the render info for use on the Debug screen
- */
- public String getDebugInfoRenders()
- {
- int i = this.viewFrustum.renderChunks.length;
- int j = this.getRenderedChunks();
- return String.format("C: %d/%d %sD: %d, L: %d, %s", j, i, this.mc.renderChunksMany ? "(s) " : "", this.renderDistanceChunks, this.setLightUpdates.size(), this.renderDispatcher == null ? "null" : this.renderDispatcher.getDebugInfo());
- }
-
- protected int getRenderedChunks()
- {
- int i = 0;
-
- for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation : this.renderInfos)
- {
- CompiledChunk compiledchunk = renderglobal$containerlocalrenderinformation.renderChunk.compiledChunk;
-
- if (compiledchunk != CompiledChunk.DUMMY && !compiledchunk.isEmpty())
- {
- ++i;
- }
- }
-
- return i;
- }
-
- /**
- * Gets the entities info for use on the Debug screen
- */
- public String getDebugInfoEntities()
- {
- return "E: " + this.countEntitiesRendered + "/" + this.countEntitiesTotal + ", B: " + this.countEntitiesHidden;
- }
-
- public void setupTerrain(Entity viewEntity, double partialTicks, ICamera camera, int frameCount, boolean playerSpectator)
- {
- if (this.mc.gameSettings.renderDistanceChunks != this.renderDistanceChunks)
- {
- this.loadRenderers();
- }
-
- this.world.profiler.startSection("camera");
- double d0 = viewEntity.posX - this.frustumUpdatePosX;
- double d1 = viewEntity.posY - this.frustumUpdatePosY;
- double d2 = viewEntity.posZ - this.frustumUpdatePosZ;
-
- if (this.frustumUpdatePosChunkX != viewEntity.chunkCoordX || this.frustumUpdatePosChunkY != viewEntity.chunkCoordY || this.frustumUpdatePosChunkZ != viewEntity.chunkCoordZ || d0 * d0 + d1 * d1 + d2 * d2 > 16.0D)
- {
- this.frustumUpdatePosX = viewEntity.posX;
- this.frustumUpdatePosY = viewEntity.posY;
- this.frustumUpdatePosZ = viewEntity.posZ;
- this.frustumUpdatePosChunkX = viewEntity.chunkCoordX;
- this.frustumUpdatePosChunkY = viewEntity.chunkCoordY;
- this.frustumUpdatePosChunkZ = viewEntity.chunkCoordZ;
- this.viewFrustum.updateChunkPositions(viewEntity.posX, viewEntity.posZ);
- }
-
- this.world.profiler.endStartSection("renderlistcamera");
- double d3 = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
- double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
- double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
- this.renderContainer.initialize(d3, d4, d5);
- this.world.profiler.endStartSection("cull");
-
- if (this.debugFixedClippingHelper != null)
- {
- Frustum frustum = new Frustum(this.debugFixedClippingHelper);
- frustum.setPosition(this.debugTerrainFrustumPosition.x, this.debugTerrainFrustumPosition.y, this.debugTerrainFrustumPosition.z);
- camera = frustum;
- }
-
- this.mc.mcProfiler.endStartSection("culling");
- BlockPos blockpos1 = new BlockPos(d3, d4 + viewEntity.getEyeHeight(), d5);
- RenderChunk renderchunk = this.viewFrustum.getRenderChunk(blockpos1);
- BlockPos blockpos = new BlockPos(MathHelper.floor(d3 / 16.0D) * 16, MathHelper.floor(d4 / 16.0D) * 16, MathHelper.floor(d5 / 16.0D) * 16);
- this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || viewEntity.posX != this.lastViewEntityX || viewEntity.posY != this.lastViewEntityY || viewEntity.posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw;
- this.lastViewEntityX = viewEntity.posX;
- this.lastViewEntityY = viewEntity.posY;
- this.lastViewEntityZ = viewEntity.posZ;
- this.lastViewEntityPitch = viewEntity.rotationPitch;
- this.lastViewEntityYaw = viewEntity.rotationYaw;
- boolean flag = this.debugFixedClippingHelper != null;
- this.mc.mcProfiler.endStartSection("update");
-
- if (!flag && this.displayListEntitiesDirty)
- {
- this.displayListEntitiesDirty = false;
- this.renderInfos = Lists.newArrayList();
- Queue queue = Queues.newArrayDeque();
- Entity.setRenderDistanceWeight(MathHelper.clamp(this.mc.gameSettings.renderDistanceChunks / 8.0D, 1.0D, 2.5D));
- boolean flag1 = this.mc.renderChunksMany;
-
- if (renderchunk != null)
- {
- boolean flag2 = false;
- RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation3 = new RenderGlobal.ContainerLocalRenderInformation(renderchunk, (EnumFacing)null, 0);
- Set set1 = this.getVisibleFacings(blockpos1);
-
- if (set1.size() == 1)
- {
- Vector3f vector3f = this.getViewVector(viewEntity, partialTicks);
- EnumFacing enumfacing = EnumFacing.getFacingFromVector(vector3f.x, vector3f.y, vector3f.z).getOpposite();
- set1.remove(enumfacing);
- }
-
- if (set1.isEmpty())
- {
- flag2 = true;
- }
-
- if (flag2 && !playerSpectator)
- {
- this.renderInfos.add(renderglobal$containerlocalrenderinformation3);
- }
- else
- {
- if (playerSpectator && this.world.getBlockState(blockpos1).isOpaqueCube())
- {
- flag1 = false;
- }
-
- renderchunk.setFrameIndex(frameCount);
- queue.add(renderglobal$containerlocalrenderinformation3);
- }
- }
- else
- {
- int i = blockpos1.getY() > 0 ? 248 : 8;
-
- for (int j = -this.renderDistanceChunks; j <= this.renderDistanceChunks; ++j)
- {
- for (int k = -this.renderDistanceChunks; k <= this.renderDistanceChunks; ++k)
- {
- RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, i, (k << 4) + 8));
-
- if (renderchunk1 != null && camera.isBoundingBoxInFrustum(renderchunk1.boundingBox.expand(0.0, blockpos1.getY() > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY, 0.0))) // Forge: fix MC-73139
- {
- renderchunk1.setFrameIndex(frameCount);
- queue.add(new RenderGlobal.ContainerLocalRenderInformation(renderchunk1, (EnumFacing)null, 0));
- }
- }
- }
- }
-
- this.mc.mcProfiler.startSection("iteration");
-
- while (!queue.isEmpty())
- {
- RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 = queue.poll();
- RenderChunk renderchunk3 = renderglobal$containerlocalrenderinformation1.renderChunk;
- EnumFacing enumfacing2 = renderglobal$containerlocalrenderinformation1.facing;
- this.renderInfos.add(renderglobal$containerlocalrenderinformation1);
-
- for (EnumFacing enumfacing1 : EnumFacing.values())
- {
- RenderChunk renderchunk2 = this.getRenderChunkOffset(blockpos, renderchunk3, enumfacing1);
-
- if ((!flag1 || !renderglobal$containerlocalrenderinformation1.hasDirection(enumfacing1.getOpposite())) && (!flag1 || enumfacing2 == null || renderchunk3.getCompiledChunk().isVisible(enumfacing2.getOpposite(), enumfacing1)) && renderchunk2 != null && renderchunk2.setFrameIndex(frameCount) && camera.isBoundingBoxInFrustum(renderchunk2.boundingBox))
- {
- RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = new RenderGlobal.ContainerLocalRenderInformation(renderchunk2, enumfacing1, renderglobal$containerlocalrenderinformation1.counter + 1);
- renderglobal$containerlocalrenderinformation.setDirection(renderglobal$containerlocalrenderinformation1.setFacing, enumfacing1);
- queue.add(renderglobal$containerlocalrenderinformation);
- }
- }
- }
-
- this.mc.mcProfiler.endSection();
- }
-
- this.mc.mcProfiler.endStartSection("captureFrustum");
-
- if (this.debugFixTerrainFrustum)
- {
- this.fixTerrainFrustum(d3, d4, d5);
- this.debugFixTerrainFrustum = false;
- }
-
- this.mc.mcProfiler.endStartSection("rebuildNear");
- Set set = this.chunksToUpdate;
- this.chunksToUpdate = Sets.newLinkedHashSet();
-
- for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation2 : this.renderInfos)
- {
- RenderChunk renderchunk4 = renderglobal$containerlocalrenderinformation2.renderChunk;
-
- if (renderchunk4.needsUpdate() || set.contains(renderchunk4))
- {
- this.displayListEntitiesDirty = true;
- BlockPos blockpos2 = renderchunk4.getPosition().add(8, 8, 8);
- boolean flag3 = blockpos2.distanceSq(blockpos1) < 768.0D;
-
- if (net.minecraftforge.common.ForgeModContainer.alwaysSetupTerrainOffThread || (!renderchunk4.needsImmediateUpdate() && !flag3))
- {
- this.chunksToUpdate.add(renderchunk4);
- }
- else
- {
- this.mc.mcProfiler.startSection("build near");
- this.renderDispatcher.updateChunkNow(renderchunk4);
- renderchunk4.clearNeedsUpdate();
- this.mc.mcProfiler.endSection();
- }
- }
- }
-
- this.chunksToUpdate.addAll(set);
- this.mc.mcProfiler.endSection();
- }
-
- private Set getVisibleFacings(BlockPos pos)
- {
- VisGraph visgraph = new VisGraph();
- BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4);
- Chunk chunk = this.world.getChunkFromBlockCoords(blockpos);
-
- for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15)))
- {
- if (chunk.getBlockState(blockpos$mutableblockpos).isOpaqueCube())
- {
- visgraph.setOpaqueCube(blockpos$mutableblockpos);
- }
- }
-
- return visgraph.getVisibleFacings(pos);
- }
-
- /**
- * Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
- * given BlockPos.
- */
- @Nullable
- private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, EnumFacing facing)
- {
- BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
-
- if (MathHelper.abs(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16)
- {
- return null;
- }
- else if (blockpos.getY() >= 0 && blockpos.getY() < 256)
- {
- return MathHelper.abs(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos);
- }
- else
- {
- return null;
- }
- }
-
- private void fixTerrainFrustum(double x, double y, double z)
- {
- this.debugFixedClippingHelper = new ClippingHelperImpl();
- ((ClippingHelperImpl)this.debugFixedClippingHelper).init();
- Matrix4f matrix4f = new Matrix4f(this.debugFixedClippingHelper.modelviewMatrix);
- matrix4f.transpose();
- Matrix4f matrix4f1 = new Matrix4f(this.debugFixedClippingHelper.projectionMatrix);
- matrix4f1.transpose();
- Matrix4f matrix4f2 = new Matrix4f();
- Matrix4f.mul(matrix4f1, matrix4f, matrix4f2);
- matrix4f2.invert();
- this.debugTerrainFrustumPosition.x = x;
- this.debugTerrainFrustumPosition.y = y;
- this.debugTerrainFrustumPosition.z = z;
- this.debugTerrainMatrix[0] = new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F);
- this.debugTerrainMatrix[1] = new Vector4f(1.0F, -1.0F, -1.0F, 1.0F);
- this.debugTerrainMatrix[2] = new Vector4f(1.0F, 1.0F, -1.0F, 1.0F);
- this.debugTerrainMatrix[3] = new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F);
- this.debugTerrainMatrix[4] = new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F);
- this.debugTerrainMatrix[5] = new Vector4f(1.0F, -1.0F, 1.0F, 1.0F);
- this.debugTerrainMatrix[6] = new Vector4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.debugTerrainMatrix[7] = new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F);
-
- for (int i = 0; i < 8; ++i)
- {
- Matrix4f.transform(matrix4f2, this.debugTerrainMatrix[i], this.debugTerrainMatrix[i]);
- this.debugTerrainMatrix[i].x /= this.debugTerrainMatrix[i].w;
- this.debugTerrainMatrix[i].y /= this.debugTerrainMatrix[i].w;
- this.debugTerrainMatrix[i].z /= this.debugTerrainMatrix[i].w;
- this.debugTerrainMatrix[i].w = 1.0F;
- }
- }
-
- protected Vector3f getViewVector(Entity entityIn, double partialTicks)
- {
- float f = (float)(entityIn.prevRotationPitch + (entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks);
- float f1 = (float)(entityIn.prevRotationYaw + (entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks);
-
- if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2)
- {
- f += 180.0F;
- }
-
- float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
- float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
- float f4 = -MathHelper.cos(-f * 0.017453292F);
- float f5 = MathHelper.sin(-f * 0.017453292F);
- return new Vector3f(f3 * f4, f5, f2 * f4);
- }
-
- /**
- * XXX renderBlockLayer
- * @param blockLayerIn
- * @param partialTicks
- * @param pass
- * @param entityIn
- * @return
- */
- public int renderBlockLayer(BlockRenderLayer blockLayerIn, double partialTicks, int pass, Entity entityIn)
- {
- RenderHelper.disableStandardItemLighting();
-
- if (blockLayerIn == BlockRenderLayer.TRANSLUCENT)
- {
- this.mc.mcProfiler.startSection("translucent_sort");
- double d0 = entityIn.posX - this.prevRenderSortX;
- double d1 = entityIn.posY - this.prevRenderSortY;
- double d2 = entityIn.posZ - this.prevRenderSortZ;
-
- if (d0 * d0 + d1 * d1 + d2 * d2 > 1.0D)
- {
- this.prevRenderSortX = entityIn.posX;
- this.prevRenderSortY = entityIn.posY;
- this.prevRenderSortZ = entityIn.posZ;
- int k = 0;
-
- for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation : this.renderInfos)
- {
- if (renderglobal$containerlocalrenderinformation.renderChunk.compiledChunk.isLayerStarted(blockLayerIn) && k++ < 15)
- {
- this.renderDispatcher.updateTransparencyLater(renderglobal$containerlocalrenderinformation.renderChunk);
- }
- }
- }
-
- this.mc.mcProfiler.endSection();
- }
-
- this.mc.mcProfiler.startSection("filterempty");
- int l = 0;
- boolean flag = blockLayerIn == BlockRenderLayer.TRANSLUCENT;
- int i1 = flag ? this.renderInfos.size() - 1 : 0;
- int i = flag ? -1 : this.renderInfos.size();
- int j1 = flag ? -1 : 1;
-
- for (int j = i1; j != i; j += j1)
- {
- RenderChunk renderchunk = (this.renderInfos.get(j)).renderChunk;
-
- if (!renderchunk.getCompiledChunk().isLayerEmpty(blockLayerIn))
- {
- ++l;
- this.renderContainer.addRenderChunk(renderchunk, blockLayerIn);
-
- // XXX
- }
- }
-
- this.mc.mcProfiler.func_194339_b(() ->
- {
- return "render_" + blockLayerIn;
- });
- this.renderBlockLayer(blockLayerIn);
- this.mc.mcProfiler.endSection();
- return l;
- }
-
- @SuppressWarnings("incomplete-switch")
- private void renderBlockLayer(BlockRenderLayer blockLayerIn)
- {
- this.mc.entityRenderer.enableLightmap();
-
- if (OpenGlHelper.useVbo())
- {
- GlStateManager.glEnableClientState(32884);
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
- GlStateManager.glEnableClientState(32888);
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit);
- GlStateManager.glEnableClientState(32888);
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
- GlStateManager.glEnableClientState(32886);
- }
-
- this.renderContainer.renderChunkLayer(blockLayerIn);
-
- if (OpenGlHelper.useVbo())
- {
- for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements())
- {
- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
- int k1 = vertexformatelement.getIndex();
-
- switch (vertexformatelement$enumusage)
- {
- case POSITION:
- GlStateManager.glDisableClientState(32884);
- break;
- case UV:
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1);
- GlStateManager.glDisableClientState(32888);
- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
- break;
- case COLOR:
- GlStateManager.glDisableClientState(32886);
- GlStateManager.resetColor();
- }
- }
- }
-
- this.mc.entityRenderer.disableLightmap();
- }
-
- private void cleanupDamagedBlocks(Iterator iteratorIn)
- {
- while (iteratorIn.hasNext())
- {
- DestroyBlockProgress destroyblockprogress = iteratorIn.next();
- int k1 = destroyblockprogress.getCreationCloudUpdateTick();
-
- if (this.cloudTickCounter - k1 > 400)
- {
- iteratorIn.remove();
- }
- }
- }
-
- public void updateClouds()
- {
- ++this.cloudTickCounter;
-
- if (this.cloudTickCounter % 20 == 0)
- {
- this.cleanupDamagedBlocks(this.damagedBlocks.values().iterator());
- }
-
- if (!this.setLightUpdates.isEmpty() && !this.renderDispatcher.hasNoFreeRenderBuilders() && this.chunksToUpdate.isEmpty())
- {
- Iterator iterator = this.setLightUpdates.iterator();
-
- while (iterator.hasNext())
- {
- BlockPos blockpos = iterator.next();
- iterator.remove();
- int k1 = blockpos.getX();
- int l1 = blockpos.getY();
- int i2 = blockpos.getZ();
- this.markBlocksForUpdate(k1 - 1, l1 - 1, i2 - 1, k1 + 1, l1 + 1, i2 + 1, false);
- }
- }
- }
-
- private void renderSkyEnd()
- {
- GlStateManager.disableFog();
- GlStateManager.disableAlpha();
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- RenderHelper.disableStandardItemLighting();
- GlStateManager.depthMask(false);
- this.renderEngine.bindTexture(END_SKY_TEXTURES);
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
-
- for (int k1 = 0; k1 < 6; ++k1)
- {
- GlStateManager.pushMatrix();
-
- if (k1 == 1)
- {
- GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
- }
-
- if (k1 == 2)
- {
- GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
- }
-
- if (k1 == 3)
- {
- GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
- }
-
- if (k1 == 4)
- {
- GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
- }
-
- if (k1 == 5)
- {
- GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
- }
-
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
- bufferbuilder.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).color(40, 40, 40, 255).endVertex();
- bufferbuilder.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 16.0D).color(40, 40, 40, 255).endVertex();
- bufferbuilder.pos(100.0D, -100.0D, 100.0D).tex(16.0D, 16.0D).color(40, 40, 40, 255).endVertex();
- bufferbuilder.pos(100.0D, -100.0D, -100.0D).tex(16.0D, 0.0D).color(40, 40, 40, 255).endVertex();
- tessellator.draw();
- GlStateManager.popMatrix();
- }
-
- GlStateManager.depthMask(true);
- GlStateManager.enableTexture2D();
- GlStateManager.enableAlpha();
- }
-
- public void renderSky(float partialTicks, int pass)
- {
- net.minecraftforge.client.IRenderHandler renderer = this.world.provider.getSkyRenderer();
- if (renderer != null)
- {
- renderer.render(partialTicks, world, mc);
- return;
- }
-
- if (this.mc.world.provider.getDimensionType().getId() == 1)
- {
- this.renderSkyEnd();
- }
- else if (this.mc.world.provider.isSurfaceWorld())
- {
- GlStateManager.disableTexture2D();
- Vec3d vec3d = this.world.getSkyColor(this.mc.getRenderViewEntity(), partialTicks);
- float f = (float)vec3d.x;
- float f1 = (float)vec3d.y;
- float f2 = (float)vec3d.z;
-
- if (pass != 2)
- {
- float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
- float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
- float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
- f = f3;
- f1 = f4;
- f2 = f5;
- }
-
- GlStateManager.color(f, f1, f2);
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- GlStateManager.depthMask(false);
- GlStateManager.enableFog();
- GlStateManager.color(f, f1, f2);
-
- if (this.vboEnabled)
- {
- this.skyVBO.bindBuffer();
- GlStateManager.glEnableClientState(32884);
- GlStateManager.glVertexPointer(3, 5126, 12, 0);
- this.skyVBO.drawArrays(7);
- this.skyVBO.unbindBuffer();
- GlStateManager.glDisableClientState(32884);
- }
- else
- {
- GlStateManager.callList(this.glSkyList);
- }
-
- GlStateManager.disableFog();
- GlStateManager.disableAlpha();
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- RenderHelper.disableStandardItemLighting();
- float[] afloat = this.world.provider.calcSunriseSunsetColors(this.world.getCelestialAngle(partialTicks), partialTicks);
-
- if (afloat != null)
- {
- GlStateManager.disableTexture2D();
- GlStateManager.shadeModel(7425);
- GlStateManager.pushMatrix();
- GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
- GlStateManager.rotate(MathHelper.sin(this.world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
- GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
- float f6 = afloat[0];
- float f7 = afloat[1];
- float f8 = afloat[2];
-
- if (pass != 2)
- {
- float f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
- float f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
- float f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
- f6 = f9;
- f7 = f10;
- f8 = f11;
- }
-
- bufferbuilder.begin(6, DefaultVertexFormats.POSITION_COLOR);
- bufferbuilder.pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, afloat[3]).endVertex();
-
- for (int j2 = 0; j2 <= 16; ++j2)
- {
- float f21 = j2 * ((float)Math.PI * 2F) / 16.0F;
- float f12 = MathHelper.sin(f21);
- float f13 = MathHelper.cos(f21);
- bufferbuilder.pos(f12 * 120.0F, f13 * 120.0F, -f13 * 40.0F * afloat[3]).color(afloat[0], afloat[1], afloat[2], 0.0F).endVertex();
- }
-
- tessellator.draw();
- GlStateManager.popMatrix();
- GlStateManager.shadeModel(7424);
- }
-
- GlStateManager.enableTexture2D();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- GlStateManager.pushMatrix();
- float f16 = 1.0F - this.world.getRainStrength(partialTicks);
- GlStateManager.color(1.0F, 1.0F, 1.0F, f16);
- GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(this.world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
- float f17 = 30.0F;
- this.renderEngine.bindTexture(SUN_TEXTURES);
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
- bufferbuilder.pos((-f17), 100.0D, (-f17)).tex(0.0D, 0.0D).endVertex();
- bufferbuilder.pos(f17, 100.0D, (-f17)).tex(1.0D, 0.0D).endVertex();
- bufferbuilder.pos(f17, 100.0D, f17).tex(1.0D, 1.0D).endVertex();
- bufferbuilder.pos((-f17), 100.0D, f17).tex(0.0D, 1.0D).endVertex();
- tessellator.draw();
- f17 = 20.0F;
- this.renderEngine.bindTexture(MOON_PHASES_TEXTURES);
- int k1 = this.world.getMoonPhase();
- int i2 = k1 % 4;
- int k2 = k1 / 4 % 2;
- float f22 = (i2 + 0) / 4.0F;
- float f23 = (k2 + 0) / 2.0F;
- float f24 = (i2 + 1) / 4.0F;
- float f14 = (k2 + 1) / 2.0F;
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
- bufferbuilder.pos((-f17), -100.0D, f17).tex(f24, f14).endVertex();
- bufferbuilder.pos(f17, -100.0D, f17).tex(f22, f14).endVertex();
- bufferbuilder.pos(f17, -100.0D, (-f17)).tex(f22, f23).endVertex();
- bufferbuilder.pos((-f17), -100.0D, (-f17)).tex(f24, f23).endVertex();
- tessellator.draw();
- GlStateManager.disableTexture2D();
- float f15 = this.world.getStarBrightness(partialTicks) * f16;
-
- if (f15 > 0.0F)
- {
- GlStateManager.color(f15, f15, f15, f15);
-
- if (this.vboEnabled)
- {
- this.starVBO.bindBuffer();
- GlStateManager.glEnableClientState(32884);
- GlStateManager.glVertexPointer(3, 5126, 12, 0);
- this.starVBO.drawArrays(7);
- this.starVBO.unbindBuffer();
- GlStateManager.glDisableClientState(32884);
- }
- else
- {
- GlStateManager.callList(this.starGLCallList);
- }
- }
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.disableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.enableFog();
- GlStateManager.popMatrix();
- GlStateManager.disableTexture2D();
- GlStateManager.color(0.0F, 0.0F, 0.0F);
- double d3 = this.mc.player.getPositionEyes(partialTicks).y - this.world.getHorizon();
-
- if (d3 < 0.0D)
- {
- GlStateManager.pushMatrix();
- GlStateManager.translate(0.0F, 12.0F, 0.0F);
-
- if (this.vboEnabled)
- {
- this.sky2VBO.bindBuffer();
- GlStateManager.glEnableClientState(32884);
- GlStateManager.glVertexPointer(3, 5126, 12, 0);
- this.sky2VBO.drawArrays(7);
- this.sky2VBO.unbindBuffer();
- GlStateManager.glDisableClientState(32884);
- }
- else
- {
- GlStateManager.callList(this.glSkyList2);
- }
-
- GlStateManager.popMatrix();
- float f19 = -((float)(d3 + 65.0D));
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
- bufferbuilder.pos(-1.0D, f19, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, f19, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, f19, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, f19, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, f19, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, f19, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, f19, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, f19, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
- bufferbuilder.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
- tessellator.draw();
- }
-
- if (this.world.provider.isSkyColored())
- {
- GlStateManager.color(f * 0.2F + 0.04F, f1 * 0.2F + 0.04F, f2 * 0.6F + 0.1F);
- }
- else
- {
- GlStateManager.color(f, f1, f2);
- }
-
- GlStateManager.pushMatrix();
- GlStateManager.translate(0.0F, -((float)(d3 - 16.0D)), 0.0F);
- GlStateManager.callList(this.glSkyList2);
- GlStateManager.popMatrix();
- GlStateManager.enableTexture2D();
- GlStateManager.depthMask(true);
- }
- }
-
- public void renderClouds(float partialTicks, int pass, double p_180447_3_, double p_180447_5_, double p_180447_7_)
- {
- if (net.minecraftforge.fml.client.FMLClientHandler.instance().renderClouds(this.cloudTickCounter, partialTicks)) return;
- if (this.mc.world.provider.isSurfaceWorld())
- {
- if (this.mc.gameSettings.shouldRenderClouds() == 2)
- {
- this.renderCloudsFancy(partialTicks, pass, p_180447_3_, p_180447_5_, p_180447_7_);
- }
- else
- {
- GlStateManager.disableCull();
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- this.renderEngine.bindTexture(CLOUDS_TEXTURES);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- Vec3d vec3d = this.world.getCloudColour(partialTicks);
- float f = (float)vec3d.x;
- float f1 = (float)vec3d.y;
- float f2 = (float)vec3d.z;
-
- if (pass != 2)
- {
- float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
- float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
- float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
- f = f3;
- f1 = f4;
- f2 = f5;
- }
-
- double d5 = this.cloudTickCounter + partialTicks;
- double d3 = p_180447_3_ + d5 * 0.029999999329447746D;
- int i2 = MathHelper.floor(d3 / 2048.0D);
- int j2 = MathHelper.floor(p_180447_7_ / 2048.0D);
- d3 = d3 - i2 * 2048;
- double lvt_22_1_ = p_180447_7_ - j2 * 2048;
- float f6 = this.world.provider.getCloudHeight() - (float)p_180447_5_ + 0.33F;
- float f7 = (float)(d3 * 4.8828125E-4D);
- float f8 = (float)(lvt_22_1_ * 4.8828125E-4D);
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
-
- for (int k2 = -256; k2 < 256; k2 += 32)
- {
- for (int l2 = -256; l2 < 256; l2 += 32)
- {
- bufferbuilder.pos(k2 + 0, f6, l2 + 32).tex((k2 + 0) * 4.8828125E-4F + f7, (l2 + 32) * 4.8828125E-4F + f8).color(f, f1, f2, 0.8F).endVertex();
- bufferbuilder.pos(k2 + 32, f6, l2 + 32).tex((k2 + 32) * 4.8828125E-4F + f7, (l2 + 32) * 4.8828125E-4F + f8).color(f, f1, f2, 0.8F).endVertex();
- bufferbuilder.pos(k2 + 32, f6, l2 + 0).tex((k2 + 32) * 4.8828125E-4F + f7, (l2 + 0) * 4.8828125E-4F + f8).color(f, f1, f2, 0.8F).endVertex();
- bufferbuilder.pos(k2 + 0, f6, l2 + 0).tex((k2 + 0) * 4.8828125E-4F + f7, (l2 + 0) * 4.8828125E-4F + f8).color(f, f1, f2, 0.8F).endVertex();
- }
- }
-
- tessellator.draw();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.disableBlend();
- GlStateManager.enableCull();
- }
- }
- }
-
- /**
- * Checks if the given position is to be rendered with cloud fog
- */
- public boolean hasCloudFog(double x, double y, double z, float partialTicks)
- {
- return false;
- }
-
- private void renderCloudsFancy(float partialTicks, int pass, double x, double y, double z)
- {
- GlStateManager.disableCull();
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- double d3 = this.cloudTickCounter + partialTicks;
- double d4 = (x + d3 * 0.029999999329447746D) / 12.0D;
- double d5 = z / 12.0D + 0.33000001311302185D;
- float f2 = this.world.provider.getCloudHeight() - (float)y + 0.33F;
- int k1 = MathHelper.floor(d4 / 2048.0D);
- int l1 = MathHelper.floor(d5 / 2048.0D);
- d4 = d4 - k1 * 2048;
- d5 = d5 - l1 * 2048;
- this.renderEngine.bindTexture(CLOUDS_TEXTURES);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- Vec3d vec3d = this.world.getCloudColour(partialTicks);
- float f3 = (float)vec3d.x;
- float f4 = (float)vec3d.y;
- float f5 = (float)vec3d.z;
-
- if (pass != 2)
- {
- float f6 = (f3 * 30.0F + f4 * 59.0F + f5 * 11.0F) / 100.0F;
- float f7 = (f3 * 30.0F + f4 * 70.0F) / 100.0F;
- float f8 = (f3 * 30.0F + f5 * 70.0F) / 100.0F;
- f3 = f6;
- f4 = f7;
- f5 = f8;
- }
-
- float f25 = f3 * 0.9F;
- float f26 = f4 * 0.9F;
- float f27 = f5 * 0.9F;
- float f9 = f3 * 0.7F;
- float f10 = f4 * 0.7F;
- float f11 = f5 * 0.7F;
- float f12 = f3 * 0.8F;
- float f13 = f4 * 0.8F;
- float f14 = f5 * 0.8F;
- float f16 = MathHelper.floor(d4) * 0.00390625F;
- float f17 = MathHelper.floor(d5) * 0.00390625F;
- float f18 = (float)(d4 - MathHelper.floor(d4));
- float f19 = (float)(d5 - MathHelper.floor(d5));
- GlStateManager.scale(12.0F, 1.0F, 12.0F);
-
- for (int k2 = 0; k2 < 2; ++k2)
- {
- if (k2 == 0)
- {
- GlStateManager.colorMask(false, false, false, false);
- }
- else
- {
- switch (pass)
- {
- case 0:
- GlStateManager.colorMask(false, true, true, true);
- break;
- case 1:
- GlStateManager.colorMask(true, false, false, true);
- break;
- case 2:
- GlStateManager.colorMask(true, true, true, true);
- }
- }
-
- for (int l2 = -3; l2 <= 4; ++l2)
- {
- for (int i3 = -3; i3 <= 4; ++i3)
- {
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
- float f21 = l2 * 8;
- float f22 = i3 * 8;
- float f23 = f21 - f18;
- float f24 = f22 - f19;
-
- if (f2 > -5.0F)
- {
- bufferbuilder.pos(f23 + 0.0F, f2 + 0.0F, f24 + 8.0F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f9, f10, f11, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 0.0F, f24 + 8.0F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f9, f10, f11, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 0.0F, f24 + 0.0F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f9, f10, f11, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + 0.0F, f2 + 0.0F, f24 + 0.0F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f9, f10, f11, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
- }
-
- if (f2 <= 5.0F)
- {
- bufferbuilder.pos(f23 + 0.0F, f2 + 4.0F - 9.765625E-4F, f24 + 8.0F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f3, f4, f5, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 4.0F - 9.765625E-4F, f24 + 8.0F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f3, f4, f5, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 4.0F - 9.765625E-4F, f24 + 0.0F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f3, f4, f5, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + 0.0F, f2 + 4.0F - 9.765625E-4F, f24 + 0.0F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f3, f4, f5, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
- }
-
- if (l2 > -1)
- {
- for (int j3 = 0; j3 < 8; ++j3)
- {
- bufferbuilder.pos(f23 + j3 + 0.0F, f2 + 0.0F, f24 + 8.0F).tex((f21 + j3 + 0.5F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + j3 + 0.0F, f2 + 4.0F, f24 + 8.0F).tex((f21 + j3 + 0.5F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + j3 + 0.0F, f2 + 4.0F, f24 + 0.0F).tex((f21 + j3 + 0.5F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + j3 + 0.0F, f2 + 0.0F, f24 + 0.0F).tex((f21 + j3 + 0.5F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
- }
- }
-
- if (l2 <= 1)
- {
- for (int k3 = 0; k3 < 8; ++k3)
- {
- bufferbuilder.pos(f23 + k3 + 1.0F - 9.765625E-4F, f2 + 0.0F, f24 + 8.0F).tex((f21 + k3 + 0.5F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + k3 + 1.0F - 9.765625E-4F, f2 + 4.0F, f24 + 8.0F).tex((f21 + k3 + 0.5F) * 0.00390625F + f16, (f22 + 8.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + k3 + 1.0F - 9.765625E-4F, f2 + 4.0F, f24 + 0.0F).tex((f21 + k3 + 0.5F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
- bufferbuilder.pos(f23 + k3 + 1.0F - 9.765625E-4F, f2 + 0.0F, f24 + 0.0F).tex((f21 + k3 + 0.5F) * 0.00390625F + f16, (f22 + 0.0F) * 0.00390625F + f17).color(f25, f26, f27, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
- }
- }
-
- if (i3 > -1)
- {
- for (int l3 = 0; l3 < 8; ++l3)
- {
- bufferbuilder.pos(f23 + 0.0F, f2 + 4.0F, f24 + l3 + 0.0F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + l3 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 4.0F, f24 + l3 + 0.0F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + l3 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 0.0F, f24 + l3 + 0.0F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + l3 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
- bufferbuilder.pos(f23 + 0.0F, f2 + 0.0F, f24 + l3 + 0.0F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + l3 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
- }
- }
-
- if (i3 <= 1)
- {
- for (int i4 = 0; i4 < 8; ++i4)
- {
- bufferbuilder.pos(f23 + 0.0F, f2 + 4.0F, f24 + i4 + 1.0F - 9.765625E-4F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + i4 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 4.0F, f24 + i4 + 1.0F - 9.765625E-4F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + i4 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
- bufferbuilder.pos(f23 + 8.0F, f2 + 0.0F, f24 + i4 + 1.0F - 9.765625E-4F).tex((f21 + 8.0F) * 0.00390625F + f16, (f22 + i4 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
- bufferbuilder.pos(f23 + 0.0F, f2 + 0.0F, f24 + i4 + 1.0F - 9.765625E-4F).tex((f21 + 0.0F) * 0.00390625F + f16, (f22 + i4 + 0.5F) * 0.00390625F + f17).color(f12, f13, f14, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
- }
- }
-
- tessellator.draw();
- }
- }
- }
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.disableBlend();
- GlStateManager.enableCull();
- }
-
- public void updateChunks(long finishTimeNano)
- {
- this.displayListEntitiesDirty |= this.renderDispatcher.runChunkUploads(finishTimeNano);
-
- if (!this.chunksToUpdate.isEmpty())
- {
- Iterator iterator = this.chunksToUpdate.iterator();
-
- while (iterator.hasNext())
- {
- RenderChunk renderchunk1 = iterator.next();
- boolean flag1;
-
- if (renderchunk1.needsImmediateUpdate())
- {
- flag1 = this.renderDispatcher.updateChunkNow(renderchunk1);
- }
- else
- {
- flag1 = this.renderDispatcher.updateChunkLater(renderchunk1);
- }
-
- if (!flag1)
- {
- break;
- }
-
- renderchunk1.clearNeedsUpdate();
- iterator.remove();
- long k1 = finishTimeNano - System.nanoTime();
-
- if (k1 < 0L)
- {
- break;
- }
- }
- }
- }
-
- public void renderWorldBorder(Entity entityIn, float partialTicks)
- {
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- WorldBorder worldborder = this.world.getWorldBorder();
- double d3 = this.mc.gameSettings.renderDistanceChunks * 16;
-
- if (entityIn.posX >= worldborder.maxX() - d3 || entityIn.posX <= worldborder.minX() + d3 || entityIn.posZ >= worldborder.maxZ() - d3 || entityIn.posZ <= worldborder.minZ() + d3)
- {
- double d4 = 1.0D - worldborder.getClosestDistance(entityIn) / d3;
- d4 = Math.pow(d4, 4.0D);
- double d5 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * partialTicks;
- double d6 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * partialTicks;
- double d7 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * partialTicks;
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- this.renderEngine.bindTexture(FORCEFIELD_TEXTURES);
- GlStateManager.depthMask(false);
- GlStateManager.pushMatrix();
- int k1 = worldborder.getStatus().getColor();
- float f = (k1 >> 16 & 255) / 255.0F;
- float f1 = (k1 >> 8 & 255) / 255.0F;
- float f2 = (k1 & 255) / 255.0F;
- GlStateManager.color(f, f1, f2, (float)d4);
- GlStateManager.doPolygonOffset(-3.0F, -3.0F);
- GlStateManager.enablePolygonOffset();
- GlStateManager.alphaFunc(516, 0.1F);
- GlStateManager.enableAlpha();
- GlStateManager.disableCull();
- float f3 = Minecraft.getSystemTime() % 3000L / 3000.0F;
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
- bufferbuilder.setTranslation(-d5, -d6, -d7);
- double d8 = Math.max(MathHelper.floor(d7 - d3), worldborder.minZ());
- double d9 = Math.min(MathHelper.ceil(d7 + d3), worldborder.maxZ());
-
- if (d5 > worldborder.maxX() - d3)
- {
- float f7 = 0.0F;
-
- for (double d10 = d8; d10 < d9; f7 += 0.5F)
- {
- double d11 = Math.min(1.0D, d9 - d10);
- float f8 = (float)d11 * 0.5F;
- bufferbuilder.pos(worldborder.maxX(), 256.0D, d10).tex(f3 + f7, f3 + 0.0F).endVertex();
- bufferbuilder.pos(worldborder.maxX(), 256.0D, d10 + d11).tex(f3 + f8 + f7, f3 + 0.0F).endVertex();
- bufferbuilder.pos(worldborder.maxX(), 0.0D, d10 + d11).tex(f3 + f8 + f7, f3 + 128.0F).endVertex();
- bufferbuilder.pos(worldborder.maxX(), 0.0D, d10).tex(f3 + f7, f3 + 128.0F).endVertex();
- ++d10;
- }
- }
-
- if (d5 < worldborder.minX() + d3)
- {
- float f9 = 0.0F;
-
- for (double d12 = d8; d12 < d9; f9 += 0.5F)
- {
- double d15 = Math.min(1.0D, d9 - d12);
- float f12 = (float)d15 * 0.5F;
- bufferbuilder.pos(worldborder.minX(), 256.0D, d12).tex(f3 + f9, f3 + 0.0F).endVertex();
- bufferbuilder.pos(worldborder.minX(), 256.0D, d12 + d15).tex(f3 + f12 + f9, f3 + 0.0F).endVertex();
- bufferbuilder.pos(worldborder.minX(), 0.0D, d12 + d15).tex(f3 + f12 + f9, f3 + 128.0F).endVertex();
- bufferbuilder.pos(worldborder.minX(), 0.0D, d12).tex(f3 + f9, f3 + 128.0F).endVertex();
- ++d12;
- }
- }
-
- d8 = Math.max(MathHelper.floor(d5 - d3), worldborder.minX());
- d9 = Math.min(MathHelper.ceil(d5 + d3), worldborder.maxX());
-
- if (d7 > worldborder.maxZ() - d3)
- {
- float f10 = 0.0F;
-
- for (double d13 = d8; d13 < d9; f10 += 0.5F)
- {
- double d16 = Math.min(1.0D, d9 - d13);
- float f13 = (float)d16 * 0.5F;
- bufferbuilder.pos(d13, 256.0D, worldborder.maxZ()).tex(f3 + f10, f3 + 0.0F).endVertex();
- bufferbuilder.pos(d13 + d16, 256.0D, worldborder.maxZ()).tex(f3 + f13 + f10, f3 + 0.0F).endVertex();
- bufferbuilder.pos(d13 + d16, 0.0D, worldborder.maxZ()).tex(f3 + f13 + f10, f3 + 128.0F).endVertex();
- bufferbuilder.pos(d13, 0.0D, worldborder.maxZ()).tex(f3 + f10, f3 + 128.0F).endVertex();
- ++d13;
- }
- }
-
- if (d7 < worldborder.minZ() + d3)
- {
- float f11 = 0.0F;
-
- for (double d14 = d8; d14 < d9; f11 += 0.5F)
- {
- double d17 = Math.min(1.0D, d9 - d14);
- float f14 = (float)d17 * 0.5F;
- bufferbuilder.pos(d14, 256.0D, worldborder.minZ()).tex(f3 + f11, f3 + 0.0F).endVertex();
- bufferbuilder.pos(d14 + d17, 256.0D, worldborder.minZ()).tex(f3 + f14 + f11, f3 + 0.0F).endVertex();
- bufferbuilder.pos(d14 + d17, 0.0D, worldborder.minZ()).tex(f3 + f14 + f11, f3 + 128.0F).endVertex();
- bufferbuilder.pos(d14, 0.0D, worldborder.minZ()).tex(f3 + f11, f3 + 128.0F).endVertex();
- ++d14;
- }
- }
-
- tessellator.draw();
- bufferbuilder.setTranslation(0.0D, 0.0D, 0.0D);
- GlStateManager.enableCull();
- GlStateManager.disableAlpha();
- GlStateManager.doPolygonOffset(0.0F, 0.0F);
- GlStateManager.disablePolygonOffset();
- GlStateManager.enableAlpha();
- GlStateManager.disableBlend();
- GlStateManager.popMatrix();
- GlStateManager.depthMask(true);
- }
- }
-
- private void preRenderDamagedBlocks()
- {
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- GlStateManager.enableBlend();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
- // FORGE: Fix MC-234
- GlStateManager.doPolygonOffset(-1.0F, -10.0F);
- GlStateManager.enablePolygonOffset();
- GlStateManager.alphaFunc(516, 0.1F);
- GlStateManager.enableAlpha();
- GlStateManager.pushMatrix();
- }
-
- private void postRenderDamagedBlocks()
- {
- GlStateManager.disableAlpha();
- GlStateManager.doPolygonOffset(0.0F, 0.0F);
- GlStateManager.disablePolygonOffset();
- GlStateManager.enableAlpha();
- GlStateManager.depthMask(true);
- GlStateManager.popMatrix();
- }
-
- public void drawBlockDamageTexture(Tessellator tessellatorIn, BufferBuilder bufferBuilderIn, Entity entityIn, float partialTicks)
- {
- double d3 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * partialTicks;
- double d4 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * partialTicks;
- double d5 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * partialTicks;
-
- if (!this.damagedBlocks.isEmpty())
- {
- this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
- this.preRenderDamagedBlocks();
- bufferBuilderIn.begin(7, DefaultVertexFormats.BLOCK);
- bufferBuilderIn.setTranslation(-d3, -d4, -d5);
- bufferBuilderIn.noColor();
- Iterator iterator = this.damagedBlocks.values().iterator();
-
- while (iterator.hasNext())
- {
- DestroyBlockProgress destroyblockprogress = iterator.next();
- BlockPos blockpos = destroyblockprogress.getPosition();
- double d6 = blockpos.getX() - d3;
- double d7 = blockpos.getY() - d4;
- double d8 = blockpos.getZ() - d5;
- Block block = this.world.getBlockState(blockpos).getBlock();
- TileEntity te = this.world.getTileEntity(blockpos);
- boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
- if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();
-
- if (!hasBreak)
- {
- if (d6 * d6 + d7 * d7 + d8 * d8 > 1024.0D)
- {
- iterator.remove();
- }
- else
- {
- IBlockState iblockstate = this.world.getBlockState(blockpos);
-
- if (iblockstate.getMaterial() != Material.AIR)
- {
- int k1 = destroyblockprogress.getPartialBlockDamage();
- TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[k1];
- BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
- blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.world);
- }
- }
- }
- }
-
- tessellatorIn.draw();
- bufferBuilderIn.setTranslation(0.0D, 0.0D, 0.0D);
- this.postRenderDamagedBlocks();
- }
- }
-
- /**
- * Draws the selection box for the player.
- */
- public void drawSelectionBox(EntityPlayer player, RayTraceResult movingObjectPositionIn, int execute, float partialTicks)
- {
- if (execute == 0 && movingObjectPositionIn.typeOfHit == RayTraceResult.Type.BLOCK)
- {
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- GlStateManager.glLineWidth(2.0F);
- GlStateManager.disableTexture2D();
- GlStateManager.depthMask(false);
- BlockPos blockpos = movingObjectPositionIn.getBlockPos();
- IBlockState iblockstate = this.world.getBlockState(blockpos);
-
- if (iblockstate.getMaterial() != Material.AIR && this.world.getWorldBorder().contains(blockpos))
- {
- double d3 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
- double d4 = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
- double d5 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
- drawSelectionBoundingBox(iblockstate.getSelectedBoundingBox(this.world, blockpos).grow(0.0020000000949949026D).offset(-d3, -d4, -d5), 0.0F, 0.0F, 0.0F, 0.4F);
- }
-
- GlStateManager.depthMask(true);
- GlStateManager.enableTexture2D();
- GlStateManager.disableBlend();
- }
- }
-
- public static void drawSelectionBoundingBox(AxisAlignedBB box, float red, float green, float blue, float alpha)
- {
- drawBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, red, green, blue, alpha);
- }
-
- public static void drawBoundingBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha)
- {
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
- drawBoundingBox(bufferbuilder, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha);
- tessellator.draw();
- }
-
- public static void drawBoundingBox(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha)
- {
- buffer.pos(minX, minY, minZ).color(red, green, blue, 0.0F).endVertex();
- buffer.pos(minX, minY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, minY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, minY, maxZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(minX, minY, maxZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(minX, minY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(minX, maxY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, maxY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, maxY, maxZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(minX, maxY, maxZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(minX, maxY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(minX, maxY, maxZ).color(red, green, blue, 0.0F).endVertex();
- buffer.pos(minX, minY, maxZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, maxY, maxZ).color(red, green, blue, 0.0F).endVertex();
- buffer.pos(maxX, minY, maxZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, maxY, minZ).color(red, green, blue, 0.0F).endVertex();
- buffer.pos(maxX, minY, minZ).color(red, green, blue, alpha).endVertex();
- buffer.pos(maxX, minY, minZ).color(red, green, blue, 0.0F).endVertex();
- }
-
- public static void renderFilledBox(AxisAlignedBB aabb, float red, float green, float blue, float alpha)
- {
- renderFilledBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ, red, green, blue, alpha);
- }
-
- public static void renderFilledBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha)
- {
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- bufferbuilder.begin(5, DefaultVertexFormats.POSITION_COLOR);
- addChainedFilledBoxVertices(bufferbuilder, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha);
- tessellator.draw();
- }
-
- public static void addChainedFilledBoxVertices(BufferBuilder builder, double p_189693_1_, double p_189693_3_, double p_189693_5_, double p_189693_7_, double p_189693_9_, double p_189693_11_, float red, float green, float blue, float alpha)
- {
- builder.pos(p_189693_1_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_3_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_1_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_5_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- builder.pos(p_189693_7_, p_189693_9_, p_189693_11_).color(red, green, blue, alpha).endVertex();
- }
-
- private void markBlocksForUpdate(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean updateImmediately)
- {
- this.viewFrustum.markBlocksForUpdate(minX, minY, minZ, maxX, maxY, maxZ, updateImmediately);
- }
-
- @Override
- public void notifyBlockUpdate(World worldIn, BlockPos pos, IBlockState oldState, IBlockState newState, int flags)
- {
- int k1 = pos.getX();
- int l1 = pos.getY();
- int i2 = pos.getZ();
- this.markBlocksForUpdate(k1 - 1, l1 - 1, i2 - 1, k1 + 1, l1 + 1, i2 + 1, (flags & 8) != 0);
- }
-
- @Override
- public void notifyLightSet(BlockPos pos)
- {
- this.setLightUpdates.add(pos.toImmutable());
- }
-
- /**
- * On the client, re-renders all blocks in this range, inclusive. On the server, does nothing.
- */
- @Override
- public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2)
- {
- this.markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1, false);
- }
-
- @Override
- public void playRecord(@Nullable SoundEvent soundIn, BlockPos pos)
- {
- ISound isound = this.mapSoundPositions.get(pos);
-
- if (isound != null)
- {
- this.mc.getSoundHandler().stopSound(isound);
- this.mapSoundPositions.remove(pos);
- }
-
- if (soundIn != null)
- {
- ItemRecord itemrecord = ItemRecord.getBySound(soundIn);
-
- if (itemrecord != null)
- {
- this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal());
- }
-
- ISound positionedsoundrecord = PositionedSoundRecord.getRecordSoundRecord(soundIn, pos.getX(), pos.getY(), pos.getZ());
- this.mapSoundPositions.put(pos, positionedsoundrecord);
- this.mc.getSoundHandler().playSound(positionedsoundrecord);
- }
-
- this.setPartying(this.world, pos, soundIn != null);
- }
-
- private void setPartying(World p_193054_1_, BlockPos pos, boolean p_193054_3_)
- {
- for (EntityLivingBase entitylivingbase : p_193054_1_.getEntitiesWithinAABB(EntityLivingBase.class, (new AxisAlignedBB(pos)).grow(3.0D)))
- {
- entitylivingbase.setPartying(pos, p_193054_3_);
- }
- }
-
- @Override
- public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch)
- {
- }
-
- @Override
- public void spawnParticle(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters)
- {
- this.spawnParticle(particleID, ignoreRange, false, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
- }
-
- @Override
- public void spawnParticle(int id, boolean ignoreRange, boolean p_190570_3_, final double x, final double y, final double z, double xSpeed, double ySpeed, double zSpeed, int... parameters)
- {
- try
- {
- this.spawnParticle0(id, ignoreRange, p_190570_3_, x, y, z, xSpeed, ySpeed, zSpeed, parameters);
- }
- catch (Throwable throwable)
- {
- CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while adding particle");
- CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being added");
- crashreportcategory.addCrashSection("ID", Integer.valueOf(id));
-
- if (parameters != null)
- {
- crashreportcategory.addCrashSection("Parameters", parameters);
- }
-
- crashreportcategory.addDetail("Position", new ICrashReportDetail()
- {
- @Override
- public String call() throws Exception
- {
- return CrashReportCategory.getCoordinateInfo(x, y, z);
- }
- });
- throw new ReportedException(crashreport);
- }
- }
-
- private void spawnParticle(EnumParticleTypes particleIn, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters)
- {
- this.spawnParticle(particleIn.getParticleID(), particleIn.getShouldIgnoreRange(), xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
- }
-
- @Nullable
- private Particle spawnParticle0(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters)
- {
- return this.spawnParticle0(particleID, ignoreRange, false, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
- }
-
- @Nullable
- private Particle spawnParticle0(int particleID, boolean ignoreRange, boolean minParticles, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters)
- {
- Entity entity = this.mc.getRenderViewEntity();
-
- if (this.mc != null && entity != null && this.mc.effectRenderer != null)
- {
- int k1 = this.calculateParticleLevel(minParticles);
- double d3 = entity.posX - xCoord;
- double d4 = entity.posY - yCoord;
- double d5 = entity.posZ - zCoord;
-
- if (ignoreRange)
- {
- return this.mc.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
- }
- else if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
- {
- return null;
- }
- else
- {
- return k1 > 1 ? null : this.mc.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
- }
- }
- else
- {
- return null;
- }
- }
-
- private int calculateParticleLevel(boolean p_190572_1_)
- {
- int k1 = this.mc.gameSettings.particleSetting;
-
- if (p_190572_1_ && k1 == 2 && this.world.rand.nextInt(10) == 0)
- {
- k1 = 1;
- }
-
- if (k1 == 1 && this.world.rand.nextInt(3) == 0)
- {
- k1 = 2;
- }
-
- return k1;
- }
-
- /**
- * Called on all IWorldAccesses when an entity is created or loaded. On client worlds, starts downloading any
- * necessary textures. On server worlds, adds the entity to the entity tracker.
- */
- @Override
- public void onEntityAdded(Entity entityIn)
- {
- }
-
- /**
- * Called on all IWorldAccesses when an entity is unloaded or destroyed. On client worlds, releases any downloaded
- * textures. On server worlds, removes the entity from the entity tracker.
- */
- @Override
- public void onEntityRemoved(Entity entityIn)
- {
- }
-
- /**
- * Deletes all display lists
- */
- public void deleteAllDisplayLists()
- {
- }
-
- @Override
- public void broadcastSound(int soundID, BlockPos pos, int data)
- {
- switch (soundID)
- {
- case 1023:
- case 1028:
- case 1038:
- Entity entity = this.mc.getRenderViewEntity();
-
- if (entity != null)
- {
- double d3 = pos.getX() - entity.posX;
- double d4 = pos.getY() - entity.posY;
- double d5 = pos.getZ() - entity.posZ;
- double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
- double d7 = entity.posX;
- double d8 = entity.posY;
- double d9 = entity.posZ;
-
- if (d6 > 0.0D)
- {
- d7 += d3 / d6 * 2.0D;
- d8 += d4 / d6 * 2.0D;
- d9 += d5 / d6 * 2.0D;
- }
-
- if (soundID == 1023)
- {
- this.world.playSound(d7, d8, d9, SoundEvents.ENTITY_WITHER_SPAWN, SoundCategory.HOSTILE, 1.0F, 1.0F, false);
- }
- else if (soundID == 1038)
- {
- this.world.playSound(d7, d8, d9, SoundEvents.BLOCK_END_PORTAL_SPAWN, SoundCategory.HOSTILE, 1.0F, 1.0F, false);
- }
- else
- {
- this.world.playSound(d7, d8, d9, SoundEvents.ENTITY_ENDERDRAGON_DEATH, SoundCategory.HOSTILE, 5.0F, 1.0F, false);
- }
- }
-
- default:
- }
- }
-
- @Override
- public void playEvent(EntityPlayer player, int type, BlockPos blockPosIn, int data)
- {
- Random random = this.world.rand;
-
- switch (type)
- {
- case 1000:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_DISPENSER_DISPENSE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
- break;
- case 1001:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_DISPENSER_FAIL, SoundCategory.BLOCKS, 1.0F, 1.2F, false);
- break;
- case 1002:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_DISPENSER_LAUNCH, SoundCategory.BLOCKS, 1.0F, 1.2F, false);
- break;
- case 1003:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ENDEREYE_LAUNCH, SoundCategory.NEUTRAL, 1.0F, 1.2F, false);
- break;
- case 1004:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_FIREWORK_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.2F, false);
- break;
- case 1005:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_IRON_DOOR_OPEN, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1006:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1007:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1008:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_FENCE_GATE_OPEN, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1009:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (random.nextFloat() - random.nextFloat()) * 0.8F, false);
- break;
- case 1010:
-
- if (Item.getItemById(data) instanceof ItemRecord)
- {
- this.world.playRecord(blockPosIn, ((ItemRecord)Item.getItemById(data)).getSound());
- }
- else
- {
- this.world.playRecord(blockPosIn, (SoundEvent)null);
- }
-
- break;
- case 1011:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_IRON_DOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1012:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1013:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1014:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1015:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_GHAST_WARN, SoundCategory.HOSTILE, 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1016:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_GHAST_SHOOT, SoundCategory.HOSTILE, 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1017:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ENDERDRAGON_SHOOT, SoundCategory.HOSTILE, 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1018:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_BLAZE_SHOOT, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1019:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1020:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1021:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1022:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_WITHER_BREAK_BLOCK, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1024:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_WITHER_SHOOT, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1025:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_BAT_TAKEOFF, SoundCategory.NEUTRAL, 0.05F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1026:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_INFECT, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1027:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_VILLAGER_CONVERTED, SoundCategory.NEUTRAL, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false);
- break;
- case 1029:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_ANVIL_DESTROY, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1030:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_ANVIL_USE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1031:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 0.3F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1032:
- this.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_PORTAL_TRAVEL, random.nextFloat() * 0.4F + 0.8F));
- break;
- case 1033:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_CHORUS_FLOWER_GROW, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
- break;
- case 1034:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_CHORUS_FLOWER_DEATH, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
- break;
- case 1035:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_BREWING_STAND_BREW, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
- break;
- case 1036:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 1037:
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 2000:
- int j2 = data % 3 - 1;
- int k1 = data / 3 % 3 - 1;
- double d11 = blockPosIn.getX() + j2 * 0.6D + 0.5D;
- double d13 = blockPosIn.getY() + 0.5D;
- double d15 = blockPosIn.getZ() + k1 * 0.6D + 0.5D;
-
- for (int l2 = 0; l2 < 10; ++l2)
- {
- double d16 = random.nextDouble() * 0.2D + 0.01D;
- double d19 = d11 + j2 * 0.01D + (random.nextDouble() - 0.5D) * k1 * 0.5D;
- double d22 = d13 + (random.nextDouble() - 0.5D) * 0.5D;
- double d25 = d15 + k1 * 0.01D + (random.nextDouble() - 0.5D) * j2 * 0.5D;
- double d27 = j2 * d16 + random.nextGaussian() * 0.01D;
- double d29 = -0.03D + random.nextGaussian() * 0.01D;
- double d30 = k1 * d16 + random.nextGaussian() * 0.01D;
- this.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d19, d22, d25, d27, d29, d30);
- }
-
- return;
- case 2001:
- Block block = Block.getBlockById(data & 4095);
-
- if (block.getDefaultState().getMaterial() != Material.AIR)
- {
- SoundType soundtype = block.getSoundType(Block.getStateById(data), world, blockPosIn, null);
- this.world.playSound(blockPosIn, soundtype.getBreakSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false);
- }
-
- this.mc.effectRenderer.addBlockDestroyEffects(blockPosIn, block.getStateFromMeta(data >> 12 & 255));
- break;
- case 2002:
- case 2007:
- double d9 = blockPosIn.getX();
- double d10 = blockPosIn.getY();
- double d12 = blockPosIn.getZ();
-
- for (int k2 = 0; k2 < 8; ++k2)
- {
- this.spawnParticle(EnumParticleTypes.ITEM_CRACK, d9, d10, d12, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, Item.getIdFromItem(Items.SPLASH_POTION));
- }
-
- float f5 = (data >> 16 & 255) / 255.0F;
- float f = (data >> 8 & 255) / 255.0F;
- float f1 = (data >> 0 & 255) / 255.0F;
- EnumParticleTypes enumparticletypes = type == 2007 ? EnumParticleTypes.SPELL_INSTANT : EnumParticleTypes.SPELL;
-
- for (int j3 = 0; j3 < 100; ++j3)
- {
- double d18 = random.nextDouble() * 4.0D;
- double d21 = random.nextDouble() * Math.PI * 2.0D;
- double d24 = Math.cos(d21) * d18;
- double d26 = 0.01D + random.nextDouble() * 0.5D;
- double d28 = Math.sin(d21) * d18;
- Particle particle1 = this.spawnParticle0(enumparticletypes.getParticleID(), enumparticletypes.getShouldIgnoreRange(), d9 + d24 * 0.1D, d10 + 0.3D, d12 + d28 * 0.1D, d24, d26, d28);
-
- if (particle1 != null)
- {
- float f4 = 0.75F + random.nextFloat() * 0.25F;
- particle1.setRBGColorF(f5 * f4, f * f4, f1 * f4);
- particle1.multiplyVelocity((float)d18);
- }
- }
-
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_SPLASH_POTION_BREAK, SoundCategory.NEUTRAL, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 2003:
- double d3 = blockPosIn.getX() + 0.5D;
- double d4 = blockPosIn.getY();
- double d5 = blockPosIn.getZ() + 0.5D;
-
- for (int l1 = 0; l1 < 8; ++l1)
- {
- this.spawnParticle(EnumParticleTypes.ITEM_CRACK, d3, d4, d5, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, Item.getIdFromItem(Items.ENDER_EYE));
- }
-
- for (double d14 = 0.0D; d14 < (Math.PI * 2D); d14 += 0.15707963267948966D)
- {
- this.spawnParticle(EnumParticleTypes.PORTAL, d3 + Math.cos(d14) * 5.0D, d4 - 0.4D, d5 + Math.sin(d14) * 5.0D, Math.cos(d14) * -5.0D, 0.0D, Math.sin(d14) * -5.0D);
- this.spawnParticle(EnumParticleTypes.PORTAL, d3 + Math.cos(d14) * 5.0D, d4 - 0.4D, d5 + Math.sin(d14) * 5.0D, Math.cos(d14) * -7.0D, 0.0D, Math.sin(d14) * -7.0D);
- }
-
- return;
- case 2004:
-
- for (int i3 = 0; i3 < 20; ++i3)
- {
- double d17 = blockPosIn.getX() + 0.5D + (this.world.rand.nextFloat() - 0.5D) * 2.0D;
- double d20 = blockPosIn.getY() + 0.5D + (this.world.rand.nextFloat() - 0.5D) * 2.0D;
- double d23 = blockPosIn.getZ() + 0.5D + (this.world.rand.nextFloat() - 0.5D) * 2.0D;
- this.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d17, d20, d23, 0.0D, 0.0D, 0.0D, new int[0]);
- this.world.spawnParticle(EnumParticleTypes.FLAME, d17, d20, d23, 0.0D, 0.0D, 0.0D, new int[0]);
- }
-
- return;
- case 2005:
- ItemDye.spawnBonemealParticles(this.world, blockPosIn, data);
- break;
- case 2006:
-
- for (int i2 = 0; i2 < 200; ++i2)
- {
- float f2 = random.nextFloat() * 4.0F;
- float f3 = random.nextFloat() * ((float)Math.PI * 2F);
- double d6 = MathHelper.cos(f3) * f2;
- double d7 = 0.01D + random.nextDouble() * 0.5D;
- double d8 = MathHelper.sin(f3) * f2;
- Particle particle = this.spawnParticle0(EnumParticleTypes.DRAGON_BREATH.getParticleID(), false, blockPosIn.getX() + d6 * 0.1D, blockPosIn.getY() + 0.3D, blockPosIn.getZ() + d8 * 0.1D, d6, d7, d8);
-
- if (particle != null)
- {
- particle.multiplyVelocity(f2);
- }
- }
-
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ENDERDRAGON_FIREBALL_EPLD, SoundCategory.HOSTILE, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false);
- break;
- case 3000:
- this.world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, true, blockPosIn.getX() + 0.5D, blockPosIn.getY() + 0.5D, blockPosIn.getZ() + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
- this.world.playSound(blockPosIn, SoundEvents.BLOCK_END_GATEWAY_SPAWN, SoundCategory.BLOCKS, 10.0F, (1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 0.7F, false);
- break;
- case 3001:
- this.world.playSound(blockPosIn, SoundEvents.ENTITY_ENDERDRAGON_GROWL, SoundCategory.HOSTILE, 64.0F, 0.8F + this.world.rand.nextFloat() * 0.3F, false);
- }
- }
-
- @Override
- public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress)
- {
- if (progress >= 0 && progress < 10)
- {
- DestroyBlockProgress destroyblockprogress = this.damagedBlocks.get(Integer.valueOf(breakerId));
-
- if (destroyblockprogress == null || destroyblockprogress.getPosition().getX() != pos.getX() || destroyblockprogress.getPosition().getY() != pos.getY() || destroyblockprogress.getPosition().getZ() != pos.getZ())
- {
- destroyblockprogress = new DestroyBlockProgress(breakerId, pos);
- this.damagedBlocks.put(Integer.valueOf(breakerId), destroyblockprogress);
- }
-
- destroyblockprogress.setPartialBlockDamage(progress);
- destroyblockprogress.setCloudUpdateTick(this.cloudTickCounter);
- }
- else
- {
- this.damagedBlocks.remove(Integer.valueOf(breakerId));
- }
- }
-
- public boolean hasNoChunkUpdates()
- {
- return this.chunksToUpdate.isEmpty() && this.renderDispatcher.hasChunkUpdates();
- }
-
- public void setDisplayListEntitiesDirty()
- {
- this.displayListEntitiesDirty = true;
- }
-
- public void updateTileEntities(Collection tileEntitiesToRemove, Collection tileEntitiesToAdd)
- {
- synchronized (this.setTileEntities)
- {
- this.setTileEntities.removeAll(tileEntitiesToRemove);
- this.setTileEntities.addAll(tileEntitiesToAdd);
- }
- }
-
- @SideOnly(Side.CLIENT)
- class ContainerLocalRenderInformation
- {
- final RenderChunk renderChunk;
- final EnumFacing facing;
- byte setFacing;
- final int counter;
-
- private ContainerLocalRenderInformation(RenderChunk renderChunkIn, EnumFacing facingIn, @Nullable int counterIn)
- {
- this.renderChunk = renderChunkIn;
- this.facing = facingIn;
- this.counter = counterIn;
- }
-
- public void setDirection(byte p_189561_1_, EnumFacing p_189561_2_)
- {
- this.setFacing = (byte)(this.setFacing | p_189561_1_ | 1 << p_189561_2_.ordinal());
- }
-
- public boolean hasDirection(EnumFacing p_189560_1_)
- {
- return (this.setFacing & 1 << p_189560_1_.ordinal()) > 0;
- }
- }
-}
\ No newline at end of file