mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 03:53:12 +01:00
GUI cleanup and fixes part 2
- Change positions of more GUI elements - Fix mistakes from last cleanup - Add window offset to AbstractSimiScreen - Implement container usability check properly and add IInteractionChecker - Render schematic and quill in schematic prompt screen - Rename curiosities2.png to curiosities_2.png - Various other tweaks, fixes, and improvements - Resolves #1847
This commit is contained in:
parent
5a30c3bcdb
commit
de929ef510
33 changed files with 582 additions and 445 deletions
|
@ -10,7 +10,6 @@ import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
|||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
@ -53,10 +52,9 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
this.width = mc.getWindow()
|
||||
this.width = client.getWindow()
|
||||
.getScaledWidth();
|
||||
this.height = mc.getWindow()
|
||||
this.height = client.getWindow()
|
||||
.getScaledHeight();
|
||||
|
||||
offsetX = AllConfigs.CLIENT.overlayOffsetX.get();
|
||||
|
@ -91,7 +89,7 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
|||
int titleLinesCount = 1;
|
||||
int tooltipTextWidth = 0;
|
||||
for (ITextProperties textLine : tooltip) {
|
||||
int textLineWidth = getMinecraft().fontRenderer.getWidth(textLine);
|
||||
int textLineWidth = client.fontRenderer.getWidth(textLine);
|
||||
if (textLineWidth > tooltipTextWidth)
|
||||
tooltipTextWidth = textLineWidth;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
|
|||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -27,7 +26,6 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
private final AllGuiTextures background = AllGuiTextures.SEQUENCER;
|
||||
private IconButton confirmButton;
|
||||
|
||||
private final ITextComponent title = Lang.translate("gui.sequenced_gearshift.title");
|
||||
private ListNBT compareTag;
|
||||
private Vector<Instruction> instructions;
|
||||
private BlockPos pos;
|
||||
|
@ -35,6 +33,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
private Vector<Vector<ScrollInput>> inputs;
|
||||
|
||||
public SequencedGearshiftScreen(SequencedGearshiftTileEntity te) {
|
||||
super(Lang.translate("gui.sequenced_gearshift.title"));
|
||||
this.instructions = te.instructions;
|
||||
this.pos = te.getPos();
|
||||
compareTag = Instruction.serializeAll(instructions);
|
||||
|
@ -42,21 +41,29 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
setWindowSize(background.width + 50, background.height);
|
||||
setWindowSize(background.width, background.height);
|
||||
setWindowOffset(-20, 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
inputs = new Vector<>(5);
|
||||
for (int row = 0; row < inputs.capacity(); row++)
|
||||
inputs.add(new Vector<>(3));
|
||||
|
||||
for (int row = 0; row < instructions.size(); row++)
|
||||
initInputsOfRow(row);
|
||||
initInputsOfRow(row, x, y);
|
||||
|
||||
confirmButton =
|
||||
new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
}
|
||||
|
||||
public void initInputsOfRow(int row) {
|
||||
int x = guiLeft + 30;
|
||||
int y = guiTop + 18;
|
||||
public void initInputsOfRow(int row, int backgroundX, int backgroundY) {
|
||||
int x = backgroundX + 30;
|
||||
int y = backgroundY + 18;
|
||||
int rowHeight = 22;
|
||||
|
||||
Vector<ScrollInput> rowInputs = inputs.get(row);
|
||||
|
@ -83,10 +90,6 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
|
||||
widgets.addAll(rowInputs);
|
||||
updateParamsOfRow(row);
|
||||
|
||||
confirmButton =
|
||||
new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
}
|
||||
|
||||
public void updateParamsOfRow(int row) {
|
||||
|
@ -123,43 +126,44 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
int hFontColor = 0xD3CBBE;
|
||||
background.draw(matrixStack, this, guiLeft, guiTop);
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
background.draw(ms, this, x, y);
|
||||
|
||||
for (int row = 0; row < instructions.capacity(); row++) {
|
||||
AllGuiTextures toDraw = AllGuiTextures.SEQUENCER_EMPTY;
|
||||
int yOffset = toDraw.height * row;
|
||||
if (row >= instructions.size()) {
|
||||
toDraw.draw(matrixStack, guiLeft, guiTop + 14 + yOffset);
|
||||
toDraw.draw(ms, x, y + 14 + yOffset);
|
||||
continue;
|
||||
}
|
||||
|
||||
Instruction instruction = instructions.get(row);
|
||||
SequencerInstructions def = instruction.instruction;
|
||||
def.background.draw(matrixStack, guiLeft, guiTop + 14 + yOffset);
|
||||
def.background.draw(ms, x, y + 14 + yOffset);
|
||||
|
||||
label(matrixStack, 36, yOffset - 3, Lang.translate(def.translationKey));
|
||||
label(ms, 36, yOffset - 3, Lang.translate(def.translationKey));
|
||||
if (def.hasValueParameter) {
|
||||
String text = def.formatValue(instruction.value);
|
||||
int stringWidth = textRenderer.getStringWidth(text);
|
||||
label(matrixStack, 90 + (12 - stringWidth / 2), yOffset - 3, new StringTextComponent(text));
|
||||
label(ms, 90 + (12 - stringWidth / 2), yOffset - 3, new StringTextComponent(text));
|
||||
}
|
||||
if (def.hasSpeedParameter)
|
||||
label(matrixStack, 127, yOffset - 3, instruction.speedModifier.label);
|
||||
label(ms, 127, yOffset - 3, instruction.speedModifier.label);
|
||||
}
|
||||
|
||||
textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getWidth(title)) / 2, guiTop + 3,
|
||||
0xffffff);
|
||||
drawCenteredText(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
GuiGameElement.of(renderedItem)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + background.width + 10, guiTop + 100, -150)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 6, y + background.height - 56, -200)
|
||||
.scale(5)
|
||||
.render(matrixStack);
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
private void label(MatrixStack matrixStack, int x, int y, ITextComponent text) {
|
||||
textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
|
||||
private void label(MatrixStack ms, int x, int y, ITextComponent text) {
|
||||
textRenderer.drawWithShadow(ms, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
|
||||
}
|
||||
|
||||
public void sendPacket() {
|
||||
|
@ -189,7 +193,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
} else {
|
||||
if (index + 1 < instructions.capacity() && index + 1 == instructions.size()) {
|
||||
instructions.add(new Instruction(SequencerInstructions.END));
|
||||
initInputsOfRow(index + 1);
|
||||
initInputsOfRow(index + 1, guiLeft, guiTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +201,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
@Override
|
||||
public boolean mouseClicked(double x, double y, int button) {
|
||||
if (confirmButton.isHovered()) {
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
client.player.closeScreen();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Collections;
|
|||
import java.util.Vector;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
|
@ -16,25 +15,20 @@ import com.simibubi.create.foundation.networking.AllPackets;
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
||||
|
||||
private final ItemStack renderedItem = ItemStack.EMPTY;//AllBlocks.CHROMATIC_PROJECTOR.asStack();
|
||||
private final AllGuiTextures background = AllGuiTextures.PROJECTOR;
|
||||
private final int guiBottom = guiTop + background.height;
|
||||
private final int guiRight = guiLeft + background.width;
|
||||
private IconButton confirmButton;
|
||||
|
||||
private final ITextComponent title = Lang.translate("gui.chromatic_projector.title");
|
||||
private final Vector<FilterStep> stages;
|
||||
private AllGuiTextures background;
|
||||
private ChromaticProjectorTileEntity tile;
|
||||
private Vector<FilterStep> stages;
|
||||
|
||||
private ItemStack renderedItem = ItemStack.EMPTY;//AllBlocks.CHROMATIC_PROJECTOR.asStack();
|
||||
private Vector<Vector<ScrollInput>> inputs;
|
||||
|
||||
ChromaticProjectorTileEntity tile;
|
||||
private IconButton confirmButton;
|
||||
|
||||
private ScrollInput radius;
|
||||
private ScrollInput density;
|
||||
|
@ -51,71 +45,86 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
|||
private IconButton bChannel;
|
||||
|
||||
public ChromaticProjectorScreen(ChromaticProjectorTileEntity te) {
|
||||
this.tile = te;
|
||||
this.stages = te.stages;
|
||||
}
|
||||
|
||||
private static Integer step(ScrollValueBehaviour.StepContext ctx, int base) {
|
||||
if (ctx.control) return 1;
|
||||
return base * (ctx.shift ? 5 : 1) - ctx.currentValue % base;
|
||||
super(Lang.translate("gui.chromatic_projector.title"));
|
||||
background = AllGuiTextures.PROJECTOR;
|
||||
tile = te;
|
||||
stages = te.stages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
setWindowSize(background.width + 50, background.height);
|
||||
setWindowSize(background.width, background.height);
|
||||
setWindowOffset(-25, 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
inputs = new Vector<>(FilterStep.MAX_STEPS);
|
||||
for (int row = 0; row < inputs.capacity(); row++)
|
||||
inputs.add(new Vector<>(2));
|
||||
|
||||
for (int row = 0; row < stages.size(); row++)
|
||||
initInputsOfRow(row);
|
||||
initInputsOfRow(row, x, y);
|
||||
|
||||
int guiBottom = guiTop + background.height;
|
||||
int guiRight = guiLeft + background.width;
|
||||
confirmButton =
|
||||
new IconButton(guiRight - 33, guiBottom - 26, AllIcons.I_CONFIRM);
|
||||
new IconButton(x + background.width - 33, y + background.height - 26, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
|
||||
initEffectSettings();
|
||||
initMetaSettings();
|
||||
initEffectSettings(x, y);
|
||||
initMetaSettings(x, y);
|
||||
}
|
||||
|
||||
private void initMetaSettings() {
|
||||
int guiBottom = guiTop + background.height;
|
||||
int y = guiBottom - 23;
|
||||
public void initInputsOfRow(int x, int y, int row) {
|
||||
x += 30;
|
||||
y += 18;
|
||||
int rowHeight = 22;
|
||||
|
||||
blend = new IconButton(guiLeft + 16, y, AllIcons.I_FX_BLEND);
|
||||
blend.setToolTip(Lang.translate("gui.chromatic_projector.blend"));
|
||||
Vector<ScrollInput> rowInputs = inputs.get(row);
|
||||
rowInputs.forEach(widgets::remove);
|
||||
rowInputs.clear();
|
||||
FilterStep filter = stages.get(row);
|
||||
|
||||
int channelX = guiLeft + 39;
|
||||
rChannel = new IconButton(channelX, y, AllIcons.I_FX_BLEND);
|
||||
rChannel.setToolTip(new StringTextComponent("R"));
|
||||
channelX += 18;
|
||||
gChannel = new IconButton(channelX, y, AllIcons.I_FX_BLEND);
|
||||
gChannel.setToolTip(new StringTextComponent("G"));
|
||||
channelX += 18;
|
||||
bChannel = new IconButton(channelX, y, AllIcons.I_FX_BLEND);
|
||||
bChannel.setToolTip(new StringTextComponent("B"));
|
||||
final int x1 = x;
|
||||
final int y1 = y;
|
||||
ScrollInput type =
|
||||
new SelectionScrollInput(x, y + rowHeight * row, 86, 18)
|
||||
.forOptions(ColorEffect.getOptions())
|
||||
.calling(state -> stageUpdated(x1, y1, row, state))
|
||||
.setState(filter.filter.id)
|
||||
.titled(Lang.translate("gui.chromatic_projector.filter"));
|
||||
ScrollInput value =
|
||||
new ScrollInput(x + 86 + 2, y + rowHeight * row, 28, 18)
|
||||
.calling(state -> filter.value = state);
|
||||
|
||||
fieldEffect = new IconButton(guiLeft + 135, y, tile.field ? AllIcons.I_FX_FIELD_ON : AllIcons.I_FX_FIELD_OFF);
|
||||
fieldEffect.setToolTip(Lang.translate("gui.chromatic_projector.field"));
|
||||
rowInputs.add(type);
|
||||
rowInputs.add(value);
|
||||
|
||||
strength = new ScrollInput(guiLeft + 159, y, 25, 18)
|
||||
.titled(Lang.translate("gui.chromatic_projector.strength"))
|
||||
.withStepFunction(ctx -> step(ctx, 5))
|
||||
.calling(tile::setStrength)
|
||||
.withRange(-100, 101)
|
||||
.setState((int) (tile.strength * 100));
|
||||
|
||||
Collections.addAll(widgets, blend, rChannel, gChannel, bChannel, fieldEffect, strength);
|
||||
widgets.addAll(rowInputs);
|
||||
updateParamsOfRow(row);
|
||||
}
|
||||
|
||||
private void initEffectSettings() {
|
||||
int x = guiLeft + 188;
|
||||
int y = guiTop + 40;
|
||||
public void updateParamsOfRow(int row) {
|
||||
FilterStep instruction = stages.get(row);
|
||||
Vector<ScrollInput> rowInputs = inputs.get(row);
|
||||
ColorEffect def = instruction.filter;
|
||||
boolean hasValue = def.hasParameter;
|
||||
|
||||
ScrollInput value = rowInputs.get(1);
|
||||
value.active = value.visible = hasValue;
|
||||
if (hasValue)
|
||||
value.withRange(def.minValue, def.maxValue + 1)
|
||||
//.titled(Lang.translate(def.parameterKey))
|
||||
.setState(instruction.value)
|
||||
.onChanged();
|
||||
|
||||
value.withStepFunction(def.step());
|
||||
}
|
||||
|
||||
private void initEffectSettings(int x, int y) {
|
||||
x += 188;
|
||||
y += 40;
|
||||
|
||||
radius = new ScrollInput(x, y, 28, 18)
|
||||
.titled(Lang.translate("gui.chromatic_projector.radius"))
|
||||
|
@ -148,97 +157,82 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
|||
Collections.addAll(widgets, radius, density, feather, fade);
|
||||
}
|
||||
|
||||
public void initInputsOfRow(int row) {
|
||||
int x = guiLeft + 30;
|
||||
int y = guiTop + 18;
|
||||
int rowHeight = 22;
|
||||
private void initMetaSettings(int x, int y) {
|
||||
y += background.height - 23;
|
||||
|
||||
Vector<ScrollInput> rowInputs = inputs.get(row);
|
||||
rowInputs.forEach(widgets::remove);
|
||||
rowInputs.clear();
|
||||
FilterStep filter = stages.get(row);
|
||||
blend = new IconButton(x + 16, y, AllIcons.I_FX_BLEND);
|
||||
blend.setToolTip(Lang.translate("gui.chromatic_projector.blend"));
|
||||
|
||||
ScrollInput type =
|
||||
new SelectionScrollInput(x, y + rowHeight * row, 86, 18)
|
||||
.forOptions(ColorEffect.getOptions())
|
||||
.calling(state -> stageUpdated(row, state))
|
||||
.setState(filter.filter.id)
|
||||
.titled(Lang.translate("gui.chromatic_projector.filter"));
|
||||
ScrollInput value =
|
||||
new ScrollInput(x + 86 + 2, y + rowHeight * row, 28, 18)
|
||||
.calling(state -> filter.value = state);
|
||||
int channelX = x + 39;
|
||||
rChannel = new IconButton(channelX, y, AllIcons.I_FX_BLEND);
|
||||
rChannel.setToolTip(new StringTextComponent("R"));
|
||||
channelX += 18;
|
||||
gChannel = new IconButton(channelX, y, AllIcons.I_FX_BLEND);
|
||||
gChannel.setToolTip(new StringTextComponent("G"));
|
||||
channelX += 18;
|
||||
bChannel = new IconButton(channelX, y, AllIcons.I_FX_BLEND);
|
||||
bChannel.setToolTip(new StringTextComponent("B"));
|
||||
|
||||
rowInputs.add(type);
|
||||
rowInputs.add(value);
|
||||
fieldEffect = new IconButton(x + 135, y, tile.field ? AllIcons.I_FX_FIELD_ON : AllIcons.I_FX_FIELD_OFF);
|
||||
fieldEffect.setToolTip(Lang.translate("gui.chromatic_projector.field"));
|
||||
|
||||
widgets.addAll(rowInputs);
|
||||
updateParamsOfRow(row);
|
||||
}
|
||||
strength = new ScrollInput(x + 159, y, 25, 18)
|
||||
.titled(Lang.translate("gui.chromatic_projector.strength"))
|
||||
.withStepFunction(ctx -> step(ctx, 5))
|
||||
.calling(tile::setStrength)
|
||||
.withRange(-100, 101)
|
||||
.setState((int) (tile.strength * 100));
|
||||
|
||||
public void updateParamsOfRow(int row) {
|
||||
FilterStep instruction = stages.get(row);
|
||||
Vector<ScrollInput> rowInputs = inputs.get(row);
|
||||
ColorEffect def = instruction.filter;
|
||||
boolean hasValue = def.hasParameter;
|
||||
|
||||
ScrollInput value = rowInputs.get(1);
|
||||
value.active = value.visible = hasValue;
|
||||
if (hasValue)
|
||||
value.withRange(def.minValue, def.maxValue + 1)
|
||||
//.titled(Lang.translate(def.parameterKey))
|
||||
.setState(instruction.value)
|
||||
.onChanged();
|
||||
|
||||
value.withStepFunction(def.step());
|
||||
Collections.addAll(widgets, blend, rChannel, gChannel, bChannel, fieldEffect, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
int hFontColor = 0xD3CBBE;
|
||||
background.draw(matrixStack, this, guiLeft, guiTop);
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
background.draw(ms, this, x, y);
|
||||
|
||||
for (int row = 0; row < stages.capacity(); row++) {
|
||||
AllGuiTextures toDraw = AllGuiTextures.PROJECTOR_EMPTY;
|
||||
int yOffset = toDraw.height * row;
|
||||
if (row >= stages.size()) {
|
||||
toDraw.draw(matrixStack, guiLeft, guiTop + 14 + yOffset);
|
||||
toDraw.draw(ms, x, y + 14 + yOffset);
|
||||
continue;
|
||||
}
|
||||
|
||||
FilterStep step = stages.get(row);
|
||||
ColorEffect def = step.filter;
|
||||
def.background.draw(matrixStack, guiLeft, guiTop + 14 + yOffset);
|
||||
def.background.draw(ms, x, y + 14 + yOffset);
|
||||
|
||||
if (def != ColorEffect.END)
|
||||
label(matrixStack, 36, yOffset - 3, Lang.translate(def.translationKey));
|
||||
label(ms, 36, yOffset - 3, Lang.translate(def.translationKey));
|
||||
if (def.hasParameter) {
|
||||
String text = step.filter.formatValue(step.value);
|
||||
int stringWidth = textRenderer.getStringWidth(text);
|
||||
label(matrixStack, 118 + (12 - stringWidth / 2), yOffset - 3, new StringTextComponent(text));
|
||||
label(ms, 118 + (12 - stringWidth / 2), yOffset - 3, new StringTextComponent(text));
|
||||
}
|
||||
}
|
||||
|
||||
renderScroll(matrixStack, radius, 2f);
|
||||
renderScroll(matrixStack, density, 100f);
|
||||
renderScroll(matrixStack, feather, 10f);
|
||||
renderScroll(matrixStack, fade, 10f);
|
||||
renderScroll(ms, radius, 2f);
|
||||
renderScroll(ms, density, 100f);
|
||||
renderScroll(ms, feather, 10f);
|
||||
renderScroll(ms, fade, 10f);
|
||||
|
||||
renderScroll(matrixStack, strength, 100f);
|
||||
renderScroll(ms, strength, 100f);
|
||||
|
||||
textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getWidth(title)) / 2, guiTop + 3,
|
||||
0xffffff);
|
||||
drawCenteredText(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
GuiGameElement.of(renderedItem)
|
||||
.scale(5)
|
||||
.at(guiLeft + background.width + 10, guiTop + 140, -150)
|
||||
.render(matrixStack);
|
||||
.at(x + background.width + 6, y + background.height - 56, -200)
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
private void renderScroll(MatrixStack matrixStack, ScrollInput input, float divisor) {
|
||||
|
||||
String text = String.valueOf(input.getState() / divisor);
|
||||
|
||||
int stringWidth = textRenderer.getStringWidth(text);
|
||||
// int stringWidth = textRenderer.getStringWidth(text);
|
||||
textRenderer.drawWithShadow(matrixStack, text, input.x + 2, input.y + 5, 0xFFFFEE);
|
||||
}
|
||||
|
||||
|
@ -246,6 +240,11 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
|||
textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
|
||||
}
|
||||
|
||||
private static Integer step(ScrollValueBehaviour.StepContext ctx, int base) {
|
||||
if (ctx.control) return 1;
|
||||
return base * (ctx.shift ? 5 : 1) - ctx.currentValue % base;
|
||||
}
|
||||
|
||||
public void sendPacket() {
|
||||
AllPackets.channel.sendToServer(new ConfigureProjectorPacket(tile));
|
||||
}
|
||||
|
@ -255,7 +254,7 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
|||
sendPacket();
|
||||
}
|
||||
|
||||
private void stageUpdated(int index, int state) {
|
||||
private void stageUpdated(int x, int y, int index, int state) {
|
||||
ColorEffect newValue = ColorEffect.all.get(state);
|
||||
stages.get(index).filter = newValue;
|
||||
stages.get(index).value = newValue.defaultValue;
|
||||
|
@ -270,7 +269,7 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
|||
} else {
|
||||
if (index + 1 < stages.capacity() && index + 1 == stages.size()) {
|
||||
stages.add(new FilterStep(ColorEffect.END));
|
||||
initInputsOfRow(index + 1);
|
||||
initInputsOfRow(x, y, index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +277,7 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen {
|
|||
@Override
|
||||
public boolean mouseClicked(double x, double y, int button) {
|
||||
if (confirmButton.isHovered()) {
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
client.player.closeScreen();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import com.simibubi.create.foundation.networking.AllPackets;
|
|||
import com.simibubi.create.foundation.networking.NbtPacket;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Hand;
|
||||
|
@ -30,6 +29,8 @@ import net.minecraftforge.fml.network.PacketDistributor;
|
|||
|
||||
public class SymmetryWandScreen extends AbstractSimiScreen {
|
||||
|
||||
private AllGuiTextures background;
|
||||
|
||||
private ScrollInput areaType;
|
||||
private Label labelType;
|
||||
private ScrollInput areaAlign;
|
||||
|
@ -46,6 +47,8 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
public SymmetryWandScreen(ItemStack wand, Hand hand) {
|
||||
super();
|
||||
|
||||
background = AllGuiTextures.WAND_OF_SYMMETRY;
|
||||
|
||||
currentElement = SymmetryWandItem.getMirror(wand);
|
||||
if (currentElement instanceof EmptyMirror) {
|
||||
currentElement = new PlaneMirror(Vector3d.ZERO);
|
||||
|
@ -56,18 +59,22 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
|
||||
@Override
|
||||
public void init() {
|
||||
setWindowSize(background.width, background.height);
|
||||
setWindowOffset(-20, 0);
|
||||
super.init();
|
||||
AllGuiTextures background = AllGuiTextures.WAND_OF_SYMMETRY;
|
||||
this.setWindowSize(background.width + 50, background.height + 50);
|
||||
widgets.clear();
|
||||
|
||||
labelType = new Label(guiLeft + 49, guiTop + 28, StringTextComponent.EMPTY).colored(0xFFFFFFFF)
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
labelType = new Label(x + 49, y + 28, StringTextComponent.EMPTY).colored(0xFFFFFFFF)
|
||||
.withShadow();
|
||||
labelAlign = new Label(guiLeft + 49, guiTop + 50, StringTextComponent.EMPTY).colored(0xFFFFFFFF)
|
||||
labelAlign = new Label(x + 49, y + 50, StringTextComponent.EMPTY).colored(0xFFFFFFFF)
|
||||
.withShadow();
|
||||
|
||||
int state =
|
||||
currentElement instanceof TriplePlaneMirror ? 2 : currentElement instanceof CrossPlaneMirror ? 1 : 0;
|
||||
areaType = new SelectionScrollInput(guiLeft + 45, guiTop + 21, 109, 18).forOptions(SymmetryMirror.getMirrors())
|
||||
areaType = new SelectionScrollInput(x + 45, y + 21, 109, 18).forOptions(SymmetryMirror.getMirrors())
|
||||
.titled(mirrorType.copy())
|
||||
.writingTo(labelType)
|
||||
.setState(state);
|
||||
|
@ -86,27 +93,24 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
initAlign(currentElement);
|
||||
initAlign(currentElement, x, y);
|
||||
});
|
||||
|
||||
widgets.clear();
|
||||
|
||||
initAlign(currentElement);
|
||||
initAlign(currentElement, x, y);
|
||||
|
||||
widgets.add(labelAlign);
|
||||
widgets.add(areaType);
|
||||
widgets.add(labelType);
|
||||
|
||||
confirmButton = new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
||||
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
|
||||
}
|
||||
|
||||
private void initAlign(SymmetryMirror element) {
|
||||
private void initAlign(SymmetryMirror element, int x, int y) {
|
||||
if (areaAlign != null)
|
||||
widgets.remove(areaAlign);
|
||||
|
||||
areaAlign = new SelectionScrollInput(guiLeft + 45, guiTop + 43, 109, 18).forOptions(element.getAlignToolTips())
|
||||
areaAlign = new SelectionScrollInput(x + 45, y + 43, 109, 18).forOptions(element.getAlignToolTips())
|
||||
.titled(orientation.copy())
|
||||
.writingTo(labelAlign)
|
||||
.setState(element.getOrientationIndex())
|
||||
|
@ -116,20 +120,24 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
AllGuiTextures.WAND_OF_SYMMETRY.draw(matrixStack, this, guiLeft, guiTop);
|
||||
textRenderer.draw(matrixStack, wand.getDisplayName(), guiLeft + 11, guiTop + 4, 0x6B3802);
|
||||
renderBlock(matrixStack);
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
background.draw(ms, this, x, y);
|
||||
textRenderer.draw(ms, wand.getDisplayName(), x + 11, y + 4, 0x6B3802);
|
||||
|
||||
renderBlock(ms, x, y);
|
||||
GuiGameElement.of(wand)
|
||||
.scale(4)
|
||||
.rotate(-70, 20, 20)
|
||||
.at(guiLeft + 170, guiTop + 490, -150)
|
||||
.render(matrixStack);
|
||||
.at(x + 178, y + 448, -150)
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
protected void renderBlock(MatrixStack ms) {
|
||||
protected void renderBlock(MatrixStack ms, int x, int y) {
|
||||
ms.push();
|
||||
ms.translate(guiLeft + 26f, guiTop + 39, 20);
|
||||
ms.translate(x + 26, y + 39, 20);
|
||||
ms.scale(16, 16, 16);
|
||||
ms.multiply(new Vector3f(.3f, 1f, 0f).getDegreesQuaternion(-22.5f));
|
||||
currentElement.applyModelTransform(ms);
|
||||
|
@ -154,7 +162,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
@Override
|
||||
public boolean mouseClicked(double x, double y, int button) {
|
||||
if (confirmButton.isHovered()) {
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
client.player.closeScreen();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import java.util.Optional;
|
|||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintSection;
|
||||
import com.simibubi.create.foundation.gui.GhostItemContainer;
|
||||
import com.simibubi.create.foundation.gui.IClearableContainer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
|
@ -25,7 +25,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class BlueprintContainer extends GhostItemContainer<BlueprintSection> implements IClearableContainer {
|
||||
public class BlueprintContainer extends GhostItemContainer<BlueprintSection> {
|
||||
|
||||
public BlueprintContainer(ContainerType<?> type, int id, PlayerInventory inv, PacketBuffer extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
|
@ -46,7 +46,7 @@ public class BlueprintContainer extends GhostItemContainer<BlueprintSection> imp
|
|||
|
||||
@Override
|
||||
protected void addSlots() {
|
||||
addPlayerSlots(9, 131);
|
||||
addPlayerSlots(8, 131);
|
||||
|
||||
int x = 29;
|
||||
int y = 21;
|
||||
|
@ -133,6 +133,11 @@ public class BlueprintContainer extends GhostItemContainer<BlueprintSection> imp
|
|||
return blueprintSection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity player) {
|
||||
return contentHolder != null && contentHolder.canPlayerUse(player);
|
||||
}
|
||||
|
||||
static class BlueprintCraftingInventory extends CraftingInventory {
|
||||
|
||||
public BlueprintCraftingInventory(Container container, ItemStackHandler items) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
|||
import com.simibubi.create.content.schematics.ISpecialEntityItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
|
||||
import com.simibubi.create.foundation.gui.IInteractionChecker;
|
||||
import com.simibubi.create.foundation.networking.ISyncPersistentData;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
@ -69,7 +70,7 @@ import net.minecraftforge.items.ItemStackHandler;
|
|||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
|
||||
public class BlueprintEntity extends HangingEntity
|
||||
implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, ISyncPersistentData {
|
||||
implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, ISyncPersistentData, IInteractionChecker {
|
||||
|
||||
protected int size;
|
||||
protected Direction verticalOrientation;
|
||||
|
@ -485,7 +486,7 @@ public class BlueprintEntity extends HangingEntity
|
|||
return sectionCache.computeIfAbsent(index, i -> new BlueprintSection(i));
|
||||
}
|
||||
|
||||
class BlueprintSection implements INamedContainerProvider {
|
||||
class BlueprintSection implements INamedContainerProvider, IInteractionChecker {
|
||||
int index;
|
||||
Couple<ItemStack> cachedDisplayItems;
|
||||
public boolean inferredIcon = false;
|
||||
|
@ -539,6 +540,11 @@ public class BlueprintEntity extends HangingEntity
|
|||
.getTranslationKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(PlayerEntity player) {
|
||||
return BlueprintEntity.this.canPlayerUse(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -546,4 +552,32 @@ public class BlueprintEntity extends HangingEntity
|
|||
sectionCache.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(PlayerEntity player) {
|
||||
AxisAlignedBB box = getBoundingBox();
|
||||
|
||||
double dx = 0;
|
||||
if (box.minX > player.getX()) {
|
||||
dx = box.minX - player.getX();
|
||||
} else if (player.getX() > box.maxX) {
|
||||
dx = player.getX() - box.maxX;
|
||||
}
|
||||
|
||||
double dy = 0;
|
||||
if (box.minY > player.getY()) {
|
||||
dy = box.minY - player.getY();
|
||||
} else if (player.getY() > box.maxY) {
|
||||
dy = player.getY() - box.maxY;
|
||||
}
|
||||
|
||||
double dz = 0;
|
||||
if (box.minZ > player.getZ()) {
|
||||
dz = box.minZ - player.getZ();
|
||||
} else if (player.getZ() > box.maxZ) {
|
||||
dz = player.getZ() - box.maxZ;
|
||||
}
|
||||
|
||||
return (dx * dx + dy * dy + dz * dz) <= 64.0D;
|
||||
}
|
||||
|
||||
}
|
|
@ -41,6 +41,7 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
|
|||
@Override
|
||||
protected void init() {
|
||||
setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
|
||||
setWindowOffset(2 + (width % 2 == 0 ? 0 : -1), 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
|
@ -54,17 +55,15 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
|
|||
widgets.add(confirmButton);
|
||||
|
||||
extraAreas = ImmutableList.of(
|
||||
new Rectangle2d(x + background.width, guiTop + background.height - 36, 56, 44)
|
||||
new Rectangle2d(x + background.width, y + background.height - 36, 56, 44)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int invLeft = guiLeft - windowXOffset + (xSize - PLAYER_INVENTORY.width) / 2;
|
||||
int invTop = guiTop + background.height + 4;
|
||||
|
||||
PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||
int invX = getLeftOfCentered(PLAYER_INVENTORY.width);
|
||||
int invY = guiTop + background.height + 4;
|
||||
renderPlayerInventory(ms, invX, invY);
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
@ -73,7 +72,7 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
|
|||
textRenderer.draw(ms, title, x + 15, y + 4, 0xFFFFFF);
|
||||
|
||||
GuiGameElement.of(AllBlockPartials.CRAFTING_BLUEPRINT_1x1)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 20, guiTop + background.height - 32, 0)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 20, y + background.height - 32, 0)
|
||||
.rotate(45, -45, 22.5f)
|
||||
.scale(40)
|
||||
.render(ms);
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.simibubi.create.foundation.utility.Lang;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
@ -44,23 +43,26 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
this.zapper = zapper;
|
||||
this.offhand = offhand;
|
||||
title = StringTextComponent.EMPTY;
|
||||
brightColor = 0xfefefe;
|
||||
brightColor = 0xFEFEFE;
|
||||
fontColor = AllGuiTextures.FONT_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
animationProgress = 0;
|
||||
setWindowSize(background.width, background.height);
|
||||
setWindowOffset(-10, 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
animationProgress = 0;
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
confirmButton =
|
||||
new IconButton(guiLeft + background.width - 43, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
||||
new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
|
||||
int i = guiLeft - 10;
|
||||
int j = guiTop;
|
||||
CompoundNBT nbt = zapper.getOrCreateTag();
|
||||
|
||||
patternButtons = new Vector<>(6);
|
||||
|
@ -69,7 +71,7 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
int id = patternButtons.size();
|
||||
PlacementPatterns pattern = PlacementPatterns.values()[id];
|
||||
patternButtons
|
||||
.add(new IconButton(i + background.width - 76 + col * 18, j + 21 + row * 18, pattern.icon));
|
||||
.add(new IconButton(x + background.width - 76 + col * 18, y + 21 + row * 18, pattern.icon));
|
||||
patternButtons.get(id)
|
||||
.setToolTip(Lang.translate("gui.terrainzapper.pattern." + pattern.translationKey));
|
||||
}
|
||||
|
@ -83,19 +85,19 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
int i = guiLeft - 10;
|
||||
int j = guiTop;
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
background.draw(matrixStack, this, i, j);
|
||||
drawOnBackground(matrixStack, i, j);
|
||||
background.draw(ms, this, x, y);
|
||||
drawOnBackground(ms, x, y);
|
||||
|
||||
renderBlock(matrixStack);
|
||||
renderZapper(matrixStack);
|
||||
renderBlock(ms, x, y);
|
||||
renderZapper(ms, x, y);
|
||||
}
|
||||
|
||||
protected void drawOnBackground(MatrixStack matrixStack, int i, int j) {
|
||||
textRenderer.draw(matrixStack, title, i + 11, j + 4, 0x54214F);
|
||||
protected void drawOnBackground(MatrixStack ms, int x, int y) {
|
||||
textRenderer.draw(ms, title, x + 11, y + 4, 0x54214F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,8 +121,7 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
if (patternButton.isHovered()) {
|
||||
patternButtons.forEach(b -> b.active = true);
|
||||
patternButton.active = false;
|
||||
patternButton.playDownSound(Minecraft.getInstance()
|
||||
.getSoundHandler());
|
||||
patternButton.playDownSound(client.getSoundHandler());
|
||||
nbt.putString("Pattern", PlacementPatterns.values()[patternButtons.indexOf(patternButton)].name());
|
||||
}
|
||||
}
|
||||
|
@ -133,19 +134,19 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
return super.mouseClicked(x, y, button);
|
||||
}
|
||||
|
||||
protected void renderZapper(MatrixStack matrixStack) {
|
||||
protected void renderZapper(MatrixStack ms, int x, int y) {
|
||||
GuiGameElement.of(zapper)
|
||||
.scale(4)
|
||||
.at((this.width - this.sWidth) / 2 + 220, this.height / 2 - this.sHeight / 4 + 27, -150)
|
||||
.render(matrixStack);
|
||||
.at(x + background.width, y + background.height - 48, -200)
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
protected void renderBlock(MatrixStack matrixStack) {
|
||||
matrixStack.push();
|
||||
matrixStack.translate(guiLeft + 22f, guiTop + 42f, 120);
|
||||
matrixStack.multiply(new Vector3f(1f, 0, 0).getDegreesQuaternion(-25f));
|
||||
matrixStack.multiply(new Vector3f(0, 1f, 0).getDegreesQuaternion(-45f));
|
||||
matrixStack.scale(20, 20, 20);
|
||||
protected void renderBlock(MatrixStack ms, int x, int y) {
|
||||
ms.push();
|
||||
ms.translate(x + 32, y + 42, 120);
|
||||
ms.multiply(new Vector3f(1f, 0, 0).getDegreesQuaternion(-25f));
|
||||
ms.multiply(new Vector3f(0, 1f, 0).getDegreesQuaternion(-45f));
|
||||
ms.scale(20, 20, 20);
|
||||
|
||||
BlockState state = Blocks.AIR.getDefaultState();
|
||||
if (zapper.hasTag() && zapper.getTag()
|
||||
|
@ -154,8 +155,8 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
.getCompound("BlockUsed"));
|
||||
|
||||
GuiGameElement.of(state)
|
||||
.render(matrixStack);
|
||||
matrixStack.pop();
|
||||
.render(ms);
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
protected void writeAdditionalOptions(CompoundNBT nbt) {}
|
||||
|
|
|
@ -43,8 +43,6 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
protected Indicator followDiagonalsIndicator;
|
||||
protected Indicator acrossMaterialsIndicator;
|
||||
|
||||
private int i;
|
||||
private int j;
|
||||
private CompoundNBT nbt;
|
||||
|
||||
public WorldshaperScreen(ItemStack zapper, boolean offhand) {
|
||||
|
@ -58,24 +56,24 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
protected void init() {
|
||||
super.init();
|
||||
|
||||
i = guiLeft - 10;
|
||||
j = guiTop + 2;
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
brushLabel = new Label(i + 61, j + 23, StringTextComponent.EMPTY).withShadow();
|
||||
brushInput = new SelectionScrollInput(i + 56, j + 18, 77, 18).forOptions(brushOptions)
|
||||
brushLabel = new Label(x + 61, y + 25, StringTextComponent.EMPTY).withShadow();
|
||||
brushInput = new SelectionScrollInput(x + 56, y + 20, 77, 18).forOptions(brushOptions)
|
||||
.titled(Lang.translate("gui.terrainzapper.brush"))
|
||||
.writingTo(brushLabel)
|
||||
.calling(this::brushChanged);
|
||||
.calling(brushIndex -> initBrushParams(x, y));
|
||||
if (nbt.contains("Brush"))
|
||||
brushInput.setState(NBTHelper.readEnum(nbt, "Brush", TerrainBrushes.class)
|
||||
.ordinal());
|
||||
|
||||
widgets.add(brushLabel);
|
||||
widgets.add(brushInput);
|
||||
initBrushParams();
|
||||
initBrushParams(x, y);
|
||||
}
|
||||
|
||||
public void initBrushParams() {
|
||||
public void initBrushParams(int x, int y) {
|
||||
if (brushParams != null) {
|
||||
nbt.put("BrushParams", NBTUtil.writeBlockPos(new BlockPos(brushParams.get(0)
|
||||
.getState(),
|
||||
|
@ -95,16 +93,16 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get();
|
||||
for (int index = 0; index < 3; index++) {
|
||||
|
||||
Label label = new Label(i + 65 + 20 * index, j + 43, StringTextComponent.EMPTY).withShadow();
|
||||
Label label = new Label(x + 65 + 20 * index, y + 45, StringTextComponent.EMPTY).withShadow();
|
||||
brushParamLabels.add(label);
|
||||
int indexFinal = index;
|
||||
ScrollInput input = new ScrollInput(i + 56 + 20 * index, j + 38, 18, 18)
|
||||
ScrollInput input = new ScrollInput(x + 56 + 20 * index, y + 40, 18, 18)
|
||||
.withRange(currentBrush.getMin(index), currentBrush.getMax(index) + 1)
|
||||
.writingTo(label)
|
||||
.titled(currentBrush.getParamLabel(index)
|
||||
.copy())
|
||||
.calling(state -> {
|
||||
label.x = i + 65 + 20 * indexFinal - textRenderer.getWidth(label.text) / 2;
|
||||
label.x = x + 65 + 20 * indexFinal - textRenderer.getWidth(label.text) / 2;
|
||||
});
|
||||
input.setState(params[index]);
|
||||
input.onChanged();
|
||||
|
@ -132,13 +130,13 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
}
|
||||
|
||||
if (currentBrush.hasConnectivityOptions()) {
|
||||
int x = i + 7 + 4 * 18;
|
||||
int y = j + 77;
|
||||
followDiagonalsIndicator = new Indicator(x, y - 6, StringTextComponent.EMPTY);
|
||||
followDiagonals = new IconButton(x, y, AllIcons.I_FOLLOW_DIAGONAL);
|
||||
x += 18;
|
||||
acrossMaterialsIndicator = new Indicator(x, y - 6, StringTextComponent.EMPTY);
|
||||
acrossMaterials = new IconButton(x, y, AllIcons.I_FOLLOW_MATERIAL);
|
||||
int x1 = x + 7 + 4 * 18;
|
||||
int y1 = y + 79;
|
||||
followDiagonalsIndicator = new Indicator(x1, y1 - 6, StringTextComponent.EMPTY);
|
||||
followDiagonals = new IconButton(x1, y1, AllIcons.I_FOLLOW_DIAGONAL);
|
||||
x1 += 18;
|
||||
acrossMaterialsIndicator = new Indicator(x1, y1 - 6, StringTextComponent.EMPTY);
|
||||
acrossMaterials = new IconButton(x1, y1, AllIcons.I_FOLLOW_MATERIAL);
|
||||
|
||||
followDiagonals.setToolTip(Lang.translate("gui.terrainzapper.searchDiagonal"));
|
||||
acrossMaterials.setToolTip(Lang.translate("gui.terrainzapper.searchFuzzy"));
|
||||
|
@ -161,7 +159,7 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
toolButtons = new Vector<>(toolValues.length);
|
||||
for (int id = 0; id < toolValues.length; id++) {
|
||||
TerrainTools tool = toolValues[id];
|
||||
toolButtons.add(new IconButton(i + 7 + id * 18, j + 77, tool.icon));
|
||||
toolButtons.add(new IconButton(x + 7 + id * 18, y + 79, tool.icon));
|
||||
toolButtons.get(id)
|
||||
.setToolTip(Lang.translate("gui.terrainzapper.tool." + tool.translationKey));
|
||||
}
|
||||
|
@ -190,7 +188,7 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
placementButtons = new Vector<>(placementValues.length);
|
||||
for (int id = 0; id < placementValues.length; id++) {
|
||||
PlacementOptions option = placementValues[id];
|
||||
placementButtons.add(new IconButton(i + 136 + id * 18, j + 77, option.icon));
|
||||
placementButtons.add(new IconButton(x + 136 + id * 18, y + 79, option.icon));
|
||||
placementButtons.get(id)
|
||||
.setToolTip(Lang.translate("gui.terrainzapper.placement." + option.translationKey));
|
||||
}
|
||||
|
@ -205,11 +203,6 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
}
|
||||
placementButtons.get(optionIndex).active = false;
|
||||
widgets.addAll(placementButtons);
|
||||
|
||||
}
|
||||
|
||||
private void brushChanged(int brushIndex) {
|
||||
initBrushParams();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -251,16 +244,16 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawOnBackground(MatrixStack matrixStack, int i, int j) {
|
||||
super.drawOnBackground(matrixStack, i, j);
|
||||
protected void drawOnBackground(MatrixStack matrixStack, int x, int y) {
|
||||
super.drawOnBackground(matrixStack, x, y);
|
||||
|
||||
Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get();
|
||||
for (int index = 2; index >= currentBrush.amtParams; index--)
|
||||
AllGuiTextures.TERRAINZAPPER_INACTIVE_PARAM.draw(matrixStack, i + 56 + 20 * index, j + 40);
|
||||
AllGuiTextures.TERRAINZAPPER_INACTIVE_PARAM.draw(matrixStack, x + 56 + 20 * index, y + 40);
|
||||
|
||||
textRenderer.draw(matrixStack, toolSection, i + 7, j + 69, fontColor);
|
||||
textRenderer.draw(matrixStack, toolSection, x + 7, y + 69, fontColor);
|
||||
if (currentBrush.hasPlacementOptions())
|
||||
textRenderer.draw(matrixStack, placementSection, i + 136, j + 69, fontColor);
|
||||
textRenderer.draw(matrixStack, placementSection, x + 136, y + 69, fontColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,8 +87,8 @@ public class AdjustableCrateContainer extends Container {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
public boolean canInteractWith(PlayerEntity player) {
|
||||
return te != null && te.canPlayerUse(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
|||
textureXShift = container.doubleCrate ? 0 : (xSize - (background.width - 8)) / 2;
|
||||
itemYShift = container.doubleCrate ? 0 : -16;
|
||||
|
||||
int crateLeft = guiLeft + textureXShift;
|
||||
int crateTop = guiTop;
|
||||
int x = guiLeft + textureXShift;
|
||||
int y = guiTop;
|
||||
|
||||
allowedItemsLabel = new Label(crateLeft + itemLabelOffset + 4, crateTop + 108, StringTextComponent.EMPTY).colored(0xFFFFFF)
|
||||
allowedItemsLabel = new Label(x + itemLabelOffset + 4, y + 108, StringTextComponent.EMPTY).colored(0xFFFFFF)
|
||||
.withShadow();
|
||||
allowedItems = new ScrollInput(crateLeft + itemLabelOffset, crateTop + 104, 41, 16).titled(storageSpace.copy())
|
||||
allowedItems = new ScrollInput(x + itemLabelOffset, y + 104, 41, 16).titled(storageSpace.copy())
|
||||
.withRange(1, (container.doubleCrate ? 2049 : 1025))
|
||||
.writingTo(allowedItemsLabel)
|
||||
.withShiftStep(64)
|
||||
|
@ -76,38 +76,36 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
|||
widgets.add(allowedItems);
|
||||
|
||||
extraAreas = ImmutableList.of(
|
||||
new Rectangle2d(crateLeft + background.width, crateTop + background.height - 56 + itemYShift, 80, 80)
|
||||
new Rectangle2d(x + background.width, y + background.height - 56 + itemYShift, 80, 80)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int invLeft = guiLeft - windowXOffset + (xSize - AllGuiTextures.PLAYER_INVENTORY.width) / 2;
|
||||
int invTop = guiTop + background.height + 4;
|
||||
int invX = getLeftOfCentered(PLAYER_INVENTORY.width);
|
||||
int invY = guiTop + background.height + 4;
|
||||
renderPlayerInventory(ms, invX, invY);
|
||||
|
||||
PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||
int x = guiLeft + textureXShift;
|
||||
int y = guiTop;
|
||||
|
||||
int crateLeft = guiLeft + textureXShift;
|
||||
int crateTop = guiTop;
|
||||
|
||||
background.draw(ms, this, crateLeft, crateTop);
|
||||
drawCenteredText(ms, textRenderer, title, crateLeft + (background.width - 8) / 2, crateTop + 3, 0xFFFFFF);
|
||||
background.draw(ms, this, x, y);
|
||||
drawCenteredText(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
String itemCount = String.valueOf(te.itemCount);
|
||||
textRenderer.draw(ms, itemCount, crateLeft + itemLabelOffset - 13 - textRenderer.getStringWidth(itemCount), crateTop + 108, 0x4B3A22);
|
||||
textRenderer.draw(ms, itemCount, x + itemLabelOffset - 13 - textRenderer.getStringWidth(itemCount), y + 108, 0x4B3A22);
|
||||
|
||||
for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) {
|
||||
if (allowedItems.getState() > slot * 64)
|
||||
continue;
|
||||
int slotsPerRow = (container.doubleCrate ? 8 : 4);
|
||||
int x = crateLeft + 22 + (slot % slotsPerRow) * 18;
|
||||
int y = crateTop + 19 + (slot / slotsPerRow) * 18;
|
||||
AllGuiTextures.ADJUSTABLE_CRATE_LOCKED_SLOT.draw(ms, this, x, y);
|
||||
int slotX = x + 22 + (slot % slotsPerRow) * 18;
|
||||
int slotY = y + 19 + (slot / slotsPerRow) * 18;
|
||||
AllGuiTextures.ADJUSTABLE_CRATE_LOCKED_SLOT.draw(ms, this, slotX, slotY);
|
||||
}
|
||||
|
||||
GuiGameElement.of(renderedItem)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(crateLeft + background.width, crateTop + background.height - 56 + itemYShift, -200)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width, y + background.height - 56 + itemYShift, -200)
|
||||
.scale(5)
|
||||
.render(ms);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.logistics.block.redstone;
|
||||
|
||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.STOCKSWITCH;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket;
|
||||
|
@ -16,7 +14,6 @@ import com.simibubi.create.foundation.utility.Lang;
|
|||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
@ -28,34 +25,39 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
|
|||
private IconButton confirmButton;
|
||||
private IconButton flipSignals;
|
||||
|
||||
private final ITextComponent title = Lang.translate("gui.stockpile_switch.title");
|
||||
private final ITextComponent invertSignal = Lang.translate("gui.stockpile_switch.invert_signal");
|
||||
private final ItemStack renderedItem = new ItemStack(AllBlocks.STOCKPILE_SWITCH.get());
|
||||
|
||||
private int lastModification;
|
||||
private AllGuiTextures background;
|
||||
private StockpileSwitchTileEntity te;
|
||||
private int lastModification;
|
||||
|
||||
private LerpedFloat cursor;
|
||||
private LerpedFloat cursorLane;
|
||||
|
||||
public StockpileSwitchScreen(StockpileSwitchTileEntity te) {
|
||||
super(Lang.translate("gui.stockpile_switch.title"));
|
||||
background = AllGuiTextures.STOCKSWITCH;
|
||||
this.te = te;
|
||||
lastModification = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
AllGuiTextures background = STOCKSWITCH;
|
||||
setWindowSize(background.width + 50, background.height);
|
||||
setWindowSize(background.width, background.height);
|
||||
setWindowOffset(-20, 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
cursor = LerpedFloat.linear()
|
||||
.startWithValue(te.getLevelForDisplay());
|
||||
cursorLane = LerpedFloat.linear()
|
||||
.startWithValue(te.getState() ? 1 : 0);
|
||||
|
||||
offBelow = new ScrollInput(guiLeft + 36, guiTop + 40, 102, 18).withRange(0, 100)
|
||||
offBelow = new ScrollInput(x + 36, y + 40, 102, 18).withRange(0, 100)
|
||||
.titled(StringTextComponent.EMPTY.copy())
|
||||
.calling(state -> {
|
||||
lastModification = 0;
|
||||
|
@ -67,7 +69,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
|
|||
})
|
||||
.setState((int) (te.offWhenBelow * 100));
|
||||
|
||||
onAbove = new ScrollInput(guiLeft + 36, guiTop + 18, 102, 18).withRange(1, 101)
|
||||
onAbove = new ScrollInput(x + 36, y + 18, 102, 18).withRange(1, 101)
|
||||
.titled(StringTextComponent.EMPTY.copy())
|
||||
.calling(state -> {
|
||||
lastModification = 0;
|
||||
|
@ -86,50 +88,50 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
|
|||
widgets.add(offBelow);
|
||||
|
||||
confirmButton =
|
||||
new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
||||
new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
|
||||
flipSignals = new IconButton(guiLeft + 14, guiTop + 40, AllIcons.I_FLIP);
|
||||
flipSignals = new IconButton(x + 14, y + 40, AllIcons.I_FLIP);
|
||||
flipSignals.setToolTip(invertSignal);
|
||||
widgets.add(flipSignals);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
STOCKSWITCH.draw(matrixStack, this, guiLeft, guiTop);
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
AllGuiTextures.STOCKSWITCH_POWERED_LANE.draw(matrixStack, this, guiLeft + 36, guiTop + (te.isInverted() ? 18 : 40));
|
||||
AllGuiTextures.STOCKSWITCH_UNPOWERED_LANE.draw(matrixStack, this, guiLeft + 36, guiTop + (te.isInverted() ? 40 : 18));
|
||||
textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (STOCKSWITCH.width - textRenderer.getWidth(title)) / 2, guiTop + 3,
|
||||
0xffffff);
|
||||
background.draw(ms, this, x, y);
|
||||
|
||||
AllGuiTextures.STOCKSWITCH_POWERED_LANE.draw(ms, this, x + 36, y + (te.isInverted() ? 18 : 40));
|
||||
AllGuiTextures.STOCKSWITCH_UNPOWERED_LANE.draw(ms, this, x + 36, y + (te.isInverted() ? 40 : 18));
|
||||
drawCenteredText(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
AllGuiTextures sprite = AllGuiTextures.STOCKSWITCH_INTERVAL;
|
||||
float lowerBound = offBelow.getState();
|
||||
float upperBound = onAbove.getState();
|
||||
|
||||
sprite.bind();
|
||||
drawTexture(matrixStack, (int) (guiLeft + upperBound) + 37, guiTop + 18, (int) (sprite.startX + upperBound), sprite.startY,
|
||||
drawTexture(ms, (int) (x + upperBound) + 37, y + 18, (int) (sprite.startX + upperBound), sprite.startY,
|
||||
(int) (sprite.width - upperBound), sprite.height);
|
||||
drawTexture(matrixStack, guiLeft + 37, guiTop + 40, sprite.startX, sprite.startY, (int) (lowerBound), sprite.height);
|
||||
drawTexture(ms, x + 37, y + 40, sprite.startX, sprite.startY, (int) (lowerBound), sprite.height);
|
||||
|
||||
AllGuiTextures.STOCKSWITCH_ARROW_UP.draw(matrixStack, this, (int) (guiLeft + lowerBound + 36) - 2, guiTop + 35);
|
||||
AllGuiTextures.STOCKSWITCH_ARROW_DOWN.draw(matrixStack, this, (int) (guiLeft + upperBound + 36) - 3, guiTop + 17);
|
||||
AllGuiTextures.STOCKSWITCH_ARROW_UP.draw(ms, this, (int) (x + lowerBound + 36) - 2, y + 35);
|
||||
AllGuiTextures.STOCKSWITCH_ARROW_DOWN.draw(ms, this, (int) (x + upperBound + 36) - 3, y + 17);
|
||||
|
||||
if (te.currentLevel != -1) {
|
||||
AllGuiTextures cursor = AllGuiTextures.STOCKSWITCH_CURSOR;
|
||||
matrixStack.push();
|
||||
matrixStack.translate(Math.min(99, this.cursor.getValue(partialTicks) * sprite.width),
|
||||
ms.push();
|
||||
ms.translate(Math.min(99, this.cursor.getValue(partialTicks) * sprite.width),
|
||||
cursorLane.getValue(partialTicks) * 22, 0);
|
||||
cursor.draw(matrixStack, this, guiLeft + 34, guiTop + 19);
|
||||
matrixStack.pop();
|
||||
cursor.draw(ms, this, x + 34, y + 19);
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
matrixStack.push();
|
||||
GuiGameElement.of(renderedItem)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + STOCKSWITCH.width + 15, guiTop + 40, -250)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 6, y + background.height - 56, -200)
|
||||
.scale(5)
|
||||
.render(matrixStack);
|
||||
matrixStack.pop();
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,7 +167,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
|
|||
if (flipSignals.isHovered())
|
||||
send(!te.isInverted());
|
||||
if (confirmButton.isHovered()) {
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
client.player.closeScreen();
|
||||
return true;
|
||||
}
|
||||
return super.mouseClicked(x, y, button);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
|||
}
|
||||
|
||||
protected void addPlayerSlots() {
|
||||
int x = 9;
|
||||
int x = 8;
|
||||
int y = 131;
|
||||
|
||||
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
||||
|
@ -88,7 +88,7 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
|||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
return playerInventory.getCurrentItem() == mainItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,6 +37,7 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
|
|||
@Override
|
||||
protected void init() {
|
||||
setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
|
||||
setWindowOffset(2 + (width % 2 == 0 ? 0 : -1), 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
|
@ -56,11 +57,9 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
|
|||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int invLeft = guiLeft - windowXOffset + (xSize - PLAYER_INVENTORY.width) / 2;
|
||||
int invTop = guiTop + background.height + 4;
|
||||
|
||||
PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||
int invX = getLeftOfCentered(PLAYER_INVENTORY.width);
|
||||
int invY = guiTop + background.height + 4;
|
||||
renderPlayerInventory(ms, invX, invY);
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
|
|
@ -57,4 +57,9 @@ public abstract class AbstractFilterContainer extends GhostItemContainer<ItemSta
|
|||
.put("Items", ghostInventory.serializeNBT());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity player) {
|
||||
return playerInventory.getCurrentItem() == contentHolder;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,11 +61,9 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int invLeft = guiLeft - windowXOffset + (xSize - PLAYER_INVENTORY.width) / 2;
|
||||
int invTop = guiTop + background.height + 4;
|
||||
|
||||
PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||
int invX = getLeftOfCentered(PLAYER_INVENTORY.width);
|
||||
int invY = guiTop + background.height + 4;
|
||||
renderPlayerInventory(ms, invX, invY);
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
|
|
@ -83,8 +83,8 @@ public class SchematicTableContainer extends Container {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
public boolean canInteractWith(PlayerEntity player) {
|
||||
return te != null && te.canPlayerUse(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY;
|
||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
@ -69,22 +70,25 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
CreateClient.SCHEMATIC_SENDER.refresh();
|
||||
List<ITextComponent> availableSchematics = CreateClient.SCHEMATIC_SENDER.getAvailableSchematics();
|
||||
|
||||
schematicsLabel = new Label(guiLeft + 49, guiTop + 26, StringTextComponent.EMPTY).withShadow();
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
schematicsLabel = new Label(x + 49, y + 26, StringTextComponent.EMPTY).withShadow();
|
||||
schematicsLabel.text = StringTextComponent.EMPTY;
|
||||
if (!availableSchematics.isEmpty()) {
|
||||
schematicsArea =
|
||||
new SelectionScrollInput(guiLeft + 45, guiTop + 21, 139, 18).forOptions(availableSchematics)
|
||||
new SelectionScrollInput(x + 45, y + 21, 139, 18).forOptions(availableSchematics)
|
||||
.titled(availableSchematicsTitle.copy())
|
||||
.writingTo(schematicsLabel);
|
||||
widgets.add(schematicsArea);
|
||||
widgets.add(schematicsLabel);
|
||||
}
|
||||
|
||||
confirmButton = new IconButton(guiLeft + 44, guiTop + 56, AllIcons.I_CONFIRM);
|
||||
confirmButton = new IconButton(x + 44, y + 56, AllIcons.I_CONFIRM);
|
||||
|
||||
folderButton = new IconButton(guiLeft + 21, guiTop + 21, AllIcons.I_OPEN_FOLDER);
|
||||
folderButton = new IconButton(x + 21, y + 21, AllIcons.I_OPEN_FOLDER);
|
||||
folderButton.setToolTip(folder);
|
||||
refreshButton = new IconButton(guiLeft + 207, guiTop + 21, AllIcons.I_REFRESH);
|
||||
refreshButton = new IconButton(x + 207, y + 21, AllIcons.I_REFRESH);
|
||||
refreshButton.setToolTip(refresh);
|
||||
|
||||
widgets.add(confirmButton);
|
||||
|
@ -92,20 +96,21 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
widgets.add(refreshButton);
|
||||
|
||||
extraAreas = ImmutableList.of(
|
||||
new Rectangle2d(guiLeft + background.width, guiTop + background.height - 40, 48, 48),
|
||||
new Rectangle2d(refreshButton.x, refreshButton.y, 16, 16)
|
||||
new Rectangle2d(x + background.width, y + background.height - 40, 48, 48),
|
||||
new Rectangle2d(refreshButton.x, refreshButton.y, refreshButton.getWidth(), refreshButton.unusedGetHeight())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int invLeft = guiLeft - windowXOffset + (xSize - AllGuiTextures.PLAYER_INVENTORY.width) / 2;
|
||||
int invTop = guiTop + background.height + 4;
|
||||
int invX = getLeftOfCentered(PLAYER_INVENTORY.width);
|
||||
int invY = guiTop + background.height + 4;
|
||||
renderPlayerInventory(ms, invX, invY);
|
||||
|
||||
AllGuiTextures.PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
background.draw(ms, this, guiLeft, guiTop);
|
||||
background.draw(ms, this, x, y);
|
||||
|
||||
ITextComponent titleText;
|
||||
if (container.getTileEntity().isUploading)
|
||||
|
@ -115,23 +120,22 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
titleText = finished;
|
||||
else
|
||||
titleText = title;
|
||||
drawCenteredText(ms, textRenderer, titleText, guiLeft + (background.width - 8) / 2, guiTop + 3, 0xFFFFFF);
|
||||
drawCenteredText(ms, textRenderer, titleText, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
if (schematicsArea == null)
|
||||
textRenderer.drawWithShadow(ms, noSchematics, guiLeft + 54, guiTop + 26, 0xD3D3D3);
|
||||
textRenderer.drawWithShadow(ms, noSchematics, x + 54, y + 26, 0xD3D3D3);
|
||||
|
||||
GuiGameElement.of(renderedItem)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + background.width, guiTop + background.height - 40, -200)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width, y + background.height - 40, -200)
|
||||
.scale(3)
|
||||
.render(ms);
|
||||
|
||||
client.getTextureManager()
|
||||
.bindTexture(SCHEMATIC_TABLE_PROGRESS.location);
|
||||
SCHEMATIC_TABLE_PROGRESS.bind();
|
||||
int width = (int) (SCHEMATIC_TABLE_PROGRESS.width
|
||||
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
|
||||
int height = SCHEMATIC_TABLE_PROGRESS.height;
|
||||
RenderSystem.disableLighting();
|
||||
drawTexture(ms, guiLeft + 70, guiTop + 57, SCHEMATIC_TABLE_PROGRESS.startX,
|
||||
drawTexture(ms, x + 70, y + 57, SCHEMATIC_TABLE_PROGRESS.startX,
|
||||
SCHEMATIC_TABLE_PROGRESS.startY, width, height);
|
||||
}
|
||||
|
||||
|
@ -198,7 +202,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
widgets.remove(schematicsArea);
|
||||
|
||||
if (!availableSchematics.isEmpty()) {
|
||||
schematicsArea = new SelectionScrollInput(guiLeft - 56 + 33, guiTop - 16 + 23, 134, 14)
|
||||
schematicsArea = new SelectionScrollInput(guiLeft + 45, guiTop + 21, 139, 18)
|
||||
.forOptions(availableSchematics)
|
||||
.titled(availableSchematicsTitle.copy())
|
||||
.writingTo(schematicsLabel);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.simibubi.create.foundation.gui.IInteractionChecker;
|
||||
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
|
@ -16,7 +17,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
public class SchematicTableTileEntity extends SyncedTileEntity implements ITickableTileEntity, INamedContainerProvider {
|
||||
public class SchematicTableTileEntity extends SyncedTileEntity implements ITickableTileEntity, INamedContainerProvider, IInteractionChecker {
|
||||
|
||||
public SchematicTableInventory inventory;
|
||||
public boolean isUploading;
|
||||
|
@ -119,4 +120,12 @@ public class SchematicTableTileEntity extends SyncedTileEntity implements ITicka
|
|||
return Lang.translate("gui.schematicTable.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(PlayerEntity player) {
|
||||
if (world == null || world.getTileEntity(pos) != this) {
|
||||
return false;
|
||||
}
|
||||
return player.getDistanceSq(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,19 +52,22 @@ public class SchematicannonContainer extends Container {
|
|||
addSlot(new SlotItemHandler(te.inventory, 3, x + 174, y + 19));
|
||||
addSlot(new SlotItemHandler(te.inventory, 4, x + 15, y + 19));
|
||||
|
||||
int invX = 37;
|
||||
int invY = 161;
|
||||
|
||||
// player Slots
|
||||
for (int row = 0; row < 3; ++row)
|
||||
for (int col = 0; col < 9; ++col)
|
||||
addSlot(new Slot(player.inventory, col + row * 9 + 9, 37 + col * 18, 161 + row * 18));
|
||||
addSlot(new Slot(player.inventory, col + row * 9 + 9, invX + col * 18, invY + row * 18));
|
||||
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
||||
addSlot(new Slot(player.inventory, hotbarSlot, 37 + hotbarSlot * 18, 219));
|
||||
addSlot(new Slot(player.inventory, hotbarSlot, invX + hotbarSlot * 18, invY + 58));
|
||||
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
public boolean canInteractWith(PlayerEntity player) {
|
||||
return te != null && te.canPlayerUse(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,7 +86,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
@Override
|
||||
protected void init() {
|
||||
setWindowSize(BG_TOP.width, BG_TOP.height + BG_BOTTOM.height + 2 + AllGuiTextures.PLAYER_INVENTORY.height);
|
||||
setWindowOffset(30 - (2 + 80) / 2, 0);
|
||||
setWindowOffset(-10 + (width % 2 == 0 ? 0 : -1), 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
|
@ -104,16 +104,16 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
Collections.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton,
|
||||
resetIndicator);
|
||||
|
||||
confirmButton = new IconButton(x + 180, guiTop + 117, AllIcons.I_CONFIRM);
|
||||
confirmButton = new IconButton(x + 180, y + 117, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
showSettingsButton = new IconButton(guiLeft + 9, guiTop + 117, AllIcons.I_PLACEMENT_SETTINGS);
|
||||
showSettingsButton = new IconButton(x + 9, y + 117, AllIcons.I_PLACEMENT_SETTINGS);
|
||||
showSettingsButton.setToolTip(Lang.translate(_showSettings));
|
||||
widgets.add(showSettingsButton);
|
||||
showSettingsIndicator = new Indicator(guiLeft + 9, guiTop + 111, StringTextComponent.EMPTY);
|
||||
showSettingsIndicator = new Indicator(x + 9, y + 111, StringTextComponent.EMPTY);
|
||||
widgets.add(showSettingsIndicator);
|
||||
|
||||
extraAreas = ImmutableList.of(
|
||||
new Rectangle2d(guiLeft + BG_TOP.width, guiTop + BG_TOP.height + BG_BOTTOM.height - 62, 84, 92)
|
||||
new Rectangle2d(x + BG_TOP.width, y + BG_TOP.height + BG_BOTTOM.height - 62, 84, 92)
|
||||
);
|
||||
|
||||
tick();
|
||||
|
@ -247,30 +247,31 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int invLeft = guiLeft - windowXOffset + (xSize - AllGuiTextures.PLAYER_INVENTORY.width) / 2;
|
||||
int invTop = guiTop + BG_TOP.height + BG_BOTTOM.height + 2;
|
||||
int invX = getLeftOfCentered(AllGuiTextures.PLAYER_INVENTORY.width);
|
||||
int invY = guiTop + BG_TOP.height + BG_BOTTOM.height + 2;
|
||||
renderPlayerInventory(ms, invX, invY);
|
||||
|
||||
AllGuiTextures.PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
BG_TOP.draw(ms, this, guiLeft, guiTop);
|
||||
BG_BOTTOM.draw(ms, this, guiLeft, guiTop + BG_TOP.height);
|
||||
BG_TOP.draw(ms, this, x, y);
|
||||
BG_BOTTOM.draw(ms, this, x, y + BG_TOP.height);
|
||||
|
||||
SchematicannonTileEntity te = container.getTileEntity();
|
||||
renderPrintingProgress(ms, te.schematicProgress);
|
||||
renderFuelBar(ms, te.fuelLevel);
|
||||
renderChecklistPrinterProgress(ms, te.bookPrintingProgress);
|
||||
renderPrintingProgress(ms, x, y, te.schematicProgress);
|
||||
renderFuelBar(ms, x, y, te.fuelLevel);
|
||||
renderChecklistPrinterProgress(ms, x, y, te.bookPrintingProgress);
|
||||
|
||||
if (!te.inventory.getStackInSlot(0)
|
||||
.isEmpty())
|
||||
renderBlueprintHighlight(ms);
|
||||
renderBlueprintHighlight(ms, x, y);
|
||||
|
||||
GuiGameElement.of(renderedItem)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + BG_TOP.width, guiTop + BG_TOP.height + BG_BOTTOM.height - 48, -200)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + BG_TOP.width, y + BG_TOP.height + BG_BOTTOM.height - 48, -200)
|
||||
.scale(5)
|
||||
.render(ms);
|
||||
|
||||
drawCenteredText(ms, textRenderer, title, guiLeft + (BG_TOP.width - 8) / 2, guiTop + 3, 0xFFFFFF);
|
||||
drawCenteredText(ms, textRenderer, title, x + (BG_TOP.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
ITextComponent msg = Lang.translate("schematicannon.status." + te.statusMsg);
|
||||
int stringWidth = textRenderer.getWidth(msg);
|
||||
|
@ -278,44 +279,41 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
if (te.missingItem != null) {
|
||||
stringWidth += 16;
|
||||
GuiGameElement.of(te.missingItem)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + 128, guiTop + 49, 100)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + 128, y + 49, 100)
|
||||
.scale(1)
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
textRenderer.drawWithShadow(ms, msg, guiLeft + 103 - stringWidth / 2, guiTop + 53, 0xCCDDFF);
|
||||
textRenderer.drawWithShadow(ms, msg, x + 103 - stringWidth / 2, y + 53, 0xCCDDFF);
|
||||
}
|
||||
|
||||
protected void renderBlueprintHighlight(MatrixStack matrixStack) {
|
||||
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(matrixStack, this, guiLeft + 10, guiTop + 60);
|
||||
protected void renderBlueprintHighlight(MatrixStack matrixStack, int x, int y) {
|
||||
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(matrixStack, this, x + 10, y + 60);
|
||||
}
|
||||
|
||||
protected void renderPrintingProgress(MatrixStack matrixStack, float progress) {
|
||||
protected void renderPrintingProgress(MatrixStack matrixStack, int x, int y, float progress) {
|
||||
progress = Math.min(progress, 1);
|
||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS;
|
||||
client.getTextureManager()
|
||||
.bindTexture(sprite.location);
|
||||
drawTexture(matrixStack, guiLeft + 44, guiTop + 64, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||
sprite.bind();
|
||||
drawTexture(matrixStack, x + 44, y + 64, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||
sprite.height);
|
||||
}
|
||||
|
||||
protected void renderChecklistPrinterProgress(MatrixStack matrixStack, float progress) {
|
||||
protected void renderChecklistPrinterProgress(MatrixStack matrixStack, int x, int y, float progress) {
|
||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_CHECKLIST_PROGRESS;
|
||||
client.getTextureManager()
|
||||
.bindTexture(sprite.location);
|
||||
drawTexture(matrixStack, guiLeft + 154, guiTop + 20, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||
sprite.bind();
|
||||
drawTexture(matrixStack, x + 154, y + 20, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||
sprite.height);
|
||||
}
|
||||
|
||||
protected void renderFuelBar(MatrixStack matrixStack, float amount) {
|
||||
protected void renderFuelBar(MatrixStack matrixStack, int x, int y, float amount) {
|
||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_FUEL;
|
||||
if (container.getTileEntity().hasCreativeCrate) {
|
||||
AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(matrixStack, this, guiLeft + 36, guiTop + 19);
|
||||
AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(matrixStack, this, x + 36, y + 19);
|
||||
return;
|
||||
}
|
||||
client.getTextureManager()
|
||||
.bindTexture(sprite.location);
|
||||
drawTexture(matrixStack, guiLeft + 36, guiTop + 19, sprite.startX, sprite.startY, (int) (sprite.width * amount),
|
||||
sprite.bind();
|
||||
drawTexture(matrixStack, x + 36, y + 19, sprite.startX, sprite.startY, (int) (sprite.width * amount),
|
||||
sprite.height);
|
||||
}
|
||||
|
||||
|
@ -323,7 +321,10 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
SchematicannonTileEntity te = container.getTileEntity();
|
||||
|
||||
int fuelX = guiLeft + 36, fuelY = guiTop + 19;
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
int fuelX = x + 36, fuelY = y + 19;
|
||||
if (mouseX >= fuelX && mouseY >= fuelY && mouseX <= fuelX + AllGuiTextures.SCHEMATICANNON_FUEL.width
|
||||
&& mouseY <= fuelY + AllGuiTextures.SCHEMATICANNON_FUEL.height) {
|
||||
List<ITextComponent> tooltip = getFuelLevelTooltip(te);
|
||||
|
@ -346,14 +347,14 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
}
|
||||
|
||||
if (te.missingItem != null) {
|
||||
int missingBlockX = guiLeft + 128, missingBlockY = guiTop + 49;
|
||||
int missingBlockX = x + 128, missingBlockY = y + 49;
|
||||
if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16
|
||||
&& mouseY <= missingBlockY + 16) {
|
||||
renderTooltip(matrixStack, te.missingItem, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
int paperX = guiLeft + 112, paperY = guiTop + 19;
|
||||
int paperX = x + 112, paperY = y + 19;
|
||||
if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16)
|
||||
renderTooltip(matrixStack, listPrinter, mouseX, mouseY);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ import net.minecraft.world.gen.feature.template.PlacementSettings;
|
|||
|
||||
public class SchematicEditScreen extends AbstractSimiScreen {
|
||||
|
||||
private AllGuiTextures background;
|
||||
|
||||
private TextFieldWidget xInput;
|
||||
private TextFieldWidget yInput;
|
||||
private TextFieldWidget zInput;
|
||||
|
@ -44,13 +46,21 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
private ScrollInput mirrorArea;
|
||||
private SchematicHandler handler;
|
||||
|
||||
public SchematicEditScreen() {
|
||||
super();
|
||||
background = AllGuiTextures.SCHEMATIC;
|
||||
handler = CreateClient.SCHEMATIC_HANDLER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
AllGuiTextures background = AllGuiTextures.SCHEMATIC;
|
||||
setWindowSize(background.width + 50, background.height);
|
||||
setWindowSize(background.width, background.height);
|
||||
setWindowOffset(-6, 0);
|
||||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
handler = CreateClient.SCHEMATIC_HANDLER;
|
||||
|
||||
xInput = new TextFieldWidget(textRenderer, x + 50, y + 26, 34, 10, StringTextComponent.EMPTY);
|
||||
yInput = new TextFieldWidget(textRenderer, x + 90, y + 26, 34, 10, StringTextComponent.EMPTY);
|
||||
|
@ -107,15 +117,12 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
Collections.addAll(widgets, labelR, labelM, rotationArea, mirrorArea);
|
||||
|
||||
confirmButton =
|
||||
new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
||||
new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||
widgets.add(confirmButton);
|
||||
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int code, int p_keyPressed_2_, int p_keyPressed_3_) {
|
||||
|
||||
if (isPaste(code)) {
|
||||
String coords = client.keyboardListener.getClipboardString();
|
||||
if (coords != null && !coords.isEmpty()) {
|
||||
|
@ -144,17 +151,18 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
AllGuiTextures.SCHEMATIC.draw(matrixStack, this, x, y);
|
||||
textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(),
|
||||
x + 93 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 3, 0xffffff);
|
||||
|
||||
background.draw(ms, this, x, y);
|
||||
String title = handler.getCurrentSchematicName();
|
||||
drawCenteredString(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
|
||||
GuiGameElement.of(AllItems.SCHEMATIC.asStack())
|
||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + 200, guiTop + 82, 0)
|
||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 6, y + background.height - 40, -200)
|
||||
.scale(3)
|
||||
.render(matrixStack);
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,14 +12,14 @@ import com.simibubi.create.foundation.gui.GuiGameElement;
|
|||
import com.simibubi.create.foundation.gui.widgets.IconButton;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
public class SchematicPromptScreen extends AbstractSimiScreen {
|
||||
|
||||
private final ITextComponent title = Lang.translate("schematicAndQuill.title");
|
||||
private AllGuiTextures background;
|
||||
|
||||
private final ITextComponent convertLabel = Lang.translate("schematicAndQuill.convert");
|
||||
private final ITextComponent abortLabel = Lang.translate("action.discard");
|
||||
private final ITextComponent confirmLabel = Lang.translate("action.saveToFile");
|
||||
|
@ -29,28 +29,36 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
|||
private IconButton abort;
|
||||
private IconButton convert;
|
||||
|
||||
public SchematicPromptScreen() {
|
||||
super(Lang.translate("schematicAndQuill.title"));
|
||||
background = AllGuiTextures.SCHEMATIC_PROMPT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
setWindowSize(background.width, background.height);
|
||||
super.init();
|
||||
AllGuiTextures background = AllGuiTextures.SCHEMATIC_PROMPT;
|
||||
setWindowSize(background.width, background.height + 30);
|
||||
widgets.clear();
|
||||
|
||||
nameField = new TextFieldWidget(textRenderer, guiLeft + 49, guiTop + 26, 131, 10, StringTextComponent.EMPTY);
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
nameField = new TextFieldWidget(textRenderer, x + 49, y + 26, 131, 10, StringTextComponent.EMPTY);
|
||||
nameField.setTextColor(-1);
|
||||
nameField.setDisabledTextColour(-1);
|
||||
nameField.setEnableBackgroundDrawing(false);
|
||||
nameField.setMaxStringLength(35);
|
||||
nameField.changeFocus(true);
|
||||
|
||||
abort = new IconButton(guiLeft + 7, guiTop + 53, AllIcons.I_TRASH);
|
||||
abort = new IconButton(x + 7, y + 53, AllIcons.I_TRASH);
|
||||
abort.setToolTip(abortLabel);
|
||||
widgets.add(abort);
|
||||
|
||||
confirm = new IconButton(guiLeft + 158, guiTop + 53, AllIcons.I_CONFIRM);
|
||||
confirm = new IconButton(x + 158, y + 53, AllIcons.I_CONFIRM);
|
||||
confirm.setToolTip(confirmLabel);
|
||||
widgets.add(confirm);
|
||||
|
||||
convert = new IconButton(guiLeft + 180, guiTop + 53, AllIcons.I_SCHEMATIC);
|
||||
convert = new IconButton(x + 180, y + 53, AllIcons.I_SCHEMATIC);
|
||||
convert.setToolTip(convertLabel);
|
||||
widgets.add(convert);
|
||||
|
||||
|
@ -62,11 +70,18 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
|||
|
||||
@Override
|
||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
AllGuiTextures.SCHEMATIC_PROMPT.draw(ms, this, guiLeft, guiTop);
|
||||
textRenderer.drawWithShadow(ms, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 3,
|
||||
0xffffff);
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
|
||||
background.draw(ms, this, x, y);
|
||||
drawCenteredText(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||
GuiGameElement.of(AllItems.SCHEMATIC.asStack())
|
||||
.at(guiLeft + 22, guiTop + 23, 0)
|
||||
.at(x + 22, y + 23, 0)
|
||||
.render(ms);
|
||||
|
||||
GuiGameElement.of(AllItems.SCHEMATIC_AND_QUILL.asStack())
|
||||
.scale(3)
|
||||
.at(x + background.width + 6, y + background.height - 40, -200)
|
||||
.render(ms);
|
||||
}
|
||||
|
||||
|
@ -91,7 +106,7 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
|||
}
|
||||
if (abort.isHovered()) {
|
||||
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.discard();
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
client.player.closeScreen();
|
||||
return true;
|
||||
}
|
||||
if (convert.isHovered()) {
|
||||
|
@ -103,7 +118,7 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
|||
|
||||
private void confirm(boolean convertImmediately) {
|
||||
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.saveSchematic(nameField.getText(), convertImmediately);
|
||||
Minecraft.getInstance().player.closeScreen();
|
||||
client.player.closeScreen();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.foundation.gui;
|
||||
|
||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -7,6 +9,8 @@ import java.util.List;
|
|||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
||||
|
@ -174,6 +178,51 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
}
|
||||
}
|
||||
|
||||
public double getItemCountTextScale() {
|
||||
int guiScaleFactor = (int) client.getWindow()
|
||||
.getGuiScaleFactor();
|
||||
double scale = 1;
|
||||
switch (guiScaleFactor) {
|
||||
case 1:
|
||||
scale = 2060 / 2048d;
|
||||
break;
|
||||
case 2:
|
||||
scale = .5;
|
||||
break;
|
||||
case 3:
|
||||
scale = .675;
|
||||
break;
|
||||
case 4:
|
||||
scale = .75;
|
||||
break;
|
||||
default:
|
||||
scale = ((float) guiScaleFactor - 1) / guiScaleFactor;
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
public int getLeftOfCentered(int textureWidth) {
|
||||
return (width - textureWidth) / 2;
|
||||
}
|
||||
|
||||
public void renderPlayerInventory(MatrixStack ms, int x, int y) {
|
||||
PLAYER_INVENTORY.draw(ms, this, x, y);
|
||||
textRenderer.draw(ms, playerInventory.getDisplayName(), x + 8, y + 6, 0x404040);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for moving JEI out of the way of extra things like Flexcrate renders.
|
||||
*
|
||||
* <p>This screen class must be bound to a SlotMover instance for this method to work.
|
||||
*
|
||||
* @return the space that the gui takes up besides the normal rectangle defined by {@link ContainerScreen}.
|
||||
*/
|
||||
public List<Rectangle2d> getExtraAreas() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// Not up to date with ItemRenderer
|
||||
@Deprecated
|
||||
protected void renderItemOverlayIntoGUI(MatrixStack matrixStack, FontRenderer fr, ItemStack stack, int xPosition,
|
||||
int yPosition, @Nullable String text, int textColor) {
|
||||
if (!stack.isEmpty()) {
|
||||
|
@ -227,32 +276,10 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
}
|
||||
}
|
||||
|
||||
public double getItemCountTextScale() {
|
||||
int guiScaleFactor = (int) client.getWindow()
|
||||
.getGuiScaleFactor();
|
||||
double scale = 1;
|
||||
switch (guiScaleFactor) {
|
||||
case 1:
|
||||
scale = 2060 / 2048d;
|
||||
break;
|
||||
case 2:
|
||||
scale = .5;
|
||||
break;
|
||||
case 3:
|
||||
scale = .675;
|
||||
break;
|
||||
case 4:
|
||||
scale = .75;
|
||||
break;
|
||||
default:
|
||||
scale = ((float) guiScaleFactor - 1) / guiScaleFactor;
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue,
|
||||
int alpha) {
|
||||
renderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
||||
renderer.vertex((double) (x + 0), (double) (y + 0), 0.0D)
|
||||
.color(red, green, blue, alpha)
|
||||
.endVertex();
|
||||
|
@ -269,18 +296,9 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
.draw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for moving JEI out of the way of extra things like Flexcrate renders
|
||||
*
|
||||
* @return the space that the gui takes up besides the normal rectangle defined by {@link ContainerScreen}.
|
||||
*/
|
||||
public List<Rectangle2d> getExtraAreas() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected void debugWindowArea(MatrixStack matrixStack) {
|
||||
fill(matrixStack, guiLeft + xSize, guiTop + ySize, guiLeft, guiTop, 0xd3d3d3d3);
|
||||
fill(matrixStack, guiLeft + xSize, guiTop + ySize, guiLeft, guiTop, 0xD3D3D3D3);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -289,4 +307,5 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
fill(matrixStack, area.getX() + area.getWidth(), area.getY() + area.getHeight(), area.getX(), area.getY(), 0xd3d3d3d3);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -17,20 +18,37 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract class AbstractSimiScreen extends Screen {
|
||||
|
||||
protected int sWidth, sHeight;
|
||||
protected int windowWidth, windowHeight;
|
||||
protected int windowXOffset, windowYOffset;
|
||||
protected int guiLeft, guiTop;
|
||||
protected List<Widget> widgets;
|
||||
|
||||
protected AbstractSimiScreen() {
|
||||
super(new StringTextComponent(""));
|
||||
protected AbstractSimiScreen(ITextComponent title) {
|
||||
super(title);
|
||||
widgets = new ArrayList<>();
|
||||
}
|
||||
|
||||
protected AbstractSimiScreen() {
|
||||
this(new StringTextComponent(""));
|
||||
}
|
||||
|
||||
protected void setWindowSize(int width, int height) {
|
||||
sWidth = width;
|
||||
sHeight = height;
|
||||
guiLeft = (this.width - sWidth) / 2;
|
||||
guiTop = (this.height - sHeight) / 2;
|
||||
windowWidth = width;
|
||||
windowHeight = height;
|
||||
}
|
||||
|
||||
protected void setWindowOffset(int xOffset, int yOffset) {
|
||||
windowXOffset = xOffset;
|
||||
windowYOffset = yOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
guiLeft = (width - windowWidth) / 2;
|
||||
guiTop = (height - windowHeight) / 2;
|
||||
guiLeft += windowXOffset;
|
||||
guiTop += windowYOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,4 +174,9 @@ public abstract class AbstractSimiScreen extends Screen {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected void debugWindowArea(MatrixStack matrixStack) {
|
||||
fill(matrixStack, guiLeft + windowWidth, guiTop + windowHeight, guiLeft, guiTop, 0xD3D3D3D3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ public enum AllGuiTextures implements IScreenRenderable {
|
|||
SEQUENCER_EMPTY("sequencer.png", 0, 102, 162, 22),
|
||||
SEQUENCER_AWAIT("sequencer.png", 0, 160, 162, 22),
|
||||
|
||||
LINKED_CONTROLLER("curiosities2.png", 179, 109),
|
||||
BLUEPRINT("curiosities2.png", 0, 109, 179, 109),
|
||||
LINKED_CONTROLLER("curiosities_2.png", 179, 109),
|
||||
BLUEPRINT("curiosities_2.png", 0, 109, 179, 109),
|
||||
|
||||
PROJECTOR("projector.png", 235, 185),
|
||||
PROJECTOR_FILTER_STRENGTH("projector.png", 0, 14, 162, 22),
|
||||
|
@ -146,4 +146,5 @@ public enum AllGuiTextures implements IScreenRenderable {
|
|||
bind();
|
||||
UIRenderHelper.drawColoredTexture(ms, c, x, y, startX, startY, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,11 +79,6 @@ public abstract class GhostItemContainer<T> extends Container implements ICleara
|
|||
return slotIn.inventory == playerInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||
ItemStack held = playerInventory.getItemStack();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.simibubi.create.foundation.gui;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
public interface IInteractionChecker {
|
||||
boolean canPlayerUse(PlayerEntity player);
|
||||
}
|
|
@ -181,14 +181,14 @@ public class PonderTagIndexScreen extends NavigatableSimiScreen {
|
|||
// stringWidth + 10, 10, false);
|
||||
new BoxElement().withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
|
||||
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
|
||||
.at((sWidth - stringWidth) / 2f - 5, itemArea.getY() - 21, 100)
|
||||
.at((windowWidth - stringWidth) / 2f - 5, itemArea.getY() - 21, 100)
|
||||
.withBounds(stringWidth + 10, 10)
|
||||
.render(ms);
|
||||
|
||||
ms.translate(0, 0, 200);
|
||||
|
||||
// UIRenderHelper.streak(0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 180, 0x101010);
|
||||
drawCenteredString(ms, textRenderer, relatedTitle, sWidth / 2, itemArea.getY() - 20, Theme.i(Theme.Key.TEXT));
|
||||
drawCenteredString(ms, textRenderer, relatedTitle, windowWidth / 2, itemArea.getY() - 20, Theme.i(Theme.Key.TEXT));
|
||||
|
||||
ms.translate(0, 0, -200);
|
||||
|
||||
|
|
|
@ -256,14 +256,14 @@ public class PonderTagScreen extends NavigatableSimiScreen {
|
|||
new BoxElement()
|
||||
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
|
||||
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
|
||||
.at((sWidth - stringWidth) / 2f - 5, itemArea.getY() - 21, 100)
|
||||
.at((windowWidth - stringWidth) / 2f - 5, itemArea.getY() - 21, 100)
|
||||
.withBounds(stringWidth + 10, 10)
|
||||
.render(ms);
|
||||
|
||||
ms.translate(0, 0, 200);
|
||||
|
||||
// UIRenderHelper.streak(0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 180, 0x101010);
|
||||
drawCenteredString(ms, textRenderer, relatedTitle, sWidth / 2, itemArea.getY() - 20, Theme.i(Theme.Key.TEXT));
|
||||
drawCenteredString(ms, textRenderer, relatedTitle, windowWidth / 2, itemArea.getY() - 20, Theme.i(Theme.Key.TEXT));
|
||||
|
||||
ms.translate(0,0, -200);
|
||||
|
||||
|
|
|
@ -7,10 +7,12 @@ import java.util.Map;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
import com.simibubi.create.foundation.gui.IInteractionChecker;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
@ -18,7 +20,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
|||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
||||
public abstract class SmartTileEntity extends SyncedTileEntity implements ITickableTileEntity, IPartialSafeNBT {
|
||||
public abstract class SmartTileEntity extends SyncedTileEntity implements ITickableTileEntity, IPartialSafeNBT, IInteractionChecker {
|
||||
|
||||
private final Map<BehaviourType<?>, TileEntityBehaviour> behaviours;
|
||||
// Internally maintained to be identical to behaviorMap.values() in order to improve iteration performance.
|
||||
|
@ -201,4 +203,12 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements ITicka
|
|||
return virtualMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(PlayerEntity player) {
|
||||
if (world == null || world.getTileEntity(pos) != this) {
|
||||
return false;
|
||||
}
|
||||
return player.getDistanceSq(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in a new issue