mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-23 21:46:40 +01:00
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:
parent
071482bb26
commit
d5ec1d6fef
31 changed files with 132 additions and 281 deletions
|
@ -2,8 +2,6 @@ package com.simibubi.create.foundation.utility.outliner;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
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.renderer.IRenderTypeBuffer;
|
||||
|
@ -17,10 +15,6 @@ import net.minecraft.util.math.Vec3d;
|
|||
public class AABBOutline extends Outline {
|
||||
|
||||
protected AxisAlignedBB bb;
|
||||
protected AllSpecialTextures faceTexture;
|
||||
protected AllSpecialTextures highlightedTexture;
|
||||
protected Direction highlightedFace;
|
||||
public boolean disableCull = false;
|
||||
|
||||
public AABBOutline(AxisAlignedBB bb) {
|
||||
this.bb = bb;
|
||||
|
@ -28,22 +22,10 @@ public class AABBOutline extends Outline {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
|
||||
float alpha = 1f;
|
||||
renderBB(ms, buffer, bb, color, alpha, !disableCull);
|
||||
renderBB(ms, buffer, bb);
|
||||
}
|
||||
|
||||
public void setTextures(AllSpecialTextures faceTexture, AllSpecialTextures highlightTexture) {
|
||||
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) {
|
||||
public void renderBB(MatrixStack ms, IRenderTypeBuffer buffer, AxisAlignedBB bb) {
|
||||
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
|
||||
.getProjectedView();
|
||||
boolean inside = bb.contains(projectedView);
|
||||
|
@ -89,12 +71,12 @@ public class AABBOutline extends Outline {
|
|||
|
||||
protected void renderFace(MatrixStack ms, IRenderTypeBuffer buffer, Direction direction, Vec3d p1, Vec3d p2,
|
||||
Vec3d p3, Vec3d p4, boolean noCull) {
|
||||
|
||||
ResourceLocation faceTexture = this.faceTexture.getLocation();
|
||||
if (direction == highlightedFace && highlightedTexture != null)
|
||||
faceTexture = highlightedTexture.getLocation();
|
||||
else if (faceTexture == null)
|
||||
if (!params.faceTexture.isPresent())
|
||||
return;
|
||||
|
||||
ResourceLocation faceTexture = params.faceTexture.get().getLocation();
|
||||
if (direction == params.highlightedFace && params.hightlightedFaceTexture.isPresent())
|
||||
faceTexture = params.hightlightedFaceTexture.get().getLocation();
|
||||
|
||||
RenderType translucentType =
|
||||
noCull ? RenderType.getEntityTranslucent(faceTexture) : RenderType.getEntityTranslucentCull(faceTexture);
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.simibubi.create.foundation.utility.outliner;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class ChasingAABBOutline extends AABBOutline {
|
||||
|
||||
|
@ -32,10 +30,8 @@ public class ChasingAABBOutline extends AABBOutline {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
Vec3d color = ColorHelper.getRGB(0xFFFFFF);
|
||||
float alpha = 1f;
|
||||
renderBB(ms, buffer, interpolateBBs(prevBB, bb, Minecraft.getInstance()
|
||||
.getRenderPartialTicks()), color, alpha, true);
|
||||
.getRenderPartialTicks()));
|
||||
}
|
||||
|
||||
private static AxisAlignedBB interpolateBBs(AxisAlignedBB current, AxisAlignedBB target, float pt) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.simibubi.create.foundation.utility.outliner;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack.Entry;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
@ -19,7 +21,7 @@ import net.minecraft.util.math.Vec3d;
|
|||
public abstract class Outline {
|
||||
|
||||
protected OutlineParams params;
|
||||
|
||||
|
||||
public Outline() {
|
||||
params = new OutlineParams();
|
||||
}
|
||||
|
@ -97,7 +99,7 @@ public abstract class Outline {
|
|||
}
|
||||
|
||||
public void tick() {}
|
||||
|
||||
|
||||
public OutlineParams getParams() {
|
||||
return params;
|
||||
}
|
||||
|
@ -105,7 +107,9 @@ public abstract class Outline {
|
|||
public static class OutlineParams {
|
||||
Optional<AllSpecialTextures> faceTexture;
|
||||
Optional<AllSpecialTextures> hightlightedFaceTexture;
|
||||
Direction highlightedFace;
|
||||
boolean fadeLineWidth;
|
||||
boolean disableCull;
|
||||
float alpha;
|
||||
private float lineWidth;
|
||||
int lightMapU, lightMapV;
|
||||
|
@ -122,30 +126,41 @@ public abstract class Outline {
|
|||
lightMapU = i >> 16 & '\uffff';
|
||||
lightMapV = i & '\uffff';
|
||||
}
|
||||
|
||||
|
||||
// builder
|
||||
|
||||
|
||||
public OutlineParams colored(int color) {
|
||||
rgb = ColorHelper.getRGB(color);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public OutlineParams lineWidth(float width) {
|
||||
this.lineWidth = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public OutlineParams withFaceTexture(AllSpecialTextures texture) {
|
||||
this.faceTexture = Optional.of(texture);
|
||||
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
|
||||
|
||||
|
||||
float getLineWidth() {
|
||||
return fadeLineWidth ? alpha * lineWidth : lineWidth;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.foundation.utility.outliner;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
@ -20,29 +21,29 @@ public class Outliner {
|
|||
|
||||
// Facade
|
||||
|
||||
public OutlineParams showAABB(Object slot, AxisAlignedBB bb, ExpireType type) {
|
||||
createAABBOutlineIfMissing(slot, bb, type);
|
||||
public OutlineParams showAABB(Object slot, AxisAlignedBB bb) {
|
||||
createAABBOutlineIfMissing(slot, bb);
|
||||
ChasingAABBOutline outline = getAndRefreshAABB(slot);
|
||||
outline.prevBB = outline.targetBB = bb;
|
||||
return outline.getParams();
|
||||
}
|
||||
|
||||
public OutlineParams chaseAABB(Object slot, AxisAlignedBB bb, ExpireType type) {
|
||||
createAABBOutlineIfMissing(slot, bb, type);
|
||||
public OutlineParams chaseAABB(Object slot, AxisAlignedBB bb) {
|
||||
createAABBOutlineIfMissing(slot, bb);
|
||||
ChasingAABBOutline outline = getAndRefreshAABB(slot);
|
||||
outline.targetBB = bb;
|
||||
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);
|
||||
OutlineEntry entry = new OutlineEntry(outline, type);
|
||||
OutlineEntry entry = new OutlineEntry(outline);
|
||||
outlines.put(slot, entry);
|
||||
return entry.getOutline()
|
||||
.getParams();
|
||||
}
|
||||
|
||||
public void keepCluster(Object slot) {
|
||||
public void keep(Object slot) {
|
||||
if (outlines.containsKey(slot))
|
||||
outlines.get(slot).ticksTillRemoval = 1;
|
||||
}
|
||||
|
@ -51,12 +52,21 @@ public class Outliner {
|
|||
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
|
||||
|
||||
private void createAABBOutlineIfMissing(Object slot, AxisAlignedBB bb, ExpireType type) {
|
||||
private void createAABBOutlineIfMissing(Object slot, AxisAlignedBB bb) {
|
||||
if (!outlines.containsKey(slot)) {
|
||||
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) -> {
|
||||
Outline outline = entry.getOutline();
|
||||
outline.params.alpha = 1;
|
||||
if (entry.type != ExpireType.IMMEDIATE && entry.ticksTillRemoval < 0) {
|
||||
if (entry.ticksTillRemoval < 0) {
|
||||
|
||||
int prevTicks = entry.ticksTillRemoval + 1;
|
||||
float lastAlpha = prevTicks >= 0 ? 1 : 1 + (prevTicks / (float) entry.type.fadeTicks);
|
||||
float currentAlpha = 1 + (entry.ticksTillRemoval / (float) entry.type.fadeTicks);
|
||||
float fadeticks = (float) OutlineEntry.fadeTicks;
|
||||
float lastAlpha = prevTicks >= 0 ? 1 : 1 + (prevTicks / fadeticks);
|
||||
float currentAlpha = 1 + (entry.ticksTillRemoval / fadeticks);
|
||||
float alpha = MathHelper.lerp(Minecraft.getInstance()
|
||||
.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 {
|
||||
|
||||
static final int fadeTicks = 8;
|
||||
private Outline outline;
|
||||
private int ticksTillRemoval;
|
||||
private ExpireType type;
|
||||
|
||||
public OutlineEntry(Outline outline, ExpireType type) {
|
||||
public OutlineEntry(Outline outline) {
|
||||
this.outline = outline;
|
||||
this.type = type;
|
||||
ticksTillRemoval = 1;
|
||||
}
|
||||
|
||||
public boolean isAlive() {
|
||||
return ticksTillRemoval >= -type.fadeTicks;
|
||||
return ticksTillRemoval >= -fadeTicks;
|
||||
}
|
||||
|
||||
public Outline getOutline() {
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.simibubi.create.AllItems;
|
|||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
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 net.minecraft.client.Minecraft;
|
||||
|
@ -36,7 +35,7 @@ public class ChassisRangeDisplay {
|
|||
public Entry(ChassisTileEntity te) {
|
||||
this.te = te;
|
||||
timer = DISPLAY_TIME;
|
||||
CreateClient.outliner.showCluster(getOutlineKey(), createSelection(te), ExpireType.FADE)
|
||||
CreateClient.outliner.showCluster(getOutlineKey(), createSelection(te))
|
||||
.colored(0xFFFFBB)
|
||||
.lineWidth(1 / 16f)
|
||||
.withFaceTexture(AllSpecialTextures.CHECKERED);
|
||||
|
@ -97,7 +96,7 @@ public class ChassisRangeDisplay {
|
|||
Entry entry = entries.get(pos);
|
||||
if (tickEntry(entry, hasWrench))
|
||||
iterator.remove();
|
||||
CreateClient.outliner.keepCluster(entry.getOutlineKey());
|
||||
CreateClient.outliner.keep(entry.getOutlineKey());
|
||||
}
|
||||
|
||||
for (Iterator<GroupEntry> iterator = groupEntries.iterator(); iterator.hasNext();) {
|
||||
|
@ -107,7 +106,7 @@ public class ChassisRangeDisplay {
|
|||
if (group == lastHoveredGroup)
|
||||
lastHoveredGroup = null;
|
||||
}
|
||||
CreateClient.outliner.keepCluster(group.getOutlineKey());
|
||||
CreateClient.outliner.keep(group.getOutlineKey());
|
||||
}
|
||||
|
||||
if (!hasWrench)
|
||||
|
|
|
@ -38,6 +38,7 @@ public class AllPaletteBlocks {
|
|||
|
||||
public static final BlockEntry<GlassBlock> TILED_GLASS = REGISTRATE.block("tiled_glass", GlassBlock::new)
|
||||
.initialProperties(() -> Blocks.GLASS)
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.blockstate(palettesCubeAll())
|
||||
.simpleItem()
|
||||
.register();
|
||||
|
|
|
@ -14,10 +14,12 @@ import com.simibubi.create.AllBlocksNew;
|
|||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
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.Label;
|
||||
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
|
||||
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.modules.schematics.ClientSchematicLoader;
|
||||
|
||||
|
@ -107,17 +109,21 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
.getFormattedText(), x - 15 + 7, y + 64 + 26, 0x666666);
|
||||
|
||||
SCHEMATIC_TABLE.draw(this, mainLeft, mainTop);
|
||||
|
||||
if (container.getTileEntity().isUploading)
|
||||
font.drawString(uploading, mainLeft + 76, mainTop + 10, ScreenResources.FONT_COLOR);
|
||||
else if (container.getSlot(1)
|
||||
.getHasStack())
|
||||
else if (container.getSlot(1).getHasStack())
|
||||
font.drawString(finished, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
|
||||
else
|
||||
font.drawString(title, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
|
||||
|
||||
if (schematicsArea == null) {
|
||||
if (schematicsArea == null)
|
||||
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()
|
||||
.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,
|
||||
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
|
||||
|
|
|
@ -10,11 +10,16 @@ import org.apache.commons.io.IOUtils;
|
|||
|
||||
import com.simibubi.create.AllItems;
|
||||
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.TextInputPromptScreen;
|
||||
import com.simibubi.create.foundation.utility.FilesHelper;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
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.client.Minecraft;
|
||||
|
@ -38,14 +43,14 @@ import net.minecraft.world.gen.feature.template.Template;
|
|||
|
||||
public class SchematicAndQuillHandler {
|
||||
|
||||
private Object outlineSlot = new Object();
|
||||
|
||||
private BlockPos firstPos;
|
||||
private BlockPos secondPos;
|
||||
private BlockPos selectedPos;
|
||||
private Direction selectedFace;
|
||||
private int range = 10;
|
||||
|
||||
// private OutlineParticle<ChasingAABBOutline> particle;
|
||||
|
||||
public boolean mouseScrolled(double delta) {
|
||||
if (!isActive())
|
||||
return false;
|
||||
|
@ -58,7 +63,8 @@ public class SchematicAndQuillHandler {
|
|||
|
||||
AxisAlignedBB bb = new AxisAlignedBB(firstPos, secondPos);
|
||||
Vec3i vec = selectedFace.getDirectionVec();
|
||||
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
|
||||
.getProjectedView();
|
||||
if (bb.contains(projectedView))
|
||||
delta *= -1;
|
||||
|
||||
|
@ -78,7 +84,7 @@ public class SchematicAndQuillHandler {
|
|||
firstPos = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||
secondPos = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.dimensions", (int) bb.getXSize() + 1,
|
||||
(int) bb.getYSize() + 1, (int) bb.getZSize() + 1);
|
||||
(int) bb.getYSize() + 1, (int) bb.getZSize() + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -99,7 +105,8 @@ public class SchematicAndQuillHandler {
|
|||
}
|
||||
|
||||
if (secondPos != null) {
|
||||
TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> {});
|
||||
TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> {
|
||||
});
|
||||
guiScreenIn.setTitle(Lang.translate("schematicAndQuill.prompt"));
|
||||
guiScreenIn.setButtonTextConfirm(Lang.translate("action.saveToFile"));
|
||||
guiScreenIn.setButtonTextAbort(Lang.translate("action.discard"));
|
||||
|
@ -123,20 +130,17 @@ public class SchematicAndQuillHandler {
|
|||
}
|
||||
|
||||
public void tick() {
|
||||
if (!isActive()) {
|
||||
// if (particle != null) {
|
||||
// particle.setExpired();
|
||||
// particle = null;
|
||||
// }
|
||||
if (!isActive())
|
||||
return;
|
||||
}
|
||||
|
||||
ClientPlayerEntity player = Minecraft.getInstance().player;
|
||||
|
||||
if (AllKeys.ACTIVATE_TOOL.isPressed()) {
|
||||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||
Vec3d targetVec = player.getEyePosition(pt).add(player.getLookVec().scale(range));
|
||||
setCursor(new BlockPos(targetVec));
|
||||
float pt = Minecraft.getInstance()
|
||||
.getRenderPartialTicks();
|
||||
Vec3d targetVec = player.getEyePosition(pt)
|
||||
.add(player.getLookVec()
|
||||
.scale(range));
|
||||
selectedPos = new BlockPos(targetVec);
|
||||
|
||||
} else {
|
||||
BlockRayTraceResult trace = RaycastHelper.rayTraceRange(player.world, player, 75);
|
||||
|
@ -144,57 +148,36 @@ public class SchematicAndQuillHandler {
|
|||
|
||||
BlockPos hit = trace.getPos();
|
||||
boolean replaceable = player.world.getBlockState(hit)
|
||||
.isReplaceable(new BlockItemUseContext(new ItemUseContext(player, Hand.MAIN_HAND, trace)));
|
||||
if (trace.getFace().getAxis().isVertical() && !replaceable)
|
||||
.isReplaceable(new BlockItemUseContext(new ItemUseContext(player, Hand.MAIN_HAND, trace)));
|
||||
if (trace.getFace()
|
||||
.getAxis()
|
||||
.isVertical() && !replaceable)
|
||||
hit = hit.offset(trace.getFace());
|
||||
setCursor(hit);
|
||||
selectedPos = hit;
|
||||
} else
|
||||
setCursor(null);
|
||||
selectedPos = null;
|
||||
}
|
||||
|
||||
// if (particle == null)
|
||||
// return;
|
||||
//
|
||||
// ChasingAABBOutline outline = particle.getOutline();
|
||||
// if (particle.isAlive())
|
||||
// outline.tick();
|
||||
selectedFace = null;
|
||||
if (secondPos != null) {
|
||||
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();
|
||||
}
|
||||
|
||||
// if (secondPos == null) {
|
||||
// selectedFace = null;
|
||||
// outline.highlightFace(null);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// 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) {
|
||||
selectedPos = pos;
|
||||
AxisAlignedBB bb = getCurrentSelectionBox();
|
||||
|
||||
// if (particle != null && !particle.isAlive())
|
||||
// particle = null;
|
||||
// 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);
|
||||
AxisAlignedBB currentSelectionBox = getCurrentSelectionBox();
|
||||
if (currentSelectionBox != null)
|
||||
outliner().chaseAABB(outlineSlot, currentSelectionBox)
|
||||
.colored(0xDDDFFF)
|
||||
.withFaceTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED)
|
||||
.highlightFace(selectedFace);
|
||||
}
|
||||
|
||||
private AxisAlignedBB getCurrentSelectionBox() {
|
||||
|
@ -202,7 +185,7 @@ public class SchematicAndQuillHandler {
|
|||
if (firstPos == null)
|
||||
return selectedPos == null ? null : new AxisAlignedBB(selectedPos);
|
||||
return selectedPos == null ? new AxisAlignedBB(firstPos)
|
||||
: new AxisAlignedBB(firstPos, selectedPos).expand(1, 1, 1);
|
||||
: new AxisAlignedBB(firstPos, selectedPos).expand(1, 1, 1);
|
||||
}
|
||||
return new AxisAlignedBB(firstPos, secondPos).expand(1, 1, 1);
|
||||
}
|
||||
|
@ -213,14 +196,14 @@ public class SchematicAndQuillHandler {
|
|||
|
||||
private boolean isPresent() {
|
||||
return Minecraft.getInstance() != null && Minecraft.getInstance().world != null
|
||||
&& Minecraft.getInstance().currentScreen == null;
|
||||
&& Minecraft.getInstance().currentScreen == null;
|
||||
}
|
||||
|
||||
public void saveSchematic(String string) {
|
||||
Template t = new Template();
|
||||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, secondPos);
|
||||
t.takeBlocksFromWorld(Minecraft.getInstance().world, new BlockPos(bb.minX, bb.minY, bb.minZ),
|
||||
new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), true, Blocks.AIR);
|
||||
new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), true, Blocks.AIR);
|
||||
|
||||
if (string.isEmpty())
|
||||
string = Lang.translate("schematicAndQuill.fallbackName");
|
||||
|
@ -246,4 +229,8 @@ public class SchematicAndQuillHandler {
|
|||
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
|
||||
}
|
||||
|
||||
private Outliner outliner() {
|
||||
return CreateClient.outliner;
|
||||
}
|
||||
|
||||
}
|
|
@ -34,8 +34,7 @@ public class SchematicHandler {
|
|||
|
||||
private String displayedSchematic;
|
||||
private SchematicTransformation transformation;
|
||||
private AxisAlignedBB bounds; // local space
|
||||
private AABBOutline outline;
|
||||
private AxisAlignedBB bounds;
|
||||
private boolean deployed;
|
||||
private boolean active;
|
||||
private Tools currentTool;
|
||||
|
@ -247,8 +246,8 @@ public class SchematicHandler {
|
|||
BlockPos size = NBTUtil.readBlockPos(tag.getCompound("Bounds"));
|
||||
|
||||
bounds = new AxisAlignedBB(BlockPos.ZERO, size);
|
||||
outline = new AABBOutline(bounds);
|
||||
outline.disableCull = true;
|
||||
// outline = new AABBOutline(bounds);
|
||||
// outline.disableCull = true;
|
||||
transformation.init(anchor, settings, bounds);
|
||||
}
|
||||
|
||||
|
@ -275,10 +274,6 @@ public class SchematicHandler {
|
|||
markDirty();
|
||||
}
|
||||
|
||||
public AABBOutline getOutline() {
|
||||
return outline;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
|
|
@ -119,11 +119,11 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
|||
if (!schematicHandler.isDeployed())
|
||||
return;
|
||||
|
||||
AABBOutline outline = schematicHandler.getOutline();
|
||||
// AABBOutline outline = schematicHandler.getOutline();
|
||||
if (renderSelectedFace) {
|
||||
schematicHandler.getOutline().setTextures(null,
|
||||
AllKeys.ctrlDown() ? AllSpecialTextures.HIGHLIGHT_CHECKERED : AllSpecialTextures.CHECKERED);
|
||||
outline.highlightFace(selectedFace);
|
||||
// schematicHandler.getOutline().setTextures(null,
|
||||
// AllKeys.ctrlDown() ? AllSpecialTextures.HIGHLIGHT_CHECKERED : AllSpecialTextures.CHECKERED);
|
||||
// outline.highlightFace(selectedFace);
|
||||
}
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
@ -131,7 +131,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
|||
RenderSystem.enableBlend();
|
||||
// outline.render(Tessellator.getInstance().getBuffer());TODO
|
||||
RenderSystem.popMatrix();
|
||||
outline.setTextures(null, null);
|
||||
// outline.setTextures(null, null);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "create:block/brass_block" }
|
||||
}
|
||||
}
|
|
@ -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" }
|
||||
}
|
||||
}
|
|
@ -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" }
|
||||
}
|
||||
}
|
|
@ -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" }
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "create:block/zinc_block" }
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "create:block/zinc_ore" }
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/brass_block"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/oxidized/copper_block/0"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/oxidized/copper_ore/0"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/oxidized/copper_shingles/0"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/gabbro"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/gabbro_bricks"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/gabbro_bricks_stairs"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "block/wall_inventory",
|
||||
"textures": {
|
||||
"wall": "create:block/gabbro_bricks"
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/gabbro_layers"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/gabbro_slab"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/gabbro_stairs"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "block/wall_inventory",
|
||||
"textures": {
|
||||
"wall": "create:block/gabbro"
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/palettes/tiled_glass"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/zinc_block"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "create:block/zinc_ore"
|
||||
}
|
Loading…
Reference in a new issue