Skip to content

Commit

Permalink
1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsterner committed Jun 13, 2024
1 parent 4c136ed commit 9c57805
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ protected void scale(GuardEntity entitylivingbaseIn, MatrixStack matrixStackIn,
@Override
public Identifier getTexture(GuardEntity entity) {
return !GuardVillagersConfig.useSteveModel
? new Identifier(GuardVillagers.MODID,
? GuardVillagers.id(
"textures/entity/guard/guard_" + entity.getGuardVariant() + ".png")
: new Identifier(GuardVillagers.MODID,
: GuardVillagers.id(
"textures/entity/guard/guard_steve_" + entity.getGuardVariant() + ".png");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

public class GuardVillagerScreen extends HandledScreen<GuardVillagerScreenHandler> {

private static final Identifier GUARD_GUI_TEXTURES = new Identifier(GuardVillagers.MODID, "textures/gui/inventory.png");
private static final Identifier GUARD_FOLLOWING_ICON = new Identifier(GuardVillagers.MODID, "textures/gui/following_icons.png");
private static final Identifier GUARD_NOT_FOLLOWING_ICON = new Identifier(GuardVillagers.MODID, "textures/gui/not_following_icons.png");
private static final Identifier PATROL_ICON = new Identifier(GuardVillagers.MODID, "textures/gui/patrollingui.png");
private static final Identifier NOT_PATROLLING_ICON = new Identifier(GuardVillagers.MODID, "textures/gui/notpatrollingui.png");
private static final Identifier GUARD_GUI_TEXTURES = GuardVillagers.id("textures/gui/inventory.png");
private static final Identifier GUARD_FOLLOWING_ICON = GuardVillagers.id( "textures/gui/following_icons.png");
private static final Identifier GUARD_NOT_FOLLOWING_ICON = GuardVillagers.id("textures/gui/not_following_icons.png");
private static final Identifier PATROL_ICON = GuardVillagers.id( "textures/gui/patrollingui.png");
private static final Identifier NOT_PATROLLING_ICON = GuardVillagers.id("textures/gui/notpatrollingui.png");

private static final Identifier ICONS = new Identifier("textures/gui/icons.png");
private static final Identifier ICONS = GuardVillagers.id("textures/gui/icons.png");
private final PlayerEntity player;
private final GuardEntity guardEntity;
private float mousePosX;
Expand Down Expand Up @@ -70,7 +70,8 @@ protected void drawBackground(DrawContext ctx, float delta, int mouseX, int mous
int i = (this.width - this.backgroundWidth) / 2;
int j = (this.height - this.backgroundHeight) / 2;
ctx.drawTexture(GUARD_GUI_TEXTURES, i, j, 0, 0, this.backgroundWidth, this.backgroundHeight);
InventoryScreen.drawEntity(ctx, i + 51, j + 75, 30, (float) (i + 51) - this.mousePosX, (float) (j + 75 - 50) - this.mousePosY, this.guardEntity);
//InventoryScreen.drawEntity(ctx, i + 51, j + 75, 30 , (float) (i + 51) - this.mousePosX, (float) (j + 75 - 50) - this.mousePosY, this.guardEntity);
InventoryScreen.drawEntity(ctx, i + 51, j + 75, (i + 51), (j + 75 - 50), 30, 0.0625f, this.mousePosX, this.mousePosY, this.guardEntity);
}

@Override
Expand Down Expand Up @@ -108,7 +109,7 @@ protected void drawForeground(DrawContext ctx, int x, int y) {

@Override
public void render(DrawContext ctx, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(ctx);
this.renderBackground(ctx, mouseX, mouseY, partialTicks);
this.mousePosX = (float) mouseX;
this.mousePosY = (float) mouseY;
super.render(ctx, mouseX, mouseY, partialTicks);
Expand All @@ -135,16 +136,17 @@ public boolean requirementsForTexture() {
}

@Override
public void renderButton(DrawContext ctx, int mouseX, int mouseY, float partialTicks) {
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
Identifier icon = this.requirementsForTexture() ? texture : newTexture;
int i = this.v;
if (this.isHovered()) {
i += this.hoveredVOffset;
}

RenderSystem.enableDepthTest();
ctx.drawTexture(icon, this.getX(), this.getY(), (float) v, (float) i, this.width, this.height, textureWidth, textureHeight);
context.drawTexture(icon, this.getX(), this.getY(), (float) v, (float) i, this.width, this.height);
}

}

}

0 comments on commit 9c57805

Please sign in to comment.