Use GuiGraphics
This commit is contained in:
parent
c051cc54c2
commit
9573b280ad
6 changed files with 41 additions and 38 deletions
|
@ -9,8 +9,7 @@ import org.betterx.bclib.BCLib;
|
|||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -43,7 +42,7 @@ class ProgressLogoRender extends CustomRenderComponent<ProgressLogoRender> {
|
|||
|
||||
@Override
|
||||
protected void customRender(
|
||||
PoseStack poseStack,
|
||||
GuiGraphics guiGraphics,
|
||||
int x,
|
||||
int y,
|
||||
float deltaTicks,
|
||||
|
@ -76,8 +75,7 @@ class ProgressLogoRender extends CustomRenderComponent<ProgressLogoRender> {
|
|||
|
||||
if (yBarImage > 0) {
|
||||
final int uvTopLogo = (int) (relativeY * LOGO_SIZE);
|
||||
RenderSystem.setShaderTexture(0, BCLibLayoutScreen.BCLIB_LOGO_LOCATION);
|
||||
GuiComponent.blit(poseStack,
|
||||
guiGraphics.blit(BCLibLayoutScreen.BCLIB_LOGO_LOCATION,
|
||||
xOffset,
|
||||
yOffset,
|
||||
width,
|
||||
|
@ -90,7 +88,7 @@ class ProgressLogoRender extends CustomRenderComponent<ProgressLogoRender> {
|
|||
if (yBarImage < height) {
|
||||
final int uvTopPixelated = (int) (relativeY * PIXELATED_SIZE);
|
||||
RenderSystem.setShaderTexture(0, ProgressScreen.BCLIB_LOGO_PIXELATED_LOCATION);
|
||||
GuiComponent.blit(poseStack,
|
||||
guiGraphics.blit(ProgressScreen.BCLIB_LOGO_PIXELATED_LOCATION,
|
||||
xOffset,
|
||||
yOffset + yBarImage,
|
||||
width,
|
||||
|
@ -101,8 +99,7 @@ class ProgressLogoRender extends CustomRenderComponent<ProgressLogoRender> {
|
|||
}
|
||||
|
||||
if (percentage > 0 && percentage < 1.0) {
|
||||
GuiComponent.fill(
|
||||
poseStack,
|
||||
guiGraphics.fill(
|
||||
0,
|
||||
yBar,
|
||||
transform.width,
|
||||
|
|
|
@ -10,8 +10,7 @@ import org.betterx.bclib.BCLib;
|
|||
import org.betterx.bclib.config.Configs;
|
||||
import org.betterx.bclib.networking.VersionChecker;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -164,7 +163,7 @@ public class UpdatesScreen extends BCLibLayoutScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBackground(PoseStack poseStack, int i, int j, float f) {
|
||||
GuiComponent.fill(poseStack, 0, 0, width, height, 0xBD343444);
|
||||
protected void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
|
||||
guiGraphics.fill(0, 0, width, height, 0xBD343444);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ import org.betterx.bclib.registry.PresetsRegistry;
|
|||
import org.betterx.worlds.together.WorldsTogether;
|
||||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -173,8 +172,8 @@ public class WelcomeScreen extends BCLibLayoutScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBackground(PoseStack poseStack, int i, int j, float f) {
|
||||
GuiComponent.fill(poseStack, 0, 0, width, height, 0xBD343444);
|
||||
protected void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
|
||||
guiGraphics.fill(0, 0, width, height, 0xBD343444);
|
||||
// Rectangle BANNER_UV = new Rectangle(0, 0, 427, 100);
|
||||
// Size BANNER_RESOURCE_SIZE = BANNER_UV.size();
|
||||
// Size BANNER_SIZE = BANNER_UV.sizeFromWidth(this.width);
|
||||
|
|
|
@ -13,8 +13,7 @@ import org.betterx.bclib.api.v2.levelgen.LevelGenUtil;
|
|||
import org.betterx.bclib.registry.PresetsRegistry;
|
||||
import org.betterx.worlds.together.worldPreset.TogetherWorldPreset;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldCreationContext;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldCreationUiState;
|
||||
|
@ -409,8 +408,8 @@ public class WorldSetupScreen extends LayoutScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBackground(PoseStack poseStack, int i, int j, float f) {
|
||||
GuiComponent.fill(poseStack, 0, 0, width, height, 0xBD343444);
|
||||
protected void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
|
||||
guiGraphics.fill(0, 0, width, height, 0xBD343444);
|
||||
}
|
||||
|
||||
record IconState(int left, int top, int size) {
|
||||
|
@ -444,8 +443,8 @@ public class WorldSetupScreen extends LayoutScreen {
|
|||
double targetT = 1;
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, int i, int j, float f) {
|
||||
super.render(poseStack, i, j, f);
|
||||
public void render(GuiGraphics guiGraphics, int i, int j, float f) {
|
||||
super.render(guiGraphics, i, j, f);
|
||||
final double SPEED = 0.05;
|
||||
if (targetT < iconT && iconT > 0) iconT = Math.max(0, iconT - f * SPEED);
|
||||
else if (targetT > iconT && iconT < 1) iconT = Math.min(1, iconT + f * SPEED);
|
||||
|
@ -474,22 +473,22 @@ public class WorldSetupScreen extends LayoutScreen {
|
|||
32
|
||||
);
|
||||
}
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(
|
||||
guiGraphics.pose().pushPose();
|
||||
guiGraphics.pose().translate(
|
||||
IconState.lerp(t, endOn.left, endOff.left),
|
||||
IconState.lerp(t, endOn.top, endOff.top),
|
||||
0
|
||||
);
|
||||
int size = IconState.lerp(t, endOn.size, endOff.size);
|
||||
RenderHelper.renderImage(
|
||||
poseStack, 0, 0,
|
||||
guiGraphics, 0, 0,
|
||||
size,
|
||||
size,
|
||||
WelcomeScreen.ICON_BETTEREND,
|
||||
Size.of(32), new Rectangle(0, 0, 32, 32),
|
||||
(float) 1
|
||||
);
|
||||
poseStack.popPose();
|
||||
guiGraphics.pose().popPose();
|
||||
}
|
||||
|
||||
if (netherButton != null) {
|
||||
|
@ -501,22 +500,22 @@ public class WorldSetupScreen extends LayoutScreen {
|
|||
);
|
||||
netherOn = endOn;
|
||||
}
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(
|
||||
guiGraphics.pose().pushPose();
|
||||
guiGraphics.pose().translate(
|
||||
IconState.lerp(t, netherOff.left, netherOn.left),
|
||||
IconState.lerp(t, netherOff.top, netherOn.top),
|
||||
0
|
||||
);
|
||||
int size = IconState.lerp(t, netherOff.size, netherOn.size);
|
||||
RenderHelper.renderImage(
|
||||
poseStack, 0, 0,
|
||||
guiGraphics, 0, 0,
|
||||
size,
|
||||
size,
|
||||
WelcomeScreen.ICON_BETTERNETHER,
|
||||
Size.of(32), new Rectangle(0, 0, 32, 32),
|
||||
(float) 1
|
||||
);
|
||||
poseStack.popPose();
|
||||
guiGraphics.pose().popPose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.betterx.bclib.mixin.client;
|
|||
|
||||
import org.betterx.bclib.interfaces.AnvilScreenHandlerExtended;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
|
@ -31,6 +31,9 @@ public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {
|
|||
@Shadow
|
||||
private EditBox name;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private static ResourceLocation ANVIL_LOCATION;
|
||||
private final List<AbstractWidget> be_buttons = Lists.newArrayList();
|
||||
|
||||
public AnvilScreenMixin(AnvilMenu handler, Inventory playerInventory, Component title, ResourceLocation texture) {
|
||||
|
@ -38,9 +41,9 @@ public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderErrorIcon(PoseStack poseStack, int i, int j) {
|
||||
public void renderErrorIcon(GuiGraphics guiGraphics, int i, int j) {
|
||||
if (this.bcl_hasRecipeError()) {
|
||||
blit(poseStack, i + 65, j + 46, this.imageWidth, 0, 28, 21);
|
||||
guiGraphics.blit(ANVIL_LOCATION, i + 65, j + 46, this.imageWidth, 0, 28, 21);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,9 +68,15 @@ public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {
|
|||
}
|
||||
|
||||
@Inject(method = "renderFg", at = @At("TAIL"))
|
||||
protected void be_renderForeground(PoseStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
|
||||
protected void be_renderForeground(
|
||||
GuiGraphics guiGraphics,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
float delta,
|
||||
CallbackInfo info
|
||||
) {
|
||||
be_buttons.forEach(button -> {
|
||||
button.render(matrices, mouseX, mouseY, delta);
|
||||
button.render(guiGraphics, mouseX, mouseY, delta);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package org.betterx.bclib.mixin.client;
|
|||
import org.betterx.bclib.blocks.BaseSignBlock;
|
||||
import org.betterx.bclib.client.render.BaseSignBlockEntityRenderer;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractSignEditScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.SignEditScreen;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -37,12 +37,12 @@ public abstract class SignEditScreenMixin extends AbstractSignEditScreen {
|
|||
|
||||
|
||||
@Inject(method = "offsetSign", at = @At("TAIL"))
|
||||
private void bclib_offsetSign(PoseStack poseStack, BlockState blockState, CallbackInfo ci) {
|
||||
private void bclib_offsetSign(GuiGraphics guiGraphics, BlockState blockState, CallbackInfo ci) {
|
||||
bclib_isSign = blockState.getBlock() instanceof BaseSignBlock;
|
||||
if (bclib_isSign) {
|
||||
bclib_renderStick = blockState.getValue(BaseSignBlock.FLOOR);
|
||||
if (bclib_renderStick) {
|
||||
poseStack.translate(0.0, 0.3125, 0.0);
|
||||
guiGraphics.pose().translate(0.0, 0.3125, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue