backpack background fixed

This commit is contained in:
Jörg Henke 2021-08-03 21:44:35 +02:00
parent b76472ff8f
commit d1a237102b
2 changed files with 7 additions and 3 deletions

View File

@ -18,7 +18,7 @@ import net.minecraft.client.render.RenderLayer;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class QuickieFabricClient implements ClientModInitializer { public class QuickieFabricClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
ScreenRegistry.register(RegistryManager.BACKPACK_SCREEN_HANDLER, BackpackScreen::new); ScreenRegistry.register(RegistryManager.BACKPACK_SCREEN_HANDLER, BackpackScreen::new);
// make cotton plant block transparent // make cotton plant block transparent
BlockRenderLayerMap.INSTANCE.putBlock(QuickieBlocks.COTTONPLANT, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(QuickieBlocks.COTTONPLANT, RenderLayer.getCutout());

View File

@ -1,5 +1,7 @@
package de.jottyfan.minecraft.quickiefabric.container; package de.jottyfan.minecraft.quickiefabric.container;
import com.mojang.blaze3d.systems.RenderSystem;
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager; import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack; import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@ -36,7 +38,8 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
} }
private void drawSlots(MatrixStack matrices, int guiX, int guiY) { private void drawSlots(MatrixStack matrices, int guiX, int guiY) {
this.client.getTextureManager().bindTexture(SLOT_TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, SLOT_TEXTURE);
for (int y = 0; y < (ItemBackpack.SLOTSIZE / 9); y++) { for (int y = 0; y < (ItemBackpack.SLOTSIZE / 9); y++) {
for (int x = 0; x < 9; x++) { for (int x = 0; x < 9; x++) {
this.drawTexture(matrices, guiX + 7 + (x * 18), guiY + 17 + (y * 18), 0, 0, 18, 18); this.drawTexture(matrices, guiX + 7 + (x * 18), guiY + 17 + (y * 18), 0, 0, 18, 18);
@ -53,7 +56,8 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
@Override @Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) { protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
this.client.getTextureManager().bindTexture(TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, TEXTURE);
int guiX = this.titleX; int guiX = this.titleX;
int guiY = (this.height - this.containerHeight) / 2; int guiY = (this.height - this.containerHeight) / 2;
this.drawTexture(matrices, guiX, guiY, 0, 0, this.containerWidth, this.containerHeight); this.drawTexture(matrices, guiX, guiY, 0, 0, this.containerWidth, this.containerHeight);