Ported Schematic and Quill handler

- Updated outlines rendered by the schematic and quill
- Removed some now auto-generated leftovers from the asset folder
- Fixed Schematic Table screen not rendering the table properly
This commit is contained in:
simibubi 2020-05-16 00:13:49 +02:00
parent 071482bb26
commit d5ec1d6fef
31 changed files with 132 additions and 281 deletions

View file

@ -2,8 +2,6 @@ package com.simibubi.create.foundation.utility.outliner;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.utility.ColorHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
@ -17,10 +15,6 @@ import net.minecraft.util.math.Vec3d;
public class AABBOutline extends Outline { public class AABBOutline extends Outline {
protected AxisAlignedBB bb; protected AxisAlignedBB bb;
protected AllSpecialTextures faceTexture;
protected AllSpecialTextures highlightedTexture;
protected Direction highlightedFace;
public boolean disableCull = false;
public AABBOutline(AxisAlignedBB bb) { public AABBOutline(AxisAlignedBB bb) {
this.bb = bb; this.bb = bb;
@ -28,22 +22,10 @@ public class AABBOutline extends Outline {
@Override @Override
public void render(MatrixStack ms, IRenderTypeBuffer buffer) { public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
Vec3d color = ColorHelper.getRGB(0xFFFFFF); renderBB(ms, buffer, bb);
float alpha = 1f;
renderBB(ms, buffer, bb, color, alpha, !disableCull);
} }
public void setTextures(AllSpecialTextures faceTexture, AllSpecialTextures highlightTexture) { public void renderBB(MatrixStack ms, IRenderTypeBuffer buffer, AxisAlignedBB bb) {
this.faceTexture = faceTexture;
this.highlightedTexture = highlightTexture;
}
public void highlightFace(Direction face) {
this.highlightedFace = face;
}
public void renderBB(MatrixStack ms, IRenderTypeBuffer buffer, AxisAlignedBB bb, Vec3d color, float alpha,
boolean doCulling) {
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo() Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
.getProjectedView(); .getProjectedView();
boolean inside = bb.contains(projectedView); boolean inside = bb.contains(projectedView);
@ -89,13 +71,13 @@ public class AABBOutline extends Outline {
protected void renderFace(MatrixStack ms, IRenderTypeBuffer buffer, Direction direction, Vec3d p1, Vec3d p2, protected void renderFace(MatrixStack ms, IRenderTypeBuffer buffer, Direction direction, Vec3d p1, Vec3d p2,
Vec3d p3, Vec3d p4, boolean noCull) { Vec3d p3, Vec3d p4, boolean noCull) {
if (!params.faceTexture.isPresent())
ResourceLocation faceTexture = this.faceTexture.getLocation();
if (direction == highlightedFace && highlightedTexture != null)
faceTexture = highlightedTexture.getLocation();
else if (faceTexture == null)
return; return;
ResourceLocation faceTexture = params.faceTexture.get().getLocation();
if (direction == params.highlightedFace && params.hightlightedFaceTexture.isPresent())
faceTexture = params.hightlightedFaceTexture.get().getLocation();
RenderType translucentType = RenderType translucentType =
noCull ? RenderType.getEntityTranslucent(faceTexture) : RenderType.getEntityTranslucentCull(faceTexture); noCull ? RenderType.getEntityTranslucent(faceTexture) : RenderType.getEntityTranslucentCull(faceTexture);
IVertexBuilder builder = buffer.getBuffer(translucentType); IVertexBuilder builder = buffer.getBuffer(translucentType);

View file

@ -1,13 +1,11 @@
package com.simibubi.create.foundation.utility.outliner; package com.simibubi.create.foundation.utility.outliner;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.utility.ColorHelper;
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.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
public class ChasingAABBOutline extends AABBOutline { public class ChasingAABBOutline extends AABBOutline {
@ -32,10 +30,8 @@ public class ChasingAABBOutline extends AABBOutline {
@Override @Override
public void render(MatrixStack ms, IRenderTypeBuffer buffer) { public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
float alpha = 1f;
renderBB(ms, buffer, interpolateBBs(prevBB, bb, Minecraft.getInstance() renderBB(ms, buffer, interpolateBBs(prevBB, bb, Minecraft.getInstance()
.getRenderPartialTicks()), color, alpha, true); .getRenderPartialTicks()));
} }
private static AxisAlignedBB interpolateBBs(AxisAlignedBB current, AxisAlignedBB target, float pt) { private static AxisAlignedBB interpolateBBs(AxisAlignedBB current, AxisAlignedBB target, float pt) {

View file

@ -2,6 +2,8 @@ package com.simibubi.create.foundation.utility.outliner;
import java.util.Optional; import java.util.Optional;
import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.matrix.MatrixStack.Entry; import com.mojang.blaze3d.matrix.MatrixStack.Entry;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
@ -105,7 +107,9 @@ public abstract class Outline {
public static class OutlineParams { public static class OutlineParams {
Optional<AllSpecialTextures> faceTexture; Optional<AllSpecialTextures> faceTexture;
Optional<AllSpecialTextures> hightlightedFaceTexture; Optional<AllSpecialTextures> hightlightedFaceTexture;
Direction highlightedFace;
boolean fadeLineWidth; boolean fadeLineWidth;
boolean disableCull;
float alpha; float alpha;
private float lineWidth; private float lineWidth;
int lightMapU, lightMapV; int lightMapU, lightMapV;
@ -140,6 +144,17 @@ public abstract class Outline {
return this; return this;
} }
public OutlineParams withFaceTextures(AllSpecialTextures texture, AllSpecialTextures highlightTexture) {
this.faceTexture = Optional.of(texture);
this.hightlightedFaceTexture = Optional.of(highlightTexture);
return this;
}
public OutlineParams highlightFace(@Nullable Direction face) {
highlightedFace = face;
return this;
}
// util // util
float getLineWidth() { float getLineWidth() {

View file

@ -3,6 +3,7 @@ package com.simibubi.create.foundation.utility.outliner;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
@ -20,29 +21,29 @@ public class Outliner {
// Facade // Facade
public OutlineParams showAABB(Object slot, AxisAlignedBB bb, ExpireType type) { public OutlineParams showAABB(Object slot, AxisAlignedBB bb) {
createAABBOutlineIfMissing(slot, bb, type); createAABBOutlineIfMissing(slot, bb);
ChasingAABBOutline outline = getAndRefreshAABB(slot); ChasingAABBOutline outline = getAndRefreshAABB(slot);
outline.prevBB = outline.targetBB = bb; outline.prevBB = outline.targetBB = bb;
return outline.getParams(); return outline.getParams();
} }
public OutlineParams chaseAABB(Object slot, AxisAlignedBB bb, ExpireType type) { public OutlineParams chaseAABB(Object slot, AxisAlignedBB bb) {
createAABBOutlineIfMissing(slot, bb, type); createAABBOutlineIfMissing(slot, bb);
ChasingAABBOutline outline = getAndRefreshAABB(slot); ChasingAABBOutline outline = getAndRefreshAABB(slot);
outline.targetBB = bb; outline.targetBB = bb;
return outline.getParams(); return outline.getParams();
} }
public OutlineParams showCluster(Object slot, Iterable<BlockPos> selection, ExpireType type) { public OutlineParams showCluster(Object slot, Iterable<BlockPos> selection) {
BlockClusterOutline outline = new BlockClusterOutline(selection); BlockClusterOutline outline = new BlockClusterOutline(selection);
OutlineEntry entry = new OutlineEntry(outline, type); OutlineEntry entry = new OutlineEntry(outline);
outlines.put(slot, entry); outlines.put(slot, entry);
return entry.getOutline() return entry.getOutline()
.getParams(); .getParams();
} }
public void keepCluster(Object slot) { public void keep(Object slot) {
if (outlines.containsKey(slot)) if (outlines.containsKey(slot))
outlines.get(slot).ticksTillRemoval = 1; outlines.get(slot).ticksTillRemoval = 1;
} }
@ -51,12 +52,21 @@ public class Outliner {
outlines.remove(slot); outlines.remove(slot);
} }
public Optional<OutlineParams> edit(Object slot) {
keep(slot);
if (outlines.containsKey(slot))
return Optional.of(outlines.get(slot)
.getOutline()
.getParams());
return Optional.empty();
}
// Utility // Utility
private void createAABBOutlineIfMissing(Object slot, AxisAlignedBB bb, ExpireType type) { private void createAABBOutlineIfMissing(Object slot, AxisAlignedBB bb) {
if (!outlines.containsKey(slot)) { if (!outlines.containsKey(slot)) {
ChasingAABBOutline outline = new ChasingAABBOutline(bb); ChasingAABBOutline outline = new ChasingAABBOutline(bb);
outlines.put(slot, new OutlineEntry(outline, type)); outlines.put(slot, new OutlineEntry(outline));
} }
} }
@ -91,11 +101,12 @@ public class Outliner {
outlines.forEach((key, entry) -> { outlines.forEach((key, entry) -> {
Outline outline = entry.getOutline(); Outline outline = entry.getOutline();
outline.params.alpha = 1; outline.params.alpha = 1;
if (entry.type != ExpireType.IMMEDIATE && entry.ticksTillRemoval < 0) { if (entry.ticksTillRemoval < 0) {
int prevTicks = entry.ticksTillRemoval + 1; int prevTicks = entry.ticksTillRemoval + 1;
float lastAlpha = prevTicks >= 0 ? 1 : 1 + (prevTicks / (float) entry.type.fadeTicks); float fadeticks = (float) OutlineEntry.fadeTicks;
float currentAlpha = 1 + (entry.ticksTillRemoval / (float) entry.type.fadeTicks); float lastAlpha = prevTicks >= 0 ? 1 : 1 + (prevTicks / fadeticks);
float currentAlpha = 1 + (entry.ticksTillRemoval / fadeticks);
float alpha = MathHelper.lerp(Minecraft.getInstance() float alpha = MathHelper.lerp(Minecraft.getInstance()
.getRenderPartialTicks(), lastAlpha, currentAlpha); .getRenderPartialTicks(), lastAlpha, currentAlpha);
@ -107,30 +118,19 @@ public class Outliner {
}); });
} }
public enum ExpireType {
IMMEDIATE(0), FADE(8), FADE_EXPAND(10);
private int fadeTicks;
private ExpireType(int fadeTicks) {
this.fadeTicks = fadeTicks;
}
}
private class OutlineEntry { private class OutlineEntry {
static final int fadeTicks = 8;
private Outline outline; private Outline outline;
private int ticksTillRemoval; private int ticksTillRemoval;
private ExpireType type;
public OutlineEntry(Outline outline, ExpireType type) { public OutlineEntry(Outline outline) {
this.outline = outline; this.outline = outline;
this.type = type;
ticksTillRemoval = 1; ticksTillRemoval = 1;
} }
public boolean isAlive() { public boolean isAlive() {
return ticksTillRemoval >= -type.fadeTicks; return ticksTillRemoval >= -fadeTicks;
} }
public Outline getOutline() { public Outline getOutline() {

View file

@ -13,7 +13,6 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllKeys; import com.simibubi.create.AllKeys;
import com.simibubi.create.AllSpecialTextures; import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.outliner.Outliner.ExpireType;
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.ChassisTileEntity; import com.simibubi.create.modules.contraptions.components.contraptions.chassis.ChassisTileEntity;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -36,7 +35,7 @@ public class ChassisRangeDisplay {
public Entry(ChassisTileEntity te) { public Entry(ChassisTileEntity te) {
this.te = te; this.te = te;
timer = DISPLAY_TIME; timer = DISPLAY_TIME;
CreateClient.outliner.showCluster(getOutlineKey(), createSelection(te), ExpireType.FADE) CreateClient.outliner.showCluster(getOutlineKey(), createSelection(te))
.colored(0xFFFFBB) .colored(0xFFFFBB)
.lineWidth(1 / 16f) .lineWidth(1 / 16f)
.withFaceTexture(AllSpecialTextures.CHECKERED); .withFaceTexture(AllSpecialTextures.CHECKERED);
@ -97,7 +96,7 @@ public class ChassisRangeDisplay {
Entry entry = entries.get(pos); Entry entry = entries.get(pos);
if (tickEntry(entry, hasWrench)) if (tickEntry(entry, hasWrench))
iterator.remove(); iterator.remove();
CreateClient.outliner.keepCluster(entry.getOutlineKey()); CreateClient.outliner.keep(entry.getOutlineKey());
} }
for (Iterator<GroupEntry> iterator = groupEntries.iterator(); iterator.hasNext();) { for (Iterator<GroupEntry> iterator = groupEntries.iterator(); iterator.hasNext();) {
@ -107,7 +106,7 @@ public class ChassisRangeDisplay {
if (group == lastHoveredGroup) if (group == lastHoveredGroup)
lastHoveredGroup = null; lastHoveredGroup = null;
} }
CreateClient.outliner.keepCluster(group.getOutlineKey()); CreateClient.outliner.keep(group.getOutlineKey());
} }
if (!hasWrench) if (!hasWrench)

View file

@ -38,6 +38,7 @@ public class AllPaletteBlocks {
public static final BlockEntry<GlassBlock> TILED_GLASS = REGISTRATE.block("tiled_glass", GlassBlock::new) public static final BlockEntry<GlassBlock> TILED_GLASS = REGISTRATE.block("tiled_glass", GlassBlock::new)
.initialProperties(() -> Blocks.GLASS) .initialProperties(() -> Blocks.GLASS)
.addLayer(() -> RenderType::getCutoutMipped)
.blockstate(palettesCubeAll()) .blockstate(palettesCubeAll())
.simpleItem() .simpleItem()
.register(); .register();

View file

@ -14,10 +14,12 @@ import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.ScreenResources; import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.widgets.IconButton; import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.schematics.ClientSchematicLoader; import com.simibubi.create.modules.schematics.ClientSchematicLoader;
@ -107,17 +109,21 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
.getFormattedText(), x - 15 + 7, y + 64 + 26, 0x666666); .getFormattedText(), x - 15 + 7, y + 64 + 26, 0x666666);
SCHEMATIC_TABLE.draw(this, mainLeft, mainTop); SCHEMATIC_TABLE.draw(this, mainLeft, mainTop);
if (container.getTileEntity().isUploading) if (container.getTileEntity().isUploading)
font.drawString(uploading, mainLeft + 76, mainTop + 10, ScreenResources.FONT_COLOR); font.drawString(uploading, mainLeft + 76, mainTop + 10, ScreenResources.FONT_COLOR);
else if (container.getSlot(1) else if (container.getSlot(1).getHasStack())
.getHasStack())
font.drawString(finished, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR); font.drawString(finished, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
else else
font.drawString(title, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR); font.drawString(title, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
if (schematicsArea == null)
if (schematicsArea == null) {
font.drawStringWithShadow(noSchematics, mainLeft + 39, mainTop + 26, 0xFFDD44); font.drawStringWithShadow(noSchematics, mainLeft + 39, mainTop + 26, 0xFFDD44);
}
RenderSystem.pushMatrix();
RenderSystem.translated(mainLeft + 217, mainTop + 48, 200);
RenderSystem.scaled(3, 3, 3);
GuiGameElement.of(AllBlocksNew.SCHEMATIC_TABLE.asStack()).render();
RenderSystem.popMatrix();
minecraft.getTextureManager() minecraft.getTextureManager()
.bindTexture(SCHEMATIC_TABLE_PROGRESS.location); .bindTexture(SCHEMATIC_TABLE_PROGRESS.location);
@ -128,34 +134,6 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
blit(mainLeft + 94, mainTop + 56, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width, blit(mainLeft + 94, mainTop + 56, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width,
height); height);
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.enableRescaleNormal();
RenderSystem.enableAlphaTest();
RenderHelper.enableGuiDepthLighting();
RenderSystem.alphaFunc(516, 0.1F);
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.translated(mainLeft + 270, mainTop + 100, 200);
RenderSystem.rotatef(50, -.5f, 1, -.2f);
RenderSystem.scaled(50, -50, 50);
Minecraft.getInstance()
.getTextureManager()
.bindTexture(PlayerContainer.BLOCK_ATLAS_TEXTURE);
minecraft.getBlockRendererDispatcher()
.renderBlock(AllBlocksNew.SCHEMATIC_TABLE.get()
.getDefaultState(), new MatrixStack(),
getMinecraft().getBufferBuilders()
.getEntityVertexConsumers(),
0xF000F0, OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE);
RenderSystem.disableAlphaTest();
RenderSystem.disableRescaleNormal();
RenderSystem.popMatrix();
} }
@Override @Override

View file

@ -10,11 +10,16 @@ import org.apache.commons.io.IOUtils;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.AllKeys; import com.simibubi.create.AllKeys;
import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.TextInputPromptScreen; import com.simibubi.create.foundation.gui.TextInputPromptScreen;
import com.simibubi.create.foundation.utility.FilesHelper; import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.RaycastHelper; import com.simibubi.create.foundation.utility.RaycastHelper;
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.outliner.Outliner;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -38,14 +43,14 @@ import net.minecraft.world.gen.feature.template.Template;
public class SchematicAndQuillHandler { public class SchematicAndQuillHandler {
private Object outlineSlot = new Object();
private BlockPos firstPos; private BlockPos firstPos;
private BlockPos secondPos; private BlockPos secondPos;
private BlockPos selectedPos; private BlockPos selectedPos;
private Direction selectedFace; private Direction selectedFace;
private int range = 10; private int range = 10;
// private OutlineParticle<ChasingAABBOutline> particle;
public boolean mouseScrolled(double delta) { public boolean mouseScrolled(double delta) {
if (!isActive()) if (!isActive())
return false; return false;
@ -58,7 +63,8 @@ public class SchematicAndQuillHandler {
AxisAlignedBB bb = new AxisAlignedBB(firstPos, secondPos); AxisAlignedBB bb = new AxisAlignedBB(firstPos, secondPos);
Vec3i vec = selectedFace.getDirectionVec(); Vec3i vec = selectedFace.getDirectionVec();
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
.getProjectedView();
if (bb.contains(projectedView)) if (bb.contains(projectedView))
delta *= -1; delta *= -1;
@ -99,7 +105,8 @@ public class SchematicAndQuillHandler {
} }
if (secondPos != null) { if (secondPos != null) {
TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> {}); TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> {
});
guiScreenIn.setTitle(Lang.translate("schematicAndQuill.prompt")); guiScreenIn.setTitle(Lang.translate("schematicAndQuill.prompt"));
guiScreenIn.setButtonTextConfirm(Lang.translate("action.saveToFile")); guiScreenIn.setButtonTextConfirm(Lang.translate("action.saveToFile"));
guiScreenIn.setButtonTextAbort(Lang.translate("action.discard")); guiScreenIn.setButtonTextAbort(Lang.translate("action.discard"));
@ -123,20 +130,17 @@ public class SchematicAndQuillHandler {
} }
public void tick() { public void tick() {
if (!isActive()) { if (!isActive())
// if (particle != null) {
// particle.setExpired();
// particle = null;
// }
return; return;
}
ClientPlayerEntity player = Minecraft.getInstance().player; ClientPlayerEntity player = Minecraft.getInstance().player;
if (AllKeys.ACTIVATE_TOOL.isPressed()) { if (AllKeys.ACTIVATE_TOOL.isPressed()) {
float pt = Minecraft.getInstance().getRenderPartialTicks(); float pt = Minecraft.getInstance()
Vec3d targetVec = player.getEyePosition(pt).add(player.getLookVec().scale(range)); .getRenderPartialTicks();
setCursor(new BlockPos(targetVec)); Vec3d targetVec = player.getEyePosition(pt)
.add(player.getLookVec()
.scale(range));
selectedPos = new BlockPos(targetVec);
} else { } else {
BlockRayTraceResult trace = RaycastHelper.rayTraceRange(player.world, player, 75); BlockRayTraceResult trace = RaycastHelper.rayTraceRange(player.world, player, 75);
@ -145,56 +149,35 @@ public class SchematicAndQuillHandler {
BlockPos hit = trace.getPos(); BlockPos hit = trace.getPos();
boolean replaceable = player.world.getBlockState(hit) boolean replaceable = player.world.getBlockState(hit)
.isReplaceable(new BlockItemUseContext(new ItemUseContext(player, Hand.MAIN_HAND, trace))); .isReplaceable(new BlockItemUseContext(new ItemUseContext(player, Hand.MAIN_HAND, trace)));
if (trace.getFace().getAxis().isVertical() && !replaceable) if (trace.getFace()
.getAxis()
.isVertical() && !replaceable)
hit = hit.offset(trace.getFace()); hit = hit.offset(trace.getFace());
setCursor(hit); selectedPos = hit;
} else } else
setCursor(null); selectedPos = null;
} }
// if (particle == null) selectedFace = null;
// return; if (secondPos != null) {
// AxisAlignedBB bb = new AxisAlignedBB(firstPos, secondPos).expand(1, 1, 1)
// ChasingAABBOutline outline = particle.getOutline(); .grow(.45f);
// if (particle.isAlive()) Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
// outline.tick(); .getProjectedView();
boolean inside = bb.contains(projectedView);
// if (secondPos == null) { PredicateTraceResult result =
// selectedFace = null; RaycastHelper.rayTraceUntil(player, 70, pos -> inside ^ bb.contains(VecHelper.getCenterOf(pos)));
// outline.highlightFace(null); selectedFace = result.missed() ? null
// return; : inside ? result.getFacing()
// } .getOpposite() : result.getFacing();
//
// AxisAlignedBB bb = new AxisAlignedBB(firstPos, secondPos).expand(1, 1, 1).grow(.45f);
// Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
// boolean inside = bb.contains(projectedView);
//
// PredicateTraceResult result =
// RaycastHelper.rayTraceUntil(player, 70, pos -> inside ^ bb.contains(VecHelper.getCenterOf(pos)));
// selectedFace = result.missed() ? null : inside ? result.getFacing().getOpposite() : result.getFacing();
// outline.highlightFace(AllKeys.ACTIVATE_TOOL.isPressed() ? selectedFace : null);
} }
private void setCursor(BlockPos pos) { AxisAlignedBB currentSelectionBox = getCurrentSelectionBox();
selectedPos = pos; if (currentSelectionBox != null)
AxisAlignedBB bb = getCurrentSelectionBox(); outliner().chaseAABB(outlineSlot, currentSelectionBox)
.colored(0xDDDFFF)
// if (particle != null && !particle.isAlive()) .withFaceTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED)
// particle = null; .highlightFace(selectedFace);
// if (bb == null) {
// if (particle != null)
// particle.setExpired();
// return;
// }
//
// if (particle == null) {
// ChasingAABBOutline outline = new ChasingAABBOutline(bb);
// outline.setTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED);
// particle = OutlineParticle.create(outline);
// }
//
// ChasingAABBOutline outline = particle.getOutline();
// outline.target(bb);
} }
private AxisAlignedBB getCurrentSelectionBox() { private AxisAlignedBB getCurrentSelectionBox() {
@ -246,4 +229,8 @@ public class SchematicAndQuillHandler {
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath); Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
} }
private Outliner outliner() {
return CreateClient.outliner;
}
} }

View file

@ -34,8 +34,7 @@ public class SchematicHandler {
private String displayedSchematic; private String displayedSchematic;
private SchematicTransformation transformation; private SchematicTransformation transformation;
private AxisAlignedBB bounds; // local space private AxisAlignedBB bounds;
private AABBOutline outline;
private boolean deployed; private boolean deployed;
private boolean active; private boolean active;
private Tools currentTool; private Tools currentTool;
@ -247,8 +246,8 @@ public class SchematicHandler {
BlockPos size = NBTUtil.readBlockPos(tag.getCompound("Bounds")); BlockPos size = NBTUtil.readBlockPos(tag.getCompound("Bounds"));
bounds = new AxisAlignedBB(BlockPos.ZERO, size); bounds = new AxisAlignedBB(BlockPos.ZERO, size);
outline = new AABBOutline(bounds); // outline = new AABBOutline(bounds);
outline.disableCull = true; // outline.disableCull = true;
transformation.init(anchor, settings, bounds); transformation.init(anchor, settings, bounds);
} }
@ -275,10 +274,6 @@ public class SchematicHandler {
markDirty(); markDirty();
} }
public AABBOutline getOutline() {
return outline;
}
public boolean isActive() { public boolean isActive() {
return active; return active;
} }

View file

@ -119,11 +119,11 @@ public abstract class SchematicToolBase implements ISchematicTool {
if (!schematicHandler.isDeployed()) if (!schematicHandler.isDeployed())
return; return;
AABBOutline outline = schematicHandler.getOutline(); // AABBOutline outline = schematicHandler.getOutline();
if (renderSelectedFace) { if (renderSelectedFace) {
schematicHandler.getOutline().setTextures(null, // schematicHandler.getOutline().setTextures(null,
AllKeys.ctrlDown() ? AllSpecialTextures.HIGHLIGHT_CHECKERED : AllSpecialTextures.CHECKERED); // AllKeys.ctrlDown() ? AllSpecialTextures.HIGHLIGHT_CHECKERED : AllSpecialTextures.CHECKERED);
outline.highlightFace(selectedFace); // outline.highlightFace(selectedFace);
} }
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
@ -131,7 +131,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
RenderSystem.enableBlend(); RenderSystem.enableBlend();
// outline.render(Tessellator.getInstance().getBuffer());TODO // outline.render(Tessellator.getInstance().getBuffer());TODO
RenderSystem.popMatrix(); RenderSystem.popMatrix();
outline.setTextures(null, null); // outline.setTextures(null, null);
} }

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/brass_block" }
}
}

View file

@ -1,12 +0,0 @@
{
"variants": {
"oxidization=0": { "model": "create:block/oxidized/copper_block/0" },
"oxidization=1": { "model": "create:block/oxidized/copper_block/1" },
"oxidization=2": { "model": "create:block/oxidized/copper_block/2" },
"oxidization=3": { "model": "create:block/oxidized/copper_block/3" },
"oxidization=4": { "model": "create:block/oxidized/copper_block/4" },
"oxidization=5": { "model": "create:block/oxidized/copper_block/5" },
"oxidization=6": { "model": "create:block/oxidized/copper_block/6" },
"oxidization=7": { "model": "create:block/oxidized/copper_block/7" }
}
}

View file

@ -1,12 +0,0 @@
{
"variants": {
"oxidization=0": { "model": "create:block/oxidized/copper_ore/0" },
"oxidization=1": { "model": "create:block/oxidized/copper_ore/1" },
"oxidization=2": { "model": "create:block/oxidized/copper_ore/2" },
"oxidization=3": { "model": "create:block/oxidized/copper_ore/3" },
"oxidization=4": { "model": "create:block/oxidized/copper_ore/4" },
"oxidization=5": { "model": "create:block/oxidized/copper_ore/5" },
"oxidization=6": { "model": "create:block/oxidized/copper_ore/6" },
"oxidization=7": { "model": "create:block/oxidized/copper_ore/7" }
}
}

View file

@ -1,12 +0,0 @@
{
"variants": {
"oxidization=0": { "model": "create:block/oxidized/copper_shingles/0" },
"oxidization=1": { "model": "create:block/oxidized/copper_shingles/1" },
"oxidization=2": { "model": "create:block/oxidized/copper_shingles/2" },
"oxidization=3": { "model": "create:block/oxidized/copper_shingles/3" },
"oxidization=4": { "model": "create:block/oxidized/copper_shingles/4" },
"oxidization=5": { "model": "create:block/oxidized/copper_shingles/5" },
"oxidization=6": { "model": "create:block/oxidized/copper_shingles/6" },
"oxidization=7": { "model": "create:block/oxidized/copper_shingles/7" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/zinc_block" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/zinc_ore" }
}
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/brass_block"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/oxidized/copper_block/0"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/oxidized/copper_ore/0"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/oxidized/copper_shingles/0"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/gabbro"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/gabbro_bricks"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/gabbro_bricks_stairs"
}

View file

@ -1,6 +0,0 @@
{
"parent": "block/wall_inventory",
"textures": {
"wall": "create:block/gabbro_bricks"
}
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/gabbro_layers"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/gabbro_slab"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/gabbro_stairs"
}

View file

@ -1,6 +0,0 @@
{
"parent": "block/wall_inventory",
"textures": {
"wall": "create:block/gabbro"
}
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/tiled_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/zinc_block"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/zinc_ore"
}