From c849bb188e9bdc607c03ca9df98837ddf55d0622 Mon Sep 17 00:00:00 2001 From: tterrag Date: Sun, 29 Mar 2020 15:18:14 -0400 Subject: [PATCH] Port remaining uses of RenderHelper and getCombinedLight --- .../ContraptionEntityRenderer.java | 2 +- .../contraptions/ContraptionRenderer.java | 18 ++++--- .../MechanicalCrafterTileEntityRenderer.java | 4 -- .../components/deployer/DeployerHandler.java | 2 +- .../particle/AirFlowParticle.java | 3 +- .../relays/belt/BeltTileEntityRenderer.java | 2 - .../belt/BeltTunnelTileEntityRenderer.java | 10 ++-- .../symmetry/SymmetryWandScreen.java | 6 ++- .../tools/SandPaperItemRenderer.java | 25 ++++----- .../zapper/ZapperRenderHandler.java | 52 ++++++++++--------- .../curiosities/zapper/ZapperScreen.java | 2 +- .../item/filter/AbstractFilterScreen.java | 2 +- .../block/SchematicTableScreen.java | 2 +- .../block/SchematicannonScreen.java | 2 +- 14 files changed, 69 insertions(+), 63 deletions(-) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java index 58f648682..56563e5c1 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java @@ -111,7 +111,7 @@ public class ContraptionEntityRenderer extends EntityRenderer RenderSystem.shadeModel(7424); RenderSystem.alphaFunc(516, 0.1F); RenderSystem.matrixMode(5888); - RenderHelper.enableStandardItemLighting(); + RenderHelper.enable(); super.render(entity, yaw, partialTicks, ms, buffers, overlay); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionRenderer.java index bef766dcb..4a7bea722 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionRenderer.java @@ -6,9 +6,9 @@ import java.util.function.Consumer; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL13; import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.Create; import com.simibubi.create.CreateClient; @@ -26,7 +26,9 @@ import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; @@ -72,11 +74,11 @@ public class ContraptionRenderer { BlockPos pos = tileEntity.getPos(); if (!tileEntity.hasFastRenderer()) { - RenderHelper.enableStandardItemLighting(); - int i = lightingWorld.getCombinedLight(pos, 0); - int j = i % 65536; - int k = i / 65536; - RenderSystem.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k); + RenderHelper.enable(); + int i = WorldRenderer.getLightmapCoordinates(lightingWorld, pos); + int j = LightTexture.getBlockLightCoordinates(i); + int k = LightTexture.getSkyLightCoordinates(i); + RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float) j, (float) k); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } @@ -188,8 +190,8 @@ public class ContraptionRenderer { } @Override - public int getCombinedLight(BlockPos pos, int minLight) { - return super.getCombinedLight(transformPos(pos), minLight); + public int getBaseLightLevel(BlockPos pos, int minLight) { + return super.getBaseLightLevel(transformPos(pos), minLight); } private BlockPos transformPos(BlockPos pos) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java index 81989a918..78818cf45 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java @@ -68,8 +68,6 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer< } public void renderItems(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - RenderHelper.enableStandardItemLighting(); - if (te.phase == Phase.IDLE) { ItemStack stack = te.inventory.getStackInSlot(0); if (!stack.isEmpty()) { @@ -137,8 +135,6 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer< } } - - RenderHelper.disableStandardItemLighting(); } public void renderFast(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java index 8f9f23a5a..aa14c55dd 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java @@ -214,7 +214,7 @@ public class DeployerHandler { !(player.isSneaking() && holdingSomething) || (stack.doesSneakBypassUse(world, clickedPos, player)); // Use on block - if (event.getUseBlock() != DENY && flag1 && clickedState.onBlockActivated(world, player, hand, result)) + if (event.getUseBlock() != DENY && flag1 && clickedState.onUse(world, player, hand, result) == ActionResultType.SUCCESS) return; if (stack.isEmpty()) return; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/particle/AirFlowParticle.java b/src/main/java/com/simibubi/create/modules/contraptions/particle/AirFlowParticle.java index 312c541f3..de34586f3 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/particle/AirFlowParticle.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/particle/AirFlowParticle.java @@ -11,6 +11,7 @@ import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.SimpleAnimatedParticle; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.particles.BlockParticleData; import net.minecraft.particles.ParticleTypes; import net.minecraft.tileentity.TileEntity; @@ -143,7 +144,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle { public int getBrightnessForRender(float partialTick) { BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); - return this.world.isBlockPresent(blockpos) ? this.world.getCombinedLight(blockpos, 0) : 0; + return this.world.isBlockPresent(blockpos) ? WorldRenderer.getLightmapCoordinates(world, blockpos) : 0; } private void selectSprite(int index) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java index ad871f046..abb78c747 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java @@ -149,8 +149,6 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer ex font.drawString(playerInventory.getDisplayName().getFormattedText(), invX + 7, invY + 6, 0x666666); font.drawString(I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037); - RenderHelper.enableGUIStandardItemLighting(); + RenderHelper.enableGuiDepthLighting(); RenderSystem.pushMatrix(); RenderSystem.translated(guiLeft + background.width + 0, guiTop + background.height - 60, 0); RenderSystem.scaled(5, 5, 5); diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java index 7eb9830d7..21c888063 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java @@ -129,7 +129,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen