Update - Added some features from OptiFine

This commit is contained in:
lax1dude 2025-01-24 18:39:36 -08:00
parent 1f0d593a8c
commit e83a912e38
1056 changed files with 17706 additions and 898 deletions
CREDITSclient_version
patches
minecraft/net/minecraft
resources/assets/minecraft
sources

52
CREDITS

@ -239,6 +239,58 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: Alfheim
Project Author: Red Studio
Project URL: https://github.com/Red-Studio-Ragnarok/Alfheim
Used For: Optimized lighting engine
* MIT License
*
* Copyright (c) 2023 Red Studio
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: OptiFine (1.8.9_HD_U_M6)
Project Author: sp614x
Project URL: https://optifine.net/
Used For: A few, limited portions we "borrowed" without the author's permission
Note: Eaglercraft is not OptiFine, we only use the code for connected textures
and maintaining compatibility with certain resource pack features
* The mod OptiFine is Copyright © 2011-2021 by sp614x and the intellectual
* property of the author.
* It may be not be reproduced under any circumstances except for personal,
* private use as long as it remains in its unaltered, unedited form.
* It may not be placed on any web site or otherwise distributed publicly
* without advance written permission.
* Use of this mod on any other website or as a part of any public display
* is strictly prohibited and a violation of copyright.
(sorry sp614x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: Google Guava
Project Author: Google
Project URL: https://github.com/google/guava

@ -1 +1 @@
u47
u48

@ -5,12 +5,17 @@
# Version: 1.0
# Author: lax1dude
> CHANGE 3 : 5 @ 3 : 135
> CHANGE 3 : 6 @ 3 : 135
~
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
~
> CHANGE 354 : 355 @ 354 : 355
> INSERT 27 : 28 @ 27
+ import net.minecraft.world.EnumSkyBlock;
> CHANGE 327 : 328 @ 327 : 328
~ public void randomTick(World world, BlockPos blockpos, IBlockState iblockstate, EaglercraftRandom random) {
@ -85,11 +90,49 @@
+ }
+
> INSERT 43 : 47 @ 43
> INSERT 43 : 85 @ 43
+
+ public boolean eaglerShadersShouldRenderGlassHighlights() {
+ return false;
+ }
+
+ public int alfheim$getLightFor(final IBlockState blockState, final IBlockAccess blockAccess,
+ final EnumSkyBlock lightType, final BlockPos blockPos) {
+ int lightLevel = blockAccess.getLightFor(lightType, blockPos);
+
+ if (lightLevel == 15)
+ return lightLevel;
+
+ if (!getUseNeighborBrightness())
+ return lightLevel;
+
+ BlockPos tmp = new BlockPos();
+ EnumFacing[] facings = EnumFacing._VALUES;
+ for (int i = 0, l = facings.length; i < l; ++i) {
+ EnumFacing facing = facings[i];
+ if (alfheim$useNeighborBrightness(blockState, facing, blockAccess, blockPos)) {
+ int opacity = 0;
+ final int neighborLightLevel = blockAccess.getLightFor(lightType,
+ blockPos.offsetEvenFaster(facing, tmp));
+
+ if (opacity == 0
+ && (lightType != EnumSkyBlock.SKY || neighborLightLevel != EnumSkyBlock.SKY.defaultLightValue))
+ opacity = 1;
+
+ lightLevel = Math.max(lightLevel, neighborLightLevel - opacity);
+
+ if (lightLevel == 15)
+ return lightLevel;
+ }
+ }
+
+ return lightLevel;
+ }
+
+ public boolean alfheim$useNeighborBrightness(final IBlockState blockState, final EnumFacing facing,
+ final IBlockAccess blockAccess, final BlockPos blockPos) {
+ return facing == EnumFacing.UP;
+ }
> EOF

@ -34,7 +34,7 @@
~ public int quantityDropped(EaglercraftRandom var1) {
> INSERT 65 : 78 @ 65
> INSERT 65 : 89 @ 65
+
+ public boolean onBlockActivated(World world, BlockPos blockpos, IBlockState var3, EntityPlayer entityplayer,
@ -49,5 +49,16 @@
+ }
+ return super.onBlockActivated(world, blockpos, var3, entityplayer, var5, var6, var7, var8);
+ }
+
+ public boolean alfheim$useNeighborBrightness(final IBlockState blockState, final EnumFacing facing,
+ final IBlockAccess blockAccess, final BlockPos blockPos) {
+ if (isFullCube())
+ return false;
+
+ if (facing.getAxis() != EnumFacing.Axis.Y)
+ return true;
+
+ return facing == (blockState.getValue(HALF) == EnumBlockHalf.TOP ? EnumFacing.DOWN : EnumFacing.UP);
+ }
> EOF

@ -60,4 +60,13 @@
~ for (int l = 0; l < amovingobjectposition.length; ++l) {
~ MovingObjectPosition movingobjectposition = amovingobjectposition[l];
> INSERT 97 : 103 @ 97
+
+ public boolean alfheim$useNeighborBrightness(final IBlockState blockState, final EnumFacing facing,
+ final IBlockAccess blockAccess, final BlockPos blockPos) {
+ return facing == (blockState.getValue(HALF) == EnumHalf.TOP ? EnumFacing.DOWN : EnumFacing.UP)
+ || facing == blockState.getValue(FACING).getOpposite();
+ }
> EOF

@ -15,10 +15,44 @@
+ import com.google.common.collect.Iterables;
+
> DELETE 2 @ 2 : 3
> CHANGE 2 : 3 @ 2 : 3
~ import net.minecraft.util.ResourceLocation;
> CHANGE 16 : 17 @ 16 : 17
~ (T) cyclePropertyValue(property.getAllowedValues(), this.getValue(property)));
> INSERT 30 : 59 @ 30
+
+ private int blockId = -1;
+ private int blockStateId = -1;
+ private int metadata = -1;
+ private ResourceLocation blockLocation = null;
+
+ public int getBlockId() {
+ if (this.blockId < 0) {
+ this.blockId = Block.getIdFromBlock(this.getBlock());
+ }
+
+ return this.blockId;
+ }
+
+ public int getBlockStateId() {
+ if (this.blockStateId < 0) {
+ this.blockStateId = Block.getStateId(this);
+ }
+
+ return this.blockStateId;
+ }
+
+ public int getMetadata() {
+ if (this.metadata < 0) {
+ this.metadata = this.getBlock().getMetaFromState(this);
+ }
+
+ return this.metadata;
+ }
> EOF

@ -5,26 +5,29 @@
# Version: 1.0
# Author: lax1dude
> INSERT 2 : 10 @ 2
> DELETE 2 @ 2 : 8
+ import java.util.ArrayList;
+ import java.util.List;
+
+ import org.apache.commons.lang3.StringUtils;
+
+ import com.carrotsearch.hppc.CharObjectHashMap;
+ import com.carrotsearch.hppc.CharObjectMap;
+ import com.carrotsearch.hppc.cursors.CharObjectCursor;
> INSERT 1 : 2 @ 1
> CHANGE 4 : 5 @ 4 : 10
+ import java.util.HashMap;
> CHANGE 3 : 4 @ 3 : 6
~
> DELETE 1 @ 1 : 4
> INSERT 2 : 9 @ 2
> CHANGE 4 : 5 @ 4 : 5
+ import com.google.common.base.Joiner;
+ import com.google.common.base.Predicate;
+ import com.google.common.base.Predicates;
+ import com.google.common.collect.Lists;
+
+ import net.minecraft.block.state.BlockWorldState;
+
~ private final CharObjectMap<Predicate<BlockWorldState>> symbolMap = new CharObjectHashMap<>();
> CHANGE 3 : 4 @ 3 : 4
~ private final Map<Character, Predicate<BlockWorldState>> symbolMap = new HashMap<>();
> CHANGE 4 : 5 @ 4 : 5
@ -59,10 +62,8 @@
~ apredicate[i][j][k] = this.symbolMap.get(((String[]) this.depth.get(i))[j].charAt(k));
> CHANGE 10 : 13 @ 10 : 13
> CHANGE 10 : 11 @ 10 : 11
~ for (CharObjectCursor<Predicate<BlockWorldState>> entry : this.symbolMap) {
~ if (entry.value == null) {
~ arraylist.add(entry.key);
~ for (Entry<Character, Predicate<BlockWorldState>> entry : this.symbolMap.entrySet()) {
> EOF

@ -149,7 +149,9 @@
> DELETE 6 @ 6 : 7
> DELETE 1 @ 1 : 19
> CHANGE 1 : 2 @ 1 : 19
~ import net.optifine.Config;
> CHANGE 1 : 2 @ 1 : 2
@ -272,10 +274,11 @@
~ } finally {
~ this.shutdownMinecraftApplet();
> CHANGE 4 : 6 @ 4 : 6
> CHANGE 4 : 7 @ 4 : 6
~ private void startGame() throws IOException {
~ this.gameSettings = new GameSettings(this);
~ Config.setGameObj(this);
> DELETE 1 @ 1 : 2
@ -1419,7 +1422,7 @@
> DELETE 26 @ 26 : 34
> INSERT 7 : 44 @ 7
> INSERT 7 : 47 @ 7
+
+ public static int getGLMaximumTextureSize() {
@ -1458,5 +1461,8 @@
+ return EagRuntime.getConfiguration().isForceProfanityFilter() || gameSettings.enableProfanityFilter;
+ }
+
+ public DefaultResourcePack getDefaultResourcePack() {
+ return mcDefaultResourcePack;
+ }
> EOF

@ -17,14 +17,13 @@
+ import java.util.Locale;
> INSERT 1 : 18 @ 1
> INSERT 1 : 17 @ 1
+
+ import org.apache.commons.lang3.StringUtils;
+
+ import java.util.TimeZone;
+
+ import com.carrotsearch.hppc.cursors.ObjectCursor;
+ import com.google.common.base.Strings;
+ import com.google.common.collect.Lists;
+
@ -108,7 +107,7 @@
~ }
~ }
> INSERT 2 : 137 @ 2
> INSERT 2 : 136 @ 2
+ private void drawFPS(int x, int y) {
+ this.fontRenderer.drawStringWithShadow(this.mc.renderGlobal.getDebugInfoShort(), x, y, 0xFFFFFF);
@ -153,9 +152,8 @@
+ this.fontRenderer.drawStringWithShadow(line, x - lw, y - i, 0xFFFFFF);
+ i += 11;
+
+ for (ObjectCursor<PotionEffect> ee : mc.thePlayer.getActivePotionEffects()) {
+ for (PotionEffect e : mc.thePlayer.getActivePotionEffectsList()) {
+ i += 11;
+ PotionEffect e = ee.value;
+ int t = e.getDuration() / 20;
+ int m = t / 60;
+ int s = t % 60;

@ -21,16 +21,19 @@
+ * + An array of all of GameSettings.Options's video options.
+ */
> CHANGE 2 : 10 @ 2 : 7
> CHANGE 2 : 13 @ 2 : 7
~ GameSettings.Options.FRAMERATE_LIMIT, GameSettings.Options.EAGLER_VSYNC, GameSettings.Options.ANAGLYPH,
~ GameSettings.Options.VIEW_BOBBING, GameSettings.Options.GUI_SCALE, GameSettings.Options.GAMMA,
~ GameSettings.Options.RENDER_CLOUDS, GameSettings.Options.PARTICLES, GameSettings.Options.FXAA,
~ GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.BLOCK_ALTERNATIVES,
~ GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.EAGLER_DYNAMIC_LIGHTS,
~ GameSettings.Options.FULLSCREEN, GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS,
~ GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS,
~ GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
~ GameSettings.Options.FULLSCREEN, GameSettings.Options.OF_CONNECTED_TEXTURES,
~ GameSettings.Options.OF_BETTER_GRASS, GameSettings.Options.OF_CUSTOM_SKIES,
~ GameSettings.Options.OF_SMART_LEAVES, GameSettings.Options.OF_CUSTOM_ITEMS, GameSettings.Options.FNAW_SKINS,
~ GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_PLAYER,
~ GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_24H,
~ GameSettings.Options.CHUNK_FIX };
> CHANGE 11 : 18 @ 11 : 22

@ -23,7 +23,26 @@
> DELETE 1 @ 1 : 3
> CHANGE 214 : 216 @ 214 : 216
> CHANGE 126 : 127 @ 126 : 129
~ GlStateManager.rotateZYXRad(this.rotateAngleX, this.rotateAngleY, this.rotateAngleZ);
> DELETE 1 @ 1 : 9
> DELETE 25 @ 25 : 28
> CHANGE 1 : 3 @ 1 : 4
~ // note: vanilla order for this function is YXZ not ZYX for some reason
~ GlStateManager.rotateZYXRad(this.rotateAngleX, this.rotateAngleY, this.rotateAngleZ);
> DELETE 1 @ 1 : 5
> CHANGE 21 : 22 @ 21 : 32
~ GlStateManager.rotateZYXRad(this.rotateAngleX, this.rotateAngleY, this.rotateAngleZ);
> CHANGE 7 : 9 @ 7 : 9
~ this.displayList = GLAllocation.generateDisplayLists();
~ EaglercraftGPU.glNewList(this.displayList, GL_COMPILE);

@ -55,4 +55,11 @@
~ return "MultiplayerChunkCache: " + this.chunkMapping.size() + ", " + this.chunkListing.size();
> INSERT 20 : 24 @ 20
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return this.chunkMapping.get(ChunkCoordIntPair.chunkXZ2Int(var1, var2));
+ }
> EOF

@ -16,25 +16,150 @@
> DELETE 3 @ 3 : 7
> CHANGE 44 : 45 @ 44 : 45
> INSERT 8 : 9 @ 8
~ float[] afloat = new float[EnumFacing._VALUES.length * 2];
+ import net.minecraft.util.EnumWorldBlockLayer;
> CHANGE 3 : 6 @ 3 : 4
> INSERT 4 : 9 @ 4
+ import net.optifine.BetterSnow;
+ import net.optifine.Config;
+ import net.optifine.model.BlockModelCustomizer;
+ import net.optifine.model.ListQuadsOverlay;
+ import net.optifine.render.RenderEnv;
> INSERT 2 : 5 @ 2
+ private static final EnumWorldBlockLayer[] OVERLAY_LAYERS = new EnumWorldBlockLayer[] { EnumWorldBlockLayer.CUTOUT,
+ EnumWorldBlockLayer.CUTOUT_MIPPED, EnumWorldBlockLayer.TRANSLUCENT };
+
> CHANGE 13 : 27 @ 13 : 18
~ RenderEnv renderenv = worldRendererIn.getRenderEnv(blockStateIn, blockPosIn);
~ modelIn = BlockModelCustomizer.getRenderModel(modelIn, blockStateIn, renderenv);
~ boolean flag1 = flag
~ ? this.renderModelAmbientOcclusion(blockAccessIn, modelIn, blockStateIn, blockPosIn,
~ worldRendererIn, checkSides)
~ : this.renderModelStandard(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn,
~ checkSides);
~
~ if (flag1) {
~ renderOverlayModels(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, checkSides, 0L,
~ renderenv, flag);
~ }
~
~ return flag1;
> CHANGE 9 : 72 @ 9 : 11
~ private void renderOverlayModels(IBlockAccess p_renderOverlayModels_1_, IBakedModel p_renderOverlayModels_2_,
~ IBlockState p_renderOverlayModels_3_, BlockPos p_renderOverlayModels_4_,
~ WorldRenderer p_renderOverlayModels_5_, boolean p_renderOverlayModels_6_, long p_renderOverlayModels_7_,
~ RenderEnv p_renderOverlayModels_9_, boolean p_renderOverlayModels_10_) {
~ if (p_renderOverlayModels_9_.isOverlaysRendered()) {
~ for (int i = 0; i < OVERLAY_LAYERS.length; ++i) {
~ EnumWorldBlockLayer enumworldblocklayer = OVERLAY_LAYERS[i];
~ ListQuadsOverlay listquadsoverlay = p_renderOverlayModels_9_.getListQuadsOverlay(enumworldblocklayer);
~
~ if (listquadsoverlay.size() > 0) {
~ RegionRenderCacheBuilder regionrendercachebuilder = p_renderOverlayModels_9_
~ .getRegionRenderCacheBuilder();
~
~ if (regionrendercachebuilder != null) {
~ WorldRenderer worldrenderer = regionrendercachebuilder
~ .getWorldRendererByLayer(enumworldblocklayer);
~
~ // if (!worldrenderer.isDrawing()) {
~ // worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
~ // worldrenderer.setTranslation(p_renderOverlayModels_5_.getXOffset(),
~ // p_renderOverlayModels_5_.getYOffset(), p_renderOverlayModels_5_.getZOffset());
~ // }
~
~ for (int j = 0; j < listquadsoverlay.size(); ++j) {
~ BakedQuad bakedquad = listquadsoverlay.getQuad(j);
~ List<BakedQuad> list = listquadsoverlay.getListQuadsSingle(bakedquad);
~ IBlockState iblockstate = listquadsoverlay.getBlockState(j);
~
~ // if (bakedquad.getQuadEmissive() != null) {
~ // listquadsoverlay.addQuad(bakedquad.getQuadEmissive(), iblockstate);
~ // }
~
~ p_renderOverlayModels_9_.reset(iblockstate, p_renderOverlayModels_4_);
~
~ if (p_renderOverlayModels_10_) {
~ this.renderModelAmbientOcclusionQuads(p_renderOverlayModels_1_, iblockstate,
~ p_renderOverlayModels_4_, worldrenderer, list, p_renderOverlayModels_9_);
~ } else {
~ Block block = iblockstate.getBlock();
~ int k = block.getMixedBrightnessForBlock(p_renderOverlayModels_1_,
~ p_renderOverlayModels_4_.offset(bakedquad.getFace()));
~ this.renderModelStandardQuads(p_renderOverlayModels_1_, block, p_renderOverlayModels_4_,
~ bakedquad.getFace(), k, false, worldrenderer, list, p_renderOverlayModels_9_);
~ }
~ }
~ }
~
~ listquadsoverlay.clear();
~ }
~ }
~ }
~
~ if (Config.isBetterSnow() && !p_renderOverlayModels_9_.isBreakingAnimation() && BetterSnow
~ .shouldRender(p_renderOverlayModels_1_, p_renderOverlayModels_3_, p_renderOverlayModels_4_)) {
~ IBakedModel ibakedmodel = BetterSnow.getModelSnowLayer();
~ IBlockState iblockstate1 = BetterSnow.getStateSnowLayer();
~ this.renderModel(p_renderOverlayModels_1_, ibakedmodel, iblockstate1, p_renderOverlayModels_4_,
~ p_renderOverlayModels_5_, p_renderOverlayModels_6_);
~ }
~ }
~
~ public boolean renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn,
~ IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) {
> CHANGE 1 : 4 @ 1 : 4
~ Block blockIn = blockStateIn.getBlock();
~ RenderEnv renderenv = worldRendererIn.getRenderEnv(blockStateIn, blockPosIn);
~ EnumWorldBlockLayer enumworldblocklayer = worldRendererIn.getBlockLayer();
> CHANGE 1 : 4 @ 1 : 2
~ EnumFacing[] facings = EnumFacing._VALUES;
~ for (int i = 0; i < facings.length; ++i) {
~ EnumFacing enumfacing = facings[i];
> INSERT 23 : 24 @ 23
> CHANGE 4 : 8 @ 4 : 6
+ boolean isDeferred = DeferredStateManager.isDeferredRenderer();
~ list = BlockModelCustomizer.getRenderQuads(list, blockAccessIn, blockStateIn, blockPosIn,
~ enumfacing, enumworldblocklayer, 0L, renderenv);
~ this.renderModelAmbientOcclusionQuads(blockAccessIn, blockStateIn, blockPosIn, worldRendererIn,
~ list, renderenv);
> INSERT 1 : 2 @ 1
> CHANGE 7 : 11 @ 7 : 9
+ float[] afloat = isDeferred ? new float[EnumFacing._VALUES.length * 2] : null;
~ list1 = BlockModelCustomizer.getRenderQuads(list1, blockAccessIn, blockStateIn, blockPosIn,
~ (EnumFacing) null, enumworldblocklayer, 0L, renderenv);
~ this.renderModelAmbientOcclusionQuads(blockAccessIn, blockStateIn, blockPosIn, worldRendererIn, list1,
~ renderenv);
> CHANGE 2 : 6 @ 2 : 3
> CHANGE 6 : 7 @ 6 : 7
~ public boolean renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn,
> INSERT 1 : 4 @ 1
+ // boolean isDeferred = DeferredStateManager.isDeferredRenderer();
+ // float[] afloat = isDeferred ? new float[EnumFacing._VALUES.length * 2] :
+ // null;
> CHANGE 1 : 4 @ 1 : 2
~ Block blockIn = blockStateIn.getBlock();
~ RenderEnv renderenv = worldRendererIn.getRenderEnv(blockStateIn, blockPosIn);
~ EnumWorldBlockLayer enumworldblocklayer = worldRendererIn.getBlockLayer();
> CHANGE 1 : 5 @ 1 : 2
~ BlockPos pointer = new BlockPos();
~ EnumFacing[] facings = EnumFacing._VALUES;
@ -45,18 +170,34 @@
~ BlockPos blockpos = blockPosIn.offsetEvenFaster(enumfacing, pointer);
> CHANGE 3 : 4 @ 3 : 4
> INSERT 2 : 4 @ 2
~ worldRendererIn, list, bitset, afloat);
+ list = BlockModelCustomizer.getRenderQuads(list, blockAccessIn, blockStateIn, blockPosIn,
+ enumfacing, enumworldblocklayer, 0L, renderenv);
> CHANGE 8 : 9 @ 8 : 9
> CHANGE 1 : 2 @ 1 : 2
~ worldRendererIn, list1, bitset, afloat);
~ worldRendererIn, list, renderenv);
> INSERT 9 : 11 @ 9
> INSERT 7 : 9 @ 7
+ boolean isDeferred = DeferredStateManager.isDeferredRenderer();
+ boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
+ list1 = BlockModelCustomizer.getRenderQuads(list1, blockAccessIn, blockStateIn, blockPosIn,
+ (EnumFacing) null, enumworldblocklayer, 0L, renderenv);
> CHANGE 1 : 2 @ 1 : 2
~ worldRendererIn, list1, renderenv);
> CHANGE 6 : 14 @ 6 : 9
~ private void renderModelAmbientOcclusionQuads(IBlockAccess blockAccessIn, IBlockState blockStateIn,
~ BlockPos blockPosIn, WorldRenderer worldRendererIn, List<BakedQuad> listQuadsIn, RenderEnv renderenv) {
~ boolean isDeferred = DeferredStateManager.isDeferredRenderer();
~ boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
~ float[] quadBounds = renderenv.getQuadBounds();
~ BitSet boundsFlags = renderenv.getBoundsFlags();
~ BlockModelRenderer.AmbientOcclusionFace aoFaceIn = renderenv.getAoFace();
~ Block blockIn = blockStateIn.getBlock();
> CHANGE 8 : 9 @ 8 : 9
@ -104,11 +245,13 @@
+ private final BlockPos blockpos5 = new BlockPos(0, 0, 0);
+
> CHANGE 2 : 5 @ 2 : 3
> CHANGE 2 : 7 @ 2 : 3
~ List<BakedQuad> listQuadsIn, BitSet boundsFlags, float[] quadBounds) {
~ List<BakedQuad> listQuadsIn, RenderEnv renderenv) {
~ boolean isDeferred = DeferredStateManager.isDeferredRenderer();
~ boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
~ BitSet boundsFlags = renderenv.getBoundsFlags();
~ float[] quadBounds = renderenv.getQuadBounds();
> CHANGE 11 : 12 @ 11 : 12
@ -263,7 +406,11 @@
~ worldrenderer.putNormal((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ(),
~ VertexMarkerState.markId);
> INSERT 9 : 16 @ 9
> CHANGE 5 : 6 @ 5 : 6
~ public static class AmbientOcclusionFace {
> INSERT 3 : 10 @ 3
+ private final BlockPos blockpos0 = new BlockPos(0, 0, 0);
+ private final BlockPos blockpos1 = new BlockPos(0, 0, 0);

@ -24,11 +24,23 @@
~ this.bakedModelStore.put((IBlockState) entry.getKey(),
> CHANGE 175 : 176 @ 175 : 176
> CHANGE 157 : 158 @ 157 : 158
~ getPropertyString(linkedhashmap));
> CHANGE 11 : 12 @ 11 : 12
~ getPropertyString(linkedhashmap));
> CHANGE 5 : 6 @ 5 : 6
~ String s = BlockDirt.VARIANT.getName((BlockDirt.DirtType) linkedhashmap.remove(BlockDirt.VARIANT));
> CHANGE 10 : 12 @ 10 : 11
> CHANGE 4 : 5 @ 4 : 5
~ return new ModelResourceLocation(s, getPropertyString(linkedhashmap));
> CHANGE 5 : 7 @ 5 : 6
~ String s = BlockStoneSlab.VARIANT
~ .getName((BlockStoneSlab.EnumType) linkedhashmap.remove(BlockStoneSlab.VARIANT));

@ -79,7 +79,9 @@
+ import net.minecraft.util.Vec3i;
> DELETE 2 @ 2 : 9
> CHANGE 2 : 3 @ 2 : 9
~ import net.optifine.Config;
> CHANGE 9 : 10 @ 9 : 10
@ -92,10 +94,12 @@
+ private GameOverlayFramebuffer overlayFramebuffer;
+ private float eagPartialTicks = 0.0f;
> INSERT 1 : 3 @ 1
> INSERT 1 : 5 @ 1
+ public float currentProjMatrixFOV = 0.0f;
+
+ private boolean initializedOF = false;
+
> DELETE 1 @ 1 : 2
@ -155,7 +159,11 @@
~ f = this.mc.isZoomKey ? this.mc.adjustedZoomValue : this.mc.gameSettings.fovSetting;
> CHANGE 169 : 173 @ 169 : 172
> CHANGE 156 : 157 @ 156 : 157
~ this.farPlaneDistance = (float) (this.mc.gameSettings.renderDistanceChunks * 16 + 16);
> CHANGE 12 : 16 @ 12 : 15
~ float farPlane = this.farPlaneDistance * 2.0f * MathHelper.SQRT_2;
~ GlStateManager.gluPerspective(currentProjMatrixFOV = this.getFOVModifier(partialTicks, true),
@ -215,8 +223,12 @@
> DELETE 1 @ 1 : 2
> CHANGE 10 : 11 @ 10 : 11
> CHANGE 10 : 15 @ 10 : 11
~ if (!initializedOF) {
~ Config.frameInitHook();
~ initializedOF = true;
~ }
~ boolean flag = Display.isActive() || mc.gameSettings.touchscreen;
> CHANGE 1 : 2 @ 1 : 2

@ -5,10 +5,9 @@
# Version: 1.0
# Author: lax1dude
> CHANGE 2 : 6 @ 2 : 3
> CHANGE 2 : 5 @ 2 : 3
~ import com.carrotsearch.hppc.ObjectContainer;
~ import com.carrotsearch.hppc.cursors.ObjectCursor;
~ import java.util.List;
~
~ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
@ -16,15 +15,14 @@
> CHANGE 40 : 41 @ 40 : 41
~ ObjectContainer<PotionEffect> collection = this.mc.thePlayer.getActivePotionEffects();
~ List<PotionEffect> collection = this.mc.thePlayer.getActivePotionEffectsList();
> INSERT 3 : 4 @ 3
+ GlStateManager.enableAlpha();
> CHANGE 5 : 7 @ 5 : 6
> CHANGE 5 : 6 @ 5 : 6
~ for (ObjectCursor<PotionEffect> potioneffect_ : collection) {
~ PotionEffect potioneffect = potioneffect_.value;
~ for (PotionEffect potioneffect : collection) {
> EOF

@ -16,7 +16,13 @@
~
~ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
> CHANGE 7 : 9 @ 7 : 9
> INSERT 5 : 8 @ 5
+ import net.minecraft.util.ResourceLocation;
+ import net.optifine.Config;
+ import net.optifine.CustomItems;
> CHANGE 2 : 4 @ 2 : 4
~ private final IntObjectMap<ModelResourceLocation> simpleShapes = new IntObjectHashMap<>();
~ private final IntObjectMap<IBakedModel> simpleShapesCache = new IntObjectHashMap<>();
@ -33,7 +39,14 @@
~ ItemMeshDefinition itemmeshdefinition = this.shapers.get(item);
> CHANGE 17 : 18 @ 17 : 18
> INSERT 9 : 13 @ 9
+ if (Config.isCustomItems()) {
+ ibakedmodel = CustomItems.getCustomItemModel(stack, ibakedmodel, (ResourceLocation) null, true);
+ }
+
> CHANGE 8 : 9 @ 8 : 9
~ return this.simpleShapesCache.get(this.getIndex(item, meta));

@ -16,13 +16,14 @@
~ import net.lax1dude.eaglercraft.v1_8.Keyboard;
~
> INSERT 2 : 23 @ 2
> INSERT 2 : 24 @ 2
+
+ import com.google.common.collect.Lists;
+ import com.google.common.collect.Maps;
+ import com.google.common.collect.Sets;
+
+ import dev.redstudio.alfheim.utils.DeduplicatedLongQueue;
+ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
+ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
+ import net.lax1dude.eaglercraft.v1_8.minecraft.ChunkUpdateManager;
@ -59,7 +60,9 @@
+ import net.minecraft.util.EnumChatFormatting;
> DELETE 13 @ 13 : 18
> CHANGE 13 : 14 @ 13 : 18
~ import net.optifine.CustomSky;
> DELETE 20 @ 20 : 24
@ -72,7 +75,12 @@
~ private float lastViewProjMatrixFOV = Float.MIN_VALUE;
~ private final ChunkUpdateManager renderDispatcher = new ChunkUpdateManager();
> CHANGE 22 : 24 @ 22 : 24
> INSERT 17 : 19 @ 17
+ private final DeduplicatedLongQueue alfheim$lightUpdatesQueue = new DeduplicatedLongQueue(8192);
+
> CHANGE 5 : 7 @ 5 : 7
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
@ -615,7 +623,15 @@
~ }
~ return i;
> CHANGE 92 : 93 @ 92 : 102
> CHANGE 18 : 19 @ 18 : 19
~ alfheim$processLightUpdates();
> INSERT 71 : 72 @ 71
+ GlStateManager.disableDepth();
> CHANGE 2 : 3 @ 2 : 12
~ GlStateManager.callList(this.glSkyList);
@ -623,15 +639,42 @@
~ .pos((double) (f12 * 120.0F), (double) (f13 * 120.0F), (double) (f13 * 40.0F * afloat[3]))
> CHANGE 42 : 43 @ 42 : 52
> INSERT 14 : 15 @ 14
+ CustomSky.renderSky(this.theWorld, this.renderEngine, partialTicks);
> CHANGE 26 : 28 @ 26 : 27
~ boolean b = !CustomSky.hasSkyLayers(this.theWorld);
~ if (f15 > 0.0F && b) {
> CHANGE 1 : 2 @ 1 : 11
~ GlStateManager.callList(this.starGLCallList);
> CHANGE 13 : 14 @ 13 : 23
> CHANGE 10 : 11 @ 10 : 11
~ if (d0 < 0.0D && b) {
> CHANGE 2 : 3 @ 2 : 12
~ GlStateManager.callList(this.glSkyList2);
> CHANGE 372 : 373 @ 372 : 373
> CHANGE 35 : 42 @ 35 : 39
~ if (b) {
~ GlStateManager.pushMatrix();
~ GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
~ GlStateManager.callList(this.glSkyList2);
~ GlStateManager.popMatrix();
~ }
~
> INSERT 2 : 3 @ 2
+ GlStateManager.enableDepth();
> CHANGE 331 : 332 @ 331 : 332
~ this.displayListEntitiesDirty |= this.renderDispatcher.updateChunks(finishTimeNano);
@ -668,11 +711,15 @@
~ EaglercraftGPU.glLineWidth(2.0F);
> CHANGE 240 : 241 @ 240 : 241
> CHANGE 111 : 112 @ 111 : 115
~ this.alfheim$lightUpdatesQueue.enqueue(blockpos.toLong());
> CHANGE 125 : 126 @ 125 : 126
~ EaglercraftRandom random = this.theWorld.rand;
> INSERT 229 : 248 @ 229
> INSERT 229 : 263 @ 229
+
+ public String getDebugInfoShort() {
@ -693,5 +740,20 @@
+ return "" + Minecraft.getDebugFPS() + "fps | C: " + j + "/" + i + ", E: " + this.countEntitiesRendered + "+" + k
+ + ", " + renderDispatcher.getDebugInfo();
+ }
+
+ public void alfheim$processLightUpdates() {
+ if (alfheim$lightUpdatesQueue.isEmpty())
+ return;
+
+ do {
+ final long longPos = alfheim$lightUpdatesQueue.dequeue();
+ final int x = (int) (longPos << 64 - BlockPos.X_SHIFT - BlockPos.NUM_X_BITS >> 64 - BlockPos.NUM_X_BITS);
+ final int y = (int) (longPos << 64 - BlockPos.Y_SHIFT - BlockPos.NUM_Y_BITS >> 64 - BlockPos.NUM_Y_BITS);
+ final int z = (int) (longPos << 64 - BlockPos.NUM_Z_BITS >> 64 - BlockPos.NUM_Z_BITS);
+ markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
+ } while (!alfheim$lightUpdatesQueue.isEmpty());
+
+ alfheim$lightUpdatesQueue.newDeduplicationSet();
+ }
> EOF

@ -5,29 +5,85 @@
# Version: 1.0
# Author: lax1dude
> INSERT 6 : 7 @ 6
> INSERT 2 : 3 @ 2
+ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
> INSERT 1 : 2 @ 1
+ import net.optifine.model.QuadBounds;
> INSERT 3 : 4 @ 3
+ protected final int[] vertexDataWithNormals;
> INSERT 5 : 6 @ 5
> INSERT 2 : 4 @ 2
+ this.vertexDataWithNormals = null;
+ protected final EaglerTextureAtlasSprite sprite;
+ private QuadBounds quadBounds;
> INSERT 4 : 11 @ 4
> CHANGE 1 : 3 @ 1 : 2
~ public BakedQuad(int[] vertexDataIn, int[] vertexDataWithNormalsIn, int tintIndexIn, EnumFacing faceIn,
~ EaglerTextureAtlasSprite sprite) {
> INSERT 1 : 2 @ 1
+ public BakedQuad(int[] vertexDataIn, int[] vertexDataWithNormalsIn, int tintIndexIn, EnumFacing faceIn) {
+ this.vertexData = vertexDataIn;
+ this.vertexDataWithNormals = vertexDataWithNormalsIn;
+ this.tintIndex = tintIndexIn;
+ this.face = faceIn;
+ }
+
> INSERT 4 : 8 @ 4
> INSERT 2 : 3 @ 2
+ this.sprite = sprite;
> INSERT 6 : 10 @ 6
+ public int[] getVertexDataWithNormals() {
+ return this.vertexDataWithNormals;
+ }
+
> INSERT 11 : 52 @ 11
+
+ public EaglerTextureAtlasSprite getSprite() {
+ return sprite;
+ }
+
+ public QuadBounds getQuadBounds() {
+ if (this.quadBounds == null) {
+ this.quadBounds = new QuadBounds(this.getVertexData());
+ }
+
+ return this.quadBounds;
+ }
+
+ public float getMidX() {
+ QuadBounds quadbounds = this.getQuadBounds();
+ return (quadbounds.getMaxX() + quadbounds.getMinX()) / 2.0F;
+ }
+
+ public double getMidY() {
+ QuadBounds quadbounds = this.getQuadBounds();
+ return (double) ((quadbounds.getMaxY() + quadbounds.getMinY()) / 2.0F);
+ }
+
+ public double getMidZ() {
+ QuadBounds quadbounds = this.getQuadBounds();
+ return (double) ((quadbounds.getMaxZ() + quadbounds.getMinZ()) / 2.0F);
+ }
+
+ public boolean isFaceQuad() {
+ QuadBounds quadbounds = this.getQuadBounds();
+ return quadbounds.isFaceQuad(this.face);
+ }
+
+ public boolean isFullQuad() {
+ QuadBounds quadbounds = this.getQuadBounds();
+ return quadbounds.isFullQuad(this.face);
+ }
+
+ public boolean isFullFaceQuad() {
+ return this.isFullQuad() && this.isFaceQuad();
+ }
> EOF

@ -12,24 +12,24 @@
+ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
+
> CHANGE 1 : 2 @ 1 : 2
> DELETE 1 @ 1 : 2
~ private final EaglerTextureAtlasSprite texture;
> CHANGE 1 : 5 @ 1 : 4
> CHANGE 1 : 5 @ 1 : 5
~ public BreakingFour(BakedQuad parBakedQuad, EaglerTextureAtlasSprite textureIn) {
~ super(Arrays.copyOf(parBakedQuad.getVertexData(), parBakedQuad.getVertexData().length),
~ Arrays.copyOf(parBakedQuad.getVertexDataWithNormals(), parBakedQuad.getVertexDataWithNormals().length),
~ parBakedQuad.tintIndex, parBakedQuad.face);
~ parBakedQuad.tintIndex, parBakedQuad.face, textureIn);
> INSERT 46 : 52 @ 46
> CHANGE 43 : 51 @ 43 : 45
+ if (this.vertexDataWithNormals != null) {
+ int i2 = 8 * parInt1;
+ this.vertexDataWithNormals[i2 + 4] = this.vertexData[i + 4];
+ this.vertexDataWithNormals[i2 + 4 + 1] = this.vertexData[i + 4 + 1];
+
+ }
~ this.vertexData[i + 4] = Float.floatToRawIntBits(sprite.getInterpolatedU((double) f3));
~ this.vertexData[i + 4 + 1] = Float.floatToRawIntBits(sprite.getInterpolatedV((double) f4));
~ if (this.vertexDataWithNormals != null) {
~ int i2 = 8 * parInt1;
~ this.vertexDataWithNormals[i2 + 4] = this.vertexData[i + 4];
~ this.vertexDataWithNormals[i2 + 4 + 1] = this.vertexData[i + 4 + 1];
~
~ }
> EOF

@ -47,7 +47,7 @@
~ }
~ stride = 7;
~
~ return new BakedQuad(aint, aint2, face.tintIndex, enumfacing);
~ return new BakedQuad(aint, aint2, face.tintIndex, enumfacing, sprite);
> CHANGE 2 : 3 @ 2 : 3

@ -17,4 +17,8 @@
> DELETE 2 @ 2 : 4
> CHANGE 3 : 4 @ 3 : 4
~ public Map<Block, IStateMapper> blockStateMap = Maps.newIdentityHashMap();
> EOF

@ -7,4 +7,8 @@
> DELETE 4 @ 4 : 5
> CHANGE 7 : 8 @ 7 : 8
~ getPropertyString(iblockstate.getProperties()));
> EOF

@ -24,4 +24,8 @@
~ s = this.name.getName(linkedhashmap.remove(this.name));
> CHANGE 10 : 11 @ 10 : 11
~ return new ModelResourceLocation(s, getPropertyString(linkedhashmap));
> EOF

@ -15,4 +15,8 @@
> DELETE 3 @ 3 : 4
> CHANGE 5 : 6 @ 5 : 6
~ public static String getPropertyString(Map<IProperty, Comparable> parMap) {
> EOF

@ -27,104 +27,141 @@
+ import net.minecraft.util.EnumWorldBlockLayer;
> CHANGE 55 : 58 @ 55 : 56
> INSERT 3 : 5 @ 3
+ import net.optifine.Config;
+ import net.optifine.CustomItems;
> INSERT 8 : 9 @ 8
+ private ModelResourceLocation modelLocation = null;
> CHANGE 35 : 36 @ 35 : 36
~ public void renderModel(IBakedModel model, int color) {
> CHANGE 8 : 11 @ 8 : 9
~ EnumFacing[] facings = EnumFacing._VALUES;
~ for (int i = 0; i < facings.length; ++i) {
~ EnumFacing enumfacing = facings[i];
> INSERT 7 : 11 @ 7
> CHANGE 7 : 12 @ 7 : 8
+ public static float renderPosX = 0.0f;
+ public static float renderPosY = 0.0f;
+ public static float renderPosZ = 0.0f;
~ public static float renderPosX = 0.0f;
~ public static float renderPosY = 0.0f;
~ public static float renderPosZ = 0.0f;
~
~ public void renderItem(ItemStack stack, IBakedModel model_) {
> CHANGE 3 : 4 @ 3 : 4
~ if (model_.isBuiltInRenderer()) {
> CHANGE 7 : 9 @ 7 : 10
~ if (Config.isCustomItems()) {
~ model_ = CustomItems.getCustomItemModel(stack, model_, this.modelLocation, false);
> INSERT 1 : 74 @ 1
+ final IBakedModel model = model_;
+
+ if (DeferredStateManager.isInDeferredPass() && isTransparentItem(stack)) {
+ if (DeferredStateManager.forwardCallbackHandler != null) {
+ final Matrix4f mat = new Matrix4f(GlStateManager.getModelViewReference());
+ final float lx = GlStateManager.getTexCoordX(1), ly = GlStateManager.getTexCoordY(1);
+ DeferredStateManager.forwardCallbackHandler.push(new ShadersRenderPassFuture(renderPosX,
+ renderPosY, renderPosZ, EaglerDeferredPipeline.instance.getPartialTicks()) {
+ @Override
+ public void draw(PassType pass) {
+ if (pass == PassType.MAIN) {
+ DeferredStateManager.reportForwardRenderObjectPosition2(x, y, z);
+ }
+ EntityRenderer.enableLightmapStatic();
+ GlStateManager.pushMatrix();
+ GlStateManager.loadMatrix(mat);
+ GlStateManager.texCoords2DDirect(1, lx, ly);
+ Minecraft.getMinecraft().getTextureManager()
+ .bindTexture(TextureMap.locationBlocksTexture);
+ RenderItem.this.renderModel(model, stack);
+ if (pass != PassType.SHADOW && stack.hasEffect()) {
+ GlStateManager.color(1.5F, 0.5F, 1.5F, 1.0F);
+ DeferredStateManager.setDefaultMaterialConstants();
+ DeferredStateManager.setRoughnessConstant(0.05f);
+ DeferredStateManager.setMetalnessConstant(0.01f);
+ GlStateManager.blendFunc(768, 1);
+ renderEffect(model, stack);
+ DeferredStateManager.setHDRTranslucentPassBlendFunc();
+ }
+ GlStateManager.popMatrix();
+ EntityRenderer.disableLightmapStatic();
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ }
+ });
+ }
+ } else {
+ this.renderModel(model, stack);
+ if (stack.hasEffect()) {
+ if (DeferredStateManager.isInDeferredPass()) {
+ if (DeferredStateManager.forwardCallbackHandler != null
+ && !DeferredStateManager.isEnableShadowRender()) {
+ final Matrix4f mat = new Matrix4f(GlStateManager.getModelViewReference());
+ final float lx = GlStateManager.getTexCoordX(1), ly = GlStateManager.getTexCoordY(1);
+ DeferredStateManager.forwardCallbackHandler.push(new ShadersRenderPassFuture(renderPosX,
+ renderPosY, renderPosZ, EaglerDeferredPipeline.instance.getPartialTicks()) {
+ @Override
+ public void draw(PassType pass) {
+ if (pass == PassType.MAIN) {
+ DeferredStateManager.reportForwardRenderObjectPosition2(x, y, z);
+ }
+ EntityRenderer.enableLightmapStatic();
+ GlStateManager.color(1.5F, 0.5F, 1.5F, 1.0F);
+ DeferredStateManager.setDefaultMaterialConstants();
+ DeferredStateManager.setRoughnessConstant(0.05f);
+ DeferredStateManager.setMetalnessConstant(0.01f);
+ GlStateManager.pushMatrix();
+ GlStateManager.loadMatrix(mat);
+ GlStateManager.texCoords2DDirect(1, lx, ly);
+ GlStateManager.tryBlendFuncSeparate(GL_ONE, GL_ONE, GL_ZERO, GL_ONE);
+ renderEffect(model, stack);
+ DeferredStateManager.setHDRTranslucentPassBlendFunc();
+ GlStateManager.popMatrix();
+ EntityRenderer.disableLightmapStatic();
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ }
+ });
+ }
+ } else {
+ GlStateManager.blendFunc(768, 1);
+ this.renderEffect(model, stack);
+ }
+ }
+ }
> CHANGE 12 : 82 @ 12 : 15
> CHANGE 6 : 15 @ 6 : 7
~ if (DeferredStateManager.isInDeferredPass() && isTransparentItem(stack)) {
~ if (DeferredStateManager.forwardCallbackHandler != null) {
~ final Matrix4f mat = new Matrix4f(GlStateManager.getModelViewReference());
~ final float lx = GlStateManager.getTexCoordX(1), ly = GlStateManager.getTexCoordY(1);
~ DeferredStateManager.forwardCallbackHandler.push(new ShadersRenderPassFuture(renderPosX,
~ renderPosY, renderPosZ, EaglerDeferredPipeline.instance.getPartialTicks()) {
~ @Override
~ public void draw(PassType pass) {
~ if (pass == PassType.MAIN) {
~ DeferredStateManager.reportForwardRenderObjectPosition2(x, y, z);
~ }
~ EntityRenderer.enableLightmapStatic();
~ GlStateManager.pushMatrix();
~ GlStateManager.loadMatrix(mat);
~ GlStateManager.texCoords2DDirect(1, lx, ly);
~ Minecraft.getMinecraft().getTextureManager()
~ .bindTexture(TextureMap.locationBlocksTexture);
~ RenderItem.this.renderModel(model, stack);
~ if (pass != PassType.SHADOW && stack.hasEffect()) {
~ GlStateManager.color(1.5F, 0.5F, 1.5F, 1.0F);
~ DeferredStateManager.setDefaultMaterialConstants();
~ DeferredStateManager.setRoughnessConstant(0.05f);
~ DeferredStateManager.setMetalnessConstant(0.01f);
~ GlStateManager.blendFunc(768, 1);
~ renderEffect(model);
~ DeferredStateManager.setHDRTranslucentPassBlendFunc();
~ }
~ GlStateManager.popMatrix();
~ EntityRenderer.disableLightmapStatic();
~ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
~ }
~ });
~ }
~ } else {
~ this.renderModel(model, stack);
~ if (stack.hasEffect()) {
~ if (DeferredStateManager.isInDeferredPass()) {
~ if (DeferredStateManager.forwardCallbackHandler != null
~ && !DeferredStateManager.isEnableShadowRender()) {
~ final Matrix4f mat = new Matrix4f(GlStateManager.getModelViewReference());
~ final float lx = GlStateManager.getTexCoordX(1), ly = GlStateManager.getTexCoordY(1);
~ DeferredStateManager.forwardCallbackHandler.push(new ShadersRenderPassFuture(renderPosX,
~ renderPosY, renderPosZ, EaglerDeferredPipeline.instance.getPartialTicks()) {
~ @Override
~ public void draw(PassType pass) {
~ if (pass == PassType.MAIN) {
~ DeferredStateManager.reportForwardRenderObjectPosition2(x, y, z);
~ }
~ EntityRenderer.enableLightmapStatic();
~ GlStateManager.color(1.5F, 0.5F, 1.5F, 1.0F);
~ DeferredStateManager.setDefaultMaterialConstants();
~ DeferredStateManager.setRoughnessConstant(0.05f);
~ DeferredStateManager.setMetalnessConstant(0.01f);
~ GlStateManager.pushMatrix();
~ GlStateManager.loadMatrix(mat);
~ GlStateManager.texCoords2DDirect(1, lx, ly);
~ GlStateManager.tryBlendFuncSeparate(GL_ONE, GL_ONE, GL_ZERO, GL_ONE);
~ renderEffect(model);
~ DeferredStateManager.setHDRTranslucentPassBlendFunc();
~ GlStateManager.popMatrix();
~ EntityRenderer.disableLightmapStatic();
~ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
~ }
~ });
~ }
~ } else {
~ GlStateManager.blendFunc(768, 1);
~ this.renderEffect(model);
~ }
~ }
~ private static boolean isTransparentItem(ItemStack stack) {
~ Item itm = stack.getItem();
~ return itm instanceof ItemBlock
~ && ((ItemBlock) itm).getBlock().getBlockLayer() == EnumWorldBlockLayer.TRANSLUCENT;
~ }
~
~ private void renderEffect(IBakedModel model, ItemStack stack) {
~ if (Config.isCustomItems() && (CustomItems.renderCustomEffect(this, stack, model) || !CustomItems.isUseGlint()))
~ return;
> INSERT 7 : 13 @ 7
> DELETE 3 @ 3 : 4
+ private static boolean isTransparentItem(ItemStack stack) {
+ Item itm = stack.getItem();
+ return itm instanceof ItemBlock
+ && ((ItemBlock) itm).getBlock().getBlockLayer() == EnumWorldBlockLayer.TRANSLUCENT;
+ }
+
> INSERT 104 : 105 @ 104
> DELETE 4 @ 4 : 5
+ this.modelLocation = modelresourcelocation;
> INSERT 123 : 124 @ 123
> INSERT 4 : 5 @ 4
+ this.modelLocation = null;
> INSERT 15 : 16 @ 15
+ boolean flag = DeferredStateManager.isEnableShadowRender();

@ -25,13 +25,24 @@
> DELETE 1 @ 1 : 2
> CHANGE 47 : 48 @ 47 : 48
> INSERT 4 : 6 @ 4
+ import net.optifine.Config;
+ import net.optifine.CustomItems;
> CHANGE 43 : 44 @ 43 : 44
~ this.func_177179_a((T) modelbase, parInt1);
> INSERT 2 : 3 @ 2
> CHANGE 1 : 8 @ 1 : 2
+ DeferredStateManager.setDefaultMaterialConstants();
~
~ if (!Config.isCustomItems()
~ || !CustomItems.bindCustomArmorTexture(itemstack, flag ? 2 : 1, (String) null)) {
~ this.renderer.bindTexture(this.getArmorResource(itemarmor, flag));
~ }
~
~ DeferredStateManager.setDefaultMaterialConstants();
> INSERT 1 : 18 @ 1
@ -53,11 +64,18 @@
+ }
+ switch (itemarmor.getArmorMaterial()) {
> INSERT 14 : 15 @ 14
> CHANGE 7 : 11 @ 7 : 8
~ if (!Config.isCustomItems()
~ || !CustomItems.bindCustomArmorTexture(itemstack, flag ? 2 : 1, "overlay")) {
~ this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay"));
~ }
> INSERT 6 : 7 @ 6
+ DeferredStateManager.setDefaultMaterialConstants();
> CHANGE 2 : 41 @ 2 : 3
> CHANGE 2 : 43 @ 2 : 4
~ if (DeferredStateManager.isInDeferredPass()) {
~ if (!DeferredStateManager.isEnableShadowRender()
@ -86,7 +104,8 @@
~ modelbase.setLivingAnimations(entitylivingbaseIn, armorSlot, parFloat2, parFloat3);
~ LayerArmorBase.this.func_177179_a((T) modelbase, parInt1);
~ LayerArmorBase.this.func_177183_a(entitylivingbaseIn, (T) modelbase, armorSlot,
~ parFloat2, parFloat3, parFloat4, parFloat5, parFloat6, parFloat7);
~ parFloat2, parFloat3, parFloat4, parFloat5, parFloat6, parFloat7,
~ itemstack);
~ DeferredStateManager.setHDRTranslucentPassBlendFunc();
~ GlStateManager.enableBlend();
~ GlStateManager.popMatrix();
@ -98,8 +117,17 @@
~ break;
~ }
~ this.func_177183_a(entitylivingbaseIn, (T) modelbase, armorSlot, parFloat2, parFloat3, parFloat4,
~ parFloat5, parFloat6, parFloat7, itemstack);
> CHANGE 27 : 31 @ 27 : 28
> CHANGE 19 : 24 @ 19 : 20
~ float parFloat3, float parFloat4, float parFloat5, float parFloat6, float parFloat7, ItemStack itemstack) {
~ if (Config.isCustomItems() && CustomItems.renderCustomArmorEffect(entitylivingbaseIn, itemstack, modelbaseIn,
~ parFloat1, parFloat2, parFloat3, parFloat4, parFloat5, parFloat6, parFloat7)) {
~ return;
~ }
> CHANGE 6 : 10 @ 6 : 7
~ boolean d = !DeferredStateManager.isInDeferredPass();
~ if (d) {

@ -16,16 +16,22 @@
~ public class TextureClock extends EaglerTextureAtlasSprite {
> CHANGE 7 : 8 @ 7 : 8
> CHANGE 41 : 48 @ 41 : 43
~ public void updateAnimation(IFramebufferGL[] copyColorFramebuffer) {
~ currentAnimUpdater = (mapWidth, mapHeight, mapLevel) -> {
~ animationCache.copyFrameToTex2D(this.frameCounter, mapLevel, this.originX >> mapLevel,
~ this.originY >> mapLevel, this.width >> mapLevel, this.height >> mapLevel, mapWidth,
~ mapHeight);
~ };
~ } else {
~ currentAnimUpdater = null;
> CHANGE 33 : 35 @ 33 : 35
> INSERT 2 : 4 @ 2
~ animationCache.copyFrameLevelsToTex2D(this.frameCounter, this.originX, this.originY, this.width,
~ this.height, copyColorFramebuffer);
+ } else {
+ currentAnimUpdater = null;
> INSERT 4 : 5 @ 4
> INSERT 2 : 3 @ 2
+

@ -16,28 +16,22 @@
~ public class TextureCompass extends EaglerTextureAtlasSprite {
> CHANGE 9 : 10 @ 9 : 10
> CHANGE 62 : 69 @ 62 : 64
~ public void updateAnimation(IFramebufferGL[] copyColorFramebuffer) {
~ currentAnimUpdater = (mapWidth, mapHeight, mapLevel) -> {
~ animationCache.copyFrameToTex2D(this.frameCounter, mapLevel, this.originX >> mapLevel,
~ this.originY >> mapLevel, this.width >> mapLevel, this.height >> mapLevel, mapWidth,
~ mapHeight);
~ };
~ } else {
~ currentAnimUpdater = null;
> CHANGE 3 : 4 @ 3 : 4
> INSERT 2 : 4 @ 2
~ (double) minecraft.thePlayer.rotationYaw, false, false, copyColorFramebuffer);
+ } else {
+ currentAnimUpdater = null;
> CHANGE 1 : 2 @ 1 : 2
~ this.updateCompass((World) null, 0.0D, 0.0D, 0.0D, true, false, copyColorFramebuffer);
> CHANGE 5 : 6 @ 5 : 6
~ boolean parFlag2, IFramebufferGL[] copyColorFramebuffer) {
> CHANGE 40 : 42 @ 40 : 42
~ animationCache.copyFrameLevelsToTex2D(this.frameCounter, this.originX, this.originY, this.width,
~ this.height, copyColorFramebuffer);
> INSERT 4 : 5 @ 4
> INSERT 2 : 3 @ 2
+

@ -34,7 +34,12 @@
> DELETE 2 @ 2 : 8
> DELETE 9 @ 9 : 11
> CHANGE 9 : 13 @ 9 : 11
~ import net.optifine.BetterGrass;
~ import net.optifine.ConnectedTextures;
~ import net.optifine.CustomItems;
~ import net.optifine.util.CounterInt;
> INSERT 1 : 3 @ 1
@ -47,7 +52,7 @@
~ private final Map<String, EaglerTextureAtlasSprite> mapRegisteredSprites;
~ private final Map<String, EaglerTextureAtlasSprite> mapUploadedSprites;
> CHANGE 3 : 11 @ 3 : 4
> CHANGE 3 : 12 @ 3 : 4
~ private final EaglerTextureAtlasSprite missingImage;
~ private final EaglerTextureAtlasSpritePBR missingImagePBR;
@ -57,6 +62,7 @@
~ public int eaglerPBRMaterialTexture = -1;
~ private boolean hasAllocatedEaglerPBRMaterialTexture = false;
~ private boolean isGLES2 = false;
~ private CounterInt counterIndexInMap;
> INSERT 1 : 7 @ 1
@ -72,12 +78,15 @@
~ this.missingImage = new EaglerTextureAtlasSprite("missingno");
~ this.missingImagePBR = new EaglerTextureAtlasSpritePBR("missingno");
> INSERT 2 : 3 @ 2
> INSERT 2 : 4 @ 2
+ this.isGLES2 = EaglercraftGPU.checkOpenGLESVersion() == 200;
+ this.counterIndexInMap = new CounterInt(0);
> INSERT 9 : 25 @ 9
> INSERT 9 : 28 @ 9
+ int idx = this.counterIndexInMap.nextValue();
+ this.missingImage.setIndexInMap(idx);
+ this.missingImagePBR.setIconWidth(16);
+ this.missingImagePBR.setIconHeight(16);
+ int[][][] aint2 = new int[3][this.mipmapLevels + 1][];
@ -94,6 +103,7 @@
+ aint2[2][0] = missingMaterial;
+ this.missingImagePBR.setFramesTextureDataPBR(new List[] { Lists.newArrayList(new int[][][] { aint2[0] }),
+ Lists.newArrayList(new int[][][] { aint2[1] }), Lists.newArrayList(new int[][][] { aint2[2] }) });
+ this.missingImagePBR.setIndexInMap(idx);
> DELETE 6 @ 6 : 7
@ -101,7 +111,11 @@
+ destroyAnimationCaches();
> INSERT 7 : 27 @ 7
> INSERT 1 : 2 @ 1
+ this.counterIndexInMap.reset();
> INSERT 6 : 26 @ 6
+ public void deleteGlTexture() {
+ super.deleteGlTexture();
@ -124,7 +138,13 @@
+ }
+
> INSERT 8 : 44 @ 8
> INSERT 1 : 4 @ 1
+ ConnectedTextures.updateIcons(this);
+ CustomItems.updateIcons(this);
+ BetterGrass.updateIcons(this);
> INSERT 7 : 43 @ 7
+ if (copyColorFramebuffer != null) {
+ for (int l = 0; l < copyColorFramebuffer.length; ++l) {
@ -163,11 +183,12 @@
+ }
+
> CHANGE 1 : 2 @ 1 : 2
> CHANGE 1 : 3 @ 1 : 2
~ EaglerTextureAtlasSprite textureatlassprite = (EaglerTextureAtlasSprite) entry.getValue();
~ textureatlassprite.updateIndexInMap(this.counterIndexInMap);
> INSERT 3 : 105 @ 3
> INSERT 3 : 106 @ 3
+ if (isEaglerPBRMode) {
+ try {
@ -188,7 +209,7 @@
+ }
+ if (abufferedimageMaterial[0] == null) {
+ abufferedimageMaterial[0] = PBRTextureMapUtils.generateMaterialTextureFor(
+ ((EaglerTextureAtlasSprite) (entry.getValue())).getIconName());
+ textureatlassprite.getIconName(), textureatlassprite.optifineBaseTextureName);
+ dontAnimateMaterial = true;
+ }
+ PBRTextureMapUtils.unifySizes(0, abufferedimageColor, abufferedimageNormal, abufferedimageMaterial);
@ -224,7 +245,8 @@
+ }
+ if (abufferedimageMaterial[i2] == null) {
+ abufferedimageMaterial[i2] = PBRTextureMapUtils.generateMaterialTextureFor(
+ ((EaglerTextureAtlasSprite) (entry.getValue())).getIconName());
+ textureatlassprite.getIconName(),
+ textureatlassprite.optifineBaseTextureName);
+ }
+ PBRTextureMapUtils.unifySizes(i2, abufferedimageColor, abufferedimageNormal,
+ abufferedimageMaterial);
@ -382,13 +404,30 @@
+ _wglBindFramebuffer(_GL_FRAMEBUFFER, null);
> CHANGE 5 : 7 @ 5 : 7
> CHANGE 3 : 12 @ 3 : 8
~ HString.format("%s/%s%s", new Object[] { this.basePath, location.getResourcePath(), ".png" }))
~ : new ResourceLocation(location.getResourceDomain(), HString.format("%s/mipmaps/%s.%d%s",
~ return isAbsoluteLocation(location)
~ ? new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + ".png")
~ : (parInt1 == 0
~ ? new ResourceLocation(location.getResourceDomain(),
~ HString.format("%s/%s%s",
~ new Object[] { this.basePath, location.getResourcePath(), ".png" }))
~ : new ResourceLocation(location.getResourceDomain(),
~ HString.format("%s/mipmaps/%s.%d%s", new Object[] { this.basePath,
~ location.getResourcePath(), Integer.valueOf(parInt1), ".png" })));
> CHANGE 3 : 5 @ 3 : 5
> CHANGE 2 : 14 @ 2 : 4
~ private boolean isAbsoluteLocation(ResourceLocation p_isAbsoluteLocation_1_) {
~ String s = p_isAbsoluteLocation_1_.getResourcePath();
~ return this.isAbsoluteLocationPath(s);
~ }
~
~ private boolean isAbsoluteLocationPath(String p_isAbsoluteLocationPath_1_) {
~ String s = p_isAbsoluteLocationPath_1_.toLowerCase();
~ return s.startsWith("mcpatcher/") || s.startsWith("optifine/");
~ }
~
~ public EaglerTextureAtlasSprite getAtlasSprite(String iconName) {
~ EaglerTextureAtlasSprite textureatlassprite = (EaglerTextureAtlasSprite) this.mapUploadedSprites.get(iconName);
@ -396,12 +435,26 @@
~ textureatlassprite = isEaglerPBRMode ? missingImagePBR : missingImage;
> CHANGE 6 : 14 @ 6 : 7
> CHANGE 6 : 28 @ 6 : 7
~ if (isEaglerPBRMode) {
~ for (int i = 0, l = this.listAnimatedSprites.size(); i < l; ++i) {
~ this.listAnimatedSprites.get(i).updateAnimationPBR(copyColorFramebuffer, copyMaterialFramebuffer,
~ height);
~ for (int j = 0, l = this.listAnimatedSprites.size(); j < l; ++j) {
~ this.listAnimatedSprites.get(j).updateAnimationPBR();
~ }
~ for (int i = 0; i < copyColorFramebuffer.length; ++i) {
~ int w = width >> i;
~ int h = height >> i;
~ _wglBindFramebuffer(_GL_FRAMEBUFFER, copyColorFramebuffer[i]);
~ GlStateManager.viewport(0, 0, w, h);
~ for (int j = 0, l = this.listAnimatedSprites.size(); j < l; ++j) {
~ this.listAnimatedSprites.get(j).copyAnimationFramePBR(0, w, h, i);
~ }
~ _wglBindFramebuffer(_GL_FRAMEBUFFER, copyMaterialFramebuffer[i]);
~ h <<= 1;
~ GlStateManager.viewport(0, 0, w, h);
~ for (int j = 0, l = this.listAnimatedSprites.size(); j < l; ++j) {
~ this.listAnimatedSprites.get(j).copyAnimationFramePBR(1, w, h, i);
~ }
~ }
~ _wglBindFramebuffer(_GL_FRAMEBUFFER, null);
~ return;
@ -409,14 +462,24 @@
> CHANGE 1 : 3 @ 1 : 3
~ for (int i = 0, l = this.listAnimatedSprites.size(); i < l; ++i) {
~ this.listAnimatedSprites.get(i).updateAnimation(copyColorFramebuffer);
~ for (int j = 0, l = this.listAnimatedSprites.size(); j < l; ++j) {
~ this.listAnimatedSprites.get(j).updateAnimation();
> INSERT 2 : 3 @ 2
> INSERT 2 : 13 @ 2
+ for (int i = 0; i < copyColorFramebuffer.length; ++i) {
+ int w = width >> i;
+ int h = height >> i;
+ _wglBindFramebuffer(_GL_FRAMEBUFFER, copyColorFramebuffer[i]);
+ GlStateManager.viewport(0, 0, w, h);
+ for (int j = 0, l = this.listAnimatedSprites.size(); j < l; ++j) {
+ this.listAnimatedSprites.get(j).copyAnimationFrame(w, h, i);
+ }
+ }
+
+ _wglBindFramebuffer(_GL_FRAMEBUFFER, null);
> CHANGE 2 : 9 @ 2 : 3
> CHANGE 2 : 13 @ 2 : 3
~ private void destroyAnimationCaches() {
~ for (int i = 0, l = this.listAnimatedSprites.size(); i < l; ++i) {
@ -425,21 +488,30 @@
~ }
~
~ public EaglerTextureAtlasSprite registerSprite(ResourceLocation location) {
~ return registerSprite(location, null);
~ }
~
~ public EaglerTextureAtlasSprite registerSprite(ResourceLocation location, String locationOptifineBase) {
> CHANGE 3 : 5 @ 3 : 4
~ EaglerTextureAtlasSprite textureatlassprite = (EaglerTextureAtlasSprite) this.mapRegisteredSprites
~ .get(location);
~ .get(location.toString());
> CHANGE 1 : 6 @ 1 : 2
> CHANGE 1 : 7 @ 1 : 2
~ if (isEaglerPBRMode) {
~ textureatlassprite = EaglerTextureAtlasSpritePBR.makeAtlasSprite(location);
~ } else {
~ textureatlassprite = EaglerTextureAtlasSprite.makeAtlasSprite(location);
~ }
~ textureatlassprite.optifineBaseTextureName = locationOptifineBase;
> CHANGE 12 : 18 @ 12 : 13
> INSERT 1 : 2 @ 1
+ textureatlassprite.updateIndexInMap(this.counterIndexInMap);
> CHANGE 11 : 17 @ 11 : 12
~ if (!isGLES2) {
~ this.mipmapLevels = mipmapLevelsIn;
@ -453,7 +525,7 @@
~ public EaglerTextureAtlasSprite getMissingSprite() {
~ return isEaglerPBRMode ? missingImagePBR : missingImage;
> INSERT 1 : 27 @ 1
> INSERT 1 : 36 @ 1
+
+ public int getWidth() {
@ -481,5 +553,14 @@
+ }
+ }
+ }
+
+ public EaglerTextureAtlasSprite getSpriteSafe(String iconName) {
+ ResourceLocation resourcelocation = new ResourceLocation(iconName);
+ return this.mapRegisteredSprites.get(resourcelocation.toString());
+ }
+
+ public int getCountRegisteredSprites() {
+ return this.counterIndexInMap.getValue();
+ }
> EOF

@ -7,7 +7,7 @@
> DELETE 2 @ 2 : 9
> CHANGE 2 : 13 @ 2 : 3
> CHANGE 2 : 14 @ 2 : 3
~ import java.nio.charset.StandardCharsets;
~
@ -19,15 +19,17 @@
~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
~ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerFolderResourcePack;
~ import net.lax1dude.eaglercraft.v1_8.minecraft.ResourceIndex;
~ import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
> DELETE 1 @ 1 : 2
> DELETE 3 @ 3 : 6
> CHANGE 3 : 4 @ 3 : 4
> CHANGE 3 : 5 @ 3 : 4
~ protected final String resourcePackFile;
~ protected ResourceIndex resourceIndex;
> CHANGE 1 : 2 @ 1 : 2
@ -50,11 +52,11 @@
~ throw e;
~ }
> CHANGE 4 : 5 @ 4 : 6
> CHANGE 4 : 5 @ 4 : 7
~ JSONObject jsonobject = null;
> CHANGE 2 : 5 @ 2 : 6
> CHANGE 1 : 4 @ 1 : 5
~ jsonobject = new JSONObject(IOUtils.inputStreamToString(parInputStream, StandardCharsets.UTF_8));
~ } catch (RuntimeException | IOException runtimeexception) {
@ -72,4 +74,11 @@
~ return this.resourcePackFile;
> INSERT 1 : 5 @ 1
+
+ public ResourceIndex getEaglerFileIndex() {
+ return this.resourceIndex;
+ }
> EOF

@ -7,25 +7,44 @@
> DELETE 2 @ 2 : 6
> DELETE 3 @ 3 : 4
> CHANGE 3 : 5 @ 3 : 4
> INSERT 1 : 6 @ 1
~ import java.util.Collection;
~ import java.util.Collections;
> INSERT 1 : 8 @ 1
+
+ import com.google.common.collect.ImmutableSet;
+
+ import net.lax1dude.eaglercraft.v1_8.EagRuntime;
+ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerFolderResourcePack;
+ import net.lax1dude.eaglercraft.v1_8.minecraft.ResourceIndex;
+ import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
> DELETE 1 @ 1 : 3
> CHANGE 5 : 6 @ 5 : 7
> CHANGE 4 : 6 @ 4 : 7
~ public class DefaultResourcePack extends ResourceIndex implements IResourcePack {
~ public static final Set<String> defaultResourceDomains = ImmutableSet.of("minecraft", "eagler");
> DELETE 1 @ 1 : 5
> CHANGE 1 : 13 @ 1 : 3
> CHANGE 15 : 16 @ 15 : 17
~ private final Collection<String> propertyFilesIndex;
~
~ public DefaultResourcePack() {
~ String str = EagRuntime.getResourceString("/assets/minecraft/optifine/_property_files_index.json");
~ if (str != null) {
~ Collection<String> lst = EaglerFolderResourcePack.loadPropertyFileList(str);
~ if (lst != null) {
~ propertyFilesIndex = lst;
~ return;
~ }
~ }
~ propertyFilesIndex = Collections.emptyList();
> CHANGE 17 : 18 @ 17 : 19
~ return null;
@ -52,4 +71,22 @@
~ public ImageData getPackImage() throws IOException {
~ return TextureUtil.readBufferedImage(EagRuntime.getRequiredResourceStream("pack.png"));
> INSERT 5 : 20 @ 5
+
+ @Override
+ public ResourceIndex getEaglerFileIndex() {
+ return this;
+ }
+
+ @Override
+ protected Collection<String> getPropertiesFiles0() {
+ return propertyFilesIndex;
+ }
+
+ @Override
+ protected Collection<String> getCITPotionsFiles0() {
+ return Collections.emptyList();
+ }
> EOF

@ -7,13 +7,23 @@
> DELETE 2 @ 2 : 3
> INSERT 3 : 5 @ 3
> INSERT 2 : 3 @ 2
+ import java.util.Collection;
> INSERT 1 : 4 @ 1
+
+ import net.lax1dude.eaglercraft.v1_8.minecraft.ResourceIndex;
+ import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
> CHANGE 13 : 14 @ 13 : 14
~ ImageData getPackImage() throws IOException;
> INSERT 2 : 4 @ 2
+
+ ResourceIndex getEaglerFileIndex();
> EOF

@ -13,7 +13,7 @@
> DELETE 7 @ 7 : 8
> INSERT 1 : 16 @ 1
> INSERT 1 : 18 @ 1
+ import java.util.Set;
+
@ -29,13 +29,22 @@
+ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.BlockVertexIDs;
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
+ import net.minecraft.block.Block;
+ import net.minecraft.block.state.IBlockState;
+ import net.minecraft.client.Minecraft;
> DELETE 9 @ 9 : 10
> INSERT 8 : 10 @ 8
+ import net.minecraft.client.renderer.block.statemap.IStateMapper;
+ import net.minecraft.client.renderer.block.statemap.StateMapperBase;
> DELETE 1 @ 1 : 2
> DELETE 3 @ 3 : 9
> DELETE 7 @ 7 : 10
> CHANGE 7 : 8 @ 7 : 10
~ import net.optifine.CustomItems;
> CHANGE 20 : 21 @ 20 : 21
@ -85,12 +94,44 @@
~ return modelblock;
> CHANGE 21 : 23 @ 21 : 22
> INSERT 4 : 5 @ 4
+ String path = parResourceLocation.getResourcePath();
> CHANGE 1 : 2 @ 1 : 2
~ ((path.startsWith("mcpatcher/") || path.startsWith("optifine/")) ? "" : "models/") + path + ".json");
> CHANGE 15 : 17 @ 15 : 16
~ + Item.itemRegistry.getNameForObject(item) + "\'");
~ LOGGER.warn(exception);
> INSERT 132 : 133 @ 132
> INSERT 7 : 23 @ 7
+ public void loadItemModel(String p_loadItemModel_1_, ResourceLocation p_loadItemModel_2_,
+ ResourceLocation p_loadItemModel_3_) {
+ this.itemLocations.put(p_loadItemModel_1_, p_loadItemModel_2_);
+
+ if (this.models.get(p_loadItemModel_2_) == null) {
+ try {
+ ModelBlock modelblock = this.loadModel(p_loadItemModel_2_);
+ this.models.put(p_loadItemModel_2_, modelblock);
+ } catch (Exception exception) {
+ LOGGER.warn("Unable to load item model: \'{}\' for item: \'{}\'",
+ new Object[] { p_loadItemModel_2_, p_loadItemModel_3_ });
+ LOGGER.warn(exception.getClass().getName() + ": " + exception.getMessage());
+ }
+ }
+ }
+
> INSERT 107 : 109 @ 107
+ CustomItems.update();
+ CustomItems.loadModels(this);
> INSERT 18 : 19 @ 18
+ boolean deferred = Minecraft.getMinecraft().gameSettings.shaders;
@ -168,4 +209,38 @@
~ for (EaglerTextureAtlasSprite textureatlassprite : this.sprites.values()) {
> INSERT 11 : 42 @ 11
+ // eagler hack
+ public String getBaseTextureForBlockPre(int blockId, int metadata) {
+ Block block = Block.blockRegistry.getObjectById(blockId);
+ if (block != null) {
+ IBlockState state = block.getStateFromMeta(metadata);
+ if (state != null) {
+ IStateMapper mapper = blockModelShapes.getBlockStateMapper().blockStateMap.get(block);
+ ModelResourceLocation loc = null;
+ if (mapper != null) {
+ loc = mapper.putStateModelLocations(block).get(state);
+ }
+ if (loc == null) {
+ loc = new ModelResourceLocation(Block.blockRegistry.getNameForObject(block),
+ StateMapperBase.getPropertyString(state.getProperties()));
+ }
+ ModelBlockDefinition.Variants v = variants.get(loc);
+ if (v != null && v.getVariants().size() > 0) {
+ ModelBlockDefinition.Variant vv = v.getVariants().get(0);
+ ModelBlock model = this.models.get(vv.getModelLocation());
+ if (model != null) {
+ String name = model.resolveTextureName("particle");
+ if (name != null) {
+ return name;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
> EOF

@ -7,4 +7,20 @@
> DELETE 6 @ 6 : 9
> INSERT 8 : 10 @ 8
+ public ModelBakery modelbakerytmp; // eagler hack
+
> CHANGE 6 : 14 @ 6 : 10
~ modelbakerytmp = new ModelBakery(iresourcemanager, this.texMap, this.modelProvider);
~ try {
~ this.modelRegistry = modelbakerytmp.setupModelRegistry();
~ this.defaultModel = (IBakedModel) this.modelRegistry.getObject(ModelBakery.MODEL_MISSING);
~ this.modelProvider.reloadModels();
~ } finally {
~ modelbakerytmp = null;
~ }
> EOF

@ -52,7 +52,9 @@
+ import net.minecraft.util.EnumChatFormatting;
> DELETE 2 @ 2 : 8
> CHANGE 2 : 3 @ 2 : 8
~ import net.optifine.CustomSky;
> DELETE 3 @ 3 : 8
@ -124,7 +126,7 @@
+ public boolean hideDefaultUsernameWarning = false;
+ public boolean hideVideoSettingsWarning = EagRuntime.getPlatformType() == EnumPlatformType.DESKTOP;
> CHANGE 1 : 15 @ 1 : 2
> CHANGE 1 : 21 @ 1 : 2
~ public int voiceListenRadius = 16;
~ public float voiceListenVolume = 0.5f;
@ -139,6 +141,12 @@
~ public float screenRecordGameVolume = ScreenRecordingController.DEFAULT_GAME_VOLUME;
~ public float screenRecordMicVolume = ScreenRecordingController.DEFAULT_MIC_VOLUME;
~
~ public int betterGrassOF = 0;
~ public int connectedTexturesOF = 1;
~ public boolean customSkyOF = true;
~ public boolean smartLeavesOF = false;
~ public boolean customItemsOF = true;
~
~ public GameSettings(Minecraft mcIn) {
> CHANGE 4 : 6 @ 4 : 7
@ -240,53 +248,77 @@
~ if (parOptions == GameSettings.Options.HUD_STATS) {
~ this.hudStats = !this.hudStats;
> CHANGE 2 : 4 @ 2 : 5
> CHANGE 2 : 32 @ 2 : 3
~ if (parOptions == GameSettings.Options.HUD_WORLD) {
~ this.hudWorld = !this.hudWorld;
> CHANGE 2 : 4 @ 2 : 5
~ }
~
~ if (parOptions == GameSettings.Options.HUD_24H) {
~ this.hud24h = !this.hud24h;
> CHANGE 2 : 4 @ 2 : 5
~ }
~
~ if (parOptions == GameSettings.Options.CHUNK_FIX) {
~ this.chunkFix = !this.chunkFix;
> CHANGE 2 : 4 @ 2 : 4
~ }
~
~ if (parOptions == GameSettings.Options.FOG) {
~ this.fog = !this.fog;
~ }
~
~ if (parOptions == GameSettings.Options.FXAA) {
~ this.fxaa = (this.fxaa + parInt1) % 3;
~ }
~
~ if (parOptions == GameSettings.Options.FULLSCREEN) {
~ this.mc.toggleFullscreen();
~ }
~
~ if (parOptions == GameSettings.Options.FNAW_SKINS) {
~ this.enableFNAWSkins = !this.enableFNAWSkins;
~ this.mc.getRenderManager().setEnableFNAWSkins(this.mc.getEnableFNAWSkins());
~ }
~
~ if (parOptions == GameSettings.Options.EAGLER_VSYNC) {
> DELETE 1 @ 1 : 2
> CHANGE 2 : 4 @ 2 : 4
~ if (parOptions == GameSettings.Options.FXAA) {
~ this.fxaa = (this.fxaa + parInt1) % 3;
~ if (parOptions == GameSettings.Options.EAGLER_DYNAMIC_LIGHTS) {
~ this.enableDynamicLights = !this.enableDynamicLights;
> INSERT 2 : 24 @ 2
> CHANGE 3 : 9 @ 3 : 5
+ if (parOptions == GameSettings.Options.FULLSCREEN) {
+ this.mc.toggleFullscreen();
+ }
+
+ if (parOptions == GameSettings.Options.FNAW_SKINS) {
+ this.enableFNAWSkins = !this.enableFNAWSkins;
+ this.mc.getRenderManager().setEnableFNAWSkins(this.mc.getEnableFNAWSkins());
+ }
+
+ if (parOptions == GameSettings.Options.EAGLER_VSYNC) {
+ this.enableVsync = !this.enableVsync;
+ }
+
+ if (parOptions == GameSettings.Options.EAGLER_DYNAMIC_LIGHTS) {
+ this.enableDynamicLights = !this.enableDynamicLights;
~ if (parOptions == GameSettings.Options.EAGLER_PROFANITY_FILTER) {
~ this.enableProfanityFilter = !this.enableProfanityFilter;
~ }
~
~ if (parOptions == GameSettings.Options.OF_CONNECTED_TEXTURES) {
~ this.connectedTexturesOF = (this.connectedTexturesOF + 1) % 3;
> CHANGE 3 : 6 @ 3 : 5
~ if (parOptions == GameSettings.Options.OF_BETTER_GRASS) {
~ this.betterGrassOF = (this.betterGrassOF + 1) % 3;
~ this.mc.renderGlobal.loadRenderers();
> CHANGE 2 : 5 @ 2 : 4
~ if (parOptions == GameSettings.Options.OF_CUSTOM_SKIES) {
~ this.customSkyOF = !this.customSkyOF;
~ CustomSky.update();
> INSERT 2 : 12 @ 2
+ if (parOptions == GameSettings.Options.OF_SMART_LEAVES) {
+ this.smartLeavesOF = !this.smartLeavesOF;
+ this.mc.renderGlobal.loadRenderers();
+ }
+
+ if (parOptions == GameSettings.Options.EAGLER_PROFANITY_FILTER) {
+ this.enableProfanityFilter = !this.enableProfanityFilter;
+ if (parOptions == GameSettings.Options.OF_CUSTOM_ITEMS) {
+ this.customItemsOF = !this.customItemsOF;
+ this.mc.renderGlobal.loadRenderers();
+ }
+
@ -298,7 +330,7 @@
> DELETE 20 @ 20 : 30
> INSERT 8 : 34 @ 8
> INSERT 8 : 40 @ 8
+ case HUD_COORDS:
+ return this.hudCoords;
@ -326,6 +358,12 @@
+ return this.enableDynamicLights;
+ case EAGLER_PROFANITY_FILTER:
+ return this.enableProfanityFilter;
+ case OF_CUSTOM_SKIES:
+ return this.customSkyOF;
+ case OF_SMART_LEAVES:
+ return this.smartLeavesOF;
+ case OF_CUSTOM_ITEMS:
+ return this.customItemsOF;
> CHANGE 43 : 46 @ 43 : 47
@ -374,7 +412,7 @@
> DELETE 11 @ 11 : 19
> INSERT 9 : 17 @ 9
> INSERT 9 : 33 @ 9
+ } else if (parOptions == GameSettings.Options.FXAA) {
+ if (this.fxaa == 0) {
@ -384,6 +422,22 @@
+ } else {
+ return s + I18n.format("options.off");
+ }
+ } else if (parOptions == GameSettings.Options.OF_CONNECTED_TEXTURES) {
+ if (this.connectedTexturesOF == 0) {
+ return s + I18n.format("options.off");
+ } else if (this.connectedTexturesOF == 1) {
+ return s + I18n.format("options.graphics.fast");
+ } else {
+ return s + I18n.format("options.graphics.fancy");
+ }
+ } else if (parOptions == GameSettings.Options.OF_BETTER_GRASS) {
+ if (this.betterGrassOF == 0) {
+ return s + I18n.format("options.off");
+ } else if (this.betterGrassOF == 1) {
+ return s + I18n.format("options.graphics.fast");
+ } else {
+ return s + I18n.format("options.graphics.fancy");
+ }
> CHANGE 6 : 12 @ 6 : 10
@ -547,7 +601,7 @@
~ for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts._VALUES) {
> INSERT 4 : 74 @ 4
> INSERT 4 : 94 @ 4
+
+ if (astring[0].equals("enableFNAWSkins")) {
@ -618,6 +672,26 @@
+ hideVideoSettingsWarning = astring[1].equals("true");
+ }
+
+ if (astring[0].equals("betterGrassOF")) {
+ betterGrassOF = Integer.parseInt(astring[1]);
+ }
+
+ if (astring[0].equals("connectedTexturesOF")) {
+ connectedTexturesOF = Integer.parseInt(astring[1]);
+ }
+
+ if (astring[0].equals("customSkyOF")) {
+ customSkyOF = astring[1].equals("true");
+ }
+
+ if (astring[0].equals("smartLeavesOF")) {
+ smartLeavesOF = astring[1].equals("true");
+ }
+
+ if (astring[0].equals("customItemsOF")) {
+ customItemsOF = astring[1].equals("true");
+ }
+
+ deferredShaderConf.readOption(astring[0], astring[1]);
> CHANGE 6 : 23 @ 6 : 7
@ -681,7 +755,7 @@
> DELETE 9 @ 9 : 20
> INSERT 5 : 37 @ 5
> INSERT 5 : 42 @ 5
+ printwriter.println("hudFps:" + this.hudFps);
+ printwriter.println("hudWorld:" + this.hudWorld);
@ -715,6 +789,11 @@
+ printwriter.println("touchControlOpacity:" + this.touchControlOpacity);
+ printwriter.println("hideDefaultUsernameWarning:" + this.hideDefaultUsernameWarning);
+ printwriter.println("hideVideoSettingsWarning:" + this.hideVideoSettingsWarning);
+ printwriter.println("betterGrassOF:" + this.betterGrassOF);
+ printwriter.println("connectedTexturesOF:" + this.connectedTexturesOF);
+ printwriter.println("customSkyOF:" + this.customSkyOF);
+ printwriter.println("smartLeavesOF:" + this.smartLeavesOF);
+ printwriter.println("customItemsOF:" + this.customItemsOF);
> CHANGE 5 : 8 @ 5 : 6
@ -780,7 +859,7 @@
> DELETE 8 @ 8 : 10
> CHANGE 16 : 26 @ 16 : 17
> CHANGE 16 : 29 @ 16 : 17
~ ENTITY_SHADOWS("options.entityShadows", false, true), HUD_FPS("options.hud.fps", false, true),
~ HUD_COORDS("options.hud.coords", false, true), HUD_STATS("options.hud.stats", false, true),
@ -791,6 +870,9 @@
~ FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
~ EAGLER_VSYNC("options.vsync", false, true), EAGLER_DYNAMIC_LIGHTS("options.dynamicLights", false, true),
~ EAGLER_PROFANITY_FILTER("options.profanityFilterButton", false, true),
~ EAGLER_TOUCH_CONTROL_OPACITY("options.touchControlOpacity", true, false);
~ EAGLER_TOUCH_CONTROL_OPACITY("options.touchControlOpacity", true, false),
~ OF_CONNECTED_TEXTURES("options.connectedTexturesOF", false, false),
~ OF_BETTER_GRASS("options.betterGrassOF", false, false), OF_CUSTOM_SKIES("options.customSkiesOF", false, true),
~ OF_SMART_LEAVES("options.smartLeavesOF", false, true), OF_CUSTOM_ITEMS("options.customItemsOF", false, true);
> EOF

@ -14,7 +14,11 @@
+ import com.carrotsearch.hppc.cursors.IntObjectCursor;
+ import com.carrotsearch.hppc.cursors.ObjectCursor;
> DELETE 2 @ 2 : 5
> CHANGE 2 : 5 @ 2 : 5
~
~ import java.util.Arrays;
~ import java.util.Collections;
> CHANGE 1 : 3 @ 1 : 4
@ -110,7 +114,23 @@
~ public ObjectContainer<PotionEffect> getActivePotionEffects() {
> CHANGE 4 : 5 @ 4 : 5
> INSERT 3 : 16 @ 3
+ public List<PotionEffect> getActivePotionEffectsList() {
+ if (activePotionsMap.isEmpty()) {
+ return Collections.emptyList();
+ }
+ PotionEffect[] arr = this.activePotionsMap.values().toArray(PotionEffect.class);
+ if (arr.length > 1) {
+ Arrays.sort(arr, (p1, p2) -> {
+ return p1.getPotionID() - p2.getPotionID();
+ });
+ }
+ return Arrays.asList(arr);
+ }
+
> CHANGE 1 : 2 @ 1 : 2
~ return this.activePotionsMap.containsKey(potionId);

@ -13,7 +13,11 @@
+ import com.google.common.collect.Lists;
+
> CHANGE 59 : 60 @ 59 : 60
> INSERT 19 : 20 @ 19
+ chunkIn.alfheim$getLightingEngine().processLightUpdates();
> CHANGE 40 : 41 @ 40 : 41
~ ArrayList<ExtendedBlockStorage> arraylist = Lists.newArrayList();

@ -15,7 +15,18 @@
> DELETE 1 @ 1 : 5
> INSERT 12 : 16 @ 12
> CHANGE 3 : 11 @ 3 : 11
~ public static final int NUM_X_BITS = 26;
~ public static final int NUM_Z_BITS = NUM_X_BITS;
~ public static final int NUM_Y_BITS = 64 - NUM_X_BITS - NUM_Z_BITS;
~ public static final int Y_SHIFT = 0 + NUM_Z_BITS;
~ public static final int X_SHIFT = Y_SHIFT + NUM_Y_BITS;
~ public static final long X_MASK = (1L << NUM_X_BITS) - 1L;
~ public static final long Y_MASK = (1L << NUM_Y_BITS) - 1L;
~ public static final long Z_MASK = (1L << NUM_Z_BITS) - 1L;
> INSERT 1 : 5 @ 1
+ public BlockPos() {
+ super(0, 0, 0);

@ -19,7 +19,11 @@
+ public static final EnumFacing[] _VALUES = values();
+
> CHANGE 162 : 164 @ 162 : 164
> CHANGE 8 : 9 @ 8 : 9
~ public static final EnumFacing[] HORIZONTALS = new EnumFacing[4];
> CHANGE 153 : 155 @ 153 : 155
~ public static EnumFacing random(EaglercraftRandom rand) {
~ return _VALUES[rand.nextInt(_VALUES.length)];

@ -5,24 +5,22 @@
# Version: 1.0
# Author: lax1dude
> DELETE 8 @ 8 : 12
> INSERT 2 : 3 @ 2
> INSERT 75 : 79 @ 75
+ import net.minecraft.block.Block;
+ public int getBiomeColorForCoords(BlockPos var1, int index) {
+ return this.worldObj.getBiomeColorForCoords(var1, index);
+ }
+
> DELETE 6 @ 6 : 10
> CHANGE 2 : 3 @ 2 : 3
> CHANGE 47 : 51 @ 47 : 49
~ return Chunk.getNoSkyLightValue();
~ IBlockState state = getBlockState(blockpos);
~ Block b = state.getBlock();
~ int j = b.alfheim$getLightFor(state, this, EnumSkyBlock.SKY, blockpos);
~ int k = b.alfheim$getLightFor(state, this, EnumSkyBlock.BLOCK, blockpos);
> CHANGE 4 : 8 @ 4 : 6
> CHANGE 26 : 28 @ 26 : 53
~ EnumFacing[] facings = EnumFacing._VALUES;
~ BlockPos tmp = new BlockPos(0, 0, 0);
~ for (int i = 0; i < facings.length; ++i) {
~ int k = this.getLightFor(pos, parBlockPos.offsetEvenFaster(facings[i], tmp));
~ public int getBiomeColorForCoords(BlockPos var1, int index) {
~ return this.worldObj.getBiomeColorForCoords(var1, index);
> EOF

@ -0,0 +1,13 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> INSERT 7 : 9 @ 7
+ public static final EnumSkyBlock[] _VALUES = values();
+
> EOF

@ -12,4 +12,9 @@
+ int getBiomeColorForCoords(BlockPos var1, int index);
+
> INSERT 5 : 7 @ 5
+
+ int getLightFor(final EnumSkyBlock lightType, final BlockPos blockPos);
> EOF

@ -12,8 +12,10 @@
+ import com.carrotsearch.hppc.LongHashSet;
+ import com.carrotsearch.hppc.LongSet;
> INSERT 3 : 4 @ 3
> INSERT 3 : 6 @ 3
+
+ import dev.redstudio.alfheim.lighting.LightingEngine;
+
> DELETE 5 @ 5 : 6
@ -61,21 +63,26 @@
~ protected LongSet activeChunkSet = new LongHashSet();
> INSERT 6 : 7 @ 6
> CHANGE 5 : 6 @ 5 : 6
+ public final boolean isRemote;
~ public final boolean isRemote;
> CHANGE 1 : 2 @ 1 : 3
> CHANGE 1 : 4 @ 1 : 3
~ private LightingEngine alfheim$lightingEngine;
~
~ protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, boolean client) {
> DELETE 5 @ 5 : 6
> DELETE 3 @ 3 : 4
> DELETE 1 @ 1 : 2
> DELETE 2 @ 2 : 3
> INSERT 1 : 2 @ 1
> INSERT 1 : 3 @ 1
+ this.isRemote = client;
+ this.alfheim$lightingEngine = new LightingEngine(this);
> CHANGE 17 : 19 @ 17 : 18
@ -125,29 +132,27 @@
~ return HString.format("ID #%d (%s // %s)",
> CHANGE 60 : 66 @ 60 : 65
> CHANGE 58 : 60 @ 58 : 68
~ BlockPos tmp = new BlockPos(0, 0, 0);
~ int i1 = this.getLight(pos.up(tmp), false);
~ int i = this.getLight(pos.east(tmp), false);
~ int j = this.getLight(pos.west(tmp), false);
~ int k = this.getLight(pos.south(tmp), false);
~ int l = this.getLight(pos.north(tmp), false);
~ if (!checkNeighbors)
~ return getLight(pos);
> CHANGE 63 : 64 @ 63 : 64
> CHANGE 1 : 2 @ 1 : 4
~ return Chunk.getNoSkyLightValue();
~ final IBlockState blockState = getBlockState(pos);
> CHANGE 10 : 16 @ 10 : 15
> CHANGE 1 : 4 @ 1 : 23
~ BlockPos tmp = new BlockPos();
~ int i1 = this.getLightFor(type, pos.up(tmp));
~ int i = this.getLightFor(type, pos.east(tmp));
~ int j = this.getLightFor(type, pos.west(tmp));
~ int k = this.getLightFor(type, pos.south(tmp));
~ int l = this.getLightFor(type, pos.north(tmp));
~ return Math.max(blockState.getBlock().alfheim$getLightFor(blockState, this, EnumSkyBlock.BLOCK, pos),
~ blockState.getBlock().alfheim$getLightFor(blockState, this, EnumSkyBlock.SKY, pos)
~ - skylightSubtracted);
> CHANGE 59 : 65 @ 59 : 60
> CHANGE 32 : 34 @ 32 : 71
~ IBlockState state = getBlockState(pos);
~ return state.getBlock().alfheim$getLightFor(state, this, type, pos);
> CHANGE 37 : 43 @ 37 : 38
~ if (lightValue < 0) {
~ j += -lightValue;
@ -260,11 +265,16 @@
> DELETE 23 @ 23 : 24
> CHANGE 5 : 8 @ 5 : 6
> INSERT 1 : 7 @ 1
~ int l = this.getRenderDistanceChunks() - 1;
~ if (l < 1)
~ l = 1;
+ int l = this.getRenderDistanceChunks() - 1;
+ if (l > 7)
+ l = 7;
+ else if (l < 1)
+ l = 1;
+
> DELETE 4 @ 4 : 5
> CHANGE 3 : 4 @ 3 : 4
@ -296,51 +306,12 @@
~ for (int m = 0; m < facings.length; ++m) {
~ EnumFacing enumfacing = facings[m];
> DELETE 22 @ 22 : 23
> CHANGE 17 : 19 @ 17 : 127
> CHANGE 25 : 26 @ 25 : 26
~ alfheim$lightingEngine.scheduleLightUpdate(lightType, pos);
~ return true;
~ BlockPos blockpos$mutableblockpos = new BlockPos();
> CHANGE 1 : 4 @ 1 : 2
~ EnumFacing[] facings = EnumFacing._VALUES;
~ for (int m = 0; m < facings.length; ++m) {
~ EnumFacing enumfacing = facings[m];
> DELETE 20 @ 20 : 23
> INSERT 6 : 7 @ 6
+ BlockPos tmp = new BlockPos(0, 0, 0);
> CHANGE 10 : 11 @ 10 : 11
~ if (this.getLightFor(lightType, blockpos1.west(tmp)) < j6) {
> CHANGE 4 : 5 @ 4 : 5
~ if (this.getLightFor(lightType, blockpos1.east(tmp)) < j6) {
> CHANGE 4 : 5 @ 4 : 5
~ if (this.getLightFor(lightType, blockpos1.down(tmp)) < j6) {
> CHANGE 4 : 5 @ 4 : 5
~ if (this.getLightFor(lightType, blockpos1.up(tmp)) < j6) {
> CHANGE 4 : 5 @ 4 : 5
~ if (this.getLightFor(lightType, blockpos1.north(tmp)) < j6) {
> CHANGE 4 : 5 @ 4 : 5
~ if (this.getLightFor(lightType, blockpos1.south(tmp)) < j6) {
> DELETE 8 @ 8 : 9
> CHANGE 30 : 33 @ 30 : 33
> CHANGE 28 : 31 @ 28 : 31
~ Chunk chunk = this.getChunkFromChunkCoordsIfLoaded(i1, j1);
~ if (chunk != null) {
@ -432,4 +403,11 @@
+ .getBoolean("loadSpawnChunks"))
+ return false;
> INSERT 6 : 10 @ 6
+
+ public LightingEngine alfheim$getLightingEngine() {
+ return alfheim$lightingEngine;
+ }
> EOF

@ -42,7 +42,11 @@
> DELETE 6 @ 6 : 7
> DELETE 11 @ 11 : 12
> INSERT 1 : 2 @ 1
+ alfheim$getLightingEngine().processLightUpdates();
> DELETE 10 @ 10 : 11
> DELETE 1 @ 1 : 2

@ -5,7 +5,13 @@
# Version: 1.0
# Author: lax1dude
> DELETE 4 @ 4 : 5
> CHANGE 4 : 9 @ 4 : 5
~
~ import dev.redstudio.alfheim.lighting.LightingEngine;
~ import dev.redstudio.alfheim.utils.EnumBoundaryFacing;
~ import dev.redstudio.alfheim.utils.WorldChunkSlice;
~
> INSERT 1 : 2 @ 1
@ -36,7 +42,14 @@
~ private List<BlockPos> tileEntityPosQueue;
~ private final ChunkCoordIntPair coordsCache;
> CHANGE 8 : 9 @ 8 : 9
> INSERT 1 : 5 @ 1
+ private LightingEngine alfheim$lightingEngine;
+ private boolean alfheim$isLightInitialized;
+ public short[] alfheim$neighborLightChecks;
+
> CHANGE 7 : 8 @ 7 : 8
~ this.tileEntityPosQueue = new LinkedList();
@ -44,7 +57,12 @@
+ this.coordsCache = new ChunkCoordIntPair(x, z);
> CHANGE 38 : 39 @ 38 : 39
> INSERT 7 : 9 @ 7
+
+ alfheim$lightingEngine = worldIn != null ? worldIn.alfheim$getLightingEngine() : null;
> CHANGE 31 : 32 @ 31 : 32
~ return this.getHeightValue(pos.x & 15, pos.z & 15);
@ -58,40 +76,82 @@
+ ++EaglerMinecraftServer.counterLightUpdate;
+ }
> CHANGE 9 : 12 @ 9 : 10
> DELETE 3 @ 3 : 8
> CHANGE 1 : 4 @ 1 : 11
~ if (!worldObj.isAreaLoaded(new BlockPos((xPosition << 4) + 8, 0, (zPosition << 4) + 8), 16)) {
~ return;
~ }
> CHANGE 1 : 4 @ 1 : 5
~ if (!this.worldObj.isRemote) {
~ ++EaglerMinecraftServer.counterLightUpdate;
~ }
> CHANGE 10 : 13 @ 10 : 11
> CHANGE 1 : 2 @ 1 : 2
~ EnumFacing[] facings = EnumFacing.Plane.HORIZONTAL.facingsArray;
~ for (int m = 0; m < facings.length; ++m) {
~ EnumFacing enumfacing = facings[m];
~ final WorldChunkSlice slice = new WorldChunkSlice(worldObj.getChunkProvider(), xPosition, zPosition);
> CHANGE 6 : 8 @ 6 : 7
> CHANGE 1 : 5 @ 1 : 5
~ for (int m = 0; m < facings.length; ++m) {
~ EnumFacing enumfacing1 = facings[m];
~ for (int x = 0; x < 16; ++x) {
~ for (int z = 0; z < 16; ++z) {
~ if (!alfheim$recheckGapsForColumn(slice, x, z))
~ continue;
> DELETE 5 @ 5 : 6
> CHANGE 1 : 3 @ 1 : 7
> DELETE 8 @ 8 : 10
~ if (parFlag)
~ return;
> CHANGE 94 : 97 @ 94 : 95
> DELETE 1 @ 1 : 3
~ EnumFacing[] facings = EnumFacing.Plane.HORIZONTAL.facingsArray;
~ for (int m = 0; m < facings.length; ++m) {
~ EnumFacing enumfacing = facings[m];
> CHANGE 2 : 3 @ 2 : 3
> INSERT 7 : 10 @ 7
~ isGapLightingUpdated = false;
+ if (!this.worldObj.isRemote) {
+ ++EaglerMinecraftServer.counterLightUpdate;
+ }
> CHANGE 24 : 26 @ 24 : 29
> CHANGE 9 : 10 @ 9 : 10
~ int heightMapY = heightMap[z << 4 | x] & 255;
~ int newHeightMapY = Math.max(y, heightMapY);
> CHANGE 1 : 3 @ 1 : 4
~ while (newHeightMapY > 0 && getBlockLightOpacity(x, newHeightMapY - 1, z) == 0)
~ --newHeightMapY;
> CHANGE 1 : 3 @ 1 : 26
~ if (newHeightMapY == heightMapY)
~ return;
> CHANGE 1 : 4 @ 1 : 2
~ if (!this.worldObj.isRemote) {
~ ++EaglerMinecraftServer.counterLightUpdate;
~ }
> CHANGE 1 : 2 @ 1 : 7
~ heightMap[z << 4 | x] = newHeightMapY;
> CHANGE 1 : 3 @ 1 : 5
~ if (!worldObj.provider.getHasNoSky())
~ alfheim$relightSkylightColumn(x, z, heightMapY, newHeightMapY);
> CHANGE 1 : 2 @ 1 : 7
~ final int heightMapY1 = heightMap[z << 4 | x];
> CHANGE 1 : 3 @ 1 : 23
~ if (heightMapY1 < heightMapMinimum) {
~ heightMapMinimum = heightMapY1;
> CHANGE 8 : 9 @ 8 : 9
~ return this.getBlock(x, y, z).getLightOpacity();
@ -148,29 +208,40 @@
~ int j = pos.y;
~ int k = pos.z & 15;
> CHANGE 86 : 89 @ 86 : 89
> CHANGE 21 : 23 @ 21 : 22
~ int i = blockpos.x & 15;
~ int j = blockpos.y;
~ int k = blockpos.z & 15;
~ alfheim$initSkylightForSection(extendedblockstorage);
~ // flag = j >= i1;
> CHANGE 1 : 3 @ 1 : 2
> CHANGE 18 : 19 @ 18 : 19
~ return extendedblockstorage == null
~ ? (this.canSeeSky(blockpos) ? enumskyblock.defaultLightValue : getNoSkyLightValue())
~ // int k1 = block1.getLightOpacity();
> CHANGE 1 : 2 @ 1 : 2
> CHANGE 8 : 12 @ 8 : 12
~ ? (this.worldObj.provider.getHasNoSky() ? getNoSkyLightValue()
~ // if (j1 != k1 && (j1 < k1 || this.getLightFor(EnumSkyBlock.SKY, pos) > 0
~ // || this.getLightFor(EnumSkyBlock.BLOCK, pos) > 0)) {
~ // this.propagateSkylightOcclusion(i, k);
~ // }
> CHANGE 6 : 9 @ 6 : 9
> CHANGE 33 : 35 @ 33 : 43
~ alfheim$lightingEngine.processLightUpdatesForType(enumskyblock);
~ return alfheim$getCachedLightFor(enumskyblock, blockpos);
> CHANGE 3 : 6 @ 3 : 6
~ int j = blockpos.x & 15;
~ int k = blockpos.y;
~ int l = blockpos.z & 15;
> CHANGE 19 : 22 @ 19 : 22
> CHANGE 4 : 5 @ 4 : 5
~ alfheim$initSkylightForSection(storageArrays[k >> 4]);
> CHANGE 14 : 18 @ 14 : 17
~ alfheim$lightingEngine.processLightUpdates();
~ int j = blockpos.x & 15;
~ int k = blockpos.y;
~ int l = blockpos.z & 15;
@ -214,7 +285,48 @@
+ blockpos = new BlockPos(blockpos);
> CHANGE 94 : 96 @ 94 : 96
> INSERT 33 : 71 @ 33
+ for (final EnumFacing facing : EnumFacing.HORIZONTALS) {
+ final int xOffset = facing.getFrontOffsetX();
+ final int zOffset = facing.getFrontOffsetZ();
+
+ final Chunk nChunk = worldObj.getChunkProvider().getLoadedChunk(xPosition + xOffset, zPosition + zOffset);
+
+ if (nChunk == null)
+ continue;
+
+ EnumSkyBlock[] lightTypes = EnumSkyBlock._VALUES;
+ EnumFacing.AxisDirection[] axisDirections = EnumFacing.AxisDirection._VALUES;
+ for (int ii = 0, ll = lightTypes.length; ii < ll; ++ii) {
+ final EnumSkyBlock lightType = lightTypes[ii];
+ for (int jj = 0, mm = axisDirections.length; jj < mm; ++jj) {
+ final EnumFacing.AxisDirection axisDir = axisDirections[jj];
+ // Merge flags upon loading of a chunk. This ensures that all flags are always
+ // already on the IN boundary below
+ alfheim$mergeFlags(lightType, this, nChunk, facing, axisDir);
+ alfheim$mergeFlags(lightType, nChunk, this, facing.getOpposite(), axisDir);
+
+ // Check everything that might have been canceled due to this chunk not being
+ // loaded.
+ // Also, pass in chunks if already known
+ // The boundary to the neighbor chunk (both ways)
+ alfheim$scheduleRelightChecksForBoundary(this, nChunk, null, lightType, xOffset, zOffset, axisDir);
+ alfheim$scheduleRelightChecksForBoundary(nChunk, this, null, lightType, -xOffset, -zOffset,
+ axisDir);
+ // The boundary to the diagonal neighbor (since the checks in that chunk were
+ // aborted if this chunk wasn't loaded, see
+ // alfheim$scheduleRelightChecksForBoundary)
+ alfheim$scheduleRelightChecksForBoundary(nChunk, null, this, lightType,
+ (zOffset != 0 ? axisDir.getOffset() : 0), (xOffset != 0 ? axisDir.getOffset() : 0),
+ facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE
+ ? EnumFacing.AxisDirection.NEGATIVE
+ : EnumFacing.AxisDirection.POSITIVE);
+ }
+ }
+ }
> CHANGE 61 : 63 @ 61 : 63
~ && (predicate == null || predicate.apply((T) entity))) {
~ list.add((T) entity);
@ -256,14 +368,366 @@
~ for (int m = 0; m < facings.length; ++m) {
~ BlockPos blockpos2 = blockpos1.offset(facings[m]);
> CHANGE 29 : 32 @ 29 : 30
> DELETE 14 @ 14 : 27
~ EnumFacing[] facings = EnumFacing.Plane.HORIZONTAL.facingsArray;
~ for (int i = 0; i < facings.length; ++i) {
~ EnumFacing enumfacing = facings[i];
> CHANGE 1 : 3 @ 1 : 7
> CHANGE 49 : 50 @ 49 : 51
~ if (!alfheim$isLightInitialized)
~ alfheim$initChunkLighting(this, worldObj);
~ BlockPos blockpos$mutableblockpos = new BlockPos((this.xPosition << 4) + x, 0, (this.zPosition << 4) + z);
> CHANGE 1 : 10 @ 1 : 5
~ for (int x = -1; x <= 1; x++) {
~ for (int z = -1; z <= 1; z++) {
~ if (x == 0 && z == 0)
~ continue;
~
~ final Chunk nChunk = worldObj.getChunkProvider().getLoadedChunk(xPosition + x, zPosition + z);
~
~ if (nChunk == null || !nChunk.alfheim$isLightInitialized())
~ return;
> INSERT 3 : 4 @ 3
+ setLightPopulated(true);
> DELETE 10 @ 10 : 64
> INSERT 79 : 413 @ 79
+
+ private boolean alfheim$recheckGapsForColumn(final WorldChunkSlice slice, final int x, final int z) {
+ final int i = x + (z << 4);
+
+ if (updateSkylightColumns[i]) {
+ updateSkylightColumns[i] = false;
+
+ final int x1 = (this.xPosition << 4) + x;
+ final int z1 = (this.zPosition << 4) + z;
+
+ alfheim$recheckGapsSkylightNeighborHeight(slice, x1, z1, getHeightValue(x, z),
+ alfheim$recheckGapsGetLowestHeight(slice, x1, z1));
+
+ return true;
+ }
+
+ return false;
+ }
+
+ private int alfheim$recheckGapsGetLowestHeight(final WorldChunkSlice slice, final int x, final int z) {
+ int max = Integer.MAX_VALUE;
+
+ Chunk chunk = slice.getChunkFromWorldCoords(x + 1, z);
+
+ if (chunk != null)
+ max = Math.min(max, chunk.getLowestHeight());
+
+ chunk = slice.getChunkFromWorldCoords(x, z + 1);
+
+ if (chunk != null)
+ max = Math.min(max, chunk.getLowestHeight());
+
+ chunk = slice.getChunkFromWorldCoords(x - 1, z);
+
+ if (chunk != null)
+ max = Math.min(max, chunk.getLowestHeight());
+
+ chunk = slice.getChunkFromWorldCoords(x, z - 1);
+
+ if (chunk != null)
+ max = Math.min(max, chunk.getLowestHeight());
+
+ return max;
+ }
+
+ private void alfheim$recheckGapsSkylightNeighborHeight(final WorldChunkSlice slice, final int x, final int z,
+ final int height, final int max) {
+ alfheim$checkSkylightNeighborHeight(slice, x, z, max);
+ alfheim$checkSkylightNeighborHeight(slice, x + 1, z, height);
+ alfheim$checkSkylightNeighborHeight(slice, x, z + 1, height);
+ alfheim$checkSkylightNeighborHeight(slice, x - 1, z, height);
+ alfheim$checkSkylightNeighborHeight(slice, x, z - 1, height);
+ }
+
+ private void alfheim$checkSkylightNeighborHeight(final WorldChunkSlice slice, final int x, final int z,
+ final int maxValue) {
+ Chunk c = slice.getChunkFromWorldCoords(x, z);
+ if (c == null)
+ return;
+
+ final int y = c.getHeightValue(x & 15, z & 15);
+
+ if (y > maxValue)
+ alfheim$updateSkylightNeighborHeight(slice, x, z, maxValue, y + 1);
+ else if (y < maxValue)
+ alfheim$updateSkylightNeighborHeight(slice, x, z, y, maxValue + 1);
+ }
+
+ private void alfheim$updateSkylightNeighborHeight(final WorldChunkSlice slice, final int x, final int z,
+ final int startY, final int endY) {
+ if (endY < startY)
+ return;
+
+ if (!slice.isLoaded(x, z, 16))
+ return;
+
+ for (int y = startY; y < endY; ++y)
+ worldObj.checkLightFor(EnumSkyBlock.SKY, new BlockPos(x, y, z));
+
+ isModified = true;
+ }
+
+ private static void alfheim$mergeFlags(final EnumSkyBlock lightType, final Chunk inChunk, final Chunk outChunk,
+ final EnumFacing dir, final EnumFacing.AxisDirection axisDirection) {
+ if (outChunk.alfheim$neighborLightChecks == null)
+ return;
+
+ inChunk.alfheim$initNeighborLightChecks();
+
+ final int inIndex = alfheim$getFlagIndex(lightType, dir, axisDirection, EnumBoundaryFacing.IN);
+ final int outIndex = alfheim$getFlagIndex(lightType, dir.getOpposite(), axisDirection, EnumBoundaryFacing.OUT);
+
+ inChunk.alfheim$neighborLightChecks[inIndex] |= outChunk.alfheim$neighborLightChecks[outIndex];
+ // No need to call Chunk.setModified() since checks are not deleted from
+ // outChunk
+ }
+
+ private void alfheim$scheduleRelightChecksForBoundary(final Chunk chunk, Chunk nChunk, Chunk sChunk,
+ final EnumSkyBlock lightType, final int xOffset, final int zOffset,
+ final EnumFacing.AxisDirection axisDirection) {
+ if (chunk.alfheim$neighborLightChecks == null)
+ return;
+
+ final int flagIndex = alfheim$getFlagIndex(lightType, xOffset, zOffset, axisDirection, EnumBoundaryFacing.IN); // OUT
+ // checks
+ // from
+ // neighbor
+ // are
+ // already
+ // merged
+
+ final int flags = chunk.alfheim$neighborLightChecks[flagIndex];
+
+ if (flags == 0)
+ return;
+
+ if (nChunk == null) {
+ nChunk = worldObj.getChunkProvider().getLoadedChunk(chunk.xPosition + xOffset, chunk.zPosition + zOffset);
+
+ if (nChunk == null)
+ return;
+ }
+
+ if (sChunk == null) {
+ sChunk = worldObj.getChunkProvider().getLoadedChunk(
+ chunk.xPosition + (zOffset != 0 ? axisDirection.getOffset() : 0),
+ chunk.zPosition + (xOffset != 0 ? axisDirection.getOffset() : 0));
+
+ if (sChunk == null)
+ return; // Cancel, since the checks in the corner columns require the corner column of
+ // sChunk
+ }
+
+ final int reverseIndex = alfheim$getFlagIndex(lightType, -xOffset, -zOffset, axisDirection,
+ EnumBoundaryFacing.OUT);
+
+ chunk.alfheim$neighborLightChecks[flagIndex] = 0;
+
+ if (alfheim$neighborLightChecks != null)
+ nChunk.alfheim$neighborLightChecks[reverseIndex] = 0; // Clear only now that it's clear that the checks
+ // are processed
+
+ chunk.setChunkModified();
+ nChunk.setChunkModified();
+
+ // Get the area to check
+ // Start in the corner...
+ int xMin = chunk.xPosition << 4;
+ int zMin = chunk.zPosition << 4;
+
+ // Move to other side of chunk if the direction is positive
+ if ((xOffset | zOffset) > 0) {
+ xMin += 15 * xOffset;
+ zMin += 15 * zOffset;
+ }
+
+ // Shift to other half if necessary (shift perpendicular to dir)
+ if (axisDirection == EnumFacing.AxisDirection.POSITIVE) {
+ xMin += 8 * (zOffset & 1); // x & 1 is same as abs(x) for x=-1,0,1
+ zMin += 8 * (xOffset & 1);
+ }
+
+ // Get maximal values (shift perpendicular to dir)
+ final int xMax = xMin + 7 * (zOffset & 1);
+ final int zMax = zMin + 7 * (xOffset & 1);
+
+ for (int y = 0; y < 16; ++y)
+ if ((flags & (1 << y)) != 0)
+ for (int x = xMin; x <= xMax; ++x)
+ for (int z = zMin; z <= zMax; ++z)
+ alfheim$scheduleRelightChecksForColumn(lightType, x, z, y << 4, (y << 4) + 15);
+ }
+
+ private void alfheim$initSkylightForSection(final ExtendedBlockStorage extendedBlockStorage) {
+ if (worldObj.provider.getHasNoSky())
+ return;
+
+ for (int x = 0; x < 16; ++x) {
+ for (int z = 0; z < 16; ++z) {
+ if (getHeightValue(x, z) > extendedBlockStorage.getYLocation())
+ continue;
+
+ for (int y = 0; y < 16; ++y)
+ extendedBlockStorage.setExtSkylightValue(x, y, z, EnumSkyBlock.SKY.defaultLightValue);
+ }
+ }
+ }
+
+ private void alfheim$scheduleRelightChecksForColumn(final EnumSkyBlock lightType, final int x, final int z,
+ final int yMin, final int yMax) {
+ final BlockPos mutableBlockPos = new BlockPos();
+
+ for (int y = yMin; y <= yMax; ++y)
+ worldObj.checkLightFor(lightType, mutableBlockPos.func_181079_c(x, y, z));
+ }
+
+ private static int alfheim$getFlagIndex(final EnumSkyBlock lightType, final int xOffset, final int zOffset,
+ final EnumFacing.AxisDirection axisDirection, final EnumBoundaryFacing boundaryFacing) {
+ return (lightType == EnumSkyBlock.BLOCK ? 0 : 16) | ((xOffset + 1) << 2) | ((zOffset + 1) << 1)
+ | (axisDirection.getOffset() + 1) | boundaryFacing.ordinal();
+ }
+
+ private static int alfheim$getFlagIndex(final EnumSkyBlock lightType, final EnumFacing facing,
+ final EnumFacing.AxisDirection axisDirection, final EnumBoundaryFacing boundaryFacing) {
+ return alfheim$getFlagIndex(lightType, facing.getFrontOffsetX(), facing.getFrontOffsetZ(), axisDirection,
+ boundaryFacing);
+ }
+
+ private static void alfheim$initChunkLighting(final Chunk chunk, final World world) {
+ final int xBase = chunk.xPosition << 4;
+ final int zBase = chunk.zPosition << 4;
+
+ final BlockPos mutableBlockPos = new BlockPos(xBase, 0, zBase);
+
+ if (world.isAreaLoaded(mutableBlockPos.add(-16, 0, -16), mutableBlockPos.add(31, 255, 31), false)) {
+ final ExtendedBlockStorage[] extendedBlockStorage = chunk.getBlockStorageArray();
+
+ for (int i = 0; i < extendedBlockStorage.length; ++i) {
+ final ExtendedBlockStorage storage = extendedBlockStorage[i];
+
+ if (storage == null)
+ continue;
+
+ int yBase = i * 16;
+
+ for (int y = 0; y < 16; y++) {
+ for (int z = 0; z < 16; z++) {
+ for (int x = 0; x < 16; x++) {
+ if (storage.getBlockByExtId(x, y, z).getLightValue() > 0) {
+ mutableBlockPos.func_181079_c(xBase + x, yBase + y, zBase + z);
+ world.checkLightFor(EnumSkyBlock.BLOCK, mutableBlockPos);
+ }
+ }
+ }
+ }
+ }
+
+ if (!world.provider.getHasNoSky())
+ chunk.alfheim$setSkylightUpdatedPublic();
+
+ chunk.alfheim$setLightInitialized(true);
+ }
+ }
+
+ private void alfheim$relightSkylightColumn(final int x, final int z, final int height1, final int height2) {
+ final int yMin = Math.min(height1, height2);
+ final int yMax = Math.max(height1, height2) - 1;
+
+ final ExtendedBlockStorage[] sections = getBlockStorageArray();
+
+ final int xBase = (xPosition << 4) + x;
+ final int zBase = (zPosition << 4) + z;
+
+ alfheim$scheduleRelightChecksForColumn(EnumSkyBlock.SKY, xBase, zBase, yMin, yMax);
+
+ if (sections[yMin >> 4] == null && yMin > 0) {
+ worldObj.checkLightFor(EnumSkyBlock.SKY, new BlockPos(xBase, yMin - 1, zBase));
+ }
+
+ short emptySections = 0;
+
+ for (int sec = yMax >> 4; sec >= yMin >> 4; --sec) {
+ if (sections[sec] == null) {
+ emptySections |= (short) (1 << sec);
+ }
+ }
+
+ if (emptySections != 0) {
+ for (final EnumFacing facing : EnumFacing.HORIZONTALS) {
+ final int xOffset = facing.getFrontOffsetX();
+ final int zOffset = facing.getFrontOffsetZ();
+
+ final boolean neighborColumnExists = (((x + xOffset) | (z + zOffset)) & 16) == 0
+ // Checks whether the position is at the specified border (the 16 bit is set for
+ // both 15+1 and 0-1)
+ || worldObj.getChunkProvider().getLoadedChunk(xPosition + xOffset, zPosition + zOffset) != null;
+
+ if (neighborColumnExists) {
+ for (int sec = yMax >> 4; sec >= yMin >> 4; --sec) {
+ if ((emptySections & (1 << sec)) != 0)
+ alfheim$scheduleRelightChecksForColumn(EnumSkyBlock.SKY, xBase + xOffset, zBase + zOffset,
+ sec << 4, (sec << 4) + 15);
+ }
+ } else {
+ alfheim$initNeighborLightChecks();
+
+ final EnumFacing.AxisDirection axisDirection = ((facing.getAxis() == EnumFacing.Axis.X ? z : x)
+ & 15) < 8 ? EnumFacing.AxisDirection.NEGATIVE : EnumFacing.AxisDirection.POSITIVE;
+ alfheim$neighborLightChecks[alfheim$getFlagIndex(EnumSkyBlock.SKY, facing, axisDirection,
+ EnumBoundaryFacing.OUT)] |= emptySections;
+
+ setChunkModified();
+ }
+ }
+ }
+ }
+
+ public LightingEngine alfheim$getLightingEngine() {
+ return alfheim$lightingEngine;
+ }
+
+ public boolean alfheim$isLightInitialized() {
+ return alfheim$isLightInitialized;
+ }
+
+ public void alfheim$setLightInitialized(final boolean lightInitialized) {
+ alfheim$isLightInitialized = lightInitialized;
+ }
+
+ public void alfheim$setSkylightUpdatedPublic() {
+ func_177441_y();
+ }
+
+ public void alfheim$initNeighborLightChecks() {
+ if (alfheim$neighborLightChecks == null) {
+ alfheim$neighborLightChecks = new short[32];
+ }
+ }
+
+ public byte alfheim$getCachedLightFor(final EnumSkyBlock lightType, final BlockPos blockPos) {
+ final int x = blockPos.x & 15;
+ final int y = blockPos.y;
+ final int z = blockPos.z & 15;
+
+ final ExtendedBlockStorage extendedblockstorage = storageArrays[y >> 4];
+
+ if (extendedblockstorage == null)
+ return canSeeSky(blockPos) ? (byte) lightType.defaultLightValue : 0;
+ else if (lightType == EnumSkyBlock.SKY)
+ return !worldObj.provider.getHasNoSky() ? (byte) extendedblockstorage.getExtSkylightValue(x, y & 15, z) : 0;
+ else
+ return lightType == EnumSkyBlock.BLOCK ? (byte) extendedblockstorage.getExtBlocklightValue(x, y & 15, z)
+ : (byte) lightType.defaultLightValue;
+ }
> EOF

@ -11,4 +11,9 @@
> DELETE 5 @ 5 : 6
> INSERT 29 : 31 @ 29
+
+ Chunk getLoadedChunk(int var1, int var2);
> EOF

@ -11,23 +11,30 @@
> DELETE 3 @ 3 : 4
> DELETE 5 @ 5 : 7
> INSERT 2 : 3 @ 2
+ import net.minecraft.nbt.NBTTagShort;
> DELETE 3 @ 3 : 5
> CHANGE 4 : 6 @ 4 : 11
~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
> CHANGE 1 : 3 @ 1 : 7
> CHANGE 1 : 4 @ 1 : 7
~ public abstract class AnvilChunkLoader implements IChunkLoader {
~ private static final Logger logger = LogManager.getLogger("AnvilChunkLoader");
~ private static final String NEIGHBOR_LIGHT_CHECKS_KEY = "NeighborLightChecks";
> DELETE 1 @ 1 : 21
> CHANGE 24 : 25 @ 24 : 109
> CHANGE 24 : 27 @ 24 : 109
~ protected void writeChunkToNBT(Chunk chunkIn, World worldIn, NBTTagCompound parNBTTagCompound) {
~ alfheim$writeNeighborLightChecksToNBT(chunkIn, parNBTTagCompound);
~ parNBTTagCompound.setBoolean("LightPopulated", chunkIn.alfheim$isLightInitialized());
> CHANGE 80 : 81 @ 80 : 81
@ -42,4 +49,57 @@
~ protected Chunk readChunkFromNBT(World worldIn, NBTTagCompound parNBTTagCompound) {
> INSERT 102 : 105 @ 102
+ alfheim$readNeighborLightChecksFromNBT(chunk, parNBTTagCompound);
+ chunk.alfheim$setLightInitialized(parNBTTagCompound.getBoolean("LightPopulated"));
+
> INSERT 2 : 46 @ 2
+
+ private static void alfheim$readNeighborLightChecksFromNBT(final Chunk chunk, final NBTTagCompound compound) {
+ if (!compound.hasKey(NEIGHBOR_LIGHT_CHECKS_KEY, 9)) {
+ return;
+ }
+
+ final NBTTagList tagList = compound.getTagList(NEIGHBOR_LIGHT_CHECKS_KEY, 2);
+
+ if (tagList.tagCount() != 32) {
+ return;
+ }
+
+ chunk.alfheim$initNeighborLightChecks();
+
+ final short[] neighborLightChecks = chunk.alfheim$neighborLightChecks;
+
+ for (int i = 0; i < 32; ++i) {
+ neighborLightChecks[i] = ((NBTTagShort) tagList.get(i)).getShort();
+ }
+ }
+
+ private static void alfheim$writeNeighborLightChecksToNBT(final Chunk chunk, final NBTTagCompound compound) {
+ final short[] neighborLightChecks = chunk.alfheim$neighborLightChecks;
+
+ if (neighborLightChecks == null) {
+ return;
+ }
+
+ boolean empty = true;
+
+ final NBTTagList list = new NBTTagList();
+
+ for (final short flags : neighborLightChecks) {
+ list.appendTag(new NBTTagShort(flags));
+
+ if (flags != 0) {
+ empty = false;
+ }
+ }
+
+ if (!empty) {
+ compound.setTag(NEIGHBOR_LIGHT_CHECKS_KEY, list);
+ }
+ }
> EOF

@ -0,0 +1,59 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> INSERT 15 : 17 @ 15
+ private int alfheim$lightRefCount = -1;
+
> CHANGE 46 : 59 @ 46 : 47
~ if (blockRefCount != 0)
~ return false;
~
~ // -1 indicates the lightRefCount needs to be re-calculated
~ if (alfheim$lightRefCount == -1) {
~ if (alfheim$checkLightArrayEqual(skylightArray, (byte) 255)
~ && alfheim$checkLightArrayEqual(blocklightArray, (byte) 0))
~ alfheim$lightRefCount = 0; // Lighting is trivial, don't send to clients
~ else
~ alfheim$lightRefCount = 1; // Lighting is not trivial, send to clients
~ }
~
~ return alfheim$lightRefCount == 0;
> INSERT 12 : 13 @ 12
+ alfheim$lightRefCount = -1;
> INSERT 8 : 9 @ 8
+ alfheim$lightRefCount = -1;
> INSERT 44 : 45 @ 44
+ alfheim$lightRefCount = -1;
> INSERT 4 : 5 @ 4
+ alfheim$lightRefCount = -1;
> INSERT 1 : 12 @ 1
+
+ private boolean alfheim$checkLightArrayEqual(final NibbleArray storage, final byte targetValue) {
+ if (storage == null)
+ return true;
+
+ for (final byte currentByte : storage.getData())
+ if (currentByte != targetValue)
+ return false;
+
+ return true;
+ }
> EOF

@ -0,0 +1,15 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> INSERT 131 : 135 @ 131
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return provideChunk(var1, var2);
+ }
> EOF

@ -19,4 +19,11 @@
~ this.endRNG = new EaglercraftRandom(parLong1, !worldIn.getWorldInfo().isOldEaglercraftRandom());
> INSERT 246 : 250 @ 246
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return provideChunk(var1, var2);
+ }
> EOF

@ -55,4 +55,11 @@
~ for (int m = 0, n = this.structureGenerators.size(); m < n; ++m) {
~ this.structureGenerators.get(m).generate(this, this.worldObj, i, j, (ChunkPrimer) null);
> INSERT 7 : 11 @ 7
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return provideChunk(var1, var2);
+ }
> EOF

@ -37,4 +37,11 @@
~ this.ravineGenerator = new MapGenRavine(scramble);
~ this.oceanMonumentGenerator = new StructureOceanMonument(scramble);
> INSERT 421 : 425 @ 421
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return provideChunk(var1, var2);
+ }
> EOF

@ -27,4 +27,11 @@
~ this.genNetherBridge = new MapGenNetherBridge(scramble);
~ this.netherCaveGenerator = new MapGenCavesHell(scramble);
> INSERT 351 : 355 @ 351
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return provideChunk(var1, var2);
+ }
> EOF

@ -127,4 +127,11 @@
~ return this.id2ChunkMap.size();
> INSERT 8 : 12 @ 8
+
+ public Chunk getLoadedChunk(int var1, int var2) {
+ return this.id2ChunkMap.get(ChunkCoordIntPair.chunkXZ2Int(var1, var2));
+ }
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "black_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "black_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "black_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "black_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "black_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "black_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "black_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "black_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "blue_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "blue_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "blue_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "blue_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "blue_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "blue_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "blue_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "blue_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "brown_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "brown_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "brown_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "brown_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "brown_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "brown_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "brown_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "brown_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "cyan_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "cyan_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "cyan_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "cyan_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "cyan_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "cyan_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "cyan_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "cyan_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "gray_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "gray_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "gray_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "gray_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "gray_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "gray_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "gray_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "gray_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "green_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "green_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "green_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "green_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "green_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "green_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "green_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "green_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "light_blue_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "light_blue_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "light_blue_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "light_blue_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "light_blue_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "light_blue_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "light_blue_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "light_blue_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "lime_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "lime_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "lime_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "lime_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "lime_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "lime_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "lime_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "lime_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "magenta_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "magenta_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "magenta_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "magenta_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "magenta_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "magenta_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "magenta_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "magenta_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "orange_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "orange_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "orange_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "orange_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "orange_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "orange_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "orange_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "orange_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "pink_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "pink_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "pink_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "pink_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "pink_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "pink_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "pink_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "pink_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "purple_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "purple_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "purple_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "purple_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "purple_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "purple_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "purple_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "purple_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "red_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "red_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "red_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "red_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "red_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "red_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "red_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "red_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "silver_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "silver_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "silver_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "silver_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "silver_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "silver_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "silver_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "silver_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "white_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "white_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "white_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "white_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "white_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "white_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "white_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "white_pane_nse", "y": 270 },
> EOF

@ -0,0 +1,25 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 5 : 7 @ 5 : 7
~ "east=false,north=false,south=true,west=false": { "model": "yellow_pane_n", "y": 180 },
~ "east=false,north=false,south=false,west=true": { "model": "yellow_pane_n", "y": 270 },
> CHANGE 1 : 4 @ 1 : 4
~ "east=true,north=false,south=true,west=false": { "model": "yellow_pane_ne", "y": 90 },
~ "east=false,north=false,south=true,west=true": { "model": "yellow_pane_ne", "y": 180 },
~ "east=false,north=true,south=false,west=true": { "model": "yellow_pane_ne", "y": 270 },
> CHANGE 3 : 6 @ 3 : 6
~ "east=true,north=false,south=true,west=true": { "model": "yellow_pane_nse", "y": 90 },
~ "east=false,north=true,south=true,west=true": { "model": "yellow_pane_nse", "y": 180 },
~ "east=true,north=true,south=false,west=true": { "model": "yellow_pane_nse", "y": 270 },
> EOF

@ -1,6 +1,6 @@
# Eagler Context Redacted Diff
# Copyright (c) 2024 lax1dude. All rights reserved.
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
@ -257,7 +257,7 @@
+ eaglercraft.command.clientStub=This command is client side!
+
> INSERT 163 : 568 @ 163
> INSERT 163 : 574 @ 163
+ eaglercraft.singleplayer.busy.killTask=Cancel Task
+ eaglercraft.singleplayer.busy.cancelWarning=Are you sure?
@ -664,6 +664,12 @@
+ eaglercraft.options.vsyncReEnabled.3=VSync enabled causes bad input lag, sorry!
+ eaglercraft.options.vsyncReEnabled.continue=Continue
+
+ eaglercraft.options.connectedTexturesOF=Connected Textures
+ eaglercraft.options.betterGrassOF=Better Grass/Snow
+ eaglercraft.options.customSkiesOF=Custom Skies
+ eaglercraft.options.smartLeavesOF=Smart Leaves
+ eaglercraft.options.customItemsOF=Custom Items
+
> INSERT 18 : 19 @ 18

@ -0,0 +1,17 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 10 : 16 @ 10 : 16
~ "down": { "uv": [ 7, 0, 9, 9 ], "texture": "#edge" },
~ "up": { "uv": [ 7, 0, 9, 9 ], "texture": "#edge" },
~ "north": { "uv": [ 7, 0, 9, 16 ], "texture": "#edge", "cullface": "north" },
~ "south": { "uv": [ 7, 0, 9, 16 ], "texture": "#edge" },
~ "west": { "uv": [ 0, 0, 9, 16 ], "texture": "#pane" },
~ "east": { "uv": [ 7, 0, 16, 16 ], "texture": "#pane" }
> EOF

@ -0,0 +1,16 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 14 : 15 @ 14 : 15
~ "west": { "uv": [ 0, 0, 9, 16 ], "texture": "#pane" },
> CHANGE 9 : 10 @ 9 : 10
~ "north": { "uv": [ 0, 0, 7, 16 ], "texture": "#pane" },
> EOF

@ -0,0 +1,17 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 10 : 16 @ 10 : 16
~ "down": { "uv": [ 7, 0, 9, 16 ], "texture": "#edge", "cull": false },
~ "up": { "uv": [ 7, 0, 9, 16 ], "texture": "#edge", "cull": false },
~ "north": { "uv": [ 7, 0, 9, 16 ], "texture": "#edge" },
~ "south": { "uv": [ 7, 0, 9, 16 ], "texture": "#edge" },
~ "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pane", "cull": false },
~ "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#pane", "cull": false }
> EOF

@ -0,0 +1,16 @@
# Eagler Context Redacted Diff
# Copyright (c) 2025 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> CHANGE 14 : 15 @ 14 : 15
~ "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pane" },
> CHANGE 9 : 10 @ 9 : 10
~ "north": { "uv": [ 0, 0, 7, 16 ], "texture": "#pane" },
> EOF

@ -58,6 +58,8 @@ class OpenGLObjects {
static class TextureGL implements ITextureGL {
final int ptr;
int width;
int height;
TextureGL(int ptr) {
this.ptr = ptr;
@ -71,7 +73,23 @@ class OpenGLObjects {
public void free() {
PlatformOpenGL._wglDeleteTextures(this);
}
@Override
public void setCacheSize(int w, int h) {
width = w;
height = h;
}
@Override
public int getWidth() {
return width;
}
@Override
public int getHeight() {
return height;
}
}
static class ProgramGL implements IProgramGL {

@ -0,0 +1,496 @@
package dev.redstudio.alfheim.lighting;
import dev.redstudio.alfheim.utils.DeduplicatedLongQueue;
import dev.redstudio.redcore.math.ClampUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3i;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
/**
* Modified by lax1dude not to abuse interfaces
*
* @author Luna Lage (Desoroxxx)
* @author kappa-maintainer
* @author embeddedt
* @author Angeline (@jellysquid)
* @since 1.0
*/
public final class LightingEngine {
private static final byte MAX_LIGHT_LEVEL = 15;
private final World world;
// Layout of longs: [padding(4)] [y(8)] [x(26)] [z(26)]
private final DeduplicatedLongQueue[] lightUpdateQueues = new DeduplicatedLongQueue[EnumSkyBlock.values().length];
// Layout of longs: see above
private final DeduplicatedLongQueue[] darkeningQueues = new DeduplicatedLongQueue[MAX_LIGHT_LEVEL + 1];
private final DeduplicatedLongQueue[] brighteningQueues = new DeduplicatedLongQueue[MAX_LIGHT_LEVEL + 1];
// Layout of longs: [newLight(4)] [pos(60)]
private final DeduplicatedLongQueue initialBrightenings;
// Layout of longs: [padding(4)] [pos(60)]
private final DeduplicatedLongQueue initialDarkenings;
private boolean updating = false;
// Layout parameters
// Length of bit segments
private static final int L_X = 26, L_Y = 8, L_Z = 26, L_L = 4;
// Bit segment shifts/positions
private static final int S_Z = 0, S_X = S_Z + L_Z, S_Y = S_X + L_X, S_L = S_Y + L_Y;
// Bit segment masks
private static final long M_X = (1L << L_X) - 1, M_Y = (1L << L_Y) - 1, M_Z = (1L << L_Z) - 1,
M_L = (1L << L_L) - 1, M_POS = (M_Y << S_Y) | (M_X << S_X) | (M_Z << S_Z);
// Bit to check whether y had overflow
private static final long Y_CHECK = 1L << (S_Y + L_Y);
private static final long[] neighborShifts = new long[6];
static {
for (byte i = 0; i < 6; ++i) {
final Vec3i offset = EnumFacing._VALUES[i].getDirectionVec();
neighborShifts[i] = ((long) offset.getY() << S_Y) | ((long) offset.getX() << S_X)
| ((long) offset.getZ() << S_Z);
}
}
// Mask to extract chunk identifier
private static final long M_CHUNK = ((M_X >> 4) << (4 + S_X)) | ((M_Z >> 4) << (4 + S_Z));
// Iteration state data
// Cache position to avoid allocation of new object each time
private final BlockPos currentPos = new BlockPos();
private Chunk currentChunk;
private long currentChunkIdentifier;
private long currentData;
// Cached data about neighboring blocks (of tempPos)
private boolean isNeighborDataValid = false;
private final NeighborInfo[] neighborInfos = new NeighborInfo[6];
private DeduplicatedLongQueue currentQueue;
public LightingEngine(final World world) {
this.world = world;
initialBrightenings = new DeduplicatedLongQueue(16384);
initialDarkenings = new DeduplicatedLongQueue(16384);
for (int i = 0; i < EnumSkyBlock.values().length; ++i)
lightUpdateQueues[i] = new DeduplicatedLongQueue(16384);
for (int i = 0; i < darkeningQueues.length; ++i)
darkeningQueues[i] = new DeduplicatedLongQueue(16384);
for (int i = 0; i < brighteningQueues.length; ++i)
brighteningQueues[i] = new DeduplicatedLongQueue(16384);
for (int i = 0; i < neighborInfos.length; ++i)
neighborInfos[i] = new NeighborInfo();
}
/**
* Schedules a light update for the specified light type and position to be
* processed later by
* {@link LightingEngine#processLightUpdatesForType(EnumSkyBlock)}
*/
public void scheduleLightUpdate(final EnumSkyBlock lightType, final BlockPos pos) {
scheduleLightUpdate(lightType, encodeWorldCoord(pos));
}
/**
* Schedules a light update for the specified light type and position to be
* processed later by {@link LightingEngine#processLightUpdates()}
*/
private void scheduleLightUpdate(final EnumSkyBlock lightType, final long blockPos) {
lightUpdateQueues[lightType.ordinal()].enqueue(blockPos);
}
/**
* Calls {@link LightingEngine#processLightUpdatesForType(EnumSkyBlock)} for
* both light types
*/
public void processLightUpdates() {
processLightUpdatesForType(EnumSkyBlock.SKY);
processLightUpdatesForType(EnumSkyBlock.BLOCK);
}
/**
* Processes light updates of the given light type
*/
public void processLightUpdatesForType(final EnumSkyBlock lightType) {
final DeduplicatedLongQueue queue = lightUpdateQueues[lightType.ordinal()];
// Quickly check if the queue is empty before we acquire a more expensive lock.
if (queue.isEmpty())
return;
processLightUpdatesForTypeInner(lightType, queue);
}
private void processLightUpdatesForTypeInner(final EnumSkyBlock lightType, final DeduplicatedLongQueue queue) {
// Avoid nested calls
if (updating)
throw new IllegalStateException("Already processing updates!");
updating = true;
currentChunkIdentifier = -1; // Reset chunk cache
currentQueue = queue;
if (currentQueue != null)
currentQueue.newDeduplicationSet();
// Process the queued updates and enqueue them for further processing
while (nextItem()) {
if (currentChunk == null)
continue;
final byte oldLight = getCursorCachedLight(lightType);
final byte newLight = calculateNewLightFromCursor(lightType);
if (oldLight < newLight)
initialBrightenings.enqueue(((long) newLight << S_L) | currentData); // Don't enqueue directly for
// brightening to avoid
// duplicate scheduling
else if (oldLight > newLight)
initialDarkenings.enqueue(currentData); // Don't enqueue directly for darkening to avoid duplicate
// scheduling
}
currentQueue = initialBrightenings;
if (currentQueue != null)
currentQueue.newDeduplicationSet();
while (nextItem()) {
final byte newLight = (byte) (currentData >> S_L & M_L);
if (newLight > getCursorCachedLight(lightType))
enqueueBrightening(currentPos, currentData & M_POS, newLight, currentChunk, lightType); // Sets the
// light to
// newLight to
// only schedule
// once. Clear
// leading bits
// of curData
// for later
}
currentQueue = initialDarkenings;
if (currentQueue != null)
currentQueue.newDeduplicationSet();
while (nextItem()) {
final byte oldLight = getCursorCachedLight(lightType);
if (oldLight != 0)
enqueueDarkening(currentPos, currentData, oldLight, currentChunk, lightType); // Sets the light to zero
// to only schedule once
}
// Iterate through enqueued updates (brightening and darkening in parallel) from
// brightest to darkest so that we only need to iterate once
for (byte currentLight = MAX_LIGHT_LEVEL; currentLight >= 0; --currentLight) {
currentQueue = darkeningQueues[currentLight];
if (currentQueue != null)
currentQueue.newDeduplicationSet();
while (nextItem()) {
// Don't darken if we got brighter due to some other change
if (getCursorCachedLight(lightType) >= currentLight)
continue;
final IBlockState blockState = currentChunk.getBlockState(currentPos);
final byte luminosity = getCursorLuminosity(blockState, lightType);
final byte opacity; // If luminosity is high enough, opacity is irrelevant
if (luminosity >= MAX_LIGHT_LEVEL - 1)
opacity = 1;
else
opacity = getPosOpacity(currentPos, blockState);
// Only darken neighbors if we indeed became darker
if (calculateNewLightFromCursor(luminosity, opacity, lightType) < currentLight) {
// Need to calculate new light value from neighbors IGNORING neighbors which are
// scheduled for darkening
byte newLight = luminosity;
fetchNeighborDataFromCursor(lightType);
for (final NeighborInfo neighborInfo : neighborInfos) {
final Chunk neighborChunk = neighborInfo.chunk;
if (neighborChunk == null)
continue;
final byte neighborLight = neighborInfo.light;
if (neighborLight == 0)
continue;
final BlockPos neighborPos = neighborInfo.mutableBlockPos;
if (currentLight - getPosOpacity(neighborPos, neighborChunk
.getBlockState(neighborPos)) >= neighborLight) /*
* Schedule neighbor for darkening if we
* possibly light it
*/ {
enqueueDarkening(neighborPos, neighborInfo.key, neighborLight, neighborChunk, lightType);
} else /* Only use for new light calculation if not */ {
// If we can't darken the neighbor, no one else can (because of processing
// order) -> safe to let us be illuminated by it
newLight = (byte) Math.max(newLight, neighborLight - opacity);
}
}
// Schedule brightening since light level was set to 0
enqueueBrighteningFromCursor(newLight, lightType);
} else /*
* We didn't become darker, so we need to re-set our initial light value (was
* set to zero) and notify neighbors
*/ {
enqueueBrighteningFromCursor(currentLight, lightType); // Do not spread to neighbors immediately to
// avoid scheduling multiple times
}
}
currentQueue = brighteningQueues[currentLight];
if (currentQueue != null)
currentQueue.newDeduplicationSet();
while (nextItem()) {
final byte oldLight = getCursorCachedLight(lightType);
// Only process this if nothing else has happened at this position since
// scheduling
if (oldLight == currentLight) {
world.notifyLightSet(currentPos);
if (currentLight > 1)
spreadLightFromCursor(currentLight, lightType);
}
}
}
updating = false;
}
/**
* Gets data for neighbors of {@link #currentPos} and saves the results into
* neighbor state data members. If a neighbor can't be accessed/doesn't exist,
* the corresponding entry in neighborChunks is null - others are not reset
*/
private void fetchNeighborDataFromCursor(final EnumSkyBlock lightType) {
// Only update if curPos was changed
if (isNeighborDataValid)
return;
isNeighborDataValid = true;
for (int i = 0; i < neighborInfos.length; ++i) {
final NeighborInfo neighborInfo = neighborInfos[i];
final long neighborLongPos = neighborInfo.key = currentData + neighborShifts[i];
if ((neighborLongPos & Y_CHECK) != 0) {
neighborInfo.chunk = null;
continue;
}
final BlockPos neighborPos = decodeWorldCoord(neighborInfo.mutableBlockPos, neighborLongPos);
final Chunk neighborChunk;
if ((neighborLongPos & M_CHUNK) == currentChunkIdentifier)
neighborChunk = neighborInfo.chunk = currentChunk;
else
neighborChunk = neighborInfo.chunk = getChunk(neighborPos);
if (neighborChunk != null) {
final ExtendedBlockStorage neighborSection = neighborChunk
.getBlockStorageArray()[neighborPos.getY() >> 4];
neighborInfo.light = getCachedLightFor(neighborChunk, neighborSection, neighborPos, lightType);
}
}
}
private static byte getCachedLightFor(final Chunk chunk, final ExtendedBlockStorage storage,
final BlockPos blockPos, final EnumSkyBlock type) {
final int x = blockPos.getX() & 15;
final int y = blockPos.getY();
final int z = blockPos.getZ() & 15;
if (storage == null)
return type == EnumSkyBlock.SKY && chunk.canSeeSky(blockPos) ? (byte) type.defaultLightValue : 0;
else if (type == EnumSkyBlock.SKY)
return chunk.getWorld().provider.getHasNoSky() ? 0 : (byte) storage.getExtSkylightValue(x, y & 15, z);
else
return type == EnumSkyBlock.BLOCK ? (byte) storage.getExtBlocklightValue(x, y & 15, z)
: (byte) type.defaultLightValue;
}
private byte calculateNewLightFromCursor(final EnumSkyBlock lightType) {
final IBlockState blockState = currentChunk.getBlockState(currentPos);
final byte luminosity = getCursorLuminosity(blockState, lightType);
final byte opacity;
if (luminosity >= MAX_LIGHT_LEVEL - 1)
opacity = 1;
else
opacity = getPosOpacity(currentPos, blockState);
return calculateNewLightFromCursor(luminosity, opacity, lightType);
}
private byte calculateNewLightFromCursor(final byte luminosity, final byte opacity, final EnumSkyBlock lightType) {
if (luminosity >= MAX_LIGHT_LEVEL - opacity)
return luminosity;
byte newLight = luminosity;
fetchNeighborDataFromCursor(lightType);
for (final NeighborInfo neighborInfo : neighborInfos) {
if (neighborInfo.chunk == null)
continue;
newLight = (byte) Math.max(neighborInfo.light - opacity, newLight);
}
return newLight;
}
private void spreadLightFromCursor(final byte currentLight, final EnumSkyBlock lightType) {
fetchNeighborDataFromCursor(lightType);
for (final NeighborInfo neighborInfo : neighborInfos) {
final Chunk neighborChunk = neighborInfo.chunk;
if (neighborChunk == null || currentLight < neighborInfo.light)
continue;
final BlockPos neighborBlockPos = neighborInfo.mutableBlockPos;
final byte newLight = (byte) (currentLight
- getPosOpacity(neighborBlockPos, neighborChunk.getBlockState(neighborBlockPos)));
if (newLight > neighborInfo.light)
enqueueBrightening(neighborBlockPos, neighborInfo.key, newLight, neighborChunk, lightType);
}
}
private void enqueueBrighteningFromCursor(final byte newLight, final EnumSkyBlock lightType) {
enqueueBrightening(currentPos, currentData, newLight, currentChunk, lightType);
}
/**
* Enqueues the blockPos for brightening and sets its light value to newLight
*/
private void enqueueBrightening(final BlockPos blockPos, final long longPos, final byte newLight, final Chunk chunk,
final EnumSkyBlock lightType) {
brighteningQueues[newLight].enqueue(longPos);
chunk.setLightFor(lightType, blockPos, newLight);
}
/**
* Enqueues the blockPos for darkening and sets its light value to 0
*/
private void enqueueDarkening(final BlockPos blockPos, final long longPos, final byte oldLight, final Chunk chunk,
final EnumSkyBlock lightType) {
darkeningQueues[oldLight].enqueue(longPos);
chunk.setLightFor(lightType, blockPos, 0);
}
private static BlockPos decodeWorldCoord(final BlockPos mutableBlockPos, final long longPos) {
return mutableBlockPos.func_181079_c((int) (longPos >> S_X & M_X) - (1 << L_X - 1), (int) (longPos >> S_Y & M_Y),
(int) (longPos >> S_Z & M_Z) - (1 << L_Z - 1));
}
private static long encodeWorldCoord(final BlockPos pos) {
return ((long) pos.getY() << S_Y) | ((long) pos.getX() + (1 << L_X - 1) << S_X)
| ((long) pos.getZ() + (1 << L_Z - 1) << S_Z);
}
/**
* Polls a new item from {@link #currentQueue} and fills in state data members
*
* @return If there was an item to poll
*/
private boolean nextItem() {
if (currentQueue.isEmpty()) {
currentQueue = null;
return false;
}
currentData = currentQueue.dequeue();
isNeighborDataValid = false;
decodeWorldCoord(currentPos, currentData);
final long chunkIdentifier = currentData & M_CHUNK;
if (currentChunkIdentifier != chunkIdentifier) {
currentChunk = getChunk(currentPos);
currentChunkIdentifier = chunkIdentifier;
}
return true;
}
private byte getCursorCachedLight(final EnumSkyBlock lightType) {
return currentChunk.alfheim$getCachedLightFor(lightType, currentPos);
}
/**
* Calculates the luminosity for {@link #currentPos}, taking into account the
* light type
*/
private byte getCursorLuminosity(final IBlockState state, final EnumSkyBlock lightType) {
if (lightType == EnumSkyBlock.SKY) {
if (currentChunk.canSeeSky(currentPos))
return (byte) EnumSkyBlock.SKY.defaultLightValue;
else
return 0;
}
return (byte) ClampUtil.clampMinFirst(state.getBlock().getLightValue(), 0, MAX_LIGHT_LEVEL);
}
private byte getPosOpacity(final BlockPos blockPos, final IBlockState blockState) {
return (byte) ClampUtil.clampMinFirst(blockState.getBlock().getLightOpacity(), 1, MAX_LIGHT_LEVEL);
}
private Chunk getChunk(final BlockPos blockPos) {
return world.getChunkProvider().getLoadedChunk(blockPos.getX() >> 4, blockPos.getZ() >> 4);
}
private static final class NeighborInfo {
public final BlockPos mutableBlockPos = new BlockPos();
public Chunk chunk;
public byte light;
public long key;
}
}

@ -0,0 +1,75 @@
package dev.redstudio.alfheim.utils;
import com.carrotsearch.hppc.LongArrayDeque;
import com.carrotsearch.hppc.LongHashSet;
/**
* A queue implementation for long values that are deduplicated on addition.
* <p>
* This is achieved by storing the values in a {@link LongOpenHashSet} and a
* {@link LongArrayFIFOQueue}.
*
* @author Luna Lage (Desoroxxx)
* @since 1.3
*/
public final class DeduplicatedLongQueue {
// TODO: Fully Implement my own implementation to get rid of the downsides of
// reduce etc...
private final LongArrayDeque queue;
private LongHashSet set;
/**
* Creates a new deduplicated queue with the given capacity.
*
* @param capacity The capacity of the deduplicated queue
*/
public DeduplicatedLongQueue(final int capacity) {
set = new LongHashSet(capacity);
queue = new LongArrayDeque(capacity);
}
/**
* Adds a value to the queue.
*
* @param value The value to add to the queue
*/
public void enqueue(final long value) {
if (set.add(value))
queue.addLast(value);
}
/**
* Removes and returns the first value in the queue.
*
* @return The first value in the queue
*/
public long dequeue() {
return queue.removeFirst();
}
/**
* Returns whether the queue is empty.
*
* @return {@code true} if the queue is empty, {@code false} otherwise
*/
public boolean isEmpty() {
return queue.isEmpty();
}
/**
* Creates a new deduplication set.
*/
public void newDeduplicationSet() {
int i = queue.size();
if(i < 4) {
i = 4;
}
if((set.keys.length * 3 / 2) > i) {
set = new LongHashSet(i);
}else {
set.clear();
}
}
}

@ -0,0 +1,5 @@
package dev.redstudio.alfheim.utils;
public enum EnumBoundaryFacing {
IN, OUT
}

@ -0,0 +1,88 @@
package dev.redstudio.alfheim.utils;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
/**
* Represents a slice of a world containing a collection of chunks.
*
* @author Luna Lage (Desoroxxx)
* @author Angeline (@jellysquid)
* @since 1.0
*/
public class WorldChunkSlice {
private static final int DIAMETER = 5;
private static final int RADIUS = DIAMETER / 2;
private final int x, z;
private final Chunk[] chunks;
/**
* Initializes a {@link WorldChunkSlice} object using a given chunk provider and
* coordinates.
*
* @param chunkProvider The chunk provider to get chunks from
* @param x The X-coordinate of the center chunk
* @param z The Z-coordinate of the center chunk
*/
public WorldChunkSlice(final IChunkProvider chunkProvider, final int x, final int z) {
chunks = new Chunk[DIAMETER * DIAMETER];
for (int xDiff = -RADIUS; xDiff <= RADIUS; xDiff++)
for (int zDiff = -RADIUS; zDiff <= RADIUS; zDiff++)
chunks[((xDiff + RADIUS) * DIAMETER) + (zDiff + RADIUS)] = chunkProvider.getLoadedChunk(x + xDiff,
z + zDiff);
this.x = x - RADIUS;
this.z = z - RADIUS;
}
/**
* Checks if all chunks within a radius around a coordinate are loaded.
*
* @param x The X-coordinate to check around
* @param z The Z-coordinate to check around
* @param radius The radius around the coordinates to check
*
* @return true if all chunks are loaded, false otherwise
*/
public boolean isLoaded(final int x, final int z, final int radius) {
final int xStart = ((x - radius) >> 4) - this.x;
final int zStart = ((z - radius) >> 4) - this.z;
final int xEnd = ((x + radius) >> 4) - this.x;
final int zEnd = ((z + radius) >> 4) - this.z;
for (int currentX = xStart; currentX <= xEnd; ++currentX)
for (int currentZ = zStart; currentZ <= zEnd; ++currentZ)
if (getChunk(currentX, currentZ) == null)
return false;
return true;
}
/**
* Retrieves the chunk that includes the provided world coordinates.
*
* @param x The X-coordinate in the world
* @param z The Z-coordinate in the world
*
* @return The Chunk object that includes these coordinates
*/
public Chunk getChunkFromWorldCoords(final int x, final int z) {
return getChunk((x >> 4) - this.x, (z >> 4) - this.z);
}
/**
* Retrieves the chunk located at the given coordinates within this chunk slice.
*
* @param x The X-coordinate within the slice
* @param z The Z-coordinate within the slice
*
* @return The Chunk object at these coordinates
*/
private Chunk getChunk(final int x, final int z) {
return chunks[(x * DIAMETER) + z];
}
}

@ -0,0 +1,201 @@
package dev.redstudio.redcore.math;
public class ClampUtil {
/**
* Clamps a value within a specified range [min, max], checking for the minimum
* value first.
* <p>
* If the input is less than min, it returns min. If the input is greater than
* max, it returns max. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
*
* @return The clamped value
*/
public static byte clampMinFirst(final byte input, final byte min, final byte max) {
return input < min ? min : input > max ? max : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the minimum
* value first.
* <p>
* If the input is less than min, it returns min. If the input is greater than
* max, it returns max. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
*
* @return The clamped value
*/
public static short clampMinFirst(final short input, final short min, final short max) {
return input < min ? min : input > max ? max : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the minimum
* value first.
* <p>
* If the input is less than min, it returns min. If the input is greater than
* max, it returns max. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
*
* @return The clamped value
*/
public static int clampMinFirst(final int input, final int min, final int max) {
return input < min ? min : input > max ? max : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the minimum
* value first.
* <p>
* If the input is less than min, it returns min. If the input is greater than
* max, it returns max. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
*
* @return The clamped value
*/
public static long clampMinFirst(final long input, final long min, final long max) {
return input < min ? min : input > max ? max : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the minimum
* value first.
* <p>
* If the input is less than min, it returns min. If the input is greater than
* max, it returns max. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
*
* @return The clamped value
*/
public static float clampMinFirst(final float input, final float min, final float max) {
return input < min ? min : input > max ? max : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the minimum
* value first.
* <p>
* If the input is less than min, it returns min. If the input is greater than
* max, it returns max. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
*
* @return The clamped value
*/
public static double clampMinFirst(final double input, final double min, final double max) {
return input < min ? min : input > max ? max : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the maximum
* value first.
* <p>
* If the input is greater than max, it returns max. If the input is less than
* min, it returns min. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
* @return The clamped value
*/
public static byte clampMaxFirst(final byte input, final byte min, final byte max) {
return input > max ? max : input < min ? min : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the maximum
* value first.
* <p>
* If the input is greater than max, it returns max. If the input is less than
* min, it returns min. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
* @return The clamped value
*/
public static short clampMaxFirst(final short input, final short min, final short max) {
return input > max ? max : input < min ? min : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the maximum
* value first.
* <p>
* If the input is greater than max, it returns max. If the input is less than
* min, it returns min. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
* @return The clamped value
*/
public static int clampMaxFirst(final int input, final int min, final int max) {
return input > max ? max : input < min ? min : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the maximum
* value first.
* <p>
* If the input is greater than max, it returns max. If the input is less than
* min, it returns min. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
* @return The clamped value
*/
public static long clampMaxFirst(final long input, final long min, final long max) {
return input > max ? max : input < min ? min : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the maximum
* value first.
* <p>
* If the input is greater than max, it returns max. If the input is less than
* min, it returns min. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
* @return The clamped value
*/
public static float clampMaxFirst(final float input, final float min, final float max) {
return input > max ? max : input < min ? min : input;
}
/**
* Clamps a value within a specified range [min, max], checking for the maximum
* value first.
* <p>
* If the input is greater than max, it returns max. If the input is less than
* min, it returns min. Otherwise, it returns the input.
*
* @param input The input value to clamp
* @param min The minimum value to clamp to
* @param max The maximum value to clamp to
* @return The clamped value
*/
public static double clampMaxFirst(final double input, final double min, final double max) {
return input > max ? max : input < min ? min : input;
}
}

@ -35,7 +35,7 @@
package jdk_internal.bidi;
import jdk_internal.bidi.icu.text.BidiBase;
import jdk_internal.icu.text.BidiBase;
/**
* This class implements the Unicode Bidirectional Algorithm.

@ -37,7 +37,7 @@
package jdk_internal.bidi;
import jdk_internal.bidi.icu.text.NormalizerBase;
import jdk_internal.icu.text.NormalizerBase;
/**
* This class provides the method {@code normalize} which transforms Unicode

@ -25,8 +25,8 @@
package jdk_internal.bidi;
import jdk_internal.bidi.icu.lang.UCharacter;
import jdk_internal.bidi.icu.text.NormalizerBase;
import jdk_internal.icu.lang.UCharacter;
import jdk_internal.icu.text.NormalizerBase;
/**
* This Normalizer is for Unicode 3.2 support for IDNA only. Developers should

@ -32,10 +32,10 @@
******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import jdk_internal.bidi.icu.text.UnicodeSet.SpanCondition;
import jdk_internal.bidi.icu.util.OutputInt;
import jdk_internal.icu.text.UnicodeSet.SpanCondition;
import jdk_internal.icu.util.OutputInt;
/**
* Helper class for frozen UnicodeSets, implements contains() and span()

@ -30,12 +30,12 @@
******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.DataInputStream;
import java.io.InputStream;
import jdk_internal.bidi.icu.text.UTF16;
import jdk_internal.icu.text.UTF16;
import java.io.IOException;

@ -35,10 +35,10 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import jdk_internal.bidi.CharacterIterator;
import jdk_internal.bidi.icu.text.UCharacterIterator;
import jdk_internal.icu.text.UCharacterIterator;
/**
* This class is a wrapper around CharacterIterator and implements the

@ -30,7 +30,7 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.DataInputStream;
import java.io.InputStream;
@ -40,7 +40,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import jdk_internal.bidi.icu.util.VersionInfo;
import jdk_internal.icu.util.VersionInfo;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
public final class ICUBinary {

@ -30,11 +30,11 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.IOException;
import jdk_internal.bidi.icu.text.Normalizer2;
import jdk_internal.icu.text.Normalizer2;
public final class Norm2AllModes {
// Public API dispatch via Normalizer2 subclasses -------------------------- ***

@ -29,16 +29,16 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.IOException;
import java.nio.ByteBuffer;
import jdk_internal.bidi.icu.lang.UCharacter;
import jdk_internal.bidi.icu.text.Normalizer2;
import jdk_internal.bidi.icu.text.UTF16;
import jdk_internal.bidi.icu.util.CodePointTrie;
import jdk_internal.bidi.icu.util.VersionInfo;
import jdk_internal.icu.lang.UCharacter;
import jdk_internal.icu.text.Normalizer2;
import jdk_internal.icu.text.UTF16;
import jdk_internal.icu.util.CodePointTrie;
import jdk_internal.icu.util.VersionInfo;
// Original filename in ICU4J: Normalizer2Impl.java
public final class NormalizerImpl {

@ -37,12 +37,12 @@
// 2007-08-14 Martin Buchholz
// - remove redundant casts
//
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.text.ParseException;
import jdk_internal.bidi.icu.lang.UCharacter;
import jdk_internal.bidi.icu.text.UTF16;
import jdk_internal.icu.lang.UCharacter;
import jdk_internal.icu.text.UTF16;
/**
* Ported code from ICU punycode.c

@ -35,11 +35,11 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import jdk_internal.bidi.icu.text.Replaceable;
import jdk_internal.bidi.icu.text.ReplaceableString;
import jdk_internal.bidi.icu.text.UCharacterIterator;
import jdk_internal.icu.text.Replaceable;
import jdk_internal.icu.text.ReplaceableString;
import jdk_internal.icu.text.UCharacterIterator;
/**
* DLF docs must define behavior when Replaceable is mutated underneath the

@ -39,7 +39,7 @@
// - copy this file from icu4jsrc_3_2/src/com/ibm/icu/impl/StringPrepDataReader.java
// - move from package com.ibm.icu.impl to package sun.net.idn
//
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.DataInputStream;
import java.io.IOException;

@ -30,13 +30,13 @@
******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.DataInputStream;
import java.io.InputStream;
import jdk_internal.bidi.icu.lang.UCharacter;
import jdk_internal.bidi.icu.text.UTF16;
import jdk_internal.icu.lang.UCharacter;
import jdk_internal.icu.text.UTF16;
import java.io.IOException;

@ -30,7 +30,7 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.IOException;
import java.nio.ByteBuffer;

@ -30,7 +30,7 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.IOException;
import java.nio.ByteBuffer;

@ -41,11 +41,12 @@
* Java port of ubidi_props.h/.c.
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.IOException;
import java.nio.ByteBuffer;
import jdk_internal.bidi.icu.lang.UCharacter;
import jdk_internal.icu.lang.UCharacter;
public final class UBiDiProps {
// constructors etc. --------------------------------------------------- ***

@ -29,17 +29,17 @@
*******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Iterator;
import jdk_internal.bidi.icu.lang.UCharacter.HangulSyllableType;
import jdk_internal.bidi.icu.lang.UCharacter.NumericType;
import jdk_internal.bidi.icu.text.UTF16;
import jdk_internal.bidi.icu.text.UnicodeSet;
import jdk_internal.bidi.icu.util.VersionInfo;
import jdk_internal.icu.lang.UCharacter.HangulSyllableType;
import jdk_internal.icu.lang.UCharacter.NumericType;
import jdk_internal.icu.text.UTF16;
import jdk_internal.icu.text.UnicodeSet;
import jdk_internal.icu.util.VersionInfo;
/**
* <p>

@ -32,14 +32,14 @@
******************************************************************************
*/
package jdk_internal.bidi.icu.impl;
package jdk_internal.icu.impl;
import java.util.ArrayList;
import jdk_internal.bidi.icu.text.UTF16;
import jdk_internal.bidi.icu.text.UnicodeSet;
import jdk_internal.bidi.icu.text.UnicodeSet.SpanCondition;
import jdk_internal.bidi.icu.util.OutputInt;
import jdk_internal.icu.text.UTF16;
import jdk_internal.icu.text.UnicodeSet;
import jdk_internal.icu.text.UnicodeSet.SpanCondition;
import jdk_internal.icu.util.OutputInt;
/*
* Implement span() etc. for a set with strings.

Some files were not shown because too many files have changed in this diff Show More