diff --git a/src/main/java/io/github/cadiboo/nocubes/EventSubscriber.java b/src/main/java/io/github/cadiboo/nocubes/EventSubscriber.java index 30b55d3d..453ea6a1 100644 --- a/src/main/java/io/github/cadiboo/nocubes/EventSubscriber.java +++ b/src/main/java/io/github/cadiboo/nocubes/EventSubscriber.java @@ -2,10 +2,11 @@ import io.github.cadiboo.nocubes.util.ModReference; import io.github.cadiboo.nocubes.world.ModWorldEventListener; +import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; /** * Subscribe to events that should be handled on both PHYSICAL sides in this class @@ -16,8 +17,11 @@ public final class EventSubscriber { @SubscribeEvent public static void onWorldLoadEvent(final WorldEvent.Load event) { - final World world = event.getWorld(); - world.addEventListener(new ModWorldEventListener()); + final IWorld iworld = event.getWorld(); + //WTF + if (iworld instanceof World) { + ((World) iworld).addEventListener(new ModWorldEventListener()); + } } diff --git a/src/main/java/io/github/cadiboo/nocubes/NoCubes.java b/src/main/java/io/github/cadiboo/nocubes/NoCubes.java index f5f90fe0..888d0f00 100644 --- a/src/main/java/io/github/cadiboo/nocubes/NoCubes.java +++ b/src/main/java/io/github/cadiboo/nocubes/NoCubes.java @@ -1,30 +1,14 @@ package io.github.cadiboo.nocubes; import io.github.cadiboo.nocubes.config.ModConfig; -import io.github.cadiboo.nocubes.util.IProxy; import io.github.cadiboo.nocubes.util.ModProfiler; -import io.github.cadiboo.nocubes.util.ModUtil; -import net.minecraft.crash.CrashReport; -import net.minecraft.util.ReportedException; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.File; import java.util.ArrayList; -import static io.github.cadiboo.nocubes.util.ModReference.ACCEPTED_MINECRAFT_VERSIONS; -import static io.github.cadiboo.nocubes.util.ModReference.CERTIFICATE_FINGERPRINT; -import static io.github.cadiboo.nocubes.util.ModReference.CLIENT_PROXY_CLASS; -import static io.github.cadiboo.nocubes.util.ModReference.DEPENDENCIES; import static io.github.cadiboo.nocubes.util.ModReference.MOD_ID; -import static io.github.cadiboo.nocubes.util.ModReference.MOD_NAME; -import static io.github.cadiboo.nocubes.util.ModReference.SERVER_PROXY_CLASS; -import static io.github.cadiboo.nocubes.util.ModReference.UPDATE_JSON; -import static io.github.cadiboo.nocubes.util.ModReference.VERSION; @Mod(MOD_ID) public final class NoCubes { diff --git a/src/main/java/io/github/cadiboo/nocubes/client/ClientCacheUtil.java b/src/main/java/io/github/cadiboo/nocubes/client/ClientCacheUtil.java index 1bd9231c..fffe5fc7 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/ClientCacheUtil.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/ClientCacheUtil.java @@ -1,7 +1,7 @@ package io.github.cadiboo.nocubes.client; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IWorldReader; import javax.annotation.Nonnull; @@ -13,7 +13,7 @@ public final class ClientCacheUtil { public static PackedLightCache generatePackedLightCache( final int startPosX, final int startPosY, final int startPosZ, final int cacheSizeX, final int cacheSizeY, final int cacheSizeZ, - @Nonnull final IBlockAccess cache, + @Nonnull final IWorldReader cache, @Nonnull BlockPos.PooledMutableBlockPos pooledMutableBlockPos ) { final PackedLightCache pooledPackedLightCache = PackedLightCache.retain(cacheSizeX, cacheSizeY, cacheSizeZ); diff --git a/src/main/java/io/github/cadiboo/nocubes/client/ClientEventSubscriber.java b/src/main/java/io/github/cadiboo/nocubes/client/ClientEventSubscriber.java index e6c79d7c..f2bfe3fe 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/ClientEventSubscriber.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/ClientEventSubscriber.java @@ -1,30 +1,15 @@ package io.github.cadiboo.nocubes.client; -import com.google.common.collect.Lists; -import cpw.mods.modlauncher.Launcher; import io.github.cadiboo.nocubes.NoCubes; import io.github.cadiboo.nocubes.client.render.RenderDispatcher; -import io.github.cadiboo.nocubes.config.ModConfig; -import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkBlockEvent; -import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkPreEvent; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.util.math.RayTraceResult; -import net.minecraftforge.common.MinecraftForge; +import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildCanBlockBeRenderedEvent; +import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkPreRenderEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import java.util.ArrayList; - import static io.github.cadiboo.nocubes.util.ModReference.MOD_ID; -import static net.minecraft.util.math.RayTraceResult.Type.BLOCK; import static net.minecraftforge.api.distmarker.Dist.CLIENT; -import static net.minecraftforge.fml.relauncher.Side.CLIENT; /** * Subscribe to events that should be handled on the PHYSICAL CLIENT in this class @@ -35,7 +20,7 @@ public final class ClientEventSubscriber { @SubscribeEvent - public static void onRebuildChunkPreEvent(final RebuildChunkPreEvent event) { + public static void onRebuildChunkPreEvent(final RebuildChunkPreRenderEvent event) { if (!NoCubes.isEnabled()) { return; } @@ -43,7 +28,7 @@ public static void onRebuildChunkPreEvent(final RebuildChunkPreEvent event) { } @SubscribeEvent - public static void onRebuildChunkBlockEvent(final RebuildChunkBlockEvent event) { + public static void onRebuildChunkBlockEvent(final RebuildCanBlockBeRenderedEvent event) { if (!NoCubes.isEnabled()) { return; } diff --git a/src/main/java/io/github/cadiboo/nocubes/client/ClientProxy.java b/src/main/java/io/github/cadiboo/nocubes/client/ClientProxy.java index fecf7106..04f452b4 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/ClientProxy.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/ClientProxy.java @@ -3,11 +3,10 @@ import io.github.cadiboo.nocubes.NoCubes; import io.github.cadiboo.nocubes.util.IProxy; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.settings.KeyBinding; import net.minecraft.crash.CrashReport; -import net.minecraft.util.ReportedException; -import net.minecraftforge.client.settings.KeyConflictContext; +import net.minecraft.crash.ReportedException; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; @@ -25,7 +24,7 @@ public final class ClientProxy implements IProxy { private static final int KEY_CODE_N = 49; - public static final KeyBinding toggleSmoothableBlockstate = new KeyBinding(MOD_ID + ".key.toggleSmoothableBlockstate", KeyConflictContext.IN_GAME, KEY_CODE_N, "key.categories.misc"); + public static final KeyBinding toggleSmoothableBlockstate = new KeyBinding(MOD_ID + ".key.toggleSmoothableBlockstate", KEY_CODE_N, "key.categories.nocubes"); static { ClientRegistry.registerKeyBinding(toggleSmoothableBlockstate); @@ -34,7 +33,7 @@ public final class ClientProxy implements IProxy { static { try { RenderGlobal_markBlocksForUpdate = MethodHandles.publicLookup().unreflect( - ObfuscationReflectionHelper.findMethod(RenderGlobal.class, "func_184385_a", + ObfuscationReflectionHelper.findMethod(WorldRenderer.class, "func_184385_a", void.class, int.class, int.class, int.class, int.class, int.class, int.class, boolean.class ) @@ -49,21 +48,21 @@ public final class ClientProxy implements IProxy { @Override public void markBlocksForUpdate(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean updateImmediately) { - final RenderGlobal renderGlobal = Minecraft.getMinecraft().renderGlobal; - - if (renderGlobal.world == null || renderGlobal.viewFrustum == null) { - return; - } - - try { - RenderGlobal_markBlocksForUpdate.invokeExact(renderGlobal, minX, minY, minZ, maxX, maxY, maxZ, updateImmediately); - } catch (ReportedException e) { - throw e; - } catch (Throwable throwable) { - final CrashReport crashReport = new CrashReport("Exception invoking method RenderGlobal.markBlocksForUpdate", throwable); - crashReport.makeCategory("Reflectively Invoking Method"); - throw new ReportedException(crashReport); - } +// final WorldRenderer renderGlobal = Minecraft.getInstance().renderGlobal; +// +// if (renderGlobal.world == null || renderGlobal.viewFrustum == null) { +// return; +// } +// +// try { +// RenderGlobal_markBlocksForUpdate.invokeExact(renderGlobal, minX, minY, minZ, maxX, maxY, maxZ, updateImmediately); +// } catch (ReportedException e) { +// throw e; +// } catch (Throwable throwable) { +// final CrashReport crashReport = new CrashReport("Exception invoking method RenderGlobal.markBlocksForUpdate", throwable); +// crashReport.makeCategory("Reflectively Invoking Method"); +// throw new ReportedException(crashReport); +// } } } diff --git a/src/main/java/io/github/cadiboo/nocubes/client/ClientUtil.java b/src/main/java/io/github/cadiboo/nocubes/client/ClientUtil.java index 3e58474c..22e4b1dc 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/ClientUtil.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/ClientUtil.java @@ -36,7 +36,7 @@ import java.util.List; import java.util.Random; -import static io.github.cadiboo.renderchunkrebuildchunkhooks.hooks.RenderChunkRebuildChunkHooksHooks.renderChunk_preRenderBlocks; +import static io.github.cadiboo.renderchunkrebuildchunkhooks.util.Utils.renderChunk_preRenderBlocks; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.round; diff --git a/src/main/java/io/github/cadiboo/nocubes/client/OptifineCompatibility.java b/src/main/java/io/github/cadiboo/nocubes/client/OptifineCompatibility.java index e9a3a1e1..7a70ad3c 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/OptifineCompatibility.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/OptifineCompatibility.java @@ -1,14 +1,11 @@ package io.github.cadiboo.nocubes.client; -import io.github.cadiboo.nocubes.util.ReflectionHelper; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorldReader; -import net.minecraftforge.fml.common.Loader; import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; public final class OptifineCompatibility { @@ -20,57 +17,63 @@ public final class OptifineCompatibility { private static final MethodHandle POP_ENTITY; static { - Class optifineConfig = null; - MethodHandle configIsShaders = null; - Class SVertexBuilder = null; - MethodHandle pushEntity = null; - MethodHandle popEntity = null; - try { - optifineConfig = ReflectionHelper.getClass(Loader.instance().getModClassLoader(), "Config"); - } catch (ReflectionHelper.UnableToFindClassException e) { - //Optifine doesn't exist; - } - - if (optifineConfig != null) { - try { - configIsShaders = MethodHandles.publicLookup().unreflect(ReflectionHelper.findMethod(optifineConfig, "isShaders", null)); - } catch (ReflectionHelper.UnableToFindMethodException e) { - //Optifine doesn't exist; - } catch (IllegalAccessException e) { - //Wtf? - } - - try { - SVertexBuilder = ReflectionHelper.getClass(Loader.instance().getModClassLoader(), "net.optifine.shaders.SVertexBuilder"); - } catch (ReflectionHelper.UnableToFindClassException e) { - //Optifine doesn't exist; - } - - { - try { - pushEntity = MethodHandles.publicLookup().unreflect(ReflectionHelper.findMethod(SVertexBuilder, "pushEntity", null, IBlockState.class, BlockPos.class, IWorldReader.class, BufferBuilder.class)); - } catch (ReflectionHelper.UnableToFindMethodException e) { - //Optifine doesn't exist; - } catch (IllegalAccessException e) { - //Wtf? - } - } - - { - try { - popEntity = MethodHandles.publicLookup().unreflect(ReflectionHelper.findMethod(SVertexBuilder, "popEntity", null, BufferBuilder.class)); - } catch (ReflectionHelper.UnableToFindMethodException e) { - //Optifine doesn't exist; - } catch (IllegalAccessException e) { - //Wtf? - } - } - } - OPTIFINE_CONFIG = optifineConfig; - CONFIG_IS_SHADERS = configIsShaders; - S_VERTEX_BUILDER = SVertexBuilder; - PUSH_ENTITY = pushEntity; - POP_ENTITY = popEntity; +// Class optifineConfig = null; +// MethodHandle configIsShaders = null; +// Class SVertexBuilder = null; +// MethodHandle pushEntity = null; +// MethodHandle popEntity = null; +// try { +// optifineConfig = ReflectionHelper.getClass(Loader.instance().getModClassLoader(), "Config"); +// } catch (ReflectionHelper.UnableToFindClassException e) { +// //Optifine doesn't exist; +// } +// +// if (optifineConfig != null) { +// try { +// configIsShaders = MethodHandles.publicLookup().unreflect(ReflectionHelper.findMethod(optifineConfig, "isShaders", null)); +// } catch (ReflectionHelper.UnableToFindMethodException e) { +// //Optifine doesn't exist; +// } catch (IllegalAccessException e) { +// //Wtf? +// } +// +// try { +// SVertexBuilder = ReflectionHelper.getClass(Loader.instance().getModClassLoader(), "net.optifine.shaders.SVertexBuilder"); +// } catch (ReflectionHelper.UnableToFindClassException e) { +// //Optifine doesn't exist; +// } +// +// { +// try { +// pushEntity = MethodHandles.publicLookup().unreflect(ReflectionHelper.findMethod(SVertexBuilder, "pushEntity", null, IBlockState.class, BlockPos.class, IWorldReader.class, BufferBuilder.class)); +// } catch (ReflectionHelper.UnableToFindMethodException e) { +// //Optifine doesn't exist; +// } catch (IllegalAccessException e) { +// //Wtf? +// } +// } +// +// { +// try { +// popEntity = MethodHandles.publicLookup().unreflect(ReflectionHelper.findMethod(SVertexBuilder, "popEntity", null, BufferBuilder.class)); +// } catch (ReflectionHelper.UnableToFindMethodException e) { +// //Optifine doesn't exist; +// } catch (IllegalAccessException e) { +// //Wtf? +// } +// } +// } +// OPTIFINE_CONFIG = optifineConfig; +// CONFIG_IS_SHADERS = configIsShaders; +// S_VERTEX_BUILDER = SVertexBuilder; +// PUSH_ENTITY = pushEntity; +// POP_ENTITY = popEntity; + + OPTIFINE_CONFIG = null; + CONFIG_IS_SHADERS = null; + S_VERTEX_BUILDER = null; + PUSH_ENTITY = null; + POP_ENTITY = null; } diff --git a/src/main/java/io/github/cadiboo/nocubes/client/PackedLightCache.java b/src/main/java/io/github/cadiboo/nocubes/client/PackedLightCache.java index f4468cd0..29a97527 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/PackedLightCache.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/PackedLightCache.java @@ -1,15 +1,15 @@ package io.github.cadiboo.nocubes.client; import io.github.cadiboo.nocubes.util.XYZCache; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nonnull; /** * @author Cadiboo */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class PackedLightCache extends XYZCache { @Nonnull diff --git a/src/main/java/io/github/cadiboo/nocubes/client/render/ExtendedLiquidBlockRenderer.java b/src/main/java/io/github/cadiboo/nocubes/client/render/ExtendedLiquidBlockRenderer.java index a494534a..d7345c28 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/render/ExtendedLiquidBlockRenderer.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/render/ExtendedLiquidBlockRenderer.java @@ -1,20 +1,10 @@ package io.github.cadiboo.nocubes.client.render; -import io.github.cadiboo.nocubes.client.ClientUtil; -import net.minecraft.block.BlockFlowingFluid; -import net.minecraft.block.BlockFluid; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.color.BlockColors; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReaderBase; import javax.annotation.Nonnull; @@ -35,276 +25,279 @@ public static boolean renderExtendedLiquid( @Nonnull final IBlockState liquidState, @Nonnull final BufferBuilder bufferBuilder ) { - - final TextureAtlasSprite[] atlasSpritesLava = { - textureMap.getAtlasSprite("minecraft:blocks/lava_still"), - textureMap.getAtlasSprite("minecraft:blocks/lava_flow") - }; - final TextureAtlasSprite[] atlasSpritesWater = { - textureMap.getAtlasSprite("minecraft:blocks/water_still"), - textureMap.getAtlasSprite("minecraft:blocks/water_flow") - }; - final TextureAtlasSprite atlasSpriteWaterOverlay = textureMap.getAtlasSprite("minecraft:blocks/water_overlay"); - - BlockFlowingFluid blockliquid = (BlockFlowingFluid) liquidState.getBlock(); - boolean isLava = liquidState.getMaterial() == Material.LAVA; - TextureAtlasSprite[] sprites = isLava ? atlasSpritesLava : atlasSpritesWater; - - int colorMultiplier = blockColors.colorMultiplier(liquidState, blockAccess, liquidPos, 0); - float red = (float) (colorMultiplier >> 16 & 255) / 255.0F; - float green = (float) (colorMultiplier >> 8 & 255) / 255.0F; - float blue = (float) (colorMultiplier & 255) / 255.0F; - - boolean shouldRenderUp = liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.UP); - boolean shouldRenderDown = liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.DOWN); - boolean[] renderSides = new boolean[]{ - liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.NORTH), - liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.SOUTH), - liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.WEST), - liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.EAST) - }; - - if (!shouldRenderUp && !shouldRenderDown && !renderSides[0] && !renderSides[1] && !renderSides[2] && !renderSides[3]) { - return false; - } else { - boolean wasAnythingRendered = false; -// float f3 = 0.5F; -// float f4 = 1.0F; -// float f5 = 0.8F; -// float f6 = 0.6F; - Material material = liquidState.getMaterial(); - float fluidHeight = getFluidHeight(blockAccess, liquidPos, material); - float fluidHeightSouth = getFluidHeight(blockAccess, liquidPos.south(), material); - float fluidHeightEastSouth = getFluidHeight(blockAccess, liquidPos.east().south(), material); - float fluidHeightEast = getFluidHeight(blockAccess, liquidPos.east(), material); -// double x = (double) renderPos.getX(); -// double y = (double) renderPos.getY(); -// double z = (double) renderPos.getZ(); - final double x = renderPosX; - final double y = renderPosY; - final double z = renderPosZ; -// float f11 = 0.001F; - - if (shouldRenderUp) { - wasAnythingRendered |= renderFluidUp(blockAccess, liquidPos, material, liquidState, blockliquid, sprites, fluidHeight, fluidHeightSouth, fluidHeightEastSouth, fluidHeightEast, red, green, blue, bufferBuilder, x, y, z); - } - - if (shouldRenderDown) { - wasAnythingRendered |= renderFluidDown(sprites, liquidState, blockAccess, liquidPos, bufferBuilder, x, y, z); - } - - for (int posAddIndex = 0; posAddIndex < 4; ++posAddIndex) { - int addX = 0; - int addY = 0; - - if (posAddIndex == 0) { - --addY; - } - - if (posAddIndex == 1) { - ++addY; - } - - if (posAddIndex == 2) { - --addX; - } - - if (posAddIndex == 3) { - ++addX; - } - - BlockPos blockpos = liquidPos.add(addX, 0, addY); - TextureAtlasSprite textureatlassprite1 = sprites[1]; - - if (!isLava) { - IBlockState state = blockAccess.getBlockState(blockpos); - - if (state.getBlockFaceShape(blockAccess, blockpos, EnumFacing.VALUES[posAddIndex + 2].getOpposite()) == BlockFaceShape.SOLID) { - textureatlassprite1 = atlasSpriteWaterOverlay; - } - } - - if (renderSides[posAddIndex]) { - float yAdd_f39; - float yAdd_f40; - double x_d3; - double z_d4; - double x_d5; - double z_d6; - - if (posAddIndex == 0) { - yAdd_f39 = fluidHeight; - yAdd_f40 = fluidHeightEast; - x_d3 = x; - x_d5 = x + 1.0D; - z_d4 = z + 0.0010000000474974513D; - z_d6 = z + 0.0010000000474974513D; - } else if (posAddIndex == 1) { - yAdd_f39 = fluidHeightEastSouth; - yAdd_f40 = fluidHeightSouth; - x_d3 = x + 1.0D; - x_d5 = x; - z_d4 = z + 1.0D - 0.0010000000474974513D; - z_d6 = z + 1.0D - 0.0010000000474974513D; - } else if (posAddIndex == 2) { - yAdd_f39 = fluidHeightSouth; - yAdd_f40 = fluidHeight; - x_d3 = x + 0.0010000000474974513D; - x_d5 = x + 0.0010000000474974513D; - z_d4 = z + 1.0D; - z_d6 = z; - } else { - yAdd_f39 = fluidHeightEast; - yAdd_f40 = fluidHeightEastSouth; - x_d3 = x + 1.0D - 0.0010000000474974513D; - x_d5 = x + 1.0D - 0.0010000000474974513D; - z_d4 = z; - z_d6 = z + 1.0D; - } - - wasAnythingRendered = true; -// float u_f41 = textureatlassprite1.getInterpolatedU(0.0D); - final float u_f41 = ClientUtil.getMinU(textureatlassprite1); - float u_f27 = textureatlassprite1.getInterpolatedU(8.0D); - float f28 = textureatlassprite1.getInterpolatedV((double) ((1.0F - yAdd_f39) * 16.0F * 0.5F)); - float v_f29 = textureatlassprite1.getInterpolatedV((double) ((1.0F - yAdd_f40) * 16.0F * 0.5F)); - float v_f30 = textureatlassprite1.getInterpolatedV(8.0D); - int packedLightmapCoords = liquidState.getPackedLightmapCoords(blockAccess, blockpos); - int skyLight = packedLightmapCoords >> 16 & 65535; - int blockLight = packedLightmapCoords & 65535; - float colorFloatMultiplier = posAddIndex < 2 ? 0.8F : 0.6F; - float redFloat = 1.0F * colorFloatMultiplier * red; - float greenFloat = 1.0F * colorFloatMultiplier * green; - float blueFloat = 1.0F * colorFloatMultiplier * blue; - bufferBuilder.pos(x_d3, y + (double) yAdd_f39, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) f28).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x_d5, y + (double) yAdd_f40, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f29).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x_d5, y + 0.0D, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x_d3, y + 0.0D, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); - - if (textureatlassprite1 != atlasSpriteWaterOverlay) { - bufferBuilder.pos(x_d3, y + 0.0D, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x_d5, y + 0.0D, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x_d5, y + (double) yAdd_f40, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f29).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x_d3, y + (double) yAdd_f39, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) f28).lightmap(skyLight, blockLight).endVertex(); - } - } - } - - return wasAnythingRendered; - } - } - - private static boolean renderFluidUp(final IBlockAccess blockAccess, final BlockPos liquidPos, final Material material, final IBlockState liquidState, final BlockLiquid blockliquid, final TextureAtlasSprite[] sprites, float fluidHeight, float fluidHeightSouth, float fluidHeightEastSouth, float fluidHeightEast, final float red, final float green, final float blue, final BufferBuilder bufferBuilder, double x, double y, double z) { - float slopeAngle = BlockLiquid.getSlopeAngle(blockAccess, liquidPos, material, liquidState); - TextureAtlasSprite textureAtlasSprite = slopeAngle > -999.0F ? sprites[1] : sprites[0]; - fluidHeight -= 0.001F; - fluidHeightSouth -= 0.001F; - fluidHeightEastSouth -= 0.001F; - fluidHeightEast -= 0.001F; - float minU; - float u_f14; - float maxU; - float u_f16; - float minV; - float maxV; - float v_f19; - float v_f20; - - if (slopeAngle < -999.0F) { -// minU = textureAtlasSprite.getInterpolatedU(0.0D); - minU = ClientUtil.getMinU(textureAtlasSprite); -// minV = textureAtlasSprite.getInterpolatedV(0.0D); - minV = ClientUtil.getMinV(textureAtlasSprite); - u_f14 = minU; -// maxV = textureAtlasSprite.getInterpolatedV(16.0D); - maxV = ClientUtil.getMaxV(textureAtlasSprite); -// maxU = textureAtlasSprite.getInterpolatedU(16.0D); - maxU = ClientUtil.getMaxU(textureAtlasSprite); - v_f19 = maxV; - u_f16 = maxU; - v_f20 = minV; - } else { - float sinSlopeAngle = MathHelper.sin(slopeAngle) * 0.25F; - float cosSlopeAngle = MathHelper.cos(slopeAngle) * 0.25F; -// float f23 = 8.0F; - minU = textureAtlasSprite.getInterpolatedU((double) (8.0F + (-cosSlopeAngle - sinSlopeAngle) * 16.0F)); - minV = textureAtlasSprite.getInterpolatedV((double) (8.0F + (-cosSlopeAngle + sinSlopeAngle) * 16.0F)); - u_f14 = textureAtlasSprite.getInterpolatedU((double) (8.0F + (-cosSlopeAngle + sinSlopeAngle) * 16.0F)); - maxV = textureAtlasSprite.getInterpolatedV((double) (8.0F + (cosSlopeAngle + sinSlopeAngle) * 16.0F)); - maxU = textureAtlasSprite.getInterpolatedU((double) (8.0F + (cosSlopeAngle + sinSlopeAngle) * 16.0F)); - v_f19 = textureAtlasSprite.getInterpolatedV((double) (8.0F + (cosSlopeAngle - sinSlopeAngle) * 16.0F)); - u_f16 = textureAtlasSprite.getInterpolatedU((double) (8.0F + (cosSlopeAngle - sinSlopeAngle) * 16.0F)); - v_f20 = textureAtlasSprite.getInterpolatedV((double) (8.0F + (-cosSlopeAngle - sinSlopeAngle) * 16.0F)); - } - - int packedLightmapCoords = liquidState.getPackedLightmapCoords(blockAccess, liquidPos); - int skyLight = packedLightmapCoords >> 16 & 65535; - int blockLight = packedLightmapCoords & 65535; - float redFloat = 1.0F * red; - float greenFloat = 1.0F * green; - float blueFloat = 1.0F * blue; - bufferBuilder.pos(x + 0.0D, y + (double) fluidHeight, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) minU, (double) minV).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x + 0.0D, y + (double) fluidHeightSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f14, (double) maxV).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEastSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) maxU, (double) v_f19).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEast, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f16, (double) v_f20).lightmap(skyLight, blockLight).endVertex(); - - if (blockliquid.shouldRenderSides(blockAccess, liquidPos.up())) { - bufferBuilder.pos(x + 0.0D, y + (double) fluidHeight, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) minU, (double) minV).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEast, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f16, (double) v_f20).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEastSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) maxU, (double) v_f19).lightmap(skyLight, blockLight).endVertex(); - bufferBuilder.pos(x + 0.0D, y + (double) fluidHeightSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f14, (double) maxV).lightmap(skyLight, blockLight).endVertex(); - } - return true; - } - - private static boolean renderFluidDown(TextureAtlasSprite[] sprites, IBlockState blockStateIn, IBlockAccess blockAccess, BlockPos liquidPos, BufferBuilder bufferBuilderIn, double x, double y, double z) { - float minU = sprites[0].getMinU(); - float maxU = sprites[0].getMaxU(); - float minV = sprites[0].getMinV(); - float maxV = sprites[0].getMaxV(); - int packedLightmapCoords = blockStateIn.getPackedLightmapCoords(blockAccess, liquidPos.down()); - int skyLight = packedLightmapCoords >> 16 & 65535; - int blockLight = packedLightmapCoords & 65535; - bufferBuilderIn.pos(x, y, z + 1.0D).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) minU, (double) maxV).lightmap(skyLight, blockLight).endVertex(); - bufferBuilderIn.pos(x, y, z).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) minU, (double) minV).lightmap(skyLight, blockLight).endVertex(); - bufferBuilderIn.pos(x + 1.0D, y, z).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) maxU, (double) minV).lightmap(skyLight, blockLight).endVertex(); - bufferBuilderIn.pos(x + 1.0D, y, z + 1.0D).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) maxU, (double) maxV).lightmap(skyLight, blockLight).endVertex(); - return true; - } - - private static float getFluidHeight(IWorldReader blockAccess, BlockPos blockPosIn, Material blockMaterial) { - int divisor = 0; - float liquidHeightPercentage = 0.0F; - - for (int posAdd = 0; posAdd < 4; ++posAdd) { - BlockPos blockpos = blockPosIn.add(-(posAdd & 1), 0, -(posAdd >> 1 & 1)); - - if (blockAccess.getBlockState(blockpos.up()).getMaterial() == blockMaterial) { - return 1.0F; - } - - IBlockState iblockstate = blockAccess.getBlockState(blockpos); - Material material = iblockstate.getMaterial(); - - if (material != blockMaterial) { - if (!material.isSolid()) { - ++liquidHeightPercentage; - ++divisor; - } - } else { - int liquidLevel = iblockstate.get(BlockFlowingFluid.LEVEL); - - if (liquidLevel >= 8 || liquidLevel == 0) { - liquidHeightPercentage += BlockFlowingFluid.getLiquidHeightPercent(liquidLevel) * 10.0F; - divisor += 10; - } - - liquidHeightPercentage += BlockLiquid.getLiquidHeightPercent(liquidLevel); - ++divisor; - } - } - - return 1.0F - liquidHeightPercentage / (float) divisor; +// +// final TextureAtlasSprite[] atlasSpritesLava = { +// textureMap.getAtlasSprite("minecraft:blocks/lava_still"), +// textureMap.getAtlasSprite("minecraft:blocks/lava_flow") +// }; +// final TextureAtlasSprite[] atlasSpritesWater = { +// textureMap.getAtlasSprite("minecraft:blocks/water_still"), +// textureMap.getAtlasSprite("minecraft:blocks/water_flow") +// }; +// final TextureAtlasSprite atlasSpriteWaterOverlay = textureMap.getAtlasSprite("minecraft:blocks/water_overlay"); +// +// BlockFlowingFluid blockliquid = (BlockFlowingFluid) liquidState.getBlock(); +// boolean isLava = liquidState.getMaterial() == Material.LAVA; +// TextureAtlasSprite[] sprites = isLava ? atlasSpritesLava : atlasSpritesWater; +// +// int colorMultiplier = blockColors.getColor(liquidState, blockAccess, liquidPos, 0); +// float red = (float) (colorMultiplier >> 16 & 255) / 255.0F; +// float green = (float) (colorMultiplier >> 8 & 255) / 255.0F; +// float blue = (float) (colorMultiplier & 255) / 255.0F; +// +// boolean shouldRenderUp = liquidState.sh(blockAccess, liquidPos, EnumFacing.UP); +// boolean shouldRenderDown = liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.DOWN); +// boolean[] renderSides = new boolean[]{ +// liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.NORTH), +// liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.SOUTH), +// liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.WEST), +// liquidState.shouldSideBeRendered(blockAccess, liquidPos, EnumFacing.EAST) +// }; +// +// if (!shouldRenderUp && !shouldRenderDown && !renderSides[0] && !renderSides[1] && !renderSides[2] && !renderSides[3]) { +// return false; +// } else { +// boolean wasAnythingRendered = false; +//// float f3 = 0.5F; +//// float f4 = 1.0F; +//// float f5 = 0.8F; +//// float f6 = 0.6F; +// Material material = liquidState.getMaterial(); +// float fluidHeight = getFluidHeight(blockAccess, liquidPos, material); +// float fluidHeightSouth = getFluidHeight(blockAccess, liquidPos.south(), material); +// float fluidHeightEastSouth = getFluidHeight(blockAccess, liquidPos.east().south(), material); +// float fluidHeightEast = getFluidHeight(blockAccess, liquidPos.east(), material); +//// double x = (double) renderPos.getX(); +//// double y = (double) renderPos.getY(); +//// double z = (double) renderPos.getZ(); +// final double x = renderPosX; +// final double y = renderPosY; +// final double z = renderPosZ; +//// float f11 = 0.001F; +// +// if (shouldRenderUp) { +// wasAnythingRendered |= renderFluidUp(blockAccess, liquidPos, material, liquidState, blockliquid, sprites, fluidHeight, fluidHeightSouth, fluidHeightEastSouth, fluidHeightEast, red, green, blue, bufferBuilder, x, y, z); +// } +// +// if (shouldRenderDown) { +// wasAnythingRendered |= renderFluidDown(sprites, liquidState, blockAccess, liquidPos, bufferBuilder, x, y, z); +// } +// +// for (int posAddIndex = 0; posAddIndex < 4; ++posAddIndex) { +// int addX = 0; +// int addY = 0; +// +// if (posAddIndex == 0) { +// --addY; +// } +// +// if (posAddIndex == 1) { +// ++addY; +// } +// +// if (posAddIndex == 2) { +// --addX; +// } +// +// if (posAddIndex == 3) { +// ++addX; +// } +// +// BlockPos blockpos = liquidPos.add(addX, 0, addY); +// TextureAtlasSprite textureatlassprite1 = sprites[1]; +// +// if (!isLava) { +// IBlockState state = blockAccess.getBlockState(blockpos); +// +// if (state.getBlockFaceShape(blockAccess, blockpos, EnumFacing.VALUES[posAddIndex + 2].getOpposite()) == BlockFaceShape.SOLID) { +// textureatlassprite1 = atlasSpriteWaterOverlay; +// } +// } +// +// if (renderSides[posAddIndex]) { +// float yAdd_f39; +// float yAdd_f40; +// double x_d3; +// double z_d4; +// double x_d5; +// double z_d6; +// +// if (posAddIndex == 0) { +// yAdd_f39 = fluidHeight; +// yAdd_f40 = fluidHeightEast; +// x_d3 = x; +// x_d5 = x + 1.0D; +// z_d4 = z + 0.0010000000474974513D; +// z_d6 = z + 0.0010000000474974513D; +// } else if (posAddIndex == 1) { +// yAdd_f39 = fluidHeightEastSouth; +// yAdd_f40 = fluidHeightSouth; +// x_d3 = x + 1.0D; +// x_d5 = x; +// z_d4 = z + 1.0D - 0.0010000000474974513D; +// z_d6 = z + 1.0D - 0.0010000000474974513D; +// } else if (posAddIndex == 2) { +// yAdd_f39 = fluidHeightSouth; +// yAdd_f40 = fluidHeight; +// x_d3 = x + 0.0010000000474974513D; +// x_d5 = x + 0.0010000000474974513D; +// z_d4 = z + 1.0D; +// z_d6 = z; +// } else { +// yAdd_f39 = fluidHeightEast; +// yAdd_f40 = fluidHeightEastSouth; +// x_d3 = x + 1.0D - 0.0010000000474974513D; +// x_d5 = x + 1.0D - 0.0010000000474974513D; +// z_d4 = z; +// z_d6 = z + 1.0D; +// } +// +// wasAnythingRendered = true; +//// float u_f41 = textureatlassprite1.getInterpolatedU(0.0D); +// final float u_f41 = ClientUtil.getMinU(textureatlassprite1); +// float u_f27 = textureatlassprite1.getInterpolatedU(8.0D); +// float f28 = textureatlassprite1.getInterpolatedV((double) ((1.0F - yAdd_f39) * 16.0F * 0.5F)); +// float v_f29 = textureatlassprite1.getInterpolatedV((double) ((1.0F - yAdd_f40) * 16.0F * 0.5F)); +// float v_f30 = textureatlassprite1.getInterpolatedV(8.0D); +// int packedLightmapCoords = liquidState.getPackedLightmapCoords(blockAccess, blockpos); +// int skyLight = packedLightmapCoords >> 16 & 65535; +// int blockLight = packedLightmapCoords & 65535; +// float colorFloatMultiplier = posAddIndex < 2 ? 0.8F : 0.6F; +// float redFloat = 1.0F * colorFloatMultiplier * red; +// float greenFloat = 1.0F * colorFloatMultiplier * green; +// float blueFloat = 1.0F * colorFloatMultiplier * blue; +// bufferBuilder.pos(x_d3, y + (double) yAdd_f39, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) f28).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x_d5, y + (double) yAdd_f40, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f29).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x_d5, y + 0.0D, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x_d3, y + 0.0D, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); +// +// if (textureatlassprite1 != atlasSpriteWaterOverlay) { +// bufferBuilder.pos(x_d3, y + 0.0D, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x_d5, y + 0.0D, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f30).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x_d5, y + (double) yAdd_f40, z_d6).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f27, (double) v_f29).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x_d3, y + (double) yAdd_f39, z_d4).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f41, (double) f28).lightmap(skyLight, blockLight).endVertex(); +// } +// } +// } +// +// return wasAnythingRendered; +// } +// } +// +// private static boolean renderFluidUp(final IBlockAccess blockAccess, final BlockPos liquidPos, final Material material, final IBlockState liquidState, final BlockLiquid blockliquid, final TextureAtlasSprite[] sprites, float fluidHeight, float fluidHeightSouth, float fluidHeightEastSouth, float fluidHeightEast, final float red, final float green, final float blue, final BufferBuilder bufferBuilder, double x, double y, double z) { +// float slopeAngle = BlockLiquid.getSlopeAngle(blockAccess, liquidPos, material, liquidState); +// TextureAtlasSprite textureAtlasSprite = slopeAngle > -999.0F ? sprites[1] : sprites[0]; +// fluidHeight -= 0.001F; +// fluidHeightSouth -= 0.001F; +// fluidHeightEastSouth -= 0.001F; +// fluidHeightEast -= 0.001F; +// float minU; +// float u_f14; +// float maxU; +// float u_f16; +// float minV; +// float maxV; +// float v_f19; +// float v_f20; +// +// if (slopeAngle < -999.0F) { +//// minU = textureAtlasSprite.getInterpolatedU(0.0D); +// minU = ClientUtil.getMinU(textureAtlasSprite); +//// minV = textureAtlasSprite.getInterpolatedV(0.0D); +// minV = ClientUtil.getMinV(textureAtlasSprite); +// u_f14 = minU; +//// maxV = textureAtlasSprite.getInterpolatedV(16.0D); +// maxV = ClientUtil.getMaxV(textureAtlasSprite); +//// maxU = textureAtlasSprite.getInterpolatedU(16.0D); +// maxU = ClientUtil.getMaxU(textureAtlasSprite); +// v_f19 = maxV; +// u_f16 = maxU; +// v_f20 = minV; +// } else { +// float sinSlopeAngle = MathHelper.sin(slopeAngle) * 0.25F; +// float cosSlopeAngle = MathHelper.cos(slopeAngle) * 0.25F; +//// float f23 = 8.0F; +// minU = textureAtlasSprite.getInterpolatedU((double) (8.0F + (-cosSlopeAngle - sinSlopeAngle) * 16.0F)); +// minV = textureAtlasSprite.getInterpolatedV((double) (8.0F + (-cosSlopeAngle + sinSlopeAngle) * 16.0F)); +// u_f14 = textureAtlasSprite.getInterpolatedU((double) (8.0F + (-cosSlopeAngle + sinSlopeAngle) * 16.0F)); +// maxV = textureAtlasSprite.getInterpolatedV((double) (8.0F + (cosSlopeAngle + sinSlopeAngle) * 16.0F)); +// maxU = textureAtlasSprite.getInterpolatedU((double) (8.0F + (cosSlopeAngle + sinSlopeAngle) * 16.0F)); +// v_f19 = textureAtlasSprite.getInterpolatedV((double) (8.0F + (cosSlopeAngle - sinSlopeAngle) * 16.0F)); +// u_f16 = textureAtlasSprite.getInterpolatedU((double) (8.0F + (cosSlopeAngle - sinSlopeAngle) * 16.0F)); +// v_f20 = textureAtlasSprite.getInterpolatedV((double) (8.0F + (-cosSlopeAngle - sinSlopeAngle) * 16.0F)); +// } +// +// int packedLightmapCoords = liquidState.getPackedLightmapCoords(blockAccess, liquidPos); +// int skyLight = packedLightmapCoords >> 16 & 65535; +// int blockLight = packedLightmapCoords & 65535; +// float redFloat = 1.0F * red; +// float greenFloat = 1.0F * green; +// float blueFloat = 1.0F * blue; +// bufferBuilder.pos(x + 0.0D, y + (double) fluidHeight, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) minU, (double) minV).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x + 0.0D, y + (double) fluidHeightSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f14, (double) maxV).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEastSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) maxU, (double) v_f19).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEast, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f16, (double) v_f20).lightmap(skyLight, blockLight).endVertex(); +// +// if (blockliquid.shouldRenderSides(blockAccess, liquidPos.up())) { +// bufferBuilder.pos(x + 0.0D, y + (double) fluidHeight, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) minU, (double) minV).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEast, z + 0.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f16, (double) v_f20).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x + 1.0D, y + (double) fluidHeightEastSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) maxU, (double) v_f19).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilder.pos(x + 0.0D, y + (double) fluidHeightSouth, z + 1.0D).color(redFloat, greenFloat, blueFloat, 1.0F).tex((double) u_f14, (double) maxV).lightmap(skyLight, blockLight).endVertex(); +// } +// return true; +// } +// +// private static boolean renderFluidDown(TextureAtlasSprite[] sprites, IBlockState blockStateIn, IBlockAccess blockAccess, BlockPos liquidPos, BufferBuilder bufferBuilderIn, double x, double y, double z) { +// float minU = sprites[0].getMinU(); +// float maxU = sprites[0].getMaxU(); +// float minV = sprites[0].getMinV(); +// float maxV = sprites[0].getMaxV(); +// int packedLightmapCoords = blockStateIn.getPackedLightmapCoords(blockAccess, liquidPos.down()); +// int skyLight = packedLightmapCoords >> 16 & 65535; +// int blockLight = packedLightmapCoords & 65535; +// bufferBuilderIn.pos(x, y, z + 1.0D).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) minU, (double) maxV).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilderIn.pos(x, y, z).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) minU, (double) minV).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilderIn.pos(x + 1.0D, y, z).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) maxU, (double) minV).lightmap(skyLight, blockLight).endVertex(); +// bufferBuilderIn.pos(x + 1.0D, y, z + 1.0D).color(0.5F, 0.5F, 0.5F, 1.0F).tex((double) maxU, (double) maxV).lightmap(skyLight, blockLight).endVertex(); +// return true; +// } +// +// private static float getFluidHeight(IWorldReader blockAccess, BlockPos blockPosIn, Material blockMaterial) { +// int divisor = 0; +// float liquidHeightPercentage = 0.0F; +// +// for (int posAdd = 0; posAdd < 4; ++posAdd) { +// BlockPos blockpos = blockPosIn.add(-(posAdd & 1), 0, -(posAdd >> 1 & 1)); +// +// if (blockAccess.getBlockState(blockpos.up()).getMaterial() == blockMaterial) { +// return 1.0F; +// } +// +// IBlockState iblockstate = blockAccess.getBlockState(blockpos); +// Material material = iblockstate.getMaterial(); +// +// if (material != blockMaterial) { +// if (!material.isSolid()) { +// ++liquidHeightPercentage; +// ++divisor; +// } +// } else { +// int liquidLevel = iblockstate.get(BlockFlowingFluid.LEVEL); +// +// if (liquidLevel >= 8 || liquidLevel == 0) { +// liquidHeightPercentage += BlockFlowingFluid.getLiquidHeightPercent(liquidLevel) * 10.0F; +// divisor += 10; +// } +// +// liquidHeightPercentage += BlockLiquid.getLiquidHeightPercent(liquidLevel); +// ++divisor; +// } +// } +// +// return 1.0F - liquidHeightPercentage / (float) divisor; +// } + + return false; } } diff --git a/src/main/java/io/github/cadiboo/nocubes/client/render/RenderDispatcher.java b/src/main/java/io/github/cadiboo/nocubes/client/render/RenderDispatcher.java index 3aeb4259..509f7099 100644 --- a/src/main/java/io/github/cadiboo/nocubes/client/render/RenderDispatcher.java +++ b/src/main/java/io/github/cadiboo/nocubes/client/render/RenderDispatcher.java @@ -5,28 +5,26 @@ import io.github.cadiboo.nocubes.client.ClientUtil; import io.github.cadiboo.nocubes.client.ExtendLiquidRange; import io.github.cadiboo.nocubes.client.PackedLightCache; -import io.github.cadiboo.nocubes.client.render.ExtendedLiquidChunkRenderer; -import io.github.cadiboo.nocubes.client.render.MeshRenderer; import io.github.cadiboo.nocubes.config.ModConfig; import io.github.cadiboo.nocubes.mesh.MeshGenerator; import io.github.cadiboo.nocubes.util.CacheUtil; import io.github.cadiboo.nocubes.util.ModProfiler; import io.github.cadiboo.nocubes.util.SmoothableCache; import io.github.cadiboo.nocubes.util.StateCache; -import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkBlockEvent; -import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkPreEvent; +import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildCanBlockBeRenderedEvent; +import io.github.cadiboo.renderchunkrebuildchunkhooks.event.RebuildChunkPreRenderEvent; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; +import net.minecraft.client.renderer.chunk.ChunkRenderTask; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; +import net.minecraft.crash.ReportedException; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.ReportedException; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IWorldReader; import static io.github.cadiboo.nocubes.config.ModConfig.approximateLighting; import static io.github.cadiboo.nocubes.util.ModUtil.LEAVES_SMOOTHABLE; @@ -40,12 +38,12 @@ public class RenderDispatcher { private static final ThreadLocal USED_RENDER_LAYERS = ThreadLocal.withInitial(() -> new boolean[BlockRenderLayer.values().length]); private static final ThreadLocal USED_RENDER_LAYERS_SET = ThreadLocal.withInitial(() -> false); - public static void renderChunk(final RebuildChunkPreEvent event) { + public static void renderChunk(final RebuildChunkPreRenderEvent event) { final RenderChunk renderChunk = event.getRenderChunk(); - final ChunkCompileTaskGenerator generator = event.getGenerator(); + final ChunkRenderTask generator = event.getGenerator(); final CompiledChunk compiledChunk = event.getCompiledChunk(); - final BlockPos renderChunkPosition = event.getRenderChunkPosition(); - final IBlockAccess blockAccess = event.getIBlockAccess(); + final BlockPos renderChunkPosition = event.getRenderChunkStartPosition(); + final IWorldReader blockAccess = event.getRenderChunkCache(); final int meshSizeX; final int meshSizeY; @@ -65,8 +63,7 @@ public static void renderChunk(final RebuildChunkPreEvent event) { final int renderChunkPositionY = renderChunkPosition.getY(); final int renderChunkPositionZ = renderChunkPosition.getZ(); - final BlockPos.PooledMutableBlockPos pooledMutableBlockPos = BlockPos.PooledMutableBlockPos.retain(); - try { + try (final BlockPos.PooledMutableBlockPos pooledMutableBlockPos = BlockPos.PooledMutableBlockPos.retain()) { renderChunk( renderChunk, generator, @@ -77,25 +74,23 @@ public static void renderChunk(final RebuildChunkPreEvent event) { pooledMutableBlockPos, meshSizeX, meshSizeY, meshSizeZ ); - } finally { - pooledMutableBlockPos.release(); } } private static void renderChunk( final RenderChunk renderChunk, - final ChunkCompileTaskGenerator generator, + final ChunkRenderTask generator, final CompiledChunk compiledChunk, final BlockPos renderChunkPosition, final int renderChunkPositionX, final int renderChunkPositionY, final int renderChunkPositionZ, - final IBlockAccess blockAccess, + final IWorldReader blockAccess, final BlockPos.PooledMutableBlockPos pooledMutableBlockPos, final int meshSizeX, final int meshSizeY, final int meshSizeZ ) { final ModProfiler profiler = NoCubes.getProfiler(); final boolean[] usedBlockRenderLayers = USED_RENDER_LAYERS.get(); USED_RENDER_LAYERS_SET.set(false); - final BlockRendererDispatcher blockRendererDispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + final BlockRendererDispatcher blockRendererDispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); { // for(MeshLayer layer : meshLayers) @@ -185,7 +180,7 @@ private static void renderChunk( private static StateCache generateMeshAndLightStateCache( final int renderChunkPositionX, final int renderChunkPositionY, final int renderChunkPositionZ, final int meshSizeX, final int meshSizeY, final int meshSizeZ, - final IBlockAccess blockAccess, + final IWorldReader blockAccess, final BlockPos.PooledMutableBlockPos pooledMutableBlockPos ) { // Density takes +1 block on every negative axis into account so we need to start at -1 block @@ -214,7 +209,7 @@ private static StateCache generateMeshAndLightStateCache( private static StateCache generateExtendedWaterStateCache( final int renderChunkPositionX, final int renderChunkPositionY, final int renderChunkPositionZ, - final IBlockAccess blockAccess, + final IWorldReader blockAccess, final BlockPos.PooledMutableBlockPos pooledMutableBlockPos, final int extendLiquidsRange ) { @@ -239,7 +234,7 @@ private static StateCache generateExtendedWaterStateCache( ); } - public static void renderBlock(final RebuildChunkBlockEvent event) { + public static void renderBlock(final RebuildCanBlockBeRenderedEvent event) { try { if (!USED_RENDER_LAYERS_SET.get()) { for (int ordinal = 0; ordinal < BlockRenderLayer.values().length; ++ordinal) { diff --git a/src/main/java/io/github/cadiboo/nocubes/config/ModConfig.java b/src/main/java/io/github/cadiboo/nocubes/config/ModConfig.java index 120bcd43..01f75ec9 100644 --- a/src/main/java/io/github/cadiboo/nocubes/config/ModConfig.java +++ b/src/main/java/io/github/cadiboo/nocubes/config/ModConfig.java @@ -1,76 +1,64 @@ package io.github.cadiboo.nocubes.config; -import io.github.cadiboo.nocubes.NoCubes; import io.github.cadiboo.nocubes.client.ExtendLiquidRange; import io.github.cadiboo.nocubes.mesh.MeshGenerator; -import net.minecraft.block.Block; -import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockMycelium; -import net.minecraft.block.BlockRedSandstone; -import net.minecraft.block.BlockSand; -import net.minecraft.block.BlockSandStone; -import net.minecraft.block.BlockSilverfish; -import net.minecraft.block.BlockSnow; -import net.minecraft.block.BlockStainedHardenedClay; -import net.minecraft.block.BlockStone; +import net.minecraft.block.BlockSnowLayer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandBase; -import net.minecraft.command.InvalidBlockStateException; -import net.minecraft.command.NumberInvalidException; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.config.Config; -import net.minecraftforge.common.config.Config.LangKey; -import net.minecraftforge.common.config.ConfigManager; -import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; -import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.HashSet; -import static io.github.cadiboo.nocubes.util.ModReference.MOD_ID; +import static net.minecraft.init.Blocks.ANDESITE; import static net.minecraft.init.Blocks.BEDROCK; +import static net.minecraft.init.Blocks.BLACK_TERRACOTTA; +import static net.minecraft.init.Blocks.BROWN_TERRACOTTA; import static net.minecraft.init.Blocks.CLAY; import static net.minecraft.init.Blocks.COAL_ORE; +import static net.minecraft.init.Blocks.COARSE_DIRT; import static net.minecraft.init.Blocks.DIAMOND_ORE; +import static net.minecraft.init.Blocks.DIORITE; import static net.minecraft.init.Blocks.DIRT; import static net.minecraft.init.Blocks.EMERALD_ORE; import static net.minecraft.init.Blocks.END_STONE; import static net.minecraft.init.Blocks.GLOWSTONE; import static net.minecraft.init.Blocks.GOLD_ORE; -import static net.minecraft.init.Blocks.GRASS; +import static net.minecraft.init.Blocks.GRANITE; +import static net.minecraft.init.Blocks.GRASS_BLOCK; import static net.minecraft.init.Blocks.GRASS_PATH; import static net.minecraft.init.Blocks.GRAVEL; -import static net.minecraft.init.Blocks.HARDENED_CLAY; +import static net.minecraft.init.Blocks.GRAY_TERRACOTTA; +import static net.minecraft.init.Blocks.INFESTED_CHISELED_STONE_BRICKS; +import static net.minecraft.init.Blocks.INFESTED_COBBLESTONE; +import static net.minecraft.init.Blocks.INFESTED_CRACKED_STONE_BRICKS; +import static net.minecraft.init.Blocks.INFESTED_MOSSY_STONE_BRICKS; +import static net.minecraft.init.Blocks.INFESTED_STONE; +import static net.minecraft.init.Blocks.INFESTED_STONE_BRICKS; import static net.minecraft.init.Blocks.IRON_ORE; import static net.minecraft.init.Blocks.LAPIS_ORE; -import static net.minecraft.init.Blocks.LIT_REDSTONE_ORE; -import static net.minecraft.init.Blocks.MAGMA; -import static net.minecraft.init.Blocks.MONSTER_EGG; +import static net.minecraft.init.Blocks.MAGMA_BLOCK; import static net.minecraft.init.Blocks.MYCELIUM; import static net.minecraft.init.Blocks.NETHERRACK; -import static net.minecraft.init.Blocks.QUARTZ_ORE; +import static net.minecraft.init.Blocks.NETHER_QUARTZ_ORE; +import static net.minecraft.init.Blocks.ORANGE_TERRACOTTA; +import static net.minecraft.init.Blocks.PODZOL; +import static net.minecraft.init.Blocks.POLISHED_ANDESITE; +import static net.minecraft.init.Blocks.POLISHED_DIORITE; +import static net.minecraft.init.Blocks.POLISHED_GRANITE; import static net.minecraft.init.Blocks.REDSTONE_ORE; +import static net.minecraft.init.Blocks.RED_SAND; import static net.minecraft.init.Blocks.RED_SANDSTONE; +import static net.minecraft.init.Blocks.RED_TERRACOTTA; import static net.minecraft.init.Blocks.SAND; import static net.minecraft.init.Blocks.SANDSTONE; import static net.minecraft.init.Blocks.SNOW; -import static net.minecraft.init.Blocks.SNOW_LAYER; +import static net.minecraft.init.Blocks.SNOW_BLOCK; import static net.minecraft.init.Blocks.SOUL_SAND; -import static net.minecraft.init.Blocks.STAINED_HARDENED_CLAY; import static net.minecraft.init.Blocks.STONE; -import static net.minecraft.item.EnumDyeColor.BLACK; -import static net.minecraft.item.EnumDyeColor.BROWN; -import static net.minecraft.item.EnumDyeColor.ORANGE; -import static net.minecraft.item.EnumDyeColor.RED; -import static net.minecraft.item.EnumDyeColor.SILVER; -import static net.minecraft.item.EnumDyeColor.WHITE; -import static net.minecraft.item.EnumDyeColor.YELLOW; +import static net.minecraft.init.Blocks.TERRACOTTA; +import static net.minecraft.init.Blocks.WHITE_TERRACOTTA; +import static net.minecraft.init.Blocks.YELLOW_TERRACOTTA; /** * Our Mod's configuration @@ -78,53 +66,53 @@ * @author Cadiboo */ @SuppressWarnings("WeakerAccess") -@Config(modid = MOD_ID) -@LangKey(MOD_ID + ".config.title") +//@Config(modid = MOD_ID) +//@LangKey(MOD_ID + ".config.title") public final class ModConfig { - @Config.Ignore + // @Config.Ignore private static final transient HashSet SMOOTHABLE_BLOCK_STATES_CACHE = new HashSet<>(); - @LangKey(MOD_ID + ".config.isEnabled") + // @LangKey(MOD_ID + ".config.isEnabled") public static boolean isEnabled = true; - @LangKey(MOD_ID + ".config.meshGenerator") + // @LangKey(MOD_ID + ".config.meshGenerator") public static MeshGenerator meshGenerator = MeshGenerator.SurfaceNets; - @LangKey(MOD_ID + ".config.reloadChunksOnConfigChange") + // @LangKey(MOD_ID + ".config.reloadChunksOnConfigChange") public static boolean reloadChunksOnConfigChange = true; - @LangKey(MOD_ID + ".config.smoothableBlockStates") + // @LangKey(MOD_ID + ".config.smoothableBlockStates") public static String[] smoothableBlockStates; // @LangKey(MOD_ID + ".config.isosurfaceLevel") // @Config.RangeDouble(min = -10, max = 10) - @Config.Ignore +// @Config.Ignore public static double isosurfaceLevel = 1.0D; // @LangKey(MOD_ID + ".config.offsetVertices") - @Config.Ignore +// @Config.Ignore public static boolean offsetVertices = false; // @LangKey(MOD_ID + ".config.offsetAmmount") // @Config.RangeDouble(min = -10, max = 10) - @Config.Ignore +// @Config.Ignore public static double offsetAmmount = 0.5F; - @LangKey(MOD_ID + ".config.approximateLighting") + // @LangKey(MOD_ID + ".config.approximateLighting") public static boolean approximateLighting = true; - @LangKey(MOD_ID + ".config.smoothLeavesSeparate") + // @LangKey(MOD_ID + ".config.smoothLeavesSeparate") public static boolean smoothLeavesSeparate = true; - @LangKey(MOD_ID + ".config.extendLiquids") + // @LangKey(MOD_ID + ".config.extendLiquids") public static ExtendLiquidRange extendLiquids = ExtendLiquidRange.OneBlock; - @Config.Ignore + // @Config.Ignore //yenah i dont like it //TODO: remove public static boolean renderEmptyBlocksOrWhatever = false; - @Config.Ignore + // @Config.Ignore // @Config.RangeDouble(min = -10, max = 10) public static double smoothOtherBlocksAmount = 0.0F; @@ -151,83 +139,82 @@ public static MeshGenerator getMeshGenerator() { return meshGenerator; } - @Mod.EventBusSubscriber(modid = MOD_ID) - private static class ConfigEventSubscriber { - - /** - * Inject the new values and save to the config file when the config has been changed from the GUI. - * - * @param event The event - */ - @SubscribeEvent - public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) { - - if (event.getModID().equals(MOD_ID)) { - ConfigManager.sync(MOD_ID, Config.Type.INSTANCE); - - if (reloadChunksOnConfigChange) { - if (Minecraft.getMinecraft().renderGlobal != null) { - Minecraft.getMinecraft().renderGlobal.loadRenderers(); - } - } - - SMOOTHABLE_BLOCK_STATES_CACHE.clear(); - - final IForgeRegistry BLOCKS = ForgeRegistries.BLOCKS; - - for (String blockStateString : smoothableBlockStates) { - final String[] splitBlockStateString = StringUtils.split(blockStateString, "["); - final String blockString = splitBlockStateString[0]; - final String stateString; - if (splitBlockStateString.length == 1) { - stateString = "default"; - } else if (splitBlockStateString.length == 2) { - stateString = StringUtils.reverse(StringUtils.reverse(StringUtils.split(blockStateString, "[")[1]).replaceFirst("]", "")); - } else { - NoCubes.NO_CUBES_LOG.error("Block/Blockstate Parsing error for \"" + blockStateString + "\""); - continue; - } - - final Block block = BLOCKS.getValue(new ResourceLocation(blockString)); - if (block == null) { - NoCubes.NO_CUBES_LOG.error("Block Parsing error NullPointerException for \"" + blockString + "\""); - continue; - } - try { - SMOOTHABLE_BLOCK_STATES_CACHE.add(CommandBase.convertArgToBlockState(block, stateString)); - } catch (NumberInvalidException | InvalidBlockStateException e) { - NoCubes.NO_CUBES_LOG.error("Blockstate Parsing error " + e + " for \"" + stateString + "\""); - continue; - } - - } - - } - - } - - } +// @Mod.EventBusSubscriber(modid = MOD_ID) +// private static class ConfigEventSubscriber { +// +// /** +// * Inject the new values and save to the config file when the config has been changed from the GUI. +// * +// * @param event The event +// */ +// @SubscribeEvent +// public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) { +// +// if (event.getModID().equals(MOD_ID)) { +// ConfigManager.sync(MOD_ID, Config.Type.INSTANCE); +// +// if (reloadChunksOnConfigChange) { +// if (Minecraft.getMinecraft().renderGlobal != null) { +// Minecraft.getMinecraft().renderGlobal.loadRenderers(); +// } +// } +// +// SMOOTHABLE_BLOCK_STATES_CACHE.clear(); +// +// final IForgeRegistry BLOCKS = ForgeRegistries.BLOCKS; +// +// for (String blockStateString : smoothableBlockStates) { +// final String[] splitBlockStateString = StringUtils.split(blockStateString, "["); +// final String blockString = splitBlockStateString[0]; +// final String stateString; +// if (splitBlockStateString.length == 1) { +// stateString = "default"; +// } else if (splitBlockStateString.length == 2) { +// stateString = StringUtils.reverse(StringUtils.reverse(StringUtils.split(blockStateString, "[")[1]).replaceFirst("]", "")); +// } else { +// NoCubes.NO_CUBES_LOG.error("Block/Blockstate Parsing error for \"" + blockStateString + "\""); +// continue; +// } +// +// final Block block = BLOCKS.getValue(new ResourceLocation(blockString)); +// if (block == null) { +// NoCubes.NO_CUBES_LOG.error("Block Parsing error NullPointerException for \"" + blockString + "\""); +// continue; +// } +// try { +// SMOOTHABLE_BLOCK_STATES_CACHE.add(CommandBase.convertArgToBlockState(block, stateString)); +// } catch (NumberInvalidException | InvalidBlockStateException e) { +// NoCubes.NO_CUBES_LOG.error("Blockstate Parsing error " + e + " for \"" + stateString + "\""); +// continue; +// } +// +// } +// +// } +// +// } +// +// } private static void setupSmoothableBlockStates() { final IBlockState[] defaultSmoothableBlockStates = new IBlockState[]{ - GRASS.getDefaultState().withProperty(BlockGrass.SNOWY, true), - GRASS.getDefaultState().withProperty(BlockGrass.SNOWY, false), - - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.STONE), - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE), - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE_SMOOTH), - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE), - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE_SMOOTH), - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), - STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE_SMOOTH), + GRASS_BLOCK.getDefaultState().with(BlockGrass.SNOWY, true), + GRASS_BLOCK.getDefaultState().with(BlockGrass.SNOWY, false), - SAND.getDefaultState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.SAND), - SAND.getDefaultState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND), + STONE.getDefaultState(), + GRANITE.getDefaultState(), + POLISHED_GRANITE.getDefaultState(), + DIORITE.getDefaultState(), + POLISHED_DIORITE.getDefaultState(), + ANDESITE.getDefaultState(), + POLISHED_ANDESITE.getDefaultState(), - SANDSTONE.getDefaultState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT), + SAND.getDefaultState(), + RED_SAND.getDefaultState(), - RED_SANDSTONE.getDefaultState().withProperty(BlockRedSandstone.TYPE, BlockRedSandstone.EnumType.DEFAULT), + SANDSTONE.getDefaultState(), + RED_SANDSTONE.getDefaultState(), GRAVEL.getDefaultState(), @@ -235,58 +222,57 @@ private static void setupSmoothableBlockStates() { IRON_ORE.getDefaultState(), GOLD_ORE.getDefaultState(), REDSTONE_ORE.getDefaultState(), - LIT_REDSTONE_ORE.getDefaultState(), DIAMOND_ORE.getDefaultState(), LAPIS_ORE.getDefaultState(), EMERALD_ORE.getDefaultState(), - QUARTZ_ORE.getDefaultState(), + NETHER_QUARTZ_ORE.getDefaultState(), - MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONE), - MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.COBBLESTONE), - MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONEBRICK), - MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.MOSSY_STONEBRICK), - MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.CRACKED_STONEBRICK), - MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.CHISELED_STONEBRICK), + INFESTED_STONE.getDefaultState(), + INFESTED_COBBLESTONE.getDefaultState(), + INFESTED_STONE_BRICKS.getDefaultState(), + INFESTED_MOSSY_STONE_BRICKS.getDefaultState(), + INFESTED_CRACKED_STONE_BRICKS.getDefaultState(), + INFESTED_CHISELED_STONE_BRICKS.getDefaultState(), GRASS_PATH.getDefaultState(), - DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), - DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT), - DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL), + DIRT.getDefaultState(), + COARSE_DIRT.getDefaultState(), + PODZOL.getDefaultState(), CLAY.getDefaultState(), - HARDENED_CLAY.getDefaultState(), - - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, WHITE), - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, ORANGE), - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, YELLOW), - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, SILVER), - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, BROWN), - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, RED), - STAINED_HARDENED_CLAY.getDefaultState().withProperty(BlockStainedHardenedClay.COLOR, BLACK), - - SNOW.getDefaultState(), - - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 1), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 2), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 3), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 4), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 5), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 6), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 7), - SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 8), + TERRACOTTA.getDefaultState(), + + WHITE_TERRACOTTA.getDefaultState(), + ORANGE_TERRACOTTA.getDefaultState(), + YELLOW_TERRACOTTA.getDefaultState(), + GRAY_TERRACOTTA.getDefaultState(), + BROWN_TERRACOTTA.getDefaultState(), + RED_TERRACOTTA.getDefaultState(), + BLACK_TERRACOTTA.getDefaultState(), + + SNOW_BLOCK.getDefaultState(), + + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 1), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 2), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 3), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 4), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 5), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 6), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 7), + SNOW.getDefaultState().with(BlockSnowLayer.LAYERS, 8), BEDROCK.getDefaultState(), NETHERRACK.getDefaultState(), SOUL_SAND.getDefaultState(), - MAGMA.getDefaultState(), + MAGMA_BLOCK.getDefaultState(), GLOWSTONE.getDefaultState(), END_STONE.getDefaultState(), - MYCELIUM.getDefaultState().withProperty(BlockMycelium.SNOWY, true), - MYCELIUM.getDefaultState().withProperty(BlockMycelium.SNOWY, false), + MYCELIUM.getDefaultState().with(BlockMycelium.SNOWY, true), + MYCELIUM.getDefaultState().with(BlockMycelium.SNOWY, false), }; diff --git a/src/main/java/io/github/cadiboo/nocubes/unusedpools/PooledPackedLightCache.java b/src/main/java/io/github/cadiboo/nocubes/unusedpools/PooledPackedLightCache.java index b8304a40..43815d79 100644 --- a/src/main/java/io/github/cadiboo/nocubes/unusedpools/PooledPackedLightCache.java +++ b/src/main/java/io/github/cadiboo/nocubes/unusedpools/PooledPackedLightCache.java @@ -1,7 +1,5 @@ package io.github.cadiboo.nocubes.unusedpools; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.logging.log4j.LogManager; import java.util.ArrayList; @@ -9,7 +7,6 @@ /** * @author Cadiboo */ -@SideOnly(Side.CLIENT) public class PooledPackedLightCache implements AutoCloseable { private int[] packedLightCache; diff --git a/src/main/java/io/github/cadiboo/nocubes/util/ReflectionUtil.java b/src/main/java/io/github/cadiboo/nocubes/util/ReflectionUtil.java index 7c61f8b0..277ee4ac 100644 --- a/src/main/java/io/github/cadiboo/nocubes/util/ReflectionUtil.java +++ b/src/main/java/io/github/cadiboo/nocubes/util/ReflectionUtil.java @@ -2,8 +2,7 @@ import com.google.common.base.Preconditions; import net.minecraft.crash.CrashReport; -import net.minecraft.util.ReportedException; -import net.minecraftforge.fml.relauncher.ReflectionHelper; +import net.minecraft.crash.ReportedException; import org.apache.commons.lang3.StringUtils; import javax.annotation.Nonnull; diff --git a/src/main/java/io/github/cadiboo/nocubes/world/ModWorldEventListener.java b/src/main/java/io/github/cadiboo/nocubes/world/ModWorldEventListener.java index ca632a24..24c71ba5 100644 --- a/src/main/java/io/github/cadiboo/nocubes/world/ModWorldEventListener.java +++ b/src/main/java/io/github/cadiboo/nocubes/world/ModWorldEventListener.java @@ -1,14 +1,14 @@ package io.github.cadiboo.nocubes.world; -import io.github.cadiboo.nocubes.NoCubes; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.particles.IParticleData; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldEventListener; -import net.minecraft.world.World; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -22,14 +22,14 @@ public class ModWorldEventListener implements IWorldEventListener { private static final int BLOCK_UPDATE_EXTEND = 2; @Override - public void notifyBlockUpdate(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, int flags) { - if (!NoCubes.isEnabled()) { - return; - } - int k1 = pos.getX(); - int l1 = pos.getY(); - int i2 = pos.getZ(); - NoCubes.proxy.markBlocksForUpdate(k1 - BLOCK_UPDATE_EXTEND, l1 - BLOCK_UPDATE_EXTEND, i2 - BLOCK_UPDATE_EXTEND, k1 + BLOCK_UPDATE_EXTEND, l1 + BLOCK_UPDATE_EXTEND, i2 + BLOCK_UPDATE_EXTEND, (flags & 8) != 0); + public void notifyBlockUpdate(@Nonnull IBlockReader worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, int flags) { +// if (!NoCubes.isEnabled()) { +// return; +// } +// int k1 = pos.getX(); +// int l1 = pos.getY(); +// int i2 = pos.getZ(); +// NoCubes.proxy.markBlocksForUpdate(k1 - BLOCK_UPDATE_EXTEND, l1 - BLOCK_UPDATE_EXTEND, i2 - BLOCK_UPDATE_EXTEND, k1 + BLOCK_UPDATE_EXTEND, l1 + BLOCK_UPDATE_EXTEND, i2 + BLOCK_UPDATE_EXTEND, (flags & 8) != 0); } @Override @@ -53,12 +53,12 @@ public void playRecord(@Nonnull final SoundEvent soundIn, @Nonnull final BlockPo } @Override - public void spawnParticle(final int particleID, final boolean ignoreRange, final double xCoord, final double yCoord, final double zCoord, final double xSpeed, final double ySpeed, final double zSpeed, @Nonnull final int... parameters) { + public void addParticle(@Nonnull final IParticleData particleData, final boolean alwaysRender, final double x, final double y, final double z, final double xSpeed, final double ySpeed, final double zSpeed) { } @Override - public void spawnParticle(final int id, final boolean ignoreRange, final boolean minimiseParticleLevel, final double x, final double y, final double z, final double xSpeed, final double ySpeed, final double zSpeed, @Nonnull final int... parameters) { + public void addParticle(@Nonnull final IParticleData particleData, final boolean ignoreRange, final boolean minimizeLevel, final double x, final double y, final double z, final double xSpeed, final double ySpeed, final double zSpeed) { } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index f20c53b6..07bec3b2 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,7 +1,7 @@ -public net/minecraft/client/renderer/BlockModelRenderer$AmbientOcclusionFace +public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace # net/minecraft/client/renderer/BlockModelRenderer$AmbientOcclusionFace public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace func_147778_a(IIII)I # getAoBrightness public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace func_178203_a(IIIIFFFF)I # getVertexBrightness public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace field_178206_b # vertexColorMultiplier public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace field_178207_c # vertexBrightness -public net.minecraft.client.renderer.RenderGlobal field_72769_h # world -public net.minecraft.client.renderer.RenderGlobal field_175008_n # viewFrustum +public net.minecraft.client.renderer.WorldRenderer field_72769_h # world +public net.minecraft.client.renderer.WorldRenderer field_175008_n # viewFrustum