Port most remaining instances of manual lightmap modification

This commit is contained in:
tterrag 2020-03-29 14:21:22 -04:00
parent 3c07aa51de
commit 9f2dcc5635
15 changed files with 120 additions and 137 deletions

View file

@ -19,6 +19,7 @@ import com.simibubi.create.modules.curiosities.zapper.terrainzapper.TerrainZappe
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
@ -70,7 +71,7 @@ public class ClientEvents {
public static void onRenderWorld(RenderWorldLastEvent event) {
MatrixStack ms = event.getMatrixStack();
IRenderTypeBuffer buffer = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers();
CreateClient.schematicHandler.render(ms, buffer);
CreateClient.schematicHandler.render(ms, buffer, 0xF000F0, OverlayTexture.DEFAULT_UV);
CreateClient.schematicAndQuillHandler.render(ms, buffer);
CreateClient.schematicHologram.render(ms, buffer);
KineticDebugger.renderSourceOutline(ms, buffer);
@ -83,11 +84,12 @@ public class ClientEvents {
if (event.getType() != ElementType.HOTBAR)
return;
onRenderHotbar();
onRenderHotbar(new MatrixStack(), Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers(),
0xF000F0, OverlayTexture.DEFAULT_UV);
}
public static void onRenderHotbar() {
CreateClient.schematicHandler.renderOverlay();
public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay);
}
@SubscribeEvent

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.redstone;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AngleHelper;
@ -29,7 +30,7 @@ public class AnalogLeverTileEntityRenderer extends SafeTileEntityRenderer<Analog
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), leverState, te.getPos());
float state = te.clientState.get(partialTicks);
IVertexBuffer vb = buffer.getBuffer(RenderType.getSolid());
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
// Handle
SuperByteBuffer handle = AllBlockPartials.ANALOG_LEVER_HANDLE.renderOn(leverState);

View file

@ -19,6 +19,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class ContactBlock extends ProperDirectionalBlock implements IPortableBlock {
@ -72,7 +73,7 @@ public class ContactBlock extends ProperDirectionalBlock implements IPortableBlo
}
@Override
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
boolean hasValidContact = hasValidContact(worldIn, pos, state.get(FACING));
if (state.get(POWERED) != hasValidContact)
worldIn.setBlockState(pos, state.with(POWERED, hasValidContact));

View file

@ -1,15 +1,15 @@
package com.simibubi.create.modules.curiosities.deforester;
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.foundation.utility.AnimationTickHolder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack;
@ -21,28 +21,23 @@ public class DeforesterItemRenderer extends ItemStackTileEntityRenderer {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
DeforesterModel mainModel = (DeforesterModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, Minecraft.getInstance().player);
float worldTime = AnimationTickHolder.getRenderTick();
float lastCoordx = GLX.lastBrightnessX;
float lastCoordy = GLX.lastBrightnessY;
RenderSystem.pushMatrix();
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
itemRenderer.renderItem(stack, mainModel.getBakedModel());
ms.push();
ms.translate(0.5F, 0.5F, 0.5F);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, light, overlay, mainModel.getBakedModel());
RenderSystem.disableLighting();
GLX.glMultiTexCoord2f(GL13.GL_TEXTURE1, 240, 120);
itemRenderer.renderItem(stack, mainModel.getPartial("light"));
itemRenderer.renderItem(stack, mainModel.getPartial("blade"));
GLX.glMultiTexCoord2f(GL13.GL_TEXTURE1, lastCoordx, lastCoordy);
RenderSystem.enableLighting();
int brightLight = LightTexture.pack(15, 7);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, brightLight, overlay, mainModel.getPartial("light"));
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, brightLight, overlay, mainModel.getPartial("blade"));
float angle = worldTime * -.5f % 360;
float xOffset = 0;
float zOffset = 0;
RenderSystem.translatef(-xOffset, 0, -zOffset);
RenderSystem.rotatef(angle, 0, 1, 0);
RenderSystem.translatef(xOffset, 0, zOffset);
ms.translate(-xOffset, 0, -zOffset);
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle));
ms.translate(xOffset, 0, zOffset);
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, brightLight, overlay, mainModel.getPartial("gear"));
RenderSystem.popMatrix();

View file

@ -1,13 +1,13 @@
package com.simibubi.create.modules.curiosities.symmetry.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
@ -18,34 +18,25 @@ public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer {
public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getModelWithOverrides(stack);
SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getItemModelWithOverrides(stack, null, null);
float worldTime = AnimationTickHolder.getRenderTick() / 20;
RenderSystem.pushMatrix();
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
itemRenderer.renderItem(stack, mainModel.getBakedModel());
ms.push();
ms.translate(0.5F, 0.5F, 0.5F);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, light, overlay, mainModel.getBakedModel());
float lastCoordx = 0;
float lastCoordy = 0;
RenderSystem.disableLighting();
lastCoordx = GLX.lastBrightnessX;
lastCoordy = GLX.lastBrightnessY;
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, 240, 240);
itemRenderer.renderItem(stack, mainModel.getPartial("core"));
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, 0xF000F0, overlay, mainModel.getPartial("core"));
float floating = MathHelper.sin(worldTime) * .05f;
RenderSystem.translated(0, floating, 0);
ms.translate(0, floating, 0);
float angle = worldTime * -10 % 360;
RenderSystem.rotatef(angle, 0, 1, 0);
itemRenderer.renderItem(stack, mainModel.getPartial("bits"));
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
RenderSystem.enableLighting();
RenderSystem.popMatrix();
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle));
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, 0xF000F0, overlay, mainModel.getPartial("bits"));
ms.pop();
}
}

View file

@ -1,32 +1,35 @@
package com.simibubi.create.modules.curiosities.zapper;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.block.FourWayBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTUtil;
public abstract class ZapperItemRenderer extends ItemStackTileEntityRenderer {
protected void renderBlockUsed(ItemStack stack, ItemRenderer itemRenderer) {
protected void renderBlockUsed(ItemStack stack, ItemRenderer itemRenderer, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
BlockState state = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed"));
RenderSystem.pushMatrix();
RenderSystem.translatef(-0.3F, -0.45F, -0.0F);
RenderSystem.scalef(0.25F, 0.25F, 0.25F);
ms.push();
ms.translate(-0.3F, -0.45F, -0.0F);
ms.scale(0.25F, 0.25F, 0.25F);
IBakedModel modelForState = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(state);
if (state.getBlock() instanceof FourWayBlock)
modelForState = Minecraft.getInstance().getItemRenderer()
.getItemModelWithOverrides(new ItemStack(state.getBlock()), Minecraft.getInstance().world, null);
itemRenderer.renderItem(new ItemStack(state.getBlock()), modelForState);
RenderSystem.popMatrix();
itemRenderer.renderItem(new ItemStack(state.getBlock()), TransformType.NONE, false, ms, buffer, light, overlay, modelForState);
ms.pop();
}
}

View file

@ -7,8 +7,6 @@ import static com.simibubi.create.modules.curiosities.zapper.blockzapper.Blockza
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Scope;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
@ -19,6 +17,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.item.ItemStack;
@ -35,22 +35,19 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
float pt = Minecraft.getInstance().getRenderPartialTicks();
float worldTime = AnimationTickHolder.getRenderTick() / 20;
RenderSystem.pushMatrix();
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
float lastCoordx = GLX.lastBrightnessX;
float lastCoordy = GLX.lastBrightnessY;
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, Math.min(lastCoordx + 60, 240), Math.min(lastCoordy + 120, 240));
ms.push();
ms.translate(0.5F, 0.5F, 0.5F);
itemRenderer.renderItem(stack, mainModel.getBakedModel());
renderComponent(stack, mainModel, Body, itemRenderer);
renderComponent(stack, mainModel, Amplifier, itemRenderer);
renderComponent(stack, mainModel, Retriever, itemRenderer);
renderComponent(stack, mainModel, Scope, itemRenderer);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, light, overlay, mainModel);
renderComponent(stack, mainModel, Body, itemRenderer, ms, buffer, light, overlay);
renderComponent(stack, mainModel, Amplifier, itemRenderer, ms, buffer, light, overlay);
renderComponent(stack, mainModel, Retriever, itemRenderer, ms, buffer, light, overlay);
renderComponent(stack, mainModel, Scope, itemRenderer, ms, buffer, light, overlay);
// Block indicator
if (mainModel.getCurrentPerspective() == TransformType.GUI && stack.hasTag()
&& stack.getTag().contains("BlockUsed"))
renderBlockUsed(stack, itemRenderer);
renderBlockUsed(stack, itemRenderer, ms, buffer, light, overlay);
ClientPlayerEntity player = Minecraft.getInstance().player;
boolean leftHanded = player.getPrimaryHand() == HandSide.LEFT;
@ -63,17 +60,14 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
float animation = MathHelper.clamp(MathHelper.lerp(pt, last, current) * 5, 0, 1);
// Core glows
RenderSystem.disableLighting();
float multiplier = MathHelper.sin(worldTime * 5);
if (mainHand || offHand) {
multiplier = animation;
}
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, multiplier * 240, 120);
itemRenderer.renderItem(stack, mainModel.getPartial("core"));
int glowLight = LightTexture.pack((int) (15 * multiplier), 15);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, glowLight, overlay, mainModel.getPartial("core"));
if (BlockzapperItem.getTier(Amplifier, stack) != ComponentTier.None)
itemRenderer.renderItem(stack, mainModel.getPartial("amplifier_core"));
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
RenderSystem.enableLighting();
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, glowLight, overlay, mainModel.getPartial("amplifier_core"));
// Accelerator spins
float angle = worldTime * -25;
@ -82,20 +76,20 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
angle %= 360;
float offset = -.155f;
RenderSystem.translatef(0, offset, 0);
RenderSystem.rotatef(angle, 0, 0, 1);
RenderSystem.translatef(0, -offset, 0);
renderComponent(stack, mainModel, Accelerator, itemRenderer);
ms.translate(0, offset, 0);
ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(angle));
ms.translate(0, -offset, 0);
renderComponent(stack, mainModel, Accelerator, itemRenderer, ms, buffer, light, overlay);
RenderSystem.popMatrix();
ms.pop();
}
public void renderComponent(ItemStack stack, BlockzapperModel model, Components component,
ItemRenderer itemRenderer) {
ItemRenderer itemRenderer, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
ComponentTier tier = BlockzapperItem.getTier(component, stack);
IBakedModel partial = model.getComponentPartial(tier, component);
if (partial != null)
itemRenderer.renderItem(stack, partial);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, light, overlay, partial);
}
}

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
@ -11,6 +10,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.HandSide;
@ -26,17 +27,18 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
float pt = Minecraft.getInstance().getRenderPartialTicks();
float worldTime = AnimationTickHolder.getRenderTick() / 20;
RenderSystem.pushMatrix();
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
float lastCoordx = GLX.lastBrightnessX;
float lastCoordy = GLX.lastBrightnessY;
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, Math.min(lastCoordx + 60, 240), Math.min(lastCoordy + 120, 240));
itemRenderer.renderItem(stack, mainModel.getBakedModel());
ms.push();
ms.translate(0.5F, 0.5F, 0.5F);
int lastBl = LightTexture.getBlockLightCoordinates(light);
int lastSl = LightTexture.getSkyLightCoordinates(light);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer,
LightTexture.pack(Math.min(lastBl + 4, 15), Math.min(lastSl + 7, 15)), overlay,
mainModel.getBakedModel());
// Block indicator
if (mainModel.getCurrentPerspective() == TransformType.GUI && stack.hasTag()
&& stack.getTag().contains("BlockUsed"))
renderBlockUsed(stack, itemRenderer);
renderBlockUsed(stack, itemRenderer, ms, buffer, light, overlay);
ClientPlayerEntity player = Minecraft.getInstance().player;
boolean leftHanded = player.getPrimaryHand() == HandSide.LEFT;
@ -49,16 +51,13 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
float animation = MathHelper.clamp(MathHelper.lerp(pt, last, current) * 5, 0, 1);
// Core glows
RenderSystem.disableLighting();
float multiplier = MathHelper.sin(worldTime * 5);
if (mainHand || offHand) {
multiplier = animation;
}
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, multiplier * 240, 120);
itemRenderer.renderItem(stack, mainModel.getPartial("terrain_core"));
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
RenderSystem.enableLighting();
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer,
LightTexture.pack((int) (15 * multiplier), 7), overlay, mainModel.getPartial("terrain_core"));
// Accelerator spins
float angle = worldTime * -25;
@ -67,10 +66,11 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
angle %= 360;
float offset = -.155f;
RenderSystem.translatef(0, offset, 0);
RenderSystem.rotatef(angle, 0, 0, 1);
RenderSystem.translatef(0, -offset, 0);
itemRenderer.renderItem(stack, mainModel.getPartial("terrain_accelerator"));
ms.translate(0, offset, 0);
ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(angle));
ms.translate(0, -offset, 0);
itemRenderer.renderItem(stack, TransformType.NONE, false, ms, buffer, light, overlay,
mainModel.getPartial("terrain_accelerator"));
RenderSystem.popMatrix();
}

View file

@ -6,13 +6,13 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.TickPriority;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class LatchBlock extends ToggleLatchBlock {
@ -51,7 +51,7 @@ public class LatchBlock extends ToggleLatchBlock {
}
@Override
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
boolean back = state.get(POWERED);
boolean shouldBack = this.shouldBePowered(worldIn, pos, state);
boolean side = state.get(POWERED_SIDE);

View file

@ -110,25 +110,22 @@ public class SchematicHandler {
currentTool.getTool().updateSelection();
}
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
// TODO 1.15 buffered render
public void render(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
if (!active)
return;
if (Minecraft.getInstance().player.isSneaking())
return;
TessellatorHelper.prepareForDrawing();
currentTool.getTool().renderTool();
TessellatorHelper.cleanUpAfterDrawing();
currentTool.getTool().renderTool(ms, buffer, light, overlay);
}
public void renderOverlay() {
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
if (!active)
return;
if (item != null)
overlay.renderOn(slot);
this.overlay.renderOn(slot);
currentTool.getTool().renderOverlay();
currentTool.getTool().renderOverlay(ms, buffer, light, overlay);
selectionScreen.renderPassive(Minecraft.getInstance().getRenderPartialTicks());
}

View file

@ -1,8 +1,11 @@
package com.simibubi.create.modules.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllKeys;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -28,8 +31,8 @@ public class DeployTool extends PlacementToolBase {
}
@Override
public void renderTool() {
super.renderTool();
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
super.renderTool(ms, buffer, light, overlay);
if (selectedPos == null)
return;
@ -44,16 +47,10 @@ public class DeployTool extends PlacementToolBase {
max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
}
RenderSystem.lineWidth(2);
RenderSystem.color4f(.5f, .8f, 1, 1);
RenderSystem.disableTexture();
// RenderSystem.color4f(.5f, .8f, 1, 1); TODO 1.15
WorldRenderer.drawBoundingBox(min.getX() - 1 / 8d, min.getY() + 1 / 16d, min.getZ() - 1 / 8d,
WorldRenderer.drawBox(ms, buffer.getBuffer(RenderType.getLines()), min.getX() - 1 / 8d, min.getY() + 1 / 16d, min.getZ() - 1 / 8d,
max.getX() + 1 / 8d, max.getY() + 1 / 8d, max.getZ() + 1 / 8d, .8f, .9f, 1, 1);
RenderSystem.lineWidth(1);
RenderSystem.enableTexture();
}
@Override

View file

@ -1,5 +1,9 @@
package com.simibubi.create.modules.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
public interface ISchematicTool {
public void init();
@ -8,8 +12,8 @@ public interface ISchematicTool {
public boolean handleRightClick();
public boolean handleMouseWheel(double delta);
public void renderTool();
public void renderOverlay();
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay);
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay);
}

View file

@ -1,5 +1,9 @@
package com.simibubi.create.modules.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
public abstract class PlacementToolBase extends SchematicToolBase {
@Override
@ -13,13 +17,13 @@ public abstract class PlacementToolBase extends SchematicToolBase {
}
@Override
public void renderTool() {
super.renderTool();
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
super.renderTool(ms, buffer, light, overlay);
}
@Override
public void renderOverlay() {
super.renderOverlay();
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
super.renderOverlay(ms, buffer, light, overlay);
}
@Override

View file

@ -1,6 +1,6 @@
package com.simibubi.create.modules.schematics.client.tools;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllKeys;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.RaycastHelper;
@ -9,6 +9,8 @@ import com.simibubi.create.modules.schematics.client.SchematicHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemUseContext;
@ -78,19 +80,15 @@ public abstract class SchematicToolBase implements ISchematicTool {
}
@Override
public void renderTool() {
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
if (schematicHandler.deployed) {
RenderSystem.lineWidth(2);
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.disableTexture();
BlockPos min = schematicHandler.getTransformedAnchor();
MutableBoundingBox bb = new MutableBoundingBox(min, min.add(schematicHandler.getTransformedSize()));
min = new BlockPos(bb.minX, bb.minY, bb.minZ);
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
WorldRenderer.drawBoundingBox(min.getX() - 1 / 8d, min.getY() + 1 / 16d, min.getZ() - 1 / 8d,
WorldRenderer.drawBox(buffer.getBuffer(RenderType.getLines()), min.getX() - 1 / 8d, min.getY() + 1 / 16d, min.getZ() - 1 / 8d,
max.getX() + 1 / 8d, max.getY() + 1 / 8d, max.getZ() + 1 / 8d, 1, 1, 1, 1);
if (schematicSelected && renderSelectedFace && AllKeys.ACTIVATE_TOOL.isPressed()) {
@ -103,20 +101,16 @@ public abstract class SchematicToolBase implements ISchematicTool {
Vec3d faceMin = center.add(vec.mul(radii).add(onFaceOffset)).add(vec.scale(1/8f));
Vec3d faceMax = center.add(vec.mul(radii).subtract(onFaceOffset)).add(vec.scale(1/8f));
RenderSystem.lineWidth(6);
WorldRenderer.drawBoundingBox(faceMin.getX(), faceMin.getY() + 1 / 16d, faceMin.getZ(), faceMax.getX(),
// RenderSystem.lineWidth(6); TODO 1.15 custom line size render type
WorldRenderer.drawBox(buffer.getBuffer(RenderType.getLines()), faceMin.getX(), faceMin.getY() + 1 / 16d, faceMin.getZ(), faceMax.getX(),
faceMax.getY() + 1 / 8d, faceMax.getZ(), .6f, .7f, 1, 1);
}
RenderSystem.lineWidth(1);
RenderSystem.enableTexture();
}
}
@Override
public void renderOverlay() {
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
}

View file

@ -4,7 +4,7 @@ loaderVersion="[28,)"
[[mods]]
modId="create"
version="mc1.14-0.2.2a"
version="${file.jarVersion}"
displayName="Create"
#updateJSONURL=""
authors="simibubi"
@ -14,13 +14,13 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="forge"
mandatory=true
versionRange="[28.1.56,)"
versionRange="[31.1.0,)"
ordering="NONE"
side="BOTH"
[[dependencies.create]]
modId="minecraft"
mandatory=true
versionRange="[1.14.4]"
versionRange="[1.15.2,1.16)"
ordering="NONE"
side="BOTH"