mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 06:24:12 +01:00
Allow attribute filter screen to have space to show JEI bookmarks
This commit is contained in:
parent
ddb5aa9a3d
commit
e3394a8907
@ -40,6 +40,8 @@ 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.logistics.block.inventories.AdjustableCrateScreen;
|
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateScreen;
|
||||||
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.FilterScreen;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicTableScreen;
|
import com.simibubi.create.content.schematics.block.SchematicTableScreen;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonScreen;
|
import com.simibubi.create.content.schematics.block.SchematicannonScreen;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
@ -231,6 +233,8 @@ public class CreateJEI implements IModPlugin {
|
|||||||
registration.addGuiContainerHandler(AdjustableCrateScreen.class, slotMover);
|
registration.addGuiContainerHandler(AdjustableCrateScreen.class, slotMover);
|
||||||
registration.addGuiContainerHandler(SchematicannonScreen.class, slotMover);
|
registration.addGuiContainerHandler(SchematicannonScreen.class, slotMover);
|
||||||
registration.addGuiContainerHandler(SchematicTableScreen.class, slotMover);
|
registration.addGuiContainerHandler(SchematicTableScreen.class, slotMover);
|
||||||
|
registration.addGuiContainerHandler(FilterScreen.class, slotMover);
|
||||||
|
registration.addGuiContainerHandler(AttributeFilterScreen.class, slotMover);
|
||||||
registration.addGhostIngredientHandler(AbstractFilterScreen.class, new FilterGhostIngredientHandler());
|
registration.addGhostIngredientHandler(AbstractFilterScreen.class, new FilterGhostIngredientHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public abstract class AbstractFilterContainer extends Container {
|
|||||||
protected abstract void saveData(ItemStack filterItem);
|
protected abstract void saveData(ItemStack filterItem);
|
||||||
|
|
||||||
protected void addPlayerSlots() {
|
protected void addPlayerSlots() {
|
||||||
int x = 58;
|
int x = 8;
|
||||||
int y = 28 + getInventoryOffset();
|
int y = 28 + getInventoryOffset();
|
||||||
|
|
||||||
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot)
|
||||||
|
@ -6,6 +6,7 @@ import static net.minecraft.util.text.TextFormatting.GRAY;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
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;
|
||||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||||
@ -19,6 +20,7 @@ import com.simibubi.create.foundation.item.TooltipHelper;
|
|||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
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.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
@ -26,6 +28,7 @@ import net.minecraft.util.text.ITextComponent;
|
|||||||
public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> extends AbstractSimiContainerScreen<F> {
|
public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> extends AbstractSimiContainerScreen<F> {
|
||||||
|
|
||||||
protected AllGuiTextures background;
|
protected AllGuiTextures background;
|
||||||
|
private List<Rectangle2d> extraAreas = Collections.EMPTY_LIST;
|
||||||
|
|
||||||
private IconButton resetButton;
|
private IconButton resetButton;
|
||||||
private IconButton confirmButton;
|
private IconButton confirmButton;
|
||||||
@ -37,12 +40,15 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWindowSize(background.width + 80, background.height + PLAYER_INVENTORY.height + 20);
|
setWindowSize(PLAYER_INVENTORY.width, background.height + PLAYER_INVENTORY.height + 20);
|
||||||
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(guiLeft + background.width - 62, guiTop + background.height - 24, AllIcons.I_TRASH);
|
resetButton = new IconButton(x + background.width - 62, guiTop + background.height - 24, AllIcons.I_TRASH);
|
||||||
confirmButton = new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
confirmButton = new IconButton(x + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
|
||||||
|
|
||||||
widgets.add(resetButton);
|
widgets.add(resetButton);
|
||||||
widgets.add(confirmButton);
|
widgets.add(confirmButton);
|
||||||
@ -50,11 +56,11 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
||||||
int x = guiLeft;
|
int x = guiLeft - 50;
|
||||||
int y = guiTop;
|
int y = guiTop;
|
||||||
background.draw(this, x, y);
|
background.draw(this, x, y);
|
||||||
|
|
||||||
int invX = x + 50;
|
int invX = guiLeft;
|
||||||
int invY = y + background.height + 10;
|
int invY = y + background.height + 10;
|
||||||
PLAYER_INVENTORY.draw(this, invX, invY);
|
PLAYER_INVENTORY.draw(this, invX, invY);
|
||||||
|
|
||||||
@ -62,7 +68,7 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||||||
font.drawStringWithShadow(I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 3, 0xdedede);
|
font.drawStringWithShadow(I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 3, 0xdedede);
|
||||||
|
|
||||||
GuiGameElement.of(container.filterItem)
|
GuiGameElement.of(container.filterItem)
|
||||||
.at(guiLeft + background.width, guiTop +background.height -60)
|
.at(x + background.width, guiTop +background.height -60)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render();
|
.render();
|
||||||
|
|
||||||
@ -150,4 +156,8 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||||||
AllPackets.channel.sendToServer(new FilterScreenPacket(option));
|
AllPackets.channel.sendToServer(new FilterScreenPacket(option));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Rectangle2d> getExtraAreas() {
|
||||||
|
return extraAreas;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void addFilterSlots() {
|
protected void addFilterSlots() {
|
||||||
this.addSlot(new SlotItemHandler(filterInventory, 0, 16, 22));
|
this.addSlot(new SlotItemHandler(filterInventory, 0, -34, 22));
|
||||||
this.addSlot(new SlotItemHandler(filterInventory, 1, 22, 57) {
|
this.addSlot(new SlotItemHandler(filterInventory, 1, -28, 57) {
|
||||||
@Override
|
@Override
|
||||||
public boolean canTakeStack(PlayerEntity playerIn) {
|
public boolean canTakeStack(PlayerEntity playerIn) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -60,7 +60,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
|||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
int x = guiLeft;
|
int x = guiLeft - 50;
|
||||||
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);
|
||||||
@ -158,7 +158,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
|||||||
RenderSystem.translatef(0.0F, 0.0F, 32.0F);
|
RenderSystem.translatef(0.0F, 0.0F, 32.0F);
|
||||||
this.setBlitOffset(200);
|
this.setBlitOffset(200);
|
||||||
this.itemRenderer.zLevel = 200.0F;
|
this.itemRenderer.zLevel = 200.0F;
|
||||||
this.itemRenderer.renderItemOverlayIntoGUI(font, stack, guiLeft + 22, guiTop + 57,
|
this.itemRenderer.renderItemOverlayIntoGUI(font, stack, guiLeft - 27, guiTop + 57,
|
||||||
String.valueOf(selectedAttributes.size() - 1));
|
String.valueOf(selectedAttributes.size() - 1));
|
||||||
this.setBlitOffset(0);
|
this.setBlitOffset(0);
|
||||||
this.itemRenderer.zLevel = 0.0F;
|
this.itemRenderer.zLevel = 0.0F;
|
||||||
|
@ -24,7 +24,7 @@ public class FilterContainer extends AbstractFilterContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addFilterSlots() {
|
protected void addFilterSlots() {
|
||||||
int x = 23;
|
int x = -27;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
|
|
||||||
for (int row = 0; row < 2; ++row)
|
for (int row = 0; row < 2; ++row)
|
||||||
|
Loading…
Reference in New Issue
Block a user