mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 07:56:44 +01:00
GUI cleanup and fixes
- Change positions of GUI elements to improve the overall experience - Fix window and extra areas to be perfectly aligned with drawn textures - Add SlotMovers to new screens - Fix schematicannon progress bar; Resolves #1674 - Fix black background in curiosities2.png - Move all title creation to getDisplayName - Other minor tweaks
This commit is contained in:
parent
5bd0c73f45
commit
2a19b5eb41
27 changed files with 351 additions and 278 deletions
|
@ -39,10 +39,10 @@ public class AllContainerTypes {
|
||||||
|
|
||||||
public static final ContainerEntry<AttributeFilterContainer> ATTRIBUTE_FILTER =
|
public static final ContainerEntry<AttributeFilterContainer> ATTRIBUTE_FILTER =
|
||||||
register("attribute_filter", AttributeFilterContainer::new, () -> AttributeFilterScreen::new);
|
register("attribute_filter", AttributeFilterContainer::new, () -> AttributeFilterScreen::new);
|
||||||
|
|
||||||
public static final ContainerEntry<BlueprintContainer> CRAFTING_BLUEPRINT =
|
public static final ContainerEntry<BlueprintContainer> CRAFTING_BLUEPRINT =
|
||||||
register("crafting_blueprint", BlueprintContainer::new, () -> BlueprintScreen::new);
|
register("crafting_blueprint", BlueprintContainer::new, () -> BlueprintScreen::new);
|
||||||
|
|
||||||
public static final ContainerEntry<LinkedControllerContainer> LINKED_CONTROLLER =
|
public static final ContainerEntry<LinkedControllerContainer> LINKED_CONTROLLER =
|
||||||
register("linked_controller", LinkedControllerContainer::new, () -> LinkedControllerScreen::new);
|
register("linked_controller", LinkedControllerContainer::new, () -> LinkedControllerScreen::new);
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import com.simibubi.create.content.contraptions.fluids.recipe.PotionMixingRecipe
|
||||||
import com.simibubi.create.content.contraptions.processing.BasinRecipe;
|
import com.simibubi.create.content.contraptions.processing.BasinRecipe;
|
||||||
import com.simibubi.create.content.curiosities.tools.BlueprintScreen;
|
import com.simibubi.create.content.curiosities.tools.BlueprintScreen;
|
||||||
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateScreen;
|
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateScreen;
|
||||||
|
import com.simibubi.create.content.logistics.item.LinkedControllerScreen;
|
||||||
import com.simibubi.create.content.logistics.item.filter.AbstractFilterScreen;
|
import com.simibubi.create.content.logistics.item.filter.AbstractFilterScreen;
|
||||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterScreen;
|
import com.simibubi.create.content.logistics.item.filter.AttributeFilterScreen;
|
||||||
import com.simibubi.create.content.logistics.item.filter.FilterScreen;
|
import com.simibubi.create.content.logistics.item.filter.FilterScreen;
|
||||||
|
@ -242,11 +243,14 @@ public class CreateJEI implements IModPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
|
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
|
||||||
SlotMover slotMover = new SlotMover();
|
SlotMover slotMover = new SlotMover();
|
||||||
registration.addGuiContainerHandler(AdjustableCrateScreen.class, slotMover);
|
|
||||||
registration.addGuiContainerHandler(SchematicannonScreen.class, slotMover);
|
|
||||||
registration.addGuiContainerHandler(SchematicTableScreen.class, slotMover);
|
registration.addGuiContainerHandler(SchematicTableScreen.class, slotMover);
|
||||||
|
registration.addGuiContainerHandler(SchematicannonScreen.class, slotMover);
|
||||||
|
registration.addGuiContainerHandler(AdjustableCrateScreen.class, slotMover);
|
||||||
registration.addGuiContainerHandler(FilterScreen.class, slotMover);
|
registration.addGuiContainerHandler(FilterScreen.class, slotMover);
|
||||||
registration.addGuiContainerHandler(AttributeFilterScreen.class, slotMover);
|
registration.addGuiContainerHandler(AttributeFilterScreen.class, slotMover);
|
||||||
|
registration.addGuiContainerHandler(BlueprintScreen.class, slotMover);
|
||||||
|
registration.addGuiContainerHandler(LinkedControllerScreen.class, slotMover);
|
||||||
|
|
||||||
registration.addGhostIngredientHandler(AbstractFilterScreen.class, new GhostIngredientHandler());
|
registration.addGhostIngredientHandler(AbstractFilterScreen.class, new GhostIngredientHandler());
|
||||||
registration.addGhostIngredientHandler(BlueprintScreen.class, new GhostIngredientHandler());
|
registration.addGhostIngredientHandler(BlueprintScreen.class, new GhostIngredientHandler());
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class BlueprintContainer extends GhostItemContainer<BlueprintSection> imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addSlots() {
|
protected void addSlots() {
|
||||||
addPlayerSlots(33, 137);
|
addPlayerSlots(9, 131);
|
||||||
|
|
||||||
int x = 29;
|
int x = 29;
|
||||||
int y = 21;
|
int y = 21;
|
||||||
|
@ -169,4 +169,4 @@ public class BlueprintContainer extends GhostItemContainer<BlueprintSection> imp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
@ -514,7 +514,8 @@ public class BlueprintEntity extends HangingEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName() {
|
public ITextComponent getDisplayName() {
|
||||||
return new StringTextComponent("");
|
return new TranslationTextComponent(AllItems.CRAFTING_BLUEPRINT.get()
|
||||||
|
.getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllItems;
|
|
||||||
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket;
|
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket;
|
||||||
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option;
|
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option;
|
||||||
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
|
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
|
||||||
|
@ -21,7 +20,6 @@ import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.Rectangle2d;
|
import net.minecraft.client.renderer.Rectangle2d;
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
@ -42,38 +40,40 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWindowSize(background.width + 50, background.height + PLAYER_INVENTORY.height + 20);
|
setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
|
||||||
super.init();
|
super.init();
|
||||||
widgets.clear();
|
widgets.clear();
|
||||||
int x = guiLeft;
|
|
||||||
int offset = guiTop < 30 ? 30 - guiTop : 0;
|
|
||||||
extraAreas =
|
|
||||||
ImmutableList.of(new Rectangle2d(x, guiTop + offset, background.width + 70, background.height - offset));
|
|
||||||
|
|
||||||
resetButton = new IconButton(x + background.width - 62, guiTop + background.height - 24, AllIcons.I_TRASH);
|
int x = guiLeft;
|
||||||
confirmButton = new IconButton(x + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
int y = guiTop;
|
||||||
|
|
||||||
|
resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
|
||||||
|
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||||
|
|
||||||
widgets.add(resetButton);
|
widgets.add(resetButton);
|
||||||
widgets.add(confirmButton);
|
widgets.add(confirmButton);
|
||||||
|
|
||||||
|
extraAreas = ImmutableList.of(
|
||||||
|
new Rectangle2d(x + background.width, guiTop + background.height - 36, 56, 44)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
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 x = guiLeft;
|
int x = guiLeft;
|
||||||
int y = guiTop;
|
int y = guiTop;
|
||||||
|
|
||||||
background.draw(ms, this, x, y);
|
background.draw(ms, this, x, y);
|
||||||
|
textRenderer.draw(ms, title, x + 15, y + 4, 0xFFFFFF);
|
||||||
|
|
||||||
int invX = guiLeft + 25;
|
GuiGameElement.of(AllBlockPartials.CRAFTING_BLUEPRINT_1x1)
|
||||||
int invY = y + background.height + 10;
|
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 20, guiTop + background.height - 32, 0)
|
||||||
PLAYER_INVENTORY.draw(ms, this, invX, invY);
|
|
||||||
|
|
||||||
String localizedName = I18n.format(AllItems.CRAFTING_BLUEPRINT.get()
|
|
||||||
.getTranslationKey());
|
|
||||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invX + 7, invY + 6, 0x666666);
|
|
||||||
textRenderer.draw(ms, localizedName, x + 15, y + 4, 0xFFFFFF);
|
|
||||||
|
|
||||||
GuiGameElement.of(AllBlockPartials.CRAFTING_BLUEPRINT_1x1).<GuiGameElement
|
|
||||||
.GuiRenderBuilder>at(x + background.width + 20, guiTop + background.height - 35, 0)
|
|
||||||
.rotate(45, -45, 22.5f)
|
.rotate(45, -45, 22.5f)
|
||||||
.scale(40)
|
.scale(40)
|
||||||
.render(ms);
|
.render(ms);
|
||||||
|
@ -189,4 +189,5 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
|
||||||
public List<Rectangle2d> getExtraAreas() {
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
return extraAreas;
|
return extraAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class AdjustableCrateContainer extends Container {
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
doubleCrate = te.isDoubleCrate();
|
doubleCrate = te.isDoubleCrate();
|
||||||
int x = doubleCrate ? 51 : 123;
|
int x = doubleCrate ? 23 : 53;
|
||||||
int maxCol = doubleCrate ? 8 : 4;
|
int maxCol = doubleCrate ? 8 : 4;
|
||||||
for (int row = 0; row < 4; ++row) {
|
for (int row = 0; row < 4; ++row) {
|
||||||
for (int col = 0; col < maxCol; ++col) {
|
for (int col = 0; col < maxCol; ++col) {
|
||||||
|
@ -54,8 +54,8 @@ public class AdjustableCrateContainer extends Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
// player Slots
|
// player Slots
|
||||||
int xOffset = 58;
|
int xOffset = doubleCrate ? 20 : 8;
|
||||||
int yOffset = 155;
|
int yOffset = 149;
|
||||||
for (int row = 0; row < 3; ++row) {
|
for (int row = 0; row < 3; ++row) {
|
||||||
for (int col = 0; col < 9; ++col) {
|
for (int col = 0; col < 9; ++col) {
|
||||||
this.addSlot(new Slot(playerInventory, col + row * 9 + 9, xOffset + col * 18, yOffset + row * 18));
|
this.addSlot(new Slot(playerInventory, col + row * 9 + 9, xOffset + col * 18, yOffset + row * 18));
|
||||||
|
|
|
@ -4,9 +4,10 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.ADJUSTABLE_CRATE
|
||||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.ADJUSTABLE_DOUBLE_CRATE;
|
import static com.simibubi.create.foundation.gui.AllGuiTextures.ADJUSTABLE_DOUBLE_CRATE;
|
||||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY;
|
import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket;
|
import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket;
|
||||||
|
@ -26,32 +27,45 @@ import net.minecraft.util.text.StringTextComponent;
|
||||||
|
|
||||||
public class AdjustableCrateScreen extends AbstractSimiContainerScreen<AdjustableCrateContainer> {
|
public class AdjustableCrateScreen extends AbstractSimiContainerScreen<AdjustableCrateContainer> {
|
||||||
|
|
||||||
|
protected AllGuiTextures background;
|
||||||
|
private List<Rectangle2d> extraAreas = Collections.emptyList();
|
||||||
|
|
||||||
private AdjustableCrateTileEntity te;
|
private AdjustableCrateTileEntity te;
|
||||||
private Label allowedItemsLabel;
|
private Label allowedItemsLabel;
|
||||||
private ScrollInput allowedItems;
|
private ScrollInput allowedItems;
|
||||||
private int lastModification;
|
private int lastModification;
|
||||||
|
|
||||||
private List<Rectangle2d> extraAreas;
|
private int itemLabelOffset;
|
||||||
|
private int textureXShift;
|
||||||
|
private int itemYShift;
|
||||||
|
|
||||||
private final ItemStack renderedItem = AllBlocks.ADJUSTABLE_CRATE.asStack();
|
private final ItemStack renderedItem = AllBlocks.ADJUSTABLE_CRATE.asStack();
|
||||||
private final ITextComponent title = Lang.translate("gui.adjustable_crate.title");
|
|
||||||
private final ITextComponent storageSpace = Lang.translate("gui.adjustable_crate.storageSpace");
|
private final ITextComponent storageSpace = Lang.translate("gui.adjustable_crate.storageSpace");
|
||||||
|
|
||||||
public AdjustableCrateScreen(AdjustableCrateContainer container, PlayerInventory inv, ITextComponent title) {
|
public AdjustableCrateScreen(AdjustableCrateContainer container, PlayerInventory inv, ITextComponent title) {
|
||||||
super(container, inv, title);
|
super(container, inv, title);
|
||||||
te = container.te;
|
te = container.te;
|
||||||
lastModification = -1;
|
lastModification = -1;
|
||||||
|
background = container.doubleCrate ? ADJUSTABLE_DOUBLE_CRATE : ADJUSTABLE_CRATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWindowSize(PLAYER_INVENTORY.width + 100, ADJUSTABLE_CRATE.height + PLAYER_INVENTORY.height + 20);
|
setWindowSize(Math.max(background.width, PLAYER_INVENTORY.width), background.height + 4 + PLAYER_INVENTORY.height);
|
||||||
|
setWindowOffset(container.doubleCrate ? -2 : 0, 0);
|
||||||
super.init();
|
super.init();
|
||||||
widgets.clear();
|
widgets.clear();
|
||||||
|
|
||||||
allowedItemsLabel = new Label(guiLeft + 100 + 69, guiTop + 108, StringTextComponent.EMPTY).colored(0xfefefe)
|
itemLabelOffset = container.doubleCrate ? 137 : 65;
|
||||||
|
textureXShift = container.doubleCrate ? 0 : (xSize - (background.width - 8)) / 2;
|
||||||
|
itemYShift = container.doubleCrate ? 0 : -16;
|
||||||
|
|
||||||
|
int crateLeft = guiLeft + textureXShift;
|
||||||
|
int crateTop = guiTop;
|
||||||
|
|
||||||
|
allowedItemsLabel = new Label(crateLeft + itemLabelOffset + 4, crateTop + 108, StringTextComponent.EMPTY).colored(0xFFFFFF)
|
||||||
.withShadow();
|
.withShadow();
|
||||||
allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled(storageSpace.copy())
|
allowedItems = new ScrollInput(crateLeft + itemLabelOffset, crateTop + 104, 41, 16).titled(storageSpace.copy())
|
||||||
.withRange(1, (container.doubleCrate ? 2049 : 1025))
|
.withRange(1, (container.doubleCrate ? 2049 : 1025))
|
||||||
.writingTo(allowedItemsLabel)
|
.writingTo(allowedItemsLabel)
|
||||||
.withShiftStep(64)
|
.withShiftStep(64)
|
||||||
|
@ -61,31 +75,27 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
||||||
widgets.add(allowedItemsLabel);
|
widgets.add(allowedItemsLabel);
|
||||||
widgets.add(allowedItems);
|
widgets.add(allowedItems);
|
||||||
|
|
||||||
extraAreas = new ArrayList<>();
|
extraAreas = ImmutableList.of(
|
||||||
extraAreas.add(new Rectangle2d(guiLeft + ADJUSTABLE_CRATE.width + 110, guiTop + 46, 71, 70));
|
new Rectangle2d(crateLeft + background.width, crateTop + background.height - 56 + itemYShift, 80, 80)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
int crateLeft = guiLeft + 100;
|
int invLeft = guiLeft - windowXOffset + (xSize - AllGuiTextures.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 crateLeft = guiLeft + textureXShift;
|
||||||
int crateTop = guiTop;
|
int crateTop = guiTop;
|
||||||
int invLeft = guiLeft + 50;
|
|
||||||
int invTop = crateTop + ADJUSTABLE_CRATE.height + 10;
|
|
||||||
int fontColor = 0x4B3A22;
|
|
||||||
|
|
||||||
if (container.doubleCrate) {
|
background.draw(ms, this, crateLeft, crateTop);
|
||||||
crateLeft -= 72;
|
drawCenteredText(ms, textRenderer, title, crateLeft + (background.width - 8) / 2, crateTop + 3, 0xFFFFFF);
|
||||||
ADJUSTABLE_DOUBLE_CRATE.draw(matrixStack, this, crateLeft, crateTop);
|
|
||||||
} else
|
|
||||||
ADJUSTABLE_CRATE.draw(matrixStack,this, crateLeft, crateTop);
|
|
||||||
|
|
||||||
textRenderer.drawWithShadow(matrixStack, title, crateLeft - 3 + (ADJUSTABLE_CRATE.width - textRenderer.getWidth(title)) / 2,
|
String itemCount = String.valueOf(te.itemCount);
|
||||||
crateTop + 3, 0xfefefe);
|
textRenderer.draw(ms, itemCount, crateLeft + itemLabelOffset - 13 - textRenderer.getStringWidth(itemCount), crateTop + 108, 0x4B3A22);
|
||||||
String itemCount = "" + te.itemCount;
|
|
||||||
textRenderer.draw(matrixStack, itemCount, guiLeft + 100 + 53 - textRenderer.getStringWidth(itemCount), crateTop + 107, fontColor);
|
|
||||||
|
|
||||||
PLAYER_INVENTORY.draw(matrixStack, this, invLeft, invTop);
|
|
||||||
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), invLeft + 7, invTop + 6, 0x666666);
|
|
||||||
|
|
||||||
for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) {
|
for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) {
|
||||||
if (allowedItems.getState() > slot * 64)
|
if (allowedItems.getState() > slot * 64)
|
||||||
|
@ -93,13 +103,13 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
||||||
int slotsPerRow = (container.doubleCrate ? 8 : 4);
|
int slotsPerRow = (container.doubleCrate ? 8 : 4);
|
||||||
int x = crateLeft + 22 + (slot % slotsPerRow) * 18;
|
int x = crateLeft + 22 + (slot % slotsPerRow) * 18;
|
||||||
int y = crateTop + 19 + (slot / slotsPerRow) * 18;
|
int y = crateTop + 19 + (slot / slotsPerRow) * 18;
|
||||||
AllGuiTextures.ADJUSTABLE_CRATE_LOCKED_SLOT.draw(matrixStack, this, x, y);
|
AllGuiTextures.ADJUSTABLE_CRATE_LOCKED_SLOT.draw(ms, this, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + ADJUSTABLE_CRATE.width + 110, guiTop + 70, -150)
|
.<GuiGameElement.GuiRenderBuilder>at(crateLeft + background.width, crateTop + background.height - 56 + itemYShift, -200)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(matrixStack);
|
.render(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -130,4 +140,5 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
||||||
public List<Rectangle2d> getExtraAreas() {
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
return extraAreas;
|
return extraAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.block.inventories;
|
package com.simibubi.create.content.logistics.block.inventories;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -159,8 +160,7 @@ public class AdjustableCrateTileEntity extends CrateTileEntity implements INamed
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName() {
|
public ITextComponent getDisplayName() {
|
||||||
return new StringTextComponent(getType().getRegistryName()
|
return Lang.translate("gui.adjustable_crate.title");
|
||||||
.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToContainer(PacketBuffer buffer) {
|
public void sendToContainer(PacketBuffer buffer) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.item;
|
package com.simibubi.create.content.logistics.item;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllContainerTypes;
|
||||||
import com.simibubi.create.foundation.gui.IClearableContainer;
|
import com.simibubi.create.foundation.gui.IClearableContainer;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -32,6 +33,10 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LinkedControllerContainer create(int id, PlayerInventory inv, ItemStack filterItem) {
|
||||||
|
return new LinkedControllerContainer(AllContainerTypes.LINKED_CONTROLLER.get(), id, inv, filterItem);
|
||||||
|
}
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
this.filterInventory = createFilterInventory();
|
this.filterInventory = createFilterInventory();
|
||||||
// readData(mainItem);
|
// readData(mainItem);
|
||||||
|
@ -40,15 +45,9 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
||||||
detectAndSendChanges();
|
detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearContents() {
|
|
||||||
for (int i = 0; i < filterInventory.getSlots(); i++)
|
|
||||||
filterInventory.setStackInSlot(i, ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addPlayerSlots() {
|
protected void addPlayerSlots() {
|
||||||
int x = 22;
|
int x = 9;
|
||||||
int y = 142;
|
int y = 131;
|
||||||
|
|
||||||
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
||||||
this.addSlot(new Slot(playerInventory, hotbarSlot, x + hotbarSlot * 18, y + 58));
|
this.addSlot(new Slot(playerInventory, hotbarSlot, x + hotbarSlot * 18, y + 58));
|
||||||
|
@ -58,9 +57,9 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addLinkSlots() {
|
protected void addLinkSlots() {
|
||||||
int slot = 0;
|
|
||||||
int x = 12;
|
int x = 12;
|
||||||
int y = 44;
|
int y = 34;
|
||||||
|
int slot = 0;
|
||||||
|
|
||||||
for (int column = 0; column < 6; column++) {
|
for (int column = 0; column < 6; column++) {
|
||||||
for (int row = 0; row < 2; ++row)
|
for (int row = 0; row < 2; ++row)
|
||||||
|
@ -71,6 +70,12 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearContents() {
|
||||||
|
for (int i = 0; i < filterInventory.getSlots(); i++)
|
||||||
|
filterInventory.setStackInSlot(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canMergeSlot(ItemStack stack, Slot slotIn) {
|
public boolean canMergeSlot(ItemStack stack, Slot slotIn) {
|
||||||
return canDragIntoSlot(slotIn);
|
return canDragIntoSlot(slotIn);
|
||||||
|
@ -149,4 +154,5 @@ public class LinkedControllerContainer extends Container implements IClearableCo
|
||||||
.put("Items", filterInventory.serializeNBT());
|
.put("Items", filterInventory.serializeNBT());
|
||||||
// saveData(filterItem);
|
// saveData(filterItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.item;
|
package com.simibubi.create.content.logistics.item;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllContainerTypes;
|
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler;
|
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler;
|
||||||
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler.Frequency;
|
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler.Frequency;
|
||||||
|
@ -31,8 +30,8 @@ import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
public class LinkedControllerItem extends Item implements INamedContainerProvider {
|
public class LinkedControllerItem extends Item implements INamedContainerProvider {
|
||||||
|
|
||||||
public LinkedControllerItem(Properties p_i48487_1_) {
|
public LinkedControllerItem(Properties properties) {
|
||||||
super(p_i48487_1_);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,7 +104,7 @@ public class LinkedControllerItem extends Item implements INamedContainerProvide
|
||||||
@Override
|
@Override
|
||||||
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
public Container createMenu(int id, PlayerInventory inv, PlayerEntity player) {
|
||||||
ItemStack heldItem = player.getHeldItemMainhand();
|
ItemStack heldItem = player.getHeldItemMainhand();
|
||||||
return new LinkedControllerContainer(AllContainerTypes.LINKED_CONTROLLER.get(), id, inv, heldItem);
|
return LinkedControllerContainer.create(id, inv, heldItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.simibubi.create.foundation.gui.widgets.IconButton;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.Rectangle2d;
|
import net.minecraft.client.renderer.Rectangle2d;
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
@ -35,6 +34,73 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
|
||||||
this.background = AllGuiTextures.LINKED_CONTROLLER;
|
this.background = AllGuiTextures.LINKED_CONTROLLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
|
||||||
|
super.init();
|
||||||
|
widgets.clear();
|
||||||
|
|
||||||
|
int x = guiLeft;
|
||||||
|
int y = guiTop;
|
||||||
|
|
||||||
|
resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
|
||||||
|
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||||
|
|
||||||
|
widgets.add(resetButton);
|
||||||
|
widgets.add(confirmButton);
|
||||||
|
|
||||||
|
extraAreas = ImmutableList.of(
|
||||||
|
new Rectangle2d(x + background.width + 4, y + background.height - 44, 64, 56)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 x = guiLeft;
|
||||||
|
int y = guiTop;
|
||||||
|
|
||||||
|
background.draw(ms, this, x, y);
|
||||||
|
textRenderer.draw(ms, title, x + 15, y + 4, 0x442000);
|
||||||
|
|
||||||
|
GuiGameElement.of(container.mainItem)
|
||||||
|
.<GuiGameElement.GuiRenderBuilder>at(x + background.width - 4, y + background.height - 56, -200)
|
||||||
|
.scale(5)
|
||||||
|
.render(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
if (!container.player.getHeldItemMainhand()
|
||||||
|
.equals(container.mainItem, false))
|
||||||
|
client.player.closeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(double x, double y, int button) {
|
||||||
|
boolean mouseClicked = super.mouseClicked(x, y, button);
|
||||||
|
|
||||||
|
if (button == 0) {
|
||||||
|
if (confirmButton.isHovered()) {
|
||||||
|
client.player.closeScreen();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (resetButton.isHovered()) {
|
||||||
|
container.clearContents();
|
||||||
|
container.sendClearPacket();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mouseClicked;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawMouseoverTooltip(MatrixStack ms, int x, int y) {
|
protected void drawMouseoverTooltip(MatrixStack ms, int x, int y) {
|
||||||
if (!this.client.player.inventory.getItemStack()
|
if (!this.client.player.inventory.getItemStack()
|
||||||
|
@ -67,71 +133,9 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
setWindowSize(PLAYER_INVENTORY.width + 50, background.height + PLAYER_INVENTORY.height + 20);
|
|
||||||
super.init();
|
|
||||||
widgets.clear();
|
|
||||||
int x = guiLeft - 50;
|
|
||||||
int offset = guiTop < 30 ? 30 - guiTop : 0;
|
|
||||||
extraAreas =
|
|
||||||
ImmutableList.of(new Rectangle2d(x, guiTop + offset, background.width + 70, background.height - offset));
|
|
||||||
|
|
||||||
resetButton = new IconButton(x + background.width - 12, guiTop + background.height - 14, AllIcons.I_TRASH);
|
|
||||||
confirmButton = new IconButton(x + background.width + 16, guiTop + background.height - 14, AllIcons.I_CONFIRM);
|
|
||||||
|
|
||||||
widgets.add(resetButton);
|
|
||||||
widgets.add(confirmButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
|
||||||
int x = guiLeft;
|
|
||||||
int y = guiTop + 10;
|
|
||||||
background.draw(ms, this, x, y);
|
|
||||||
|
|
||||||
int invX = guiLeft + 14;
|
|
||||||
int invY = y + background.height + 5;
|
|
||||||
PLAYER_INVENTORY.draw(ms, this, invX, invY);
|
|
||||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invX + 7, invY + 6, 0x666666);
|
|
||||||
textRenderer.draw(ms, I18n.format(container.mainItem.getTranslationKey()), x + 15, y + 4, 0x442000);
|
|
||||||
|
|
||||||
GuiGameElement.of(container.mainItem).<GuiGameElement
|
|
||||||
.GuiRenderBuilder>at(x + background.width - 8, guiTop + background.height - 53, -200)
|
|
||||||
.scale(5)
|
|
||||||
.render(ms);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick() {
|
|
||||||
super.tick();
|
|
||||||
if (!container.player.getHeldItemMainhand()
|
|
||||||
.equals(container.mainItem, false))
|
|
||||||
client.player.closeScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mouseClicked(double x, double y, int button) {
|
|
||||||
boolean mouseClicked = super.mouseClicked(x, y, button);
|
|
||||||
|
|
||||||
if (button == 0) {
|
|
||||||
if (confirmButton.isHovered()) {
|
|
||||||
client.player.closeScreen();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (resetButton.isHovered()) {
|
|
||||||
container.clearContents();
|
|
||||||
container.sendClearPacket();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mouseClicked;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Rectangle2d> getExtraAreas() {
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
return extraAreas;
|
return extraAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,13 @@ public abstract class AbstractFilterContainer extends GhostItemContainer<ItemSta
|
||||||
|
|
||||||
protected abstract int getPlayerInventoryXOffset();
|
protected abstract int getPlayerInventoryXOffset();
|
||||||
|
|
||||||
|
protected abstract int getPlayerInventoryYOffset();
|
||||||
|
|
||||||
protected abstract void addFilterSlots();
|
protected abstract void addFilterSlots();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addSlots() {
|
protected void addSlots() {
|
||||||
addPlayerSlots(8, 28 + getPlayerInventoryXOffset());
|
addPlayerSlots(getPlayerInventoryXOffset(), getPlayerInventoryYOffset());
|
||||||
addFilterSlots();
|
addFilterSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
|
||||||
import net.minecraft.client.gui.widget.Widget;
|
import net.minecraft.client.gui.widget.Widget;
|
||||||
import net.minecraft.client.renderer.Rectangle2d;
|
import net.minecraft.client.renderer.Rectangle2d;
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.util.text.IFormattableTextComponent;
|
import net.minecraft.util.text.IFormattableTextComponent;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
@ -42,37 +41,42 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWindowSize(PLAYER_INVENTORY.width, background.height + PLAYER_INVENTORY.height + 20);
|
setWindowSize(Math.max(background.width, PLAYER_INVENTORY.width), background.height + 4 + PLAYER_INVENTORY.height);
|
||||||
super.init();
|
super.init();
|
||||||
widgets.clear();
|
widgets.clear();
|
||||||
int x = guiLeft - 50;
|
|
||||||
int offset = guiTop < 30 ? 30 - guiTop : 0;
|
|
||||||
extraAreas = ImmutableList.of(new Rectangle2d(x, guiTop + offset, background.width + 70, background.height - offset));
|
|
||||||
|
|
||||||
resetButton = new IconButton(x + background.width - 62, guiTop + background.height - 24, AllIcons.I_TRASH);
|
int x = guiLeft;
|
||||||
confirmButton = new IconButton(x + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
int y = guiTop;
|
||||||
|
|
||||||
|
resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
|
||||||
|
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
|
||||||
|
|
||||||
widgets.add(resetButton);
|
widgets.add(resetButton);
|
||||||
widgets.add(confirmButton);
|
widgets.add(confirmButton);
|
||||||
|
|
||||||
|
extraAreas = ImmutableList.of(
|
||||||
|
new Rectangle2d(x + background.width, y + background.height - 40, 80, 48)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
int x = guiLeft - 50;
|
int invLeft = guiLeft - windowXOffset + (xSize - PLAYER_INVENTORY.width) / 2;
|
||||||
int y = guiTop;
|
int invTop = guiTop + background.height + 4;
|
||||||
background.draw(ms, this, x, y);
|
|
||||||
|
|
||||||
int invX = guiLeft;
|
PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||||
int invY = y + background.height + 10;
|
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||||
PLAYER_INVENTORY.draw(ms, this, invX, invY);
|
|
||||||
textRenderer.draw(ms, playerInventory.getDisplayName(), invX + 7, invY + 6, 0x666666);
|
int x = guiLeft;
|
||||||
textRenderer.draw(ms, I18n.format(container.contentHolder.getTranslationKey()), x + 15, y + 3, 0xdedede);
|
int y = guiTop;
|
||||||
|
|
||||||
|
background.draw(ms, this, x, y);
|
||||||
|
drawCenteredText(ms, textRenderer, title, x + (background.width - 8) / 2, y + 3, 0xFFFFFF);
|
||||||
|
|
||||||
GuiGameElement.of(container.contentHolder)
|
GuiGameElement.of(container.contentHolder)
|
||||||
.<GuiGameElement.GuiRenderBuilder>at(x + background.width, guiTop + background.height - 60, -200)
|
.<GuiGameElement.GuiRenderBuilder>at(x + background.width, y + background.height - 56, -200)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(ms);
|
.render(ms);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -164,4 +168,5 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
||||||
public List<Rectangle2d> getExtraAreas() {
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
return extraAreas;
|
return extraAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,6 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
||||||
selectedAttributes.add(Pair.of(itemAttribute, inverted));
|
selectedAttributes.add(Pair.of(itemAttribute, inverted));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearContents() {
|
|
||||||
selectedAttributes.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init(PlayerInventory inv, ItemStack contentHolder) {
|
protected void init(PlayerInventory inv, ItemStack contentHolder) {
|
||||||
super.init(inv, contentHolder);
|
super.init(inv, contentHolder);
|
||||||
|
@ -62,13 +57,19 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemStackHandler createGhostInventory() {
|
protected int getPlayerInventoryXOffset() {
|
||||||
return new ItemStackHandler(2);
|
return 51;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getPlayerInventoryYOffset() {
|
||||||
|
return 105;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void addFilterSlots() {
|
protected void addFilterSlots() {
|
||||||
this.addSlot(new SlotItemHandler(ghostInventory, 0, -34, 22));
|
this.addSlot(new SlotItemHandler(ghostInventory, 0, 16, 22));
|
||||||
this.addSlot(new SlotItemHandler(ghostInventory, 1, -28, 57) {
|
this.addSlot(new SlotItemHandler(ghostInventory, 1, 22, 57) {
|
||||||
@Override
|
@Override
|
||||||
public boolean canTakeStack(PlayerEntity playerIn) {
|
public boolean canTakeStack(PlayerEntity playerIn) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -76,6 +77,16 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ItemStackHandler createGhostInventory() {
|
||||||
|
return new ItemStackHandler(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearContents() {
|
||||||
|
selectedAttributes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
|
||||||
if (slotId == 37)
|
if (slotId == 37)
|
||||||
|
@ -114,11 +125,6 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getPlayerInventoryXOffset() {
|
|
||||||
return 83;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readData(ItemStack filterItem) {
|
protected void readData(ItemStack filterItem) {
|
||||||
selectedAttributes = new ArrayList<>();
|
selectedAttributes = new ArrayList<>();
|
||||||
|
|
|
@ -61,8 +61,10 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
|
setWindowOffset(-11, 7);
|
||||||
super.init();
|
super.init();
|
||||||
int x = guiLeft - 50;
|
|
||||||
|
int x = guiLeft;
|
||||||
int y = guiTop;
|
int y = guiTop;
|
||||||
|
|
||||||
whitelistDis = new IconButton(x + 47, y + 59, AllIcons.I_WHITELIST_OR);
|
whitelistDis = new IconButton(x + 47, y + 59, AllIcons.I_WHITELIST_OR);
|
||||||
|
@ -103,7 +105,6 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
||||||
.append(at.getFirst()
|
.append(at.getFirst()
|
||||||
.format(at.getSecond()))
|
.format(at.getSecond()))
|
||||||
.formatted(TextFormatting.GRAY)));
|
.formatted(TextFormatting.GRAY)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void referenceItemChanged(ItemStack stack) {
|
private void referenceItemChanged(ItemStack stack) {
|
||||||
|
@ -163,9 +164,9 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
||||||
ItemStack stack = container.ghostInventory.getStackInSlot(1);
|
ItemStack stack = container.ghostInventory.getStackInSlot(1);
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
matrixStack.translate(0.0F, 0.0F, 32.0F);
|
matrixStack.translate(0.0F, 0.0F, 32.0F);
|
||||||
this.setZOffset(200);
|
this.setZOffset(150);
|
||||||
this.itemRenderer.zLevel = 200.0F;
|
this.itemRenderer.zLevel = 150.0F;
|
||||||
this.itemRenderer.renderItemOverlayIntoGUI(textRenderer, stack, guiLeft - 27, guiTop + 57,
|
this.itemRenderer.renderItemOverlayIntoGUI(textRenderer, stack, guiLeft + 22, guiTop + 57,
|
||||||
String.valueOf(selectedAttributes.size() - 1));
|
String.valueOf(selectedAttributes.size() - 1));
|
||||||
this.setZOffset(0);
|
this.setZOffset(0);
|
||||||
this.itemRenderer.zLevel = 0.0F;
|
this.itemRenderer.zLevel = 0.0F;
|
||||||
|
|
|
@ -27,9 +27,19 @@ public class FilterContainer extends AbstractFilterContainer {
|
||||||
return new FilterContainer(AllContainerTypes.FILTER.get(), id, inv, stack);
|
return new FilterContainer(AllContainerTypes.FILTER.get(), id, inv, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getPlayerInventoryXOffset() {
|
||||||
|
return 38;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getPlayerInventoryYOffset() {
|
||||||
|
return 119;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addFilterSlots() {
|
protected void addFilterSlots() {
|
||||||
int x = -27;
|
int x = 23;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
for (int row = 0; row < 2; ++row)
|
for (int row = 0; row < 2; ++row)
|
||||||
for (int col = 0; col < 9; ++col)
|
for (int col = 0; col < 9; ++col)
|
||||||
|
@ -40,11 +50,6 @@ public class FilterContainer extends AbstractFilterContainer {
|
||||||
protected ItemStackHandler createGhostInventory() {
|
protected ItemStackHandler createGhostInventory() {
|
||||||
return FilterItem.getFilterItems(contentHolder);
|
return FilterItem.getFilterItems(contentHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getPlayerInventoryXOffset() {
|
|
||||||
return 97;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readData(ItemStack filterItem) {
|
protected void readData(ItemStack filterItem) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
@ -165,7 +166,7 @@ public class FilterItem extends Item implements INamedContainerProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName() {
|
public ITextComponent getDisplayName() {
|
||||||
return new StringTextComponent(getTranslationKey());
|
return new TranslationTextComponent(getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStackHandler getFilterItems(ItemStack stack) {
|
public static ItemStackHandler getFilterItems(ItemStack stack) {
|
||||||
|
|
|
@ -40,7 +40,9 @@ public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
|
setWindowOffset(-11, 5);
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
int x = guiLeft;
|
int x = guiLeft;
|
||||||
int y = guiTop;
|
int y = guiTop;
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
|
||||||
respectNBTIndicator = new Indicator(x + 60, y + 67, StringTextComponent.EMPTY);
|
respectNBTIndicator = new Indicator(x + 60, y + 67, StringTextComponent.EMPTY);
|
||||||
ignoreNBTIndicator = new Indicator(x + 78, y + 67, StringTextComponent.EMPTY);
|
ignoreNBTIndicator = new Indicator(x + 78, y + 67, StringTextComponent.EMPTY);
|
||||||
widgets.addAll(Arrays.asList(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator));
|
widgets.addAll(Arrays.asList(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator));
|
||||||
|
|
||||||
handleIndicators();
|
handleIndicators();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class SchematicTableContainer extends Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
inputSlot = new SlotItemHandler(te.inventory, 0, -35, 41) {
|
inputSlot = new SlotItemHandler(te.inventory, 0, 21, 57) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack) {
|
public boolean isItemValid(ItemStack stack) {
|
||||||
return AllItems.EMPTY_SCHEMATIC.isIn(stack) || AllItems.SCHEMATIC_AND_QUILL.isIn(stack)
|
return AllItems.EMPTY_SCHEMATIC.isIn(stack) || AllItems.SCHEMATIC_AND_QUILL.isIn(stack)
|
||||||
|
@ -54,7 +54,7 @@ public class SchematicTableContainer extends Container {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
outputSlot = new SlotItemHandler(te.inventory, 1, 110, 41) {
|
outputSlot = new SlotItemHandler(te.inventory, 1, 166, 57) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack) {
|
public boolean isItemValid(ItemStack stack) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -67,12 +67,12 @@ public class SchematicTableContainer extends Container {
|
||||||
// player Slots
|
// player Slots
|
||||||
for (int row = 0; row < 3; ++row) {
|
for (int row = 0; row < 3; ++row) {
|
||||||
for (int col = 0; col < 9; ++col) {
|
for (int col = 0; col < 9; ++col) {
|
||||||
this.addSlot(new Slot(player.inventory, col + row * 9 + 9, 12 + col * 18, 102 + row * 18));
|
this.addSlot(new Slot(player.inventory, col + row * 9 + 9, 38 + col * 18, 105 + row * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot) {
|
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot) {
|
||||||
this.addSlot(new Slot(player.inventory, hotbarSlot, 12 + hotbarSlot * 18, 160));
|
this.addSlot(new Slot(player.inventory, hotbarSlot, 38 + hotbarSlot * 18, 163));
|
||||||
}
|
}
|
||||||
|
|
||||||
detectAndSendChanges();
|
detectAndSendChanges();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package com.simibubi.create.content.schematics.block;
|
package com.simibubi.create.content.schematics.block;
|
||||||
|
|
||||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE;
|
|
||||||
import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS;
|
import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS;
|
||||||
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
|
@ -22,7 +22,6 @@ import com.simibubi.create.foundation.gui.widgets.ScrollInput;
|
||||||
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
|
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.client.gui.IHasContainer;
|
|
||||||
import net.minecraft.client.renderer.Rectangle2d;
|
import net.minecraft.client.renderer.Rectangle2d;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -31,17 +30,17 @@ import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
|
||||||
public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicTableContainer>
|
public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicTableContainer> {
|
||||||
implements IHasContainer<SchematicTableContainer> {
|
|
||||||
|
protected AllGuiTextures background;
|
||||||
|
private List<Rectangle2d> extraAreas = Collections.emptyList();
|
||||||
|
|
||||||
private ScrollInput schematicsArea;
|
private ScrollInput schematicsArea;
|
||||||
private IconButton confirmButton;
|
private IconButton confirmButton;
|
||||||
private IconButton folderButton;
|
private IconButton folderButton;
|
||||||
private IconButton refreshButton;
|
private IconButton refreshButton;
|
||||||
private Label schematicsLabel;
|
private Label schematicsLabel;
|
||||||
private List<Rectangle2d> extraAreas;
|
|
||||||
|
|
||||||
private final ITextComponent title = Lang.translate("gui.schematicTable.title");
|
|
||||||
private final ITextComponent uploading = Lang.translate("gui.schematicTable.uploading");
|
private final ITextComponent uploading = Lang.translate("gui.schematicTable.uploading");
|
||||||
private final ITextComponent finished = Lang.translate("gui.schematicTable.finished");
|
private final ITextComponent finished = Lang.translate("gui.schematicTable.finished");
|
||||||
private final ITextComponent refresh = Lang.translate("gui.schematicTable.refresh");
|
private final ITextComponent refresh = Lang.translate("gui.schematicTable.refresh");
|
||||||
|
@ -57,74 +56,74 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
||||||
public SchematicTableScreen(SchematicTableContainer container, PlayerInventory playerInventory,
|
public SchematicTableScreen(SchematicTableContainer container, PlayerInventory playerInventory,
|
||||||
ITextComponent title) {
|
ITextComponent title) {
|
||||||
super(container, playerInventory, title);
|
super(container, playerInventory, title);
|
||||||
|
background = AllGuiTextures.SCHEMATIC_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWindowSize(SCHEMATIC_TABLE.width, SCHEMATIC_TABLE.height + 50);
|
setWindowSize(background.width, background.height + 4 + AllGuiTextures.PLAYER_INVENTORY.height);
|
||||||
|
setWindowOffset(-11, 8);
|
||||||
super.init();
|
super.init();
|
||||||
widgets.clear();
|
widgets.clear();
|
||||||
|
|
||||||
int mainLeft = guiLeft - 56;
|
|
||||||
int mainTop = guiTop - 16;
|
|
||||||
|
|
||||||
CreateClient.SCHEMATIC_SENDER.refresh();
|
CreateClient.SCHEMATIC_SENDER.refresh();
|
||||||
List<ITextComponent> availableSchematics = CreateClient.SCHEMATIC_SENDER.getAvailableSchematics();
|
List<ITextComponent> availableSchematics = CreateClient.SCHEMATIC_SENDER.getAvailableSchematics();
|
||||||
|
|
||||||
schematicsLabel = new Label(mainLeft + 49, mainTop + 26, StringTextComponent.EMPTY).withShadow();
|
schematicsLabel = new Label(guiLeft + 49, guiTop + 26, StringTextComponent.EMPTY).withShadow();
|
||||||
schematicsLabel.text = StringTextComponent.EMPTY;
|
schematicsLabel.text = StringTextComponent.EMPTY;
|
||||||
if (!availableSchematics.isEmpty()) {
|
if (!availableSchematics.isEmpty()) {
|
||||||
schematicsArea =
|
schematicsArea =
|
||||||
new SelectionScrollInput(mainLeft + 45, mainTop + 21, 139, 18).forOptions(availableSchematics)
|
new SelectionScrollInput(guiLeft + 45, guiTop + 21, 139, 18).forOptions(availableSchematics)
|
||||||
.titled(availableSchematicsTitle.copy())
|
.titled(availableSchematicsTitle.copy())
|
||||||
.writingTo(schematicsLabel);
|
.writingTo(schematicsLabel);
|
||||||
widgets.add(schematicsArea);
|
widgets.add(schematicsArea);
|
||||||
widgets.add(schematicsLabel);
|
widgets.add(schematicsLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmButton = new IconButton(mainLeft + 44, mainTop + 56, AllIcons.I_CONFIRM);
|
confirmButton = new IconButton(guiLeft + 44, guiTop + 56, AllIcons.I_CONFIRM);
|
||||||
|
|
||||||
folderButton = new IconButton(mainLeft + 21, mainTop + 21, AllIcons.I_OPEN_FOLDER);
|
folderButton = new IconButton(guiLeft + 21, guiTop + 21, AllIcons.I_OPEN_FOLDER);
|
||||||
folderButton.setToolTip(folder);
|
folderButton.setToolTip(folder);
|
||||||
refreshButton = new IconButton(mainLeft + 207, mainTop + 21, AllIcons.I_REFRESH);
|
refreshButton = new IconButton(guiLeft + 207, guiTop + 21, AllIcons.I_REFRESH);
|
||||||
refreshButton.setToolTip(refresh);
|
refreshButton.setToolTip(refresh);
|
||||||
|
|
||||||
widgets.add(confirmButton);
|
widgets.add(confirmButton);
|
||||||
widgets.add(folderButton);
|
widgets.add(folderButton);
|
||||||
widgets.add(refreshButton);
|
widgets.add(refreshButton);
|
||||||
|
|
||||||
extraAreas = new ArrayList<>();
|
extraAreas = ImmutableList.of(
|
||||||
extraAreas.add(new Rectangle2d(mainLeft, mainTop, SCHEMATIC_TABLE.width, SCHEMATIC_TABLE.height));
|
new Rectangle2d(guiLeft + background.width, guiTop + background.height - 40, 48, 48),
|
||||||
|
new Rectangle2d(refreshButton.x, refreshButton.y, 16, 16)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
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 x = guiLeft + 20;
|
AllGuiTextures.PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||||
int y = guiTop;
|
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||||
|
|
||||||
int mainLeft = guiLeft - 56;
|
background.draw(ms, this, guiLeft, guiTop);
|
||||||
int mainTop = guiTop - 16;
|
|
||||||
|
|
||||||
AllGuiTextures.PLAYER_INVENTORY.draw(matrixStack, this, x - 16, y + 70 + 14);
|
|
||||||
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), x - 15 + 7, y + 64 + 26, 0x666666);
|
|
||||||
|
|
||||||
SCHEMATIC_TABLE.draw(matrixStack, this, mainLeft, mainTop);
|
|
||||||
|
|
||||||
|
ITextComponent titleText;
|
||||||
if (container.getTileEntity().isUploading)
|
if (container.getTileEntity().isUploading)
|
||||||
textRenderer.drawWithShadow(matrixStack, uploading, mainLeft + 11, mainTop + 3, 0xffffff);
|
titleText = uploading;
|
||||||
else if (container.getSlot(1)
|
else if (container.getSlot(1)
|
||||||
.getHasStack())
|
.getHasStack())
|
||||||
textRenderer.drawWithShadow(matrixStack, finished, mainLeft + 11, mainTop + 3, 0xffffff);
|
titleText = finished;
|
||||||
else
|
else
|
||||||
textRenderer.drawWithShadow(matrixStack, title, mainLeft + 11, mainTop + 3, 0xffffff);
|
titleText = title;
|
||||||
|
drawCenteredText(ms, textRenderer, titleText, guiLeft + (background.width - 8) / 2, guiTop + 3, 0xFFFFFF);
|
||||||
|
|
||||||
if (schematicsArea == null)
|
if (schematicsArea == null)
|
||||||
textRenderer.drawWithShadow(matrixStack, noSchematics, mainLeft + 54, mainTop + 26, 0xd3d3d3);
|
textRenderer.drawWithShadow(ms, noSchematics, guiLeft + 54, guiTop + 26, 0xD3D3D3);
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.<GuiGameElement.GuiRenderBuilder>at(mainLeft + 217, mainTop + 50, -150)
|
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + background.width, guiTop + background.height - 40, -200)
|
||||||
.scale(3)
|
.scale(3)
|
||||||
.render(matrixStack);
|
.render(ms);
|
||||||
|
|
||||||
client.getTextureManager()
|
client.getTextureManager()
|
||||||
.bindTexture(SCHEMATIC_TABLE_PROGRESS.location);
|
.bindTexture(SCHEMATIC_TABLE_PROGRESS.location);
|
||||||
|
@ -132,7 +131,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
||||||
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
|
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
|
||||||
int height = SCHEMATIC_TABLE_PROGRESS.height;
|
int height = SCHEMATIC_TABLE_PROGRESS.height;
|
||||||
RenderSystem.disableLighting();
|
RenderSystem.disableLighting();
|
||||||
drawTexture(matrixStack, mainLeft + 70, mainTop + 57, SCHEMATIC_TABLE_PROGRESS.startX,
|
drawTexture(ms, guiLeft + 70, guiTop + 57, SCHEMATIC_TABLE_PROGRESS.startX,
|
||||||
SCHEMATIC_TABLE_PROGRESS.startY, width, height);
|
SCHEMATIC_TABLE_PROGRESS.startY, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,4 +217,5 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
||||||
public List<Rectangle2d> getExtraAreas() {
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
return extraAreas;
|
return extraAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.schematics.block;
|
package com.simibubi.create.content.schematics.block;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
||||||
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -116,7 +117,7 @@ public class SchematicTableTileEntity extends SyncedTileEntity implements ITicka
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName() {
|
public ITextComponent getDisplayName() {
|
||||||
return new StringTextComponent(getType().getRegistryName().toString());
|
return Lang.translate("gui.schematicTable.title");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class SchematicannonContainer extends Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
int x = 20;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
addSlot(new SlotItemHandler(te.inventory, 0, x + 15, y + 65));
|
addSlot(new SlotItemHandler(te.inventory, 0, x + 15, y + 65));
|
||||||
|
@ -55,9 +55,9 @@ public class SchematicannonContainer extends Container {
|
||||||
// player Slots
|
// player Slots
|
||||||
for (int row = 0; row < 3; ++row)
|
for (int row = 0; row < 3; ++row)
|
||||||
for (int col = 0; col < 9; ++col)
|
for (int col = 0; col < 9; ++col)
|
||||||
addSlot(new Slot(player.inventory, col + row * 9 + 9, -2 + col * 18, 163 + row * 18));
|
addSlot(new Slot(player.inventory, col + row * 9 + 9, 37 + col * 18, 161 + row * 18));
|
||||||
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
||||||
addSlot(new Slot(player.inventory, hotbarSlot, -2 + hotbarSlot * 18, 221));
|
addSlot(new Slot(player.inventory, hotbarSlot, 37 + hotbarSlot * 18, 219));
|
||||||
|
|
||||||
detectAndSendChanges();
|
detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import com.simibubi.create.foundation.item.TooltipHelper;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.widget.Widget;
|
import net.minecraft.client.gui.widget.Widget;
|
||||||
import net.minecraft.client.renderer.Rectangle2d;
|
import net.minecraft.client.renderer.Rectangle2d;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
@ -56,10 +55,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
protected IconButton resetButton;
|
protected IconButton resetButton;
|
||||||
protected Indicator resetIndicator;
|
protected Indicator resetIndicator;
|
||||||
|
|
||||||
private List<Rectangle2d> extraAreas;
|
private List<Rectangle2d> extraAreas = Collections.emptyList();
|
||||||
protected List<Widget> placementSettingWidgets;
|
protected List<Widget> placementSettingWidgets;
|
||||||
|
|
||||||
private final ITextComponent title = Lang.translate("gui.schematicannon.title");
|
|
||||||
private final ITextComponent listPrinter = Lang.translate("gui.schematicannon.listPrinter");
|
private final ITextComponent listPrinter = Lang.translate("gui.schematicannon.listPrinter");
|
||||||
private final String _gunpowderLevel = "gui.schematicannon.gunpowderLevel";
|
private final String _gunpowderLevel = "gui.schematicannon.gunpowderLevel";
|
||||||
private final String _shotsRemaining = "gui.schematicannon.shotsRemaining";
|
private final String _shotsRemaining = "gui.schematicannon.shotsRemaining";
|
||||||
|
@ -80,21 +78,21 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
private Indicator showSettingsIndicator;
|
private Indicator showSettingsIndicator;
|
||||||
|
|
||||||
public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory,
|
public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory,
|
||||||
ITextComponent p_i51105_3_) {
|
ITextComponent title) {
|
||||||
super(container, inventory, p_i51105_3_);
|
super(container, inventory, title);
|
||||||
placementSettingWidgets = new ArrayList<>();
|
placementSettingWidgets = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWindowSize(BG_TOP.width + 50, BG_BOTTOM.height + BG_TOP.height + 80);
|
setWindowSize(BG_TOP.width, BG_TOP.height + BG_BOTTOM.height + 2 + AllGuiTextures.PLAYER_INVENTORY.height);
|
||||||
|
setWindowOffset(30 - (2 + 80) / 2, 0);
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
int x = guiLeft + 20;
|
|
||||||
int y = guiTop;
|
|
||||||
|
|
||||||
widgets.clear();
|
widgets.clear();
|
||||||
|
|
||||||
|
int x = guiLeft;
|
||||||
|
int y = guiTop;
|
||||||
|
|
||||||
// Play Pause Stop
|
// Play Pause Stop
|
||||||
playButton = new IconButton(x + 75, y + 86, AllIcons.I_PLAY);
|
playButton = new IconButton(x + 75, y + 86, AllIcons.I_PLAY);
|
||||||
playIndicator = new Indicator(x + 75, y + 79, StringTextComponent.EMPTY);
|
playIndicator = new Indicator(x + 75, y + 79, StringTextComponent.EMPTY);
|
||||||
|
@ -106,17 +104,18 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
Collections.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton,
|
Collections.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton,
|
||||||
resetIndicator);
|
resetIndicator);
|
||||||
|
|
||||||
extraAreas = new ArrayList<>();
|
|
||||||
extraAreas.add(new Rectangle2d(guiLeft + 240, guiTop + 88, 84, 113));
|
|
||||||
|
|
||||||
confirmButton = new IconButton(x + 180, guiTop + 117, AllIcons.I_CONFIRM);
|
confirmButton = new IconButton(x + 180, guiTop + 117, AllIcons.I_CONFIRM);
|
||||||
widgets.add(confirmButton);
|
widgets.add(confirmButton);
|
||||||
showSettingsButton = new IconButton(guiLeft + 29, guiTop + 117, AllIcons.I_PLACEMENT_SETTINGS);
|
showSettingsButton = new IconButton(guiLeft + 9, guiTop + 117, AllIcons.I_PLACEMENT_SETTINGS);
|
||||||
showSettingsButton.setToolTip(Lang.translate(_showSettings));
|
showSettingsButton.setToolTip(Lang.translate(_showSettings));
|
||||||
widgets.add(showSettingsButton);
|
widgets.add(showSettingsButton);
|
||||||
showSettingsIndicator = new Indicator(guiLeft + 29, guiTop + 111, StringTextComponent.EMPTY);
|
showSettingsIndicator = new Indicator(guiLeft + 9, guiTop + 111, StringTextComponent.EMPTY);
|
||||||
widgets.add(showSettingsIndicator);
|
widgets.add(showSettingsIndicator);
|
||||||
|
|
||||||
|
extraAreas = ImmutableList.of(
|
||||||
|
new Rectangle2d(guiLeft + BG_TOP.width, guiTop + BG_TOP.height + BG_BOTTOM.height - 62, 84, 92)
|
||||||
|
);
|
||||||
|
|
||||||
tick();
|
tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +126,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
if (placementSettingsHidden())
|
if (placementSettingsHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x = guiLeft + 20;
|
int x = guiLeft;
|
||||||
int y = guiTop;
|
int y = guiTop;
|
||||||
|
|
||||||
// Replace settings
|
// Replace settings
|
||||||
|
@ -247,49 +246,48 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
AllGuiTextures.PLAYER_INVENTORY.draw(matrixStack, this, guiLeft - 10, guiTop + 145);
|
int invLeft = guiLeft - windowXOffset + (xSize - AllGuiTextures.PLAYER_INVENTORY.width) / 2;
|
||||||
BG_TOP.draw(matrixStack, this, guiLeft + 20, guiTop);
|
int invTop = guiTop + BG_TOP.height + BG_BOTTOM.height + 2;
|
||||||
BG_BOTTOM.draw(matrixStack, this, guiLeft + 20, guiTop + BG_TOP.height);
|
|
||||||
|
AllGuiTextures.PLAYER_INVENTORY.draw(ms, this, invLeft, invTop);
|
||||||
|
textRenderer.draw(ms, playerInventory.getDisplayName(), invLeft + 8, invTop + 6, 0x404040);
|
||||||
|
|
||||||
|
BG_TOP.draw(ms, this, guiLeft, guiTop);
|
||||||
|
BG_BOTTOM.draw(ms, this, guiLeft, guiTop + BG_TOP.height);
|
||||||
|
|
||||||
SchematicannonTileEntity te = container.getTileEntity();
|
SchematicannonTileEntity te = container.getTileEntity();
|
||||||
renderPrintingProgress(matrixStack, te.schematicProgress);
|
renderPrintingProgress(ms, te.schematicProgress);
|
||||||
renderFuelBar(matrixStack, te.fuelLevel);
|
renderFuelBar(ms, te.fuelLevel);
|
||||||
renderChecklistPrinterProgress(matrixStack, te.bookPrintingProgress);
|
renderChecklistPrinterProgress(ms, te.bookPrintingProgress);
|
||||||
|
|
||||||
if (!te.inventory.getStackInSlot(0)
|
if (!te.inventory.getStackInSlot(0)
|
||||||
.isEmpty())
|
.isEmpty())
|
||||||
renderBlueprintHighlight(matrixStack);
|
renderBlueprintHighlight(ms);
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + 230, guiTop + 110, -200)
|
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + BG_TOP.width, guiTop + BG_TOP.height + BG_BOTTOM.height - 48, -200)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(matrixStack);
|
.render(ms);
|
||||||
|
|
||||||
textRenderer.drawWithShadow(matrixStack, title, guiLeft + 80, guiTop + 3, 0xfefefe);
|
drawCenteredText(ms, textRenderer, title, guiLeft + (BG_TOP.width - 8) / 2, guiTop + 3, 0xFFFFFF);
|
||||||
|
|
||||||
ITextComponent msg = Lang.translate("schematicannon.status." + te.statusMsg);
|
ITextComponent msg = Lang.translate("schematicannon.status." + te.statusMsg);
|
||||||
int stringWidth = textRenderer.getWidth(msg);
|
int stringWidth = textRenderer.getWidth(msg);
|
||||||
|
|
||||||
if (te.missingItem != null) {
|
if (te.missingItem != null) {
|
||||||
stringWidth += 15;
|
stringWidth += 16;
|
||||||
GuiGameElement.of(te.missingItem)
|
GuiGameElement.of(te.missingItem)
|
||||||
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + 150, guiTop + 46, 100)
|
.<GuiGameElement.GuiRenderBuilder>at(guiLeft + 128, guiTop + 49, 100)
|
||||||
.scale(1)
|
.scale(1)
|
||||||
.render(matrixStack);
|
.render(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
textRenderer.drawWithShadow(matrixStack, msg, guiLeft + 20 + 102 - stringWidth / 2, guiTop + 50, 0xCCDDFF);
|
textRenderer.drawWithShadow(ms, msg, guiLeft + 103 - stringWidth / 2, guiTop + 53, 0xCCDDFF);
|
||||||
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), guiLeft - 10 + 7, guiTop + 145 + 6, 0x666666);
|
|
||||||
|
|
||||||
// to see or debug the bounds of the extra area uncomment the following lines
|
|
||||||
// Rectangle2d r = extraAreas.get(0);
|
|
||||||
// fill(r.getX() + r.getWidth(), r.getY() + r.getHeight(), r.getX(), r.getY(),
|
|
||||||
// 0xd3d3d3d3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderBlueprintHighlight(MatrixStack matrixStack) {
|
protected void renderBlueprintHighlight(MatrixStack matrixStack) {
|
||||||
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(matrixStack, this, guiLeft + 20 + 10, guiTop + 60);
|
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(matrixStack, this, guiLeft + 10, guiTop + 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderPrintingProgress(MatrixStack matrixStack, float progress) {
|
protected void renderPrintingProgress(MatrixStack matrixStack, float progress) {
|
||||||
|
@ -297,7 +295,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS;
|
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS;
|
||||||
client.getTextureManager()
|
client.getTextureManager()
|
||||||
.bindTexture(sprite.location);
|
.bindTexture(sprite.location);
|
||||||
drawTexture(matrixStack, guiLeft + 20 + 44, guiTop + 64, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
drawTexture(matrixStack, guiLeft + 44, guiTop + 64, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||||
sprite.height);
|
sprite.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,19 +303,19 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_CHECKLIST_PROGRESS;
|
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_CHECKLIST_PROGRESS;
|
||||||
client.getTextureManager()
|
client.getTextureManager()
|
||||||
.bindTexture(sprite.location);
|
.bindTexture(sprite.location);
|
||||||
drawTexture(matrixStack, guiLeft + 20 + 154, guiTop + 20, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
drawTexture(matrixStack, guiLeft + 154, guiTop + 20, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||||
sprite.height);
|
sprite.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderFuelBar(MatrixStack matrixStack, float amount) {
|
protected void renderFuelBar(MatrixStack matrixStack, float amount) {
|
||||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_FUEL;
|
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_FUEL;
|
||||||
if (container.getTileEntity().hasCreativeCrate) {
|
if (container.getTileEntity().hasCreativeCrate) {
|
||||||
AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(matrixStack, this, guiLeft + 20 + 36, guiTop + 19);
|
AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(matrixStack, this, guiLeft + 36, guiTop + 19);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client.getTextureManager()
|
client.getTextureManager()
|
||||||
.bindTexture(sprite.location);
|
.bindTexture(sprite.location);
|
||||||
drawTexture(matrixStack, guiLeft + 20 + 36, guiTop + 19, sprite.startX, sprite.startY, (int) (sprite.width * amount),
|
drawTexture(matrixStack, guiLeft + 36, guiTop + 19, sprite.startX, sprite.startY, (int) (sprite.width * amount),
|
||||||
sprite.height);
|
sprite.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +323,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||||
SchematicannonTileEntity te = container.getTileEntity();
|
SchematicannonTileEntity te = container.getTileEntity();
|
||||||
|
|
||||||
int fuelX = guiLeft + 20 + 36, fuelY = guiTop + 19;
|
int fuelX = guiLeft + 36, fuelY = guiTop + 19;
|
||||||
if (mouseX >= fuelX && mouseY >= fuelY && mouseX <= fuelX + AllGuiTextures.SCHEMATICANNON_FUEL.width
|
if (mouseX >= fuelX && mouseY >= fuelY && mouseX <= fuelX + AllGuiTextures.SCHEMATICANNON_FUEL.width
|
||||||
&& mouseY <= fuelY + AllGuiTextures.SCHEMATICANNON_FUEL.height) {
|
&& mouseY <= fuelY + AllGuiTextures.SCHEMATICANNON_FUEL.height) {
|
||||||
List<ITextComponent> tooltip = getFuelLevelTooltip(te);
|
List<ITextComponent> tooltip = getFuelLevelTooltip(te);
|
||||||
|
@ -348,14 +346,14 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
}
|
}
|
||||||
|
|
||||||
if (te.missingItem != null) {
|
if (te.missingItem != null) {
|
||||||
int missingBlockX = guiLeft + 150, missingBlockY = guiTop + 46;
|
int missingBlockX = guiLeft + 128, missingBlockY = guiTop + 49;
|
||||||
if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16
|
if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16
|
||||||
&& mouseY <= missingBlockY + 16) {
|
&& mouseY <= missingBlockY + 16) {
|
||||||
renderTooltip(matrixStack, te.missingItem, mouseX, mouseY);
|
renderTooltip(matrixStack, te.missingItem, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int paperX = guiLeft + 132, paperY = guiTop + 19;
|
int paperX = guiLeft + 112, paperY = guiTop + 19;
|
||||||
if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16)
|
if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16)
|
||||||
renderTooltip(matrixStack, listPrinter, mouseX, mouseY);
|
renderTooltip(matrixStack, listPrinter, mouseX, mouseY);
|
||||||
|
|
||||||
|
@ -393,7 +391,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirmButton.isHovered()) {
|
if (confirmButton.isHovered()) {
|
||||||
Minecraft.getInstance().player.closeScreen();
|
client.player.closeScreen();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.NBTProcessors;
|
import com.simibubi.create.foundation.utility.NBTProcessors;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -61,7 +62,6 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MutableBoundingBox;
|
import net.minecraft.util.math.MutableBoundingBox;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
|
||||||
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
||||||
import net.minecraft.world.gen.feature.template.Template;
|
import net.minecraft.world.gen.feature.template.Template;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
@ -908,7 +908,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) {
|
protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) {
|
||||||
if (state.getBlock()
|
if (!state.getBlock()
|
||||||
.isAir(state, world, target))
|
.isAir(state, world, target))
|
||||||
blocksPlaced++;
|
blocksPlaced++;
|
||||||
flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data));
|
flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data));
|
||||||
|
@ -937,8 +937,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName() {
|
public ITextComponent getDisplayName() {
|
||||||
return new StringTextComponent(getType().getRegistryName()
|
return Lang.translate("gui.schematicannon.title");
|
||||||
.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateChecklist() {
|
public void updateChecklist() {
|
||||||
|
|
|
@ -33,6 +33,8 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public abstract class AbstractSimiContainerScreen<T extends Container> extends ContainerScreen<T> {
|
public abstract class AbstractSimiContainerScreen<T extends Container> extends ContainerScreen<T> {
|
||||||
|
|
||||||
protected List<Widget> widgets;
|
protected List<Widget> widgets;
|
||||||
|
protected int windowXOffset;
|
||||||
|
protected int windowYOffset;
|
||||||
|
|
||||||
public AbstractSimiContainerScreen(T container, PlayerInventory inv, ITextComponent title) {
|
public AbstractSimiContainerScreen(T container, PlayerInventory inv, ITextComponent title) {
|
||||||
super(container, inv, title);
|
super(container, inv, title);
|
||||||
|
@ -44,6 +46,18 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
||||||
this.ySize = height;
|
this.ySize = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setWindowOffset(int xOffset, int yOffset) {
|
||||||
|
windowXOffset = xOffset;
|
||||||
|
windowYOffset = yOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
super.init();
|
||||||
|
guiLeft += windowXOffset;
|
||||||
|
guiTop += windowYOffset;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawForeground(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) {
|
protected void drawForeground(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) {
|
||||||
// no-op to prevent screen- and inventory-title from being rendered at incorrect location
|
// no-op to prevent screen- and inventory-title from being rendered at incorrect location
|
||||||
|
@ -263,4 +277,16 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
||||||
public List<Rectangle2d> getExtraAreas() {
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
protected void debugWindowArea(MatrixStack matrixStack) {
|
||||||
|
fill(matrixStack, guiLeft + xSize, guiTop + ySize, guiLeft, guiTop, 0xd3d3d3d3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
protected void debugExtraAreas(MatrixStack matrixStack) {
|
||||||
|
for (Rectangle2d area : getExtraAreas()) {
|
||||||
|
fill(matrixStack, area.getX() + area.getWidth(), area.getY() + area.getHeight(), area.getX(), area.getY(), 0xd3d3d3d3);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public enum AllGuiTextures implements IScreenRenderable {
|
||||||
SEQUENCER_EMPTY("sequencer.png", 0, 102, 162, 22),
|
SEQUENCER_EMPTY("sequencer.png", 0, 102, 162, 22),
|
||||||
SEQUENCER_AWAIT("sequencer.png", 0, 160, 162, 22),
|
SEQUENCER_AWAIT("sequencer.png", 0, 160, 162, 22),
|
||||||
|
|
||||||
LINKED_CONTROLLER("curiosities2.png", 180, 109),
|
LINKED_CONTROLLER("curiosities2.png", 179, 109),
|
||||||
BLUEPRINT("curiosities2.png", 0, 109, 179, 109),
|
BLUEPRINT("curiosities2.png", 0, 109, 179, 109),
|
||||||
|
|
||||||
// JEI
|
// JEI
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in a new issue