1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-24 17:14:50 +00:00

attempt to use mojmap

currently does not compile
This commit is contained in:
Merith
2021-11-26 20:54:21 +00:00
parent bae502e8ea
commit dbbbe96df2
287 changed files with 4731 additions and 4820 deletions

View File

@@ -7,38 +7,37 @@
package dan200.computercraft.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.client.gui.widgets.ComputerSidebar;
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
import dan200.computercraft.client.render.ComputerBorderRenderer;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import javax.annotation.Nonnull;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import static dan200.computercraft.shared.turtle.inventory.ContainerTurtle.BORDER;
public class GuiTurtle extends ComputerScreenBase<ContainerTurtle>
{
private static final Identifier BACKGROUND_NORMAL = new Identifier( "computercraft", "textures/gui/turtle_normal.png" );
private static final Identifier BACKGROUND_ADVANCED = new Identifier( "computercraft", "textures/gui/turtle_advanced.png" );
private static final ResourceLocation BACKGROUND_NORMAL = new ResourceLocation( "computercraft", "textures/gui/turtle_normal.png" );
private static final ResourceLocation BACKGROUND_ADVANCED = new ResourceLocation( "computercraft", "textures/gui/turtle_advanced.png" );
private static final int TEX_WIDTH = 254;
private static final int TEX_HEIGHT = 217;
private final ComputerFamily family;
public GuiTurtle( ContainerTurtle container, PlayerInventory player, Text title )
public GuiTurtle( ContainerTurtle container, Inventory player, Component title )
{
super( container, player, title, BORDER );
family = container.getFamily();
backgroundWidth = TEX_WIDTH + ComputerSidebar.WIDTH;
backgroundHeight = TEX_HEIGHT;
imageWidth = TEX_WIDTH + ComputerSidebar.WIDTH;
imageHeight = TEX_HEIGHT;
}
@@ -46,25 +45,25 @@ public class GuiTurtle extends ComputerScreenBase<ContainerTurtle>
protected WidgetTerminal createTerminal()
{
return new WidgetTerminal(
computer, x + BORDER + ComputerSidebar.WIDTH, y + BORDER,
computer, leftPos + BORDER + ComputerSidebar.WIDTH, topPos + BORDER,
ComputerCraft.turtleTermWidth, ComputerCraft.turtleTermHeight
);
}
@Override
public void drawBackground( @Nonnull MatrixStack transform, float partialTicks, int mouseX, int mouseY )
public void renderBg( @Nonnull PoseStack transform, float partialTicks, int mouseX, int mouseY )
{
boolean advanced = family == ComputerFamily.ADVANCED;
RenderSystem.setShaderTexture( 0, advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
drawTexture( transform, x + ComputerSidebar.WIDTH, y, 0, 0, TEX_WIDTH, TEX_HEIGHT );
blit( transform, leftPos + ComputerSidebar.WIDTH, topPos, 0, 0, TEX_WIDTH, TEX_HEIGHT );
// Draw selection slot
int slot = getScreenHandler().getSelectedSlot();
int slot = getMenu().getSelectedSlot();
if( slot >= 0 )
{
int slotX = slot % 4;
int slotY = slot / 4;
drawTexture( transform, x + ContainerTurtle.TURTLE_START_X - 2 + slotX * 18, y + ContainerTurtle.PLAYER_START_Y - 2 + slotY * 18,
blit( transform, leftPos + ContainerTurtle.TURTLE_START_X - 2 + slotX * 18, topPos + ContainerTurtle.PLAYER_START_Y - 2 + slotY * 18,
0,
217,
24,
@@ -72,6 +71,6 @@ public class GuiTurtle extends ComputerScreenBase<ContainerTurtle>
}
RenderSystem.setShaderTexture( 0, advanced ? ComputerBorderRenderer.BACKGROUND_ADVANCED : ComputerBorderRenderer.BACKGROUND_NORMAL );
ComputerSidebar.renderBackground( transform, x, y + sidebarYOffset );
ComputerSidebar.renderBackground( transform, leftPos, topPos + sidebarYOffset );
}
}