mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-23 19:38:08 +01:00
Port new code to 1.15 (help)
- Shoddily eliminated compilation errors with new code from 0.2.3
This commit is contained in:
parent
83ceb7d215
commit
aea5918636
36 changed files with 295 additions and 389 deletions
|
@ -75,8 +75,8 @@ public class ValueBoxRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
box.render(highlighted);
|
box.render(highlighted);
|
||||||
GlStateManager.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
GlStateManager.disableAlphaTest();
|
RenderSystem.disableAlphaTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderText(ValueBox box, FontRenderer font, String text) {
|
public static void renderText(ValueBox box, FontRenderer font, String text) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.foundation.behaviour.scrollvalue;
|
package com.simibubi.create.foundation.behaviour.scrollvalue;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllKeys;
|
import com.simibubi.create.AllKeys;
|
||||||
|
@ -62,8 +64,8 @@ public class ScrollValueRenderer {
|
||||||
render(world, pos, face, behaviour, highlight);
|
render(world, pos, face, behaviour, highlight);
|
||||||
|
|
||||||
TessellatorHelper.cleanUpAfterDrawing();
|
TessellatorHelper.cleanUpAfterDrawing();
|
||||||
GlStateManager.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void render(ClientWorld world, BlockPos pos, Direction face, ScrollValueBehaviour behaviour,
|
protected static void render(ClientWorld world, BlockPos pos, Direction face, ScrollValueBehaviour behaviour,
|
||||||
|
|
|
@ -3,12 +3,9 @@ package com.simibubi.create.foundation.block.render;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
|
||||||
import net.minecraft.client.renderer.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package com.simibubi.create.foundation.utility;
|
package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
import static net.minecraft.util.Direction.*;
|
import static net.minecraft.util.Direction.DOWN;
|
||||||
|
import static net.minecraft.util.Direction.EAST;
|
||||||
|
import static net.minecraft.util.Direction.NORTH;
|
||||||
|
import static net.minecraft.util.Direction.SOUTH;
|
||||||
|
import static net.minecraft.util.Direction.UP;
|
||||||
|
import static net.minecraft.util.Direction.WEST;
|
||||||
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.entity.MobEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
|
@ -10,10 +10,10 @@ import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.BufferBuilder.DrawState;
|
import net.minecraft.client.renderer.BufferBuilder.DrawState;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
import net.minecraft.client.renderer.GLAllocation;
|
||||||
import net.minecraft.client.renderer.Matrix4f;
|
import net.minecraft.client.renderer.Matrix4f;
|
||||||
import net.minecraft.client.renderer.Vector4f;
|
import net.minecraft.client.renderer.Vector4f;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package com.simibubi.create.foundation.utility.outliner;
|
package com.simibubi.create.foundation.utility.outliner;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
import com.simibubi.create.AllSpecialTextures;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.GlHelper;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
@ -26,13 +25,9 @@ public class AABBOutline extends Outline {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(BufferBuilder buffer) {
|
public void render(BufferBuilder buffer) {
|
||||||
begin();
|
|
||||||
|
|
||||||
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
|
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
|
||||||
float alpha = 1f;
|
float alpha = 1f;
|
||||||
renderBB(bb, buffer, color, alpha, !disableCull);
|
renderBB(bb, buffer, color, alpha, !disableCull);
|
||||||
|
|
||||||
draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextures(AllSpecialTextures faceTexture, AllSpecialTextures highlightTexture) {
|
public void setTextures(AllSpecialTextures faceTexture, AllSpecialTextures highlightTexture) {
|
||||||
|
@ -44,7 +39,7 @@ public class AABBOutline extends Outline {
|
||||||
this.highlightedFace = face;
|
this.highlightedFace = face;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderBB(AxisAlignedBB bb, BufferBuilder buffer, Vec3d color, float alpha, boolean doCulling) {
|
public void renderBB(AxisAlignedBB bb, IVertexBuilder builder, Vec3d color, float alpha, boolean doCulling) {
|
||||||
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||||
boolean inside = bb.contains(projectedView);
|
boolean inside = bb.contains(projectedView);
|
||||||
bb = bb.grow(inside ? -1 / 128d : 1 / 128d);
|
bb = bb.grow(inside ? -1 / 128d : 1 / 128d);
|
||||||
|
@ -58,46 +53,37 @@ public class AABBOutline extends Outline {
|
||||||
Vec3d xYZ = new Vec3d(bb.minX, bb.maxY, bb.maxZ);
|
Vec3d xYZ = new Vec3d(bb.minX, bb.maxY, bb.maxZ);
|
||||||
Vec3d XYZ = new Vec3d(bb.maxX, bb.maxY, bb.maxZ);
|
Vec3d XYZ = new Vec3d(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
|
|
||||||
if (doCulling) {
|
renderFace(Direction.NORTH, xYz, XYz, Xyz, xyz, builder);
|
||||||
GlStateManager.enableCull();
|
renderFace(Direction.SOUTH, XYZ, xYZ, xyZ, XyZ, builder);
|
||||||
if (inside)
|
renderFace(Direction.EAST, XYz, XYZ, XyZ, Xyz, builder);
|
||||||
GlStateManager.disableCull();
|
renderFace(Direction.WEST, xYZ, xYz, xyz, xyZ, builder);
|
||||||
}
|
renderFace(Direction.UP, xYZ, XYZ, XYz, xYz, builder);
|
||||||
|
renderFace(Direction.DOWN, xyz, Xyz, XyZ, xyZ, builder);
|
||||||
renderFace(Direction.NORTH, xYz, XYz, Xyz, xyz, buffer);
|
|
||||||
renderFace(Direction.SOUTH, XYZ, xYZ, xyZ, XyZ, buffer);
|
|
||||||
renderFace(Direction.EAST, XYz, XYZ, XyZ, Xyz, buffer);
|
|
||||||
renderFace(Direction.WEST, xYZ, xYz, xyz, xyZ, buffer);
|
|
||||||
renderFace(Direction.UP, xYZ, XYZ, XYz, xYz, buffer);
|
|
||||||
renderFace(Direction.DOWN, xyz, Xyz, XyZ, xyZ, buffer);
|
|
||||||
|
|
||||||
if (doCulling)
|
|
||||||
GlStateManager.enableCull();
|
|
||||||
|
|
||||||
Vec3d start = xyz;
|
Vec3d start = xyz;
|
||||||
AllSpecialTextures.BLANK.bind();
|
AllSpecialTextures.BLANK.bind();
|
||||||
renderAACuboidLine(start, Xyz, color, alpha, buffer);
|
renderAACuboidLine(start, Xyz, color, alpha, builder);
|
||||||
renderAACuboidLine(start, xYz, color, alpha, buffer);
|
renderAACuboidLine(start, xYz, color, alpha, builder);
|
||||||
renderAACuboidLine(start, xyZ, color, alpha, buffer);
|
renderAACuboidLine(start, xyZ, color, alpha, builder);
|
||||||
|
|
||||||
start = XyZ;
|
start = XyZ;
|
||||||
renderAACuboidLine(start, xyZ, color, alpha, buffer);
|
renderAACuboidLine(start, xyZ, color, alpha, builder);
|
||||||
renderAACuboidLine(start, XYZ, color, alpha, buffer);
|
renderAACuboidLine(start, XYZ, color, alpha, builder);
|
||||||
renderAACuboidLine(start, Xyz, color, alpha, buffer);
|
renderAACuboidLine(start, Xyz, color, alpha, builder);
|
||||||
|
|
||||||
start = XYz;
|
start = XYz;
|
||||||
renderAACuboidLine(start, xYz, color, alpha, buffer);
|
renderAACuboidLine(start, xYz, color, alpha, builder);
|
||||||
renderAACuboidLine(start, Xyz, color, alpha, buffer);
|
renderAACuboidLine(start, Xyz, color, alpha, builder);
|
||||||
renderAACuboidLine(start, XYZ, color, alpha, buffer);
|
renderAACuboidLine(start, XYZ, color, alpha, builder);
|
||||||
|
|
||||||
start = xYZ;
|
start = xYZ;
|
||||||
renderAACuboidLine(start, XYZ, color, alpha, buffer);
|
renderAACuboidLine(start, XYZ, color, alpha, builder);
|
||||||
renderAACuboidLine(start, xyZ, color, alpha, buffer);
|
renderAACuboidLine(start, xyZ, color, alpha, builder);
|
||||||
renderAACuboidLine(start, xYz, color, alpha, buffer);
|
renderAACuboidLine(start, xYz, color, alpha, builder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderFace(Direction direction, Vec3d p1, Vec3d p2, Vec3d p3, Vec3d p4, BufferBuilder buffer) {
|
protected void renderFace(Direction direction, Vec3d p1, Vec3d p2, Vec3d p3, Vec3d p4, IVertexBuilder builder) {
|
||||||
if (direction == highlightedFace && highlightedTexture != null)
|
if (direction == highlightedFace && highlightedTexture != null)
|
||||||
highlightedTexture.bind();
|
highlightedTexture.bind();
|
||||||
else if (faceTexture != null)
|
else if (faceTexture != null)
|
||||||
|
@ -110,13 +96,7 @@ public class AABBOutline extends Outline {
|
||||||
Axis axis = direction.getAxis();
|
Axis axis = direction.getAxis();
|
||||||
float maxU = (float) Math.abs(axis == Axis.X ? uDiff.z : uDiff.x);
|
float maxU = (float) Math.abs(axis == Axis.X ? uDiff.z : uDiff.x);
|
||||||
float maxV = (float) Math.abs(axis == Axis.Y ? vDiff.z : vDiff.y);
|
float maxV = (float) Math.abs(axis == Axis.Y ? vDiff.z : vDiff.y);
|
||||||
|
putQuadUV(p1, p2, p3, p4, 0, 0, maxU, maxV, new Vec3d(1, 1, 1), 1, builder);
|
||||||
GlHelper.enableTextureRepeat();
|
|
||||||
GlStateManager.depthMask(false);
|
|
||||||
putQuadUV(p1, p2, p3, p4, 0, 0, maxU, maxV, new Vec3d(1, 1, 1), 1, buffer);
|
|
||||||
flush();
|
|
||||||
GlStateManager.depthMask(true);
|
|
||||||
GlHelper.disableTextureRepeat();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ public class BlockClusterOutline extends Outline {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(BufferBuilder buffer) {
|
public void render(BufferBuilder buffer) {
|
||||||
begin();
|
|
||||||
Vec3d color = ColorHelper.getRGB(0xDDDDDD);
|
Vec3d color = ColorHelper.getRGB(0xDDDDDD);
|
||||||
AllSpecialTextures.SELECTION.bind();
|
AllSpecialTextures.SELECTION.bind();
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ public class BlockClusterOutline extends Outline {
|
||||||
renderFace(pos, direction, color, alpha * .25f, 1 / 64d, buffer);
|
renderFace(pos, direction, color, alpha * .25f, 1 / 64d, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
flush();
|
|
||||||
AllSpecialTextures.BLANK.bind();
|
AllSpecialTextures.BLANK.bind();
|
||||||
|
|
||||||
for (MergeEntry edge : cluster.visibleEdges) {
|
for (MergeEntry edge : cluster.visibleEdges) {
|
||||||
|
@ -51,7 +49,6 @@ public class BlockClusterOutline extends Outline {
|
||||||
renderAACuboidLine(start, new Vec3d(edge.pos.offset(direction)), color, 1, buffer);
|
renderAACuboidLine(start, new Vec3d(edge.pos.offset(direction)), color, 1, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlpha(float alpha) {
|
public void setAlpha(float alpha) {
|
||||||
|
|
|
@ -30,14 +30,10 @@ public class ChasingAABBOutline extends AABBOutline {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(BufferBuilder buffer) {
|
public void render(BufferBuilder buffer) {
|
||||||
begin();
|
|
||||||
|
|
||||||
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
|
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
|
||||||
float alpha = 1f;
|
float alpha = 1f;
|
||||||
renderBB(interpolateBBs(prevBB, bb, Minecraft.getInstance().getRenderPartialTicks()), buffer, color, alpha,
|
renderBB(interpolateBBs(prevBB, bb, Minecraft.getInstance().getRenderPartialTicks()), buffer, color, alpha,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AxisAlignedBB interpolateBBs(AxisAlignedBB current, AxisAlignedBB target, float pt) {
|
private static AxisAlignedBB interpolateBBs(AxisAlignedBB current, AxisAlignedBB target, float pt) {
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package com.simibubi.create.foundation.utility.outliner;
|
package com.simibubi.create.foundation.utility.outliner;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -18,21 +15,7 @@ public abstract class Outline {
|
||||||
|
|
||||||
public abstract void render(BufferBuilder buffer);
|
public abstract void render(BufferBuilder buffer);
|
||||||
|
|
||||||
protected void begin() {
|
public void renderAACuboidLine(Vec3d start, Vec3d end, Vec3d rgb, float alpha, IVertexBuilder builder) {
|
||||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
|
||||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void draw() {
|
|
||||||
Tessellator.getInstance().draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void flush() {
|
|
||||||
draw();
|
|
||||||
begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderAACuboidLine(Vec3d start, Vec3d end, Vec3d rgb, float alpha, BufferBuilder buffer) {
|
|
||||||
Vec3d diff = end.subtract(start);
|
Vec3d diff = end.subtract(start);
|
||||||
if (diff.x + diff.y + diff.z < 0) {
|
if (diff.x + diff.y + diff.z < 0) {
|
||||||
Vec3d temp = start;
|
Vec3d temp = start;
|
||||||
|
@ -60,17 +43,17 @@ public abstract class Outline {
|
||||||
Vec3d a4 = plane.add(start);
|
Vec3d a4 = plane.add(start);
|
||||||
Vec3d b4 = plane.add(end);
|
Vec3d b4 = plane.add(end);
|
||||||
|
|
||||||
putQuad(b4, b3, b2, b1, rgb, alpha, buffer);
|
putQuad(b4, b3, b2, b1, rgb, alpha, builder);
|
||||||
putQuad(a1, a2, a3, a4, rgb, alpha, buffer);
|
putQuad(a1, a2, a3, a4, rgb, alpha, builder);
|
||||||
|
|
||||||
putQuad(a1, b1, b2, a2, rgb, alpha, buffer);
|
putQuad(a1, b1, b2, a2, rgb, alpha, builder);
|
||||||
putQuad(a2, b2, b3, a3, rgb, alpha, buffer);
|
putQuad(a2, b2, b3, a3, rgb, alpha, builder);
|
||||||
putQuad(a3, b3, b4, a4, rgb, alpha, buffer);
|
putQuad(a3, b3, b4, a4, rgb, alpha, builder);
|
||||||
putQuad(a4, b4, b1, a1, rgb, alpha, buffer);
|
putQuad(a4, b4, b1, a1, rgb, alpha, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderFace(BlockPos pos, Direction face, Vec3d rgb, float alpha, double scaleOffset,
|
protected void renderFace(BlockPos pos, Direction face, Vec3d rgb, float alpha, double scaleOffset,
|
||||||
BufferBuilder buffer) {
|
IVertexBuilder builder) {
|
||||||
Vec3d center = VecHelper.getCenterOf(pos);
|
Vec3d center = VecHelper.getCenterOf(pos);
|
||||||
Vec3d offset = new Vec3d(face.getDirectionVec());
|
Vec3d offset = new Vec3d(face.getDirectionVec());
|
||||||
Vec3d plane = VecHelper.planeByNormal(offset);
|
Vec3d plane = VecHelper.planeByNormal(offset);
|
||||||
|
@ -88,27 +71,27 @@ public abstract class Outline {
|
||||||
plane = VecHelper.rotate(plane, deg, axis);
|
plane = VecHelper.rotate(plane, deg, axis);
|
||||||
Vec3d a4 = plane.add(center);
|
Vec3d a4 = plane.add(center);
|
||||||
|
|
||||||
putQuad(a1, a2, a3, a4, rgb, alpha, buffer);
|
putQuad(a1, a2, a3, a4, rgb, alpha, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putQuad(Vec3d v1, Vec3d v2, Vec3d v3, Vec3d v4, Vec3d rgb, float alpha, BufferBuilder buffer) {
|
public void putQuad(Vec3d v1, Vec3d v2, Vec3d v3, Vec3d v4, Vec3d rgb, float alpha, IVertexBuilder builder) {
|
||||||
putQuadUV(v1, v2, v3, v4, 0, 0, 1, 1, rgb, alpha, buffer);
|
putQuadUV(v1, v2, v3, v4, 0, 0, 1, 1, rgb, alpha, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putQuadUV(Vec3d v1, Vec3d v2, Vec3d v3, Vec3d v4, float minU, float minV, float maxU,
|
public void putQuadUV(Vec3d v1, Vec3d v2, Vec3d v3, Vec3d v4, float minU, float minV, float maxU, float maxV,
|
||||||
float maxV, Vec3d rgb, float alpha, BufferBuilder buffer) {
|
Vec3d rgb, float alpha, IVertexBuilder builder) {
|
||||||
putVertex(v1, rgb, minU, minV, alpha, buffer);
|
putVertex(v1, rgb, minU, minV, alpha, builder);
|
||||||
putVertex(v2, rgb, maxU, minV, alpha, buffer);
|
putVertex(v2, rgb, maxU, minV, alpha, builder);
|
||||||
putVertex(v3, rgb, maxU, maxV, alpha, buffer);
|
putVertex(v3, rgb, maxU, maxV, alpha, builder);
|
||||||
putVertex(v4, rgb, minU, maxV, alpha, buffer);
|
putVertex(v4, rgb, minU, maxV, alpha, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void putVertex(Vec3d pos, Vec3d rgb, float u, float v, float alpha, BufferBuilder buffer) {
|
protected void putVertex(Vec3d pos, Vec3d rgb, float u, float v, float alpha, IVertexBuilder builder) {
|
||||||
int i = 15 << 20 | 15 << 4;
|
int i = 15 << 20 | 15 << 4;
|
||||||
int j = i >> 16 & '\uffff';
|
int j = i >> 16 & '\uffff';
|
||||||
int k = i & '\uffff';
|
int k = i & '\uffff';
|
||||||
buffer.pos(pos.x, pos.y, pos.z).tex(u, v).color((float) rgb.x, (float) rgb.y, (float) rgb.z, alpha)
|
builder.vertex(pos.x, pos.y, pos.z).texture(u, v).color((float) rgb.x, (float) rgb.y, (float) rgb.z, alpha)
|
||||||
.lightmap(j, k).endVertex();
|
.light(j, k).endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.simibubi.create.foundation.utility.outliner;
|
package com.simibubi.create.foundation.utility.outliner;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.client.particle.IParticleRenderType;
|
import net.minecraft.client.particle.IParticleRenderType;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -24,7 +23,8 @@ public class OutlineParticle<O extends Outline> extends Particle {
|
||||||
public static <O extends Outline> OutlineParticle<O> create(O outline) {
|
public static <O extends Outline> OutlineParticle<O> create(O outline) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
ClientPlayerEntity player = mc.player;
|
ClientPlayerEntity player = mc.player;
|
||||||
OutlineParticle<O> effect = new OutlineParticle<>(outline, mc.world, player.posX, player.posY, player.posZ);
|
OutlineParticle<O> effect =
|
||||||
|
new OutlineParticle<>(outline, mc.world, player.getX(), player.getY(), player.getZ());
|
||||||
mc.particles.addEffect(effect);
|
mc.particles.addEffect(effect);
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
@ -34,18 +34,13 @@ public class OutlineParticle<O extends Outline> extends Particle {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderParticle(BufferBuilder buffer, ActiveRenderInfo entityIn, float partialTicks, float rotationX,
|
public void buildGeometry(IVertexBuilder builder, ActiveRenderInfo renderInfo, float p_225606_3_) {
|
||||||
float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
Vec3d view = renderInfo.getProjectedView();
|
||||||
GlStateManager.pushMatrix();
|
// GlStateManager.translated(-view.x, -view.y, -view.z);
|
||||||
Vec3d view = entityIn.getProjectedView();
|
// TODO
|
||||||
GlStateManager.translated(-view.x, -view.y, -view.z);
|
// GlStateManager.enableBlend();
|
||||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
// getOutline().render(buffer);
|
||||||
|
// GlStateManager.disableBlend();
|
||||||
GlStateManager.enableBlend();
|
|
||||||
getOutline().render(buffer);
|
|
||||||
GlStateManager.disableBlend();
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,15 +2,20 @@ package com.simibubi.create.foundation.utility.render;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GLX;
|
import org.lwjgl.opengl.GL13;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import com.simibubi.create.foundation.utility.WrappedWorld;
|
import com.simibubi.create.foundation.utility.WrappedWorld;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.crash.ReportedException;
|
import net.minecraft.crash.ReportedException;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -23,20 +28,17 @@ public class StructureRenderer {
|
||||||
protected static LightingWorld lightingWorld;
|
protected static LightingWorld lightingWorld;
|
||||||
|
|
||||||
public static void renderTileEntities(World world, Vec3d position, Vec3d rotation,
|
public static void renderTileEntities(World world, Vec3d position, Vec3d rotation,
|
||||||
Iterable<TileEntity> customRenderTEs) {
|
Iterable<TileEntity> customRenderTEs, MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||||
TileEntityRendererDispatcher dispatcher = TileEntityRendererDispatcher.instance;
|
|
||||||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||||
World prevDispatcherWorld = dispatcher.world;
|
|
||||||
|
|
||||||
if (lightingWorld == null)
|
if (lightingWorld == null)
|
||||||
lightingWorld = new LightingWorld(world);
|
lightingWorld = new LightingWorld(world);
|
||||||
lightingWorld.setWorld(world);
|
lightingWorld.setWorld(world);
|
||||||
lightingWorld.setTransform(position, rotation);
|
lightingWorld.setTransform(position, rotation);
|
||||||
dispatcher.setWorld(lightingWorld);
|
|
||||||
|
|
||||||
for (Iterator<TileEntity> iterator = customRenderTEs.iterator(); iterator.hasNext();) {
|
for (Iterator<TileEntity> iterator = customRenderTEs.iterator(); iterator.hasNext();) {
|
||||||
TileEntity tileEntity = iterator.next();
|
TileEntity tileEntity = iterator.next();
|
||||||
if (dispatcher.getRenderer(tileEntity) == null) {
|
if (TileEntityRendererDispatcher.instance.getRenderer(tileEntity) == null) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -45,20 +47,20 @@ public class StructureRenderer {
|
||||||
|
|
||||||
BlockPos pos = tileEntity.getPos();
|
BlockPos pos = tileEntity.getPos();
|
||||||
if (!tileEntity.hasFastRenderer()) {
|
if (!tileEntity.hasFastRenderer()) {
|
||||||
RenderHelper.enableStandardItemLighting();
|
RenderHelper.enable();
|
||||||
int i = lightingWorld.getCombinedLight(pos, 0);
|
int i = WorldRenderer.getLightmapCoordinates(lightingWorld, pos);
|
||||||
int j = i % 65536;
|
int j = LightTexture.getBlockLightCoordinates(i);
|
||||||
int k = i / 65536;
|
int k = LightTexture.getSkyLightCoordinates(i);
|
||||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
|
RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float) j, (float) k);
|
||||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderSystem.disableCull();
|
||||||
World prevTileWorld = tileEntity.getWorld();
|
World prevTileWorld = tileEntity.getWorld();
|
||||||
tileEntity.setWorld(lightingWorld);
|
tileEntity.setLocation(lightingWorld, pos);
|
||||||
GlStateManager.disableCull();
|
TileEntityRendererDispatcher.instance.render(tileEntity, pt, ms, buffer);
|
||||||
dispatcher.render(tileEntity, pos.getX(), pos.getY(), pos.getZ(), pt, -1, true);
|
tileEntity.setLocation(prevTileWorld, pos);
|
||||||
GlStateManager.enableCull();
|
RenderSystem.enableCull();
|
||||||
tileEntity.setWorld(prevTileWorld);
|
|
||||||
|
|
||||||
} catch (ReportedException e) {
|
} catch (ReportedException e) {
|
||||||
if (AllConfigs.CLIENT.explainRenderErrors.get()) {
|
if (AllConfigs.CLIENT.explainRenderErrors.get()) {
|
||||||
|
@ -72,8 +74,6 @@ public class StructureRenderer {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatcher.setWorld(prevDispatcherWorld);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LightingWorld extends WrappedWorld {
|
private static class LightingWorld extends WrappedWorld {
|
||||||
|
@ -95,8 +95,8 @@ public class StructureRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCombinedLight(BlockPos pos, int minLight) {
|
public int getBaseLightLevel(BlockPos pos, int minLight) {
|
||||||
return super.getCombinedLight(transformPos(pos), minLight);
|
return super.getBaseLightLevel(transformPos(pos), minLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockPos transformPos(BlockPos pos) {
|
private BlockPos transformPos(BlockPos pos) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create.modules.contraptions;
|
package com.simibubi.create.modules.contraptions;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.actors;
|
package com.simibubi.create.modules.contraptions.components.actors;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.Debug;
|
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity;
|
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.MovementBehaviour;
|
import com.simibubi.create.modules.contraptions.components.contraptions.MovementBehaviour;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext;
|
import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.FallingBlock;
|
import net.minecraft.block.FallingBlock;
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||||
|
|
|
@ -12,9 +12,9 @@ import com.simibubi.create.modules.contraptions.components.contraptions.chassis.
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock;
|
import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState;
|
import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock;
|
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyTileEntity;
|
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock.MagnetBlock;
|
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock.MagnetBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock.RopeBlock;
|
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock.RopeBlock;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyTileEntity;
|
||||||
import com.simibubi.create.modules.logistics.block.AttachedLogisticalBlock;
|
import com.simibubi.create.modules.logistics.block.AttachedLogisticalBlock;
|
||||||
import com.simibubi.create.modules.logistics.block.RedstoneLinkBlock;
|
import com.simibubi.create.modules.logistics.block.RedstoneLinkBlock;
|
||||||
import com.simibubi.create.modules.logistics.block.extractor.ExtractorBlock;
|
import com.simibubi.create.modules.logistics.block.extractor.ExtractorBlock;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.contraptions;
|
package com.simibubi.create.modules.contraptions.components.contraptions;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
|
|
@ -64,7 +64,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerData() {}
|
protected void registerData() {
|
||||||
|
}
|
||||||
|
|
||||||
public int getWidthPixels() {
|
public int getWidthPixels() {
|
||||||
return 12;
|
return 12;
|
||||||
|
@ -104,12 +105,10 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
protected void updateBoundingBox() {
|
protected void updateBoundingBox() {
|
||||||
if (this.getFacingDirection() != null) {
|
if (this.getFacingDirection() != null) {
|
||||||
this.posX =
|
double x = hangingPosition.getX() + 0.5 - facingDirection.getXOffset() * 0.5;
|
||||||
(double) this.hangingPosition.getX() + 0.5 - (double) this.getFacingDirection().getXOffset() * 0.5;
|
double y = hangingPosition.getY() + 0.5 - facingDirection.getYOffset() * 0.5;
|
||||||
this.posY =
|
double z = hangingPosition.getZ() + 0.5 - facingDirection.getZOffset() * 0.5;
|
||||||
(double) this.hangingPosition.getY() + 0.5 - (double) this.getFacingDirection().getYOffset() * 0.5;
|
this.setPos(x, y, z);
|
||||||
this.posZ =
|
|
||||||
(double) this.hangingPosition.getZ() + 0.5 - (double) this.getFacingDirection().getZOffset() * 0.5;
|
|
||||||
double d1 = (double) this.getWidthPixels();
|
double d1 = (double) this.getWidthPixels();
|
||||||
double d2 = (double) this.getHeightPixels();
|
double d2 = (double) this.getHeightPixels();
|
||||||
double d3 = (double) this.getWidthPixels();
|
double d3 = (double) this.getWidthPixels();
|
||||||
|
@ -130,16 +129,12 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
d1 = d1 / 32.0D;
|
d1 = d1 / 32.0D;
|
||||||
d2 = d2 / 32.0D;
|
d2 = d2 / 32.0D;
|
||||||
d3 = d3 / 32.0D;
|
d3 = d3 / 32.0D;
|
||||||
this.setBoundingBox(new AxisAlignedBB(this.posX - d1, this.posY - d2, this.posZ - d3, this.posX + d1,
|
this.setBoundingBox(new AxisAlignedBB(x - d1, y - d2, z - d3, x + d1, y + d2, z + d3));
|
||||||
this.posY + d2, this.posZ + d3));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
this.prevPosX = this.posX;
|
|
||||||
this.prevPosY = this.posY;
|
|
||||||
this.prevPosZ = this.posZ;
|
|
||||||
if (this.validationTimer++ == 10 && !this.world.isRemote) {
|
if (this.validationTimer++ == 10 && !this.world.isRemote) {
|
||||||
this.validationTimer = 0;
|
this.validationTimer = 0;
|
||||||
if (isAlive() && !this.onValidSurface()) {
|
if (isAlive() && !this.onValidSurface()) {
|
||||||
|
@ -216,24 +211,6 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
return AllItems.SUPER_GLUE.asStack();
|
return AllItems.SUPER_GLUE.asStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public int getBrightnessForRender() {
|
|
||||||
BlockPos blockpos = hangingPosition;
|
|
||||||
BlockPos blockpos2 = blockpos.offset(this.getFacingDirection().getOpposite());
|
|
||||||
|
|
||||||
PlayerEntity player = Minecraft.getInstance().player;
|
|
||||||
boolean holdingGlue = AllItems.SUPER_GLUE.typeOf(player.getHeldItemMainhand())
|
|
||||||
|| AllItems.SUPER_GLUE.typeOf(player.getHeldItemOffhand());
|
|
||||||
boolean visible = world.isAirBlock(blockpos) || world.isAirBlock(blockpos2);
|
|
||||||
|
|
||||||
int minLight = holdingGlue && !visible ? 8 : 0;
|
|
||||||
int light = this.world.isBlockPresent(blockpos) ? this.world.getCombinedLight(blockpos, minLight) : 15;
|
|
||||||
int light2 = this.world.isBlockPresent(blockpos2) ? this.world.getCombinedLight(blockpos2, minLight) : 15;
|
|
||||||
|
|
||||||
return Math.max(light, light2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyEntityCollision(Entity entityIn) {
|
public void applyEntityCollision(Entity entityIn) {
|
||||||
super.applyEntityCollision(entityIn);
|
super.applyEntityCollision(entityIn);
|
||||||
|
@ -290,11 +267,11 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemEntity entityDropItem(ItemStack stack, float offsetY) {
|
public ItemEntity entityDropItem(ItemStack stack, float yOffset) {
|
||||||
|
float xOffset = (float) this.getFacingDirection().getXOffset() * 0.15F;
|
||||||
|
float zOffset = (float) this.getFacingDirection().getZOffset() * 0.15F;
|
||||||
ItemEntity itementity =
|
ItemEntity itementity =
|
||||||
new ItemEntity(this.world, this.posX + (double) ((float) this.getFacingDirection().getXOffset() * 0.15F),
|
new ItemEntity(this.world, this.getX() + xOffset, this.getY() + yOffset, this.getZ() + zOffset, stack);
|
||||||
this.posY + (double) offsetY,
|
|
||||||
this.posZ + (double) ((float) this.getFacingDirection().getZOffset() * 0.15F), stack);
|
|
||||||
itementity.setDefaultPickupDelay();
|
itementity.setDefaultPickupDelay();
|
||||||
this.world.addEntity(itementity);
|
this.world.addEntity(itementity);
|
||||||
return itementity;
|
return itementity;
|
||||||
|
@ -356,10 +333,12 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStruckByLightning(LightningBoltEntity lightningBolt) {}
|
public void onStruckByLightning(LightningBoltEntity lightningBolt) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recalculateSize() {}
|
public void recalculateSize() {
|
||||||
|
}
|
||||||
|
|
||||||
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
|
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.contraptions.glue;
|
package com.simibubi.create.modules.contraptions.components.contraptions.glue;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||||
import net.minecraft.client.renderer.model.PositionTextureVertex;
|
|
||||||
import net.minecraft.client.renderer.model.TexturedQuad;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -29,8 +27,8 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
||||||
private ResourceLocation regular = new ResourceLocation(Create.ID, "textures/entity/super_glue/slime.png");
|
private ResourceLocation regular = new ResourceLocation(Create.ID, "textures/entity/super_glue/slime.png");
|
||||||
private ResourceLocation ghostly = new ResourceLocation(Create.ID, "textures/entity/super_glue/ghostly.png");
|
private ResourceLocation ghostly = new ResourceLocation(Create.ID, "textures/entity/super_glue/ghostly.png");
|
||||||
|
|
||||||
private TexturedQuad quad1;
|
private Vec3d[] quad1;
|
||||||
private TexturedQuad quad2;
|
private Vec3d[] quad2;
|
||||||
|
|
||||||
public SuperGlueRenderer(EntityRendererManager renderManager) {
|
public SuperGlueRenderer(EntityRendererManager renderManager) {
|
||||||
super(renderManager);
|
super(renderManager);
|
||||||
|
@ -38,15 +36,17 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ResourceLocation getEntityTexture(SuperGlueEntity entity) {
|
public ResourceLocation getEntityTexture(SuperGlueEntity entity) {
|
||||||
return isVisible(entity) ? regular : ghostly;
|
return isVisible(entity) ? regular : ghostly;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // TODO what are these floats for?
|
||||||
public void doRender(SuperGlueEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
public void render(SuperGlueEntity entity, float p_225623_2_, float p_225623_3_, MatrixStack ms,
|
||||||
Direction facing = entity.getFacingDirection();
|
IRenderTypeBuffer buffer, int light) {
|
||||||
PlayerEntity player = Minecraft.getInstance().player;
|
super.render(entity, p_225623_2_, p_225623_3_, ms, buffer, light);
|
||||||
|
IVertexBuilder builder = buffer.getBuffer(RenderType.getEntityCutout(getEntityTexture(entity)));
|
||||||
|
|
||||||
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
boolean visible = isVisible(entity);
|
boolean visible = isVisible(entity);
|
||||||
boolean holdingGlue = AllItems.SUPER_GLUE.typeOf(player.getHeldItemMainhand())
|
boolean holdingGlue = AllItems.SUPER_GLUE.typeOf(player.getHeldItemMainhand())
|
||||||
|| AllItems.SUPER_GLUE.typeOf(player.getHeldItemOffhand());
|
|| AllItems.SUPER_GLUE.typeOf(player.getHeldItemOffhand());
|
||||||
|
@ -55,27 +55,22 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
||||||
if (!visible && !holdingGlue)
|
if (!visible && !holdingGlue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
// GlStateManager.pushMatrix(); TODO find equivalent
|
||||||
GlStateManager.translated(x, y, z);
|
// GlStateManager.translated(x, y, z);
|
||||||
GlStateManager.rotated(AngleHelper.horizontalAngle(facing), 0, 1, 0);
|
// GlStateManager.rotated(AngleHelper.horizontalAngle(facing), 0, 1, 0);
|
||||||
GlStateManager.rotated(AngleHelper.verticalAngle(facing), 1, 0, 0);
|
// GlStateManager.rotated(AngleHelper.verticalAngle(facing), 1, 0, 0);
|
||||||
|
// if (!visible) {
|
||||||
|
// GlStateManager.color4f(1, 1, 1, 0.375f);
|
||||||
|
// GlStateManager.enableBlend();
|
||||||
|
// GlStateManager.disableDepthTest();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// TODO use quad1 & quad2 to render the glue texture
|
||||||
|
|
||||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
// GlStateManager.disableBlend();
|
||||||
bindEntityTexture(entity);
|
// GlStateManager.enableDepthTest();
|
||||||
|
// GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
if (!visible) {
|
// GlStateManager.popMatrix();
|
||||||
GlStateManager.color4f(1, 1, 1, 0.375f);
|
|
||||||
GlStateManager.enableBlend();
|
|
||||||
GlStateManager.disableDepthTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
quad1.draw(buffer, 1);
|
|
||||||
quad2.draw(buffer, 1);
|
|
||||||
|
|
||||||
GlStateManager.disableBlend();
|
|
||||||
GlStateManager.enableDepthTest();
|
|
||||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isVisible(SuperGlueEntity entity) {
|
private boolean isVisible(SuperGlueEntity entity) {
|
||||||
|
@ -108,18 +103,21 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
||||||
Vec3d a4 = plane.add(start);
|
Vec3d a4 = plane.add(start);
|
||||||
Vec3d b4 = plane.add(end);
|
Vec3d b4 = plane.add(end);
|
||||||
|
|
||||||
PositionTextureVertex v11 = new PositionTextureVertex(a1, 1, 0);
|
quad1 = new Vec3d[] { a1, a2, a3, a4 };
|
||||||
PositionTextureVertex v12 = new PositionTextureVertex(a2, 1, 1);
|
quad2 = new Vec3d[] { b1, b2, b3, b4 };
|
||||||
PositionTextureVertex v13 = new PositionTextureVertex(a3, 0, 1);
|
|
||||||
PositionTextureVertex v14 = new PositionTextureVertex(a4, 0, 0);
|
|
||||||
|
|
||||||
PositionTextureVertex v21 = new PositionTextureVertex(b1, 1, 0);
|
// PositionTextureVertex v11 = new PositionTextureVertex(a1, 1, 0);
|
||||||
PositionTextureVertex v22 = new PositionTextureVertex(b2, 1, 1);
|
// PositionTextureVertex v12 = new PositionTextureVertex(a2, 1, 1);
|
||||||
PositionTextureVertex v23 = new PositionTextureVertex(b3, 0, 1);
|
// PositionTextureVertex v13 = new PositionTextureVertex(a3, 0, 1);
|
||||||
PositionTextureVertex v24 = new PositionTextureVertex(b4, 0, 0);
|
// PositionTextureVertex v14 = new PositionTextureVertex(a4, 0, 0);
|
||||||
|
//
|
||||||
quad1 = new TexturedQuad(new PositionTextureVertex[] { v14, v11, v12, v13 }, 0, 0, 16, 16, 16, 16);
|
// PositionTextureVertex v21 = new PositionTextureVertex(b1, 1, 0);
|
||||||
quad2 = new TexturedQuad(new PositionTextureVertex[] { v21, v24, v23, v22 }, 0, 0, 16, 16, 16, 16);
|
// PositionTextureVertex v22 = new PositionTextureVertex(b2, 1, 1);
|
||||||
|
// PositionTextureVertex v23 = new PositionTextureVertex(b3, 0, 1);
|
||||||
|
// PositionTextureVertex v24 = new PositionTextureVertex(b4, 0, 0);
|
||||||
|
//
|
||||||
|
// quad1 = new TexturedQuad(new PositionTextureVertex[] { v14, v11, v12, v13 }, 0, 0, 16, 16, 16, 16);
|
||||||
|
// quad2 = new TexturedQuad(new PositionTextureVertex[] { v21, v24, v23, v22 }, 0, 0, 16, 16, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,8 @@ public class MinecartContraptionItem extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addContraptionToMinecart(World world, ItemStack itemstack,
|
public static void addContraptionToMinecart(World world, ItemStack itemstack, AbstractMinecartEntity cart,
|
||||||
AbstractMinecartEntity abstractminecartentity, @Nullable Direction newFacing) {
|
@Nullable Direction newFacing) {
|
||||||
CompoundNBT tag = itemstack.getOrCreateTag();
|
CompoundNBT tag = itemstack.getOrCreateTag();
|
||||||
if (tag.contains("Contraption")) {
|
if (tag.contains("Contraption")) {
|
||||||
CompoundNBT contraptionTag = tag.getCompound("Contraption");
|
CompoundNBT contraptionTag = tag.getCompound("Contraption");
|
||||||
|
@ -152,9 +152,8 @@ public class MinecartContraptionItem extends Item {
|
||||||
else
|
else
|
||||||
contraption = ContraptionEntity.createMounted(world, mountedContraption, initialAngle);
|
contraption = ContraptionEntity.createMounted(world, mountedContraption, initialAngle);
|
||||||
|
|
||||||
contraption.startRiding(abstractminecartentity);
|
contraption.startRiding(cart);
|
||||||
contraption.setPosition(abstractminecartentity.posX, abstractminecartentity.posY,
|
contraption.setPosition(cart.getX(), cart.getY(), cart.getZ());
|
||||||
abstractminecartentity.posZ);
|
|
||||||
world.addEntity(contraption);
|
world.addEntity(contraption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +164,8 @@ public class MinecartContraptionItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {}
|
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) {
|
public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import com.simibubi.create.modules.contraptions.components.crafter.RecipeGridHan
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.Vector3f;
|
import net.minecraft.client.renderer.Vector3f;
|
||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
|
|
@ -42,8 +42,8 @@ import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
|
||||||
import net.minecraftforge.common.util.Constants.NBT;
|
import net.minecraftforge.common.util.Constants.NBT;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.client.particle.IParticleFactory;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.IWorldReader;
|
import net.minecraft.world.IWorldReader;
|
||||||
import net.minecraft.world.TickPriority;
|
import net.minecraft.world.TickPriority;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTileEntity> {
|
public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTileEntity> {
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if (te == null || !(te instanceof KineticTileEntity))
|
if (te == null || !(te instanceof KineticTileEntity))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create.modules.curiosities.deforester;
|
package com.simibubi.create.modules.curiosities.deforester;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -21,7 +21,6 @@ import com.simibubi.create.modules.curiosities.symmetry.mirror.TriplePlaneMirror
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.Vector3f;
|
import net.minecraft.client.renderer.Vector3f;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
|
@ -29,7 +28,6 @@ import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||||
import net.minecraftforge.fml.network.PacketDistributor;
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.simibubi.create.modules.curiosities.zapper;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
|
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
||||||
|
@ -18,18 +16,14 @@ import com.simibubi.create.foundation.utility.Lang;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
|
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
|
||||||
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
|
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.TickPriority;
|
import net.minecraft.world.TickPriority;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
public class PulseRepeaterBlock extends RedstoneDiodeBlock {
|
public class PulseRepeaterBlock extends RedstoneDiodeBlock {
|
||||||
|
|
|
@ -24,7 +24,6 @@ import com.simibubi.create.modules.schematics.ClientSchematicLoader;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.IHasContainer;
|
import net.minecraft.client.gui.IHasContainer;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
|
|
@ -1,30 +1,33 @@
|
||||||
package com.simibubi.create.modules.schematics.client;
|
package com.simibubi.create.modules.schematics.client;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Arrays;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.system.MemoryUtil;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import com.simibubi.create.foundation.utility.render.StructureRenderer;
|
|
||||||
import com.simibubi.create.modules.schematics.SchematicWorld;
|
import com.simibubi.create.modules.schematics.SchematicWorld;
|
||||||
|
|
||||||
|
import net.minecraft.block.BedBlock;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
|
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage;
|
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraftforge.client.ForgeHooksClient;
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
|
@ -33,12 +36,11 @@ import net.minecraftforge.client.model.data.EmptyModelData;
|
||||||
public class SchematicRenderer {
|
public class SchematicRenderer {
|
||||||
|
|
||||||
private final RegionRenderCacheBuilder bufferCache = new RegionRenderCacheBuilder();
|
private final RegionRenderCacheBuilder bufferCache = new RegionRenderCacheBuilder();
|
||||||
private final boolean[] usedBlockRenderLayers = new boolean[BlockRenderLayer.values().length];
|
private final Set<RenderType> usedBlockRenderLayers = new HashSet<>(RenderType.getBlockLayers().size());
|
||||||
private final boolean[] startedBufferBuilders = new boolean[BlockRenderLayer.values().length];
|
private final Set<RenderType> startedBufferBuilders = new HashSet<>(RenderType.getBlockLayers().size());
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private boolean changed;
|
private boolean changed;
|
||||||
private SchematicWorld schematic;
|
private SchematicWorld schematic;
|
||||||
private AABBOutline outline;
|
|
||||||
private BlockPos anchor;
|
private BlockPos anchor;
|
||||||
|
|
||||||
public SchematicRenderer() {
|
public SchematicRenderer() {
|
||||||
|
@ -71,95 +73,98 @@ public class SchematicRenderer {
|
||||||
changed = false;
|
changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render() {
|
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||||
|
// TODO 1.15 buffered render
|
||||||
if (!active)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GlStateManager.disableCull();
|
final Entity entity = Minecraft.getInstance().getRenderViewEntity();
|
||||||
GlStateManager.enableAlphaTest();
|
|
||||||
GlStateManager.depthMask(true);
|
if (entity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ActiveRenderInfo renderInfo = Minecraft.getInstance().gameRenderer.getActiveRenderInfo();
|
||||||
|
Vec3d view = renderInfo.getProjectedView();
|
||||||
|
double renderPosX = view.x;
|
||||||
|
double renderPosY = view.y;
|
||||||
|
double renderPosZ = view.z;
|
||||||
|
|
||||||
|
RenderSystem.enableAlphaTest();
|
||||||
|
RenderSystem.enableBlend();
|
||||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||||
|
|
||||||
for (int blockRenderLayerId = 0; blockRenderLayerId < usedBlockRenderLayers.length; blockRenderLayerId++)
|
for (RenderType layer : RenderType.getBlockLayers()) {
|
||||||
if (usedBlockRenderLayers[blockRenderLayerId])
|
if (!usedBlockRenderLayers.contains(layer)) {
|
||||||
drawBuffer(bufferCache.getBuilder(blockRenderLayerId));
|
continue;
|
||||||
|
}
|
||||||
GlStateManager.pushMatrix();
|
final BufferBuilder bufferBuilder = bufferCache.get(layer);
|
||||||
Vec3d position = new Vec3d(anchor);
|
RenderSystem.pushMatrix();
|
||||||
Vec3d rotation = Vec3d.ZERO;
|
RenderSystem.translated(-renderPosX, -renderPosY, -renderPosZ);
|
||||||
StructureRenderer.renderTileEntities(schematic, position, rotation, schematic.getTileEntities());
|
drawBuffer(bufferBuilder);
|
||||||
GlStateManager.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
}
|
||||||
|
RenderSystem.disableAlphaTest();
|
||||||
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void redraw(Minecraft minecraft) {
|
private void redraw(Minecraft minecraft) {
|
||||||
Arrays.fill(usedBlockRenderLayers, false);
|
usedBlockRenderLayers.clear();
|
||||||
Arrays.fill(startedBufferBuilders, false);
|
startedBufferBuilders.clear();
|
||||||
|
|
||||||
|
final SchematicWorld blockAccess = schematic;
|
||||||
|
final BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher();
|
||||||
|
|
||||||
SchematicWorld blockAccess = schematic;
|
|
||||||
blockAccess.renderMode = true;
|
|
||||||
BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher();
|
|
||||||
List<BlockState> blockstates = new LinkedList<>();
|
List<BlockState> blockstates = new LinkedList<>();
|
||||||
BlockPos min = blockAccess.getBounds().getOrigin();
|
|
||||||
BlockPos max = min.add(blockAccess.getBounds().getSize());
|
|
||||||
outline = new AABBOutline(new AxisAlignedBB(min, max));
|
|
||||||
outline.setTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED);
|
|
||||||
|
|
||||||
for (BlockPos localPos : BlockPos.getAllInBoxMutable(min, max)) {
|
for (BlockPos localPos : BlockPos.getAllInBoxMutable(blockAccess.getBounds().getOrigin(),
|
||||||
|
blockAccess.getBounds().getOrigin().add(blockAccess.getBounds().getSize()))) {
|
||||||
BlockPos pos = localPos.add(anchor);
|
BlockPos pos = localPos.add(anchor);
|
||||||
BlockState state = blockAccess.getBlockState(pos);
|
BlockState state = blockAccess.getBlockState(pos);
|
||||||
|
for (RenderType blockRenderLayer : RenderType.getBlockLayers()) {
|
||||||
for (BlockRenderLayer blockRenderLayer : BlockRenderLayer.values()) {
|
if (!RenderTypeLookup.canRenderInLayer(state, blockRenderLayer)) {
|
||||||
if (!state.getBlock().canRenderInLayer(state, blockRenderLayer))
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
ForgeHooksClient.setRenderLayer(blockRenderLayer);
|
ForgeHooksClient.setRenderLayer(blockRenderLayer);
|
||||||
|
final BufferBuilder bufferBuilder = bufferCache.get(blockRenderLayer);
|
||||||
final int blockRenderLayerId = blockRenderLayer.ordinal();
|
if (startedBufferBuilders.add(blockRenderLayer)) {
|
||||||
final BufferBuilder bufferBuilder = bufferCache.getBuilder(blockRenderLayerId);
|
// Copied from RenderChunk
|
||||||
if (!startedBufferBuilders[blockRenderLayerId]) {
|
{
|
||||||
startedBufferBuilders[blockRenderLayerId] = true;
|
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||||
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usedBlockRenderLayers[blockRenderLayerId] |= blockRendererDispatcher.renderBlock(state, pos,
|
// Block transformations
|
||||||
blockAccess, bufferBuilder, minecraft.world.rand, EmptyModelData.INSTANCE);
|
if (state.getBlock() instanceof BedBlock) {
|
||||||
|
state = Blocks.QUARTZ_SLAB.getDefaultState();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blockRendererDispatcher.renderModel(state, pos, blockAccess, new MatrixStack(), bufferBuilder, true,
|
||||||
|
minecraft.world.rand, EmptyModelData.INSTANCE)) {
|
||||||
|
usedBlockRenderLayers.add(blockRenderLayer);
|
||||||
|
}
|
||||||
blockstates.add(state);
|
blockstates.add(state);
|
||||||
}
|
}
|
||||||
ForgeHooksClient.setRenderLayer(null);
|
ForgeHooksClient.setRenderLayer(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// finishDrawing
|
// finishDrawing
|
||||||
blockAccess.renderMode = false;
|
for (RenderType layer : RenderType.getBlockLayers()) {
|
||||||
for (int blockRenderLayerId = 0; blockRenderLayerId < usedBlockRenderLayers.length; blockRenderLayerId++) {
|
if (!startedBufferBuilders.contains(layer)) {
|
||||||
if (!startedBufferBuilders[blockRenderLayerId])
|
|
||||||
continue;
|
continue;
|
||||||
bufferCache.getBuilder(blockRenderLayerId).finishDrawing();
|
}
|
||||||
|
bufferCache.get(layer).finishDrawing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Coppied from the Tesselator's vboUploader - Draw everything but don't
|
|
||||||
// reset the buffer
|
|
||||||
private static void drawBuffer(final BufferBuilder bufferBuilder) {
|
private static void drawBuffer(final BufferBuilder bufferBuilder) {
|
||||||
if (bufferBuilder.getVertexCount() <= 0)
|
Pair<BufferBuilder.DrawState, ByteBuffer> pair = bufferBuilder.popData();
|
||||||
return;
|
BufferBuilder.DrawState state = pair.getFirst();
|
||||||
|
|
||||||
VertexFormat vertexformat = bufferBuilder.getVertexFormat();
|
if (state.getCount() > 0) {
|
||||||
int size = vertexformat.getSize();
|
state.getVertexFormat().startDrawing(MemoryUtil.memAddress(pair.getSecond()));
|
||||||
ByteBuffer bytebuffer = bufferBuilder.getByteBuffer();
|
RenderSystem.drawArrays(state.getMode(), 0, state.getCount());
|
||||||
List<VertexFormatElement> list = vertexformat.getElements();
|
state.getVertexFormat().endDrawing();
|
||||||
|
|
||||||
for (int index = 0; index < list.size(); ++index) {
|
|
||||||
VertexFormatElement vertexformatelement = list.get(index);
|
|
||||||
Usage usage = vertexformatelement.getUsage();
|
|
||||||
bytebuffer.position(vertexformat.getOffset(index));
|
|
||||||
usage.preDraw(vertexformat, index, size, bytebuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
GlStateManager.drawArrays(bufferBuilder.getDrawMode(), 0, bufferBuilder.getVertexCount());
|
|
||||||
|
|
||||||
for (int index = 0; index < list.size(); ++index) {
|
|
||||||
VertexFormatElement vertexformatelement = list.get(index);
|
|
||||||
Usage usage = vertexformatelement.getUsage();
|
|
||||||
usage.postDraw(vertexformat, index, size, bytebuffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.modules.schematics.client;
|
package com.simibubi.create.modules.schematics.client;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
@ -51,16 +51,17 @@ public class SchematicTransformation {
|
||||||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
GlStateManager.translated(x.get(pt), y.get(pt), z.get(pt));
|
RenderSystem.translated(x.get(pt), y.get(pt), z.get(pt));
|
||||||
|
|
||||||
Vec3d rotationOffset = getRotationOffset(true);
|
Vec3d rotationOffset = getRotationOffset(true);
|
||||||
|
|
||||||
// Rotation & Mirror
|
// Rotation & Mirror
|
||||||
GlStateManager.translated(xOrigin + rotationOffset.x, 0, zOrigin + rotationOffset.z);
|
|
||||||
GlStateManager.rotated(rotation.get(pt), 0, 1, 0);
|
RenderSystem.translated(xOrigin + rotationOffset.x, 0, zOrigin + rotationOffset.z);
|
||||||
GlStateManager.translated(-rotationOffset.x, 0, -rotationOffset.z);
|
RenderSystem.rotatef(rotation.get(pt), 0, 1, 0);
|
||||||
GlStateManager.scaled(scaleFrontBack.get(pt), 1, scaleLeftRight.get(pt));
|
RenderSystem.translated(-rotationOffset.x, 0, -rotationOffset.z);
|
||||||
GlStateManager.translated(-xOrigin, 0, -zOrigin);
|
RenderSystem.scaled(scaleFrontBack.get(pt), 1, scaleLeftRight.get(pt));
|
||||||
|
RenderSystem.translated(-xOrigin, 0, -zOrigin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
package com.simibubi.create.modules.schematics.client.tools;
|
package com.simibubi.create.modules.schematics.client.tools;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.GlHelper;
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -51,8 +45,8 @@ public class FlipTool extends PlacementToolBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToolLocal() {
|
public void renderToolLocal(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||||
super.renderToolLocal();
|
super.renderToolLocal(ms, buffer, light, overlay);
|
||||||
|
|
||||||
if (!schematicSelected || !selectedFace.getAxis().isHorizontal())
|
if (!schematicSelected || !selectedFace.getAxis().isHorizontal())
|
||||||
return;
|
return;
|
||||||
|
@ -78,32 +72,33 @@ public class FlipTool extends PlacementToolBase {
|
||||||
plane = plane.mul(-1, 1, -1);
|
plane = plane.mul(-1, 1, -1);
|
||||||
Vec3d v4 = plane.add(center);
|
Vec3d v4 = plane.add(center);
|
||||||
|
|
||||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
// BufferBuilder buffer = Tessellator.getInstance().getBuffer();TODO 1.15
|
||||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
// buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
AABBOutline outline = schematicHandler.getOutline();
|
//
|
||||||
AllSpecialTextures.BLANK.bind();
|
// AABBOutline outline = schematicHandler.getOutline();
|
||||||
outline.renderAACuboidLine(v1, v2, color, 1, buffer);
|
// AllSpecialTextures.BLANK.bind();
|
||||||
outline.renderAACuboidLine(v2, v3, color, 1, buffer);
|
// outline.renderAACuboidLine(v1, v2, color, 1, builder);
|
||||||
outline.renderAACuboidLine(v3, v4, color, 1, buffer);
|
// outline.renderAACuboidLine(v2, v3, color, 1, builder);
|
||||||
outline.renderAACuboidLine(v4, v1, color, 1, buffer);
|
// outline.renderAACuboidLine(v3, v4, color, 1, builder);
|
||||||
|
// outline.renderAACuboidLine(v4, v1, color, 1, builder);
|
||||||
Tessellator.getInstance().draw();
|
//
|
||||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
// Tessellator.getInstance().draw();
|
||||||
|
// buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
GlHelper.enableTextureRepeat();
|
//
|
||||||
GlStateManager.depthMask(false);
|
// GlHelper.enableTextureRepeat();
|
||||||
Vec3d uDiff = v2.subtract(v1);
|
// GlStateManager.depthMask(false);
|
||||||
Vec3d vDiff = v4.subtract(v1);
|
// Vec3d uDiff = v2.subtract(v1);
|
||||||
float maxU = (float) Math.abs(axis == Axis.X ? uDiff.z : uDiff.x);
|
// Vec3d vDiff = v4.subtract(v1);
|
||||||
float maxV = (float) Math.abs(axis == Axis.Y ? vDiff.z : vDiff.y);
|
// float maxU = (float) Math.abs(axis == Axis.X ? uDiff.z : uDiff.x);
|
||||||
|
// float maxV = (float) Math.abs(axis == Axis.Y ? vDiff.z : vDiff.y);
|
||||||
GlStateManager.enableCull();
|
//
|
||||||
AllSpecialTextures.HIGHLIGHT_CHECKERED.bind();
|
// GlStateManager.enableCull();
|
||||||
outline.putQuadUV(v1, v2, v3, v4, 0, 0, maxU, maxV, color, 1, buffer);
|
// AllSpecialTextures.HIGHLIGHT_CHECKERED.bind();
|
||||||
outline.putQuadUV(v2, v1, v4, v3, 0, 0, maxU, maxV, color, 1, buffer);
|
// outline.putQuadUV(v1, v2, v3, v4, 0, 0, maxU, maxV, color, 1, builder);
|
||||||
Tessellator.getInstance().draw();
|
// outline.putQuadUV(v2, v1, v4, v3, 0, 0, maxU, maxV, color, 1, builder);
|
||||||
GlStateManager.popMatrix();
|
// Tessellator.getInstance().draw();
|
||||||
GlHelper.disableTextureRepeat();
|
// GlStateManager.popMatrix();
|
||||||
|
// GlHelper.disableTextureRepeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
package com.simibubi.create.modules.schematics.client.tools;
|
package com.simibubi.create.modules.schematics.client.tools;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
|
|
||||||
public class RotateTool extends PlacementToolBase {
|
public class RotateTool extends PlacementToolBase {
|
||||||
|
|
||||||
|
@ -22,26 +14,26 @@ public class RotateTool extends PlacementToolBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToolLocal() {
|
public void renderToolLocal(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||||
super.renderToolLocal();
|
super.renderToolLocal(ms, buffer, light, overlay);
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
// GlStateManager.pushMatrix();TODO 1.15
|
||||||
RenderHelper.disableStandardItemLighting();
|
// RenderHelper.disableStandardItemLighting();
|
||||||
GlStateManager.enableBlend();
|
// GlStateManager.enableBlend();
|
||||||
|
//
|
||||||
Vec3d color = ColorHelper.getRGB(0x4d80e4);
|
// Vec3d color = ColorHelper.getRGB(0x4d80e4);
|
||||||
AxisAlignedBB bounds = schematicHandler.getBounds();
|
// AxisAlignedBB bounds = schematicHandler.getBounds();
|
||||||
double height = bounds.getYSize() + Math.max(20, bounds.getYSize());
|
// double height = bounds.getYSize() + Math.max(20, bounds.getYSize());
|
||||||
|
//
|
||||||
Vec3d center = bounds.getCenter().add(schematicHandler.getTransformation().getRotationOffset(false));
|
// Vec3d center = bounds.getCenter().add(schematicHandler.getTransformation().getRotationOffset(false));
|
||||||
Vec3d start = center.subtract(0, height / 2, 0);
|
// Vec3d start = center.subtract(0, height / 2, 0);
|
||||||
Vec3d end = center.add(0, height / 2, 0);
|
// Vec3d end = center.add(0, height / 2, 0);
|
||||||
|
//
|
||||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
// BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
// buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
schematicHandler.getOutline().renderAACuboidLine(start, end, color, 1, buffer);
|
// schematicHandler.getOutline().renderAACuboidLine(start, end, color, 1, buffer);
|
||||||
Tessellator.getInstance().draw();
|
// Tessellator.getInstance().draw();
|
||||||
GlStateManager.popMatrix();
|
// GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue