repositioned a few BP gui elements

This commit is contained in:
ticticboooom
2022-06-29 13:57:25 +01:00
parent 9b4387abac
commit 372b6d29dc
7 changed files with 27 additions and 16 deletions

View File

@@ -23,12 +23,14 @@ public class BlueprintContainer extends Container {
public BlueprintContainer(int windowId, PlayerInventory inv, PacketBuffer data) {
super(MMContainerTypes.BLUEPRINT.get(), windowId);
int index = 0;
for (int i = 0; i < 9; i++) {
addSlot(new BlueprintSlot(index, 41+ (i * 18), 111));
for (int i = 0; i < 11; i++) {
addSlot(new BlueprintSlot(index, -35 + 1, -15 + (i * 18)+ 1));
index++;
}
for (int i = 0; i < 9; i++) {
addSlot(new BlueprintSlot(index, 41+ (i * 18), 129));
addSlot(new BlueprintSlot(index, -35 + 18+ 1, -15 + (i * 18)+ 1));
index++;
addSlot(new BlueprintSlot(index, -35 + (2 * 18)+ 1, -15 + (i * 18)+ 1));
index++;
addSlot(new BlueprintSlot(index, -35 + (3 * 18)+ 1, -15 + (i * 18)+ 1));
index++;
}
}
@@ -52,7 +54,6 @@ public class BlueprintContainer extends Container {
}
@Override
public boolean canInteractWith(PlayerEntity playerIn) {
return true;

View File

@@ -15,6 +15,7 @@ import com.ticticboooom.mods.mm.setup.MMRegistries;
import com.ticticboooom.mods.mm.structures.StructureKeyType;
import com.ticticboooom.mods.mm.util.GuiBlockUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.IRenderTypeBuffer;
@@ -78,9 +79,11 @@ public class BlueprintScreen extends ContainerScreen<BlueprintContainer> {
Minecraft.getInstance().textureManager.bindTexture(STRUCTURE_BG);
blit(matrixStack, guiLeft + 40, guiTop - 15, 0, 0, 162, 150);
Minecraft.getInstance().textureManager.bindTexture(new ResourceLocation(Ref.MOD_ID, "textures/gui/slot_parts.png"));
for (int i = 0; i < 9; i++) {
blit(matrixStack, guiLeft + 40 + (i * 18), guiTop + 110, 0, 26, 18, 18);
blit(matrixStack, guiLeft + 40 + (i * 18), guiTop + 128, 0, 26, 18, 18);
for (int i = 0; i < 11; i++) {
blit(matrixStack, guiLeft -35, guiTop -15 + (i * 18), 0, 26, 18, 18);
blit(matrixStack, guiLeft -35 + 18, guiTop -15 + (i * 18), 0, 26, 18, 18);
blit(matrixStack, guiLeft -35 + (2*18), guiTop -15 + (i * 18), 0, 26, 18, 18);
blit(matrixStack, guiLeft -35 + (3*18), guiTop -15 + (i * 18), 0, 26, 18, 18);
}
GLScissor.enable(guiLeft + 40, guiTop - 15, 162, 120);
@@ -106,6 +109,8 @@ public class BlueprintScreen extends ContainerScreen<BlueprintContainer> {
GLScissor.disable();
renderItems();
renderActStructureButtons(x, y, matrixStack);
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
fontRenderer.drawString(matrixStack, screenContainer.structure.name.getString(),guiLeft + 40, guiTop + 110, 0x444444);
prevMouseState = GLFW.glfwGetMouseButton(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT);
}
@@ -212,13 +217,13 @@ public class BlueprintScreen extends ContainerScreen<BlueprintContainer> {
private void renderActStructureButtons(int x, int y, MatrixStack ms) {
Minecraft mc = Minecraft.getInstance();
Minecraft.getInstance().textureManager.bindTexture(new ResourceLocation(Ref.MOD_ID, "textures/gui/slot_parts.png"));
blit(ms, guiLeft + 40, guiTop + 160, 0, 26, 18, 18);
blit(ms, guiLeft + 184, guiTop + 160, 0, 26, 18, 18);
blit(ms, guiLeft + 40, guiTop + 165, 0, 26, 18, 18);
blit(ms, guiLeft + 184, guiTop + 165, 0, 26, 18, 18);
int mouseState = GLFW.glfwGetMouseButton(mc.getMainWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT);
if (mouseState == 1 & prevMouseState == 0) {
if (y >= guiTop + 160 && y <= guiTop + 160 + 18 && x >= guiLeft + 40 && x <= guiLeft + 40 + 18) {
if (y >= guiTop + 165 && y <= guiTop + 165 + 18 && x >= guiLeft + 40 && x <= guiLeft + 40 + 18) {
screenContainer.rotateDisplayedStructureBackward();
} else if (y >= guiTop + 160 && y <= guiTop + 160 + 18 && x >= guiLeft + 184 && x <= guiLeft + 184 + 18) {
} else if (y >= guiTop + 165 && y <= guiTop + 165 + 18 && x >= guiLeft + 184 && x <= guiLeft + 184 + 18) {
screenContainer.rotateDisplayedStructureForward();
}
}

View File

@@ -3,6 +3,7 @@ package com.ticticboooom.mods.mm.data.model;
import com.ticticboooom.mods.mm.structures.StructureKeyTypeValue;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import java.util.List;
import java.util.Map;
@@ -16,6 +17,7 @@ public class StructureModel {
public Map<String, RequiredPort> requiredPorts;
public Map<String, List<String>> portGroupings;
public List<PositionedKey> positionedKeys;
public ITextComponent name;
public static class Key {
public Key(ResourceLocation type, StructureKeyTypeValue data){

View File

@@ -20,6 +20,7 @@ import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import javax.swing.text.html.parser.Parser;
import java.util.*;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE)
@@ -46,7 +47,7 @@ public class StructureReloadListener extends JsonReloadListener {
private StructureModel parse(ResourceLocation key, JsonObject json) {
StructureModel result = new StructureModel();
result.id = key;
result.name = ParserUtils.parseTextComponent(json.get("name"));
result.portGroupings = ParserUtils.parseOrDefault(json, "portGroupings", x -> {
JsonObject obj = x.getAsJsonObject();
Map<String, List<String>> res = new HashMap<>();

View File

@@ -3,6 +3,7 @@
"test:main",
"test:second"
],
"name": "Bobs Uncle",
"controllerSettings": {
"facing": "west"
},

View File

@@ -3,6 +3,7 @@
"test:main",
"test:second"
],
"name": "bobs aunt",
"controllerSettings": {
"facing": "west"
},

View File

@@ -1,2 +1,2 @@
#Wed Jun 29 10:30:30 BST 2022
VERSION_CODE=1865
#Wed Jun 29 13:54:49 BST 2022
VERSION_CODE=1898