Skip to content

Commit

Permalink
1.20 update mostly done
Browse files Browse the repository at this point in the history
  • Loading branch information
Roundaround committed May 28, 2023
1 parent e787764 commit 191ac4e
Show file tree
Hide file tree
Showing 18 changed files with 182 additions and 214 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id("roundalib") version "0.1.3"
id("roundalib") version "0.3.6"
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ org.gradle.parallel=true
# RoundaLib Properties
group_id=me.roundaround
mod_id=armorstands
mod_version=1.0.2
minecraft_version=1.19.4
yarn_mappings=build.1
loader_version=0.14.19
fabric_version=0.76.0
mod_menu_version=6.1.0-rc.4
mod_version=1.1.0
minecraft_version=1.20-pre6
yarn_mappings=build.2
loader_version=0.14.21
fabric_version=0.82.1+1.20
mod_menu_version=7.0.0-beta.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 18 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand All @@ -205,6 +210,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import me.roundaround.armorstands.client.gui.widget.NavigationButtonWidget;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -44,13 +44,13 @@ public void tick() {
}
}

public void render(MatrixStack matrixStack) {
public void render(DrawContext drawContext) {
shownMessage.ifPresent((message) -> {
message.render(screen, matrixStack);
message.render(screen, drawContext);
});
}

private static class Message extends DrawableHelper {
private static class Message {
private static final int SHOW_DURATION = 40;

private final Text text;
Expand All @@ -72,7 +72,7 @@ public void tick() {
timeRemaining--;
}

public void render(Screen screen, MatrixStack matrixStack) {
public void render(Screen screen, DrawContext context) {
MinecraftClient client = MinecraftClient.getInstance();
TextRenderer textRenderer = client.textRenderer;
int width = textRenderer.getWidth(text);
Expand All @@ -87,8 +87,8 @@ public void render(Screen screen, MatrixStack matrixStack) {

RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
fill(matrixStack, x - 2, y - 2, x + width + 2, y + textRenderer.fontHeight + 2, backgroundColor);
textRenderer.drawWithShadow(matrixStack, text, x, y, textColor);
context.fill(x - 2, y - 2, x + width + 2, y + textRenderer.fontHeight + 2, backgroundColor);
context.drawTextWithShadow(textRenderer, text, x, y, textColor);
RenderSystem.disableBlend();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import me.roundaround.armorstands.network.packet.c2s.UtilityActionPacket;
import me.roundaround.armorstands.screen.ArmorStandScreenHandler;
import me.roundaround.armorstands.util.HasArmorStand;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.navigation.GuiNavigation;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
Expand Down Expand Up @@ -67,6 +66,7 @@ protected AbstractArmorStandScreen(ArmorStandScreenHandler handler, Text title)

this.messageRenderer = new MessageRenderer(this);

// TODO: Find an alternative to this
this.passEvents = true;
}

Expand Down Expand Up @@ -119,32 +119,32 @@ protected void handledScreenTick() {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
int adjustedMouseX = cursorLocked ? -1 : mouseX;
int adjustedMouseY = cursorLocked ? -1 : mouseY;

RenderSystem.enableBlend();
((InGameHudAccessor) this.client.inGameHud).invokeRenderVignetteOverlay(matrixStack,
((InGameHudAccessor) this.client.inGameHud).invokeRenderVignetteOverlay(drawContext,
this.client.getCameraEntity());

// Render labels before all other widgets so they are rendered on bottom
for (LabelWidget label : this.labels) {
label.render(matrixStack, adjustedMouseX, adjustedMouseY, delta);
label.render(drawContext, adjustedMouseX, adjustedMouseY, delta);
}

super.render(matrixStack, adjustedMouseX, adjustedMouseY, delta);
super.render(drawContext, adjustedMouseX, adjustedMouseY, delta);

renderActivePageButtonHighlight(matrixStack);
renderActivePageButtonHighlight(drawContext);

this.messageRenderer.render(matrixStack);
this.messageRenderer.render(drawContext);
}

@Override
protected void drawBackground(MatrixStack matrixStack, float delta, int mouseX, int mouseY) {
protected void drawBackground(DrawContext drawContext, float delta, int mouseX, int mouseY) {
}

@Override
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) {
protected void drawForeground(DrawContext drawContext, int mouseX, int mouseY) {
}

@Override
Expand Down Expand Up @@ -442,20 +442,19 @@ protected void initRight() {
protected void initEnd() {
}

protected void renderActivePageButtonHighlight(MatrixStack matrixStack) {
protected void renderActivePageButtonHighlight(DrawContext drawContext) {
if (this.activeButton == null) {
return;
}

RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();

MatrixStack matrixStack = drawContext.getMatrices();
matrixStack.push();
matrixStack.translate(0, 0, 100);
drawNineSlicedTexture(matrixStack,
drawContext.drawNineSlicedTexture(WIDGETS_TEXTURE,
this.activeButton.getX() - 2,
this.activeButton.getY() - 2,
25,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,22 @@
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.datafixers.util.Pair;

import me.roundaround.armorstands.ArmorStandsMod;
import me.roundaround.armorstands.client.gui.widget.FlagToggleWidget;
import me.roundaround.armorstands.network.ArmorStandFlag;
import me.roundaround.armorstands.network.ScreenType;
import me.roundaround.armorstands.screen.ArmorStandScreenHandler;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.Identifier;

public class ArmorStandInventoryScreen extends AbstractArmorStandScreen {
private static final int BACKGROUND_WIDTH = 176;
private static final int BACKGROUND_HEIGHT = 166;
private static final Identifier CUSTOM_TEXTURE = new Identifier(
ArmorStandsMod.MOD_ID,
"textures/gui/container/inventory.png");
private static final Identifier CUSTOM_TEXTURE =
new Identifier(ArmorStandsMod.MOD_ID, "textures/gui/container/inventory.png");

private float mouseX;
private float mouseY;
Expand All @@ -42,20 +39,16 @@ public ScreenType getScreenType() {

@Override
protected void initRight() {
this.showArmsToggle = addDrawableChild(
new FlagToggleWidget(
this.textRenderer,
ArmorStandFlag.SHOW_ARMS,
ArmorStandFlag.SHOW_ARMS.getValue(this.armorStand),
this.width - SCREEN_EDGE_PAD,
this.height - SCREEN_EDGE_PAD - 2 * FlagToggleWidget.WIDGET_HEIGHT - BETWEEN_PAD));
this.lockInventoryToggle = addDrawableChild(
new FlagToggleWidget(
this.textRenderer,
ArmorStandFlag.LOCK_INVENTORY,
ArmorStandFlag.LOCK_INVENTORY.getValue(this.armorStand),
this.width - SCREEN_EDGE_PAD,
this.height - SCREEN_EDGE_PAD - FlagToggleWidget.WIDGET_HEIGHT));
this.showArmsToggle = addDrawableChild(new FlagToggleWidget(this.textRenderer,
ArmorStandFlag.SHOW_ARMS,
ArmorStandFlag.SHOW_ARMS.getValue(this.armorStand),
this.width - SCREEN_EDGE_PAD,
this.height - SCREEN_EDGE_PAD - 2 * FlagToggleWidget.WIDGET_HEIGHT - BETWEEN_PAD));
this.lockInventoryToggle = addDrawableChild(new FlagToggleWidget(this.textRenderer,
ArmorStandFlag.LOCK_INVENTORY,
ArmorStandFlag.LOCK_INVENTORY.getValue(this.armorStand),
this.width - SCREEN_EDGE_PAD,
this.height - SCREEN_EDGE_PAD - FlagToggleWidget.WIDGET_HEIGHT));
}

@Override
Expand All @@ -67,45 +60,35 @@ public void handledScreenTick() {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
renderBackground(matrixStack);
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
renderBackground(drawContext);

this.mouseX = mouseX;
this.mouseY = mouseY;
super.render(matrixStack, mouseX, mouseY, delta);
super.render(drawContext, mouseX, mouseY, delta);

drawMouseoverTooltip(matrixStack, mouseX, mouseY);
drawMouseoverTooltip(drawContext, mouseX, mouseY);
}

@Override
protected void drawBackground(MatrixStack matrixStack, float delta, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
protected void drawBackground(DrawContext drawContext, float delta, int mouseX, int mouseY) {
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);

int x = (this.width - BACKGROUND_WIDTH) / 2;
int y = (this.height - BACKGROUND_HEIGHT) / 2;

RenderSystem.setShaderTexture(0, CUSTOM_TEXTURE);
drawTexture(
matrixStack,
x,
y,
0,
0,
BACKGROUND_WIDTH,
BACKGROUND_HEIGHT);
drawContext.drawTexture(CUSTOM_TEXTURE, x, y, 0, 0, BACKGROUND_WIDTH, BACKGROUND_HEIGHT);

ImmutableList<Pair<Slot, EquipmentSlot>> armorSlots = this.handler.getArmorSlots();
for (int index = 0; index < armorSlots.size(); index++) {
Slot slot = armorSlots.get(index).getFirst();
EquipmentSlot equipmentSlot = armorSlots.get(index).getSecond();
if (ArmorStandScreenHandler.isSlotDisabled(armorStand, equipmentSlot)) {
fill(matrixStack, x + slot.x, y + slot.y, x + slot.x + 16, y + slot.y + 16, 0x80000000);
drawContext.fill(x + slot.x, y + slot.y, x + slot.x + 16, y + slot.y + 16, 0x80000000);
}
}

InventoryScreen.drawEntity(
matrixStack,
InventoryScreen.drawEntity(drawContext,
x + 88,
y + 75,
30,
Expand Down
Loading

0 comments on commit 191ac4e

Please sign in to comment.