fixed backpack rendering
This commit is contained in:
parent
69c52f5bb8
commit
2c9aaea4c8
@ -9,7 +9,7 @@
|
||||
loader_version=0.14.21
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.20.1.0
|
||||
mod_version = 1.20.1.1
|
||||
maven_group = de.jottyfan.minecraft
|
||||
archives_base_name = quickiefabric
|
||||
|
||||
|
@ -21,5 +21,6 @@ public class QuickieFabric implements ModInitializer {
|
||||
RegistryManager.registerContainer();
|
||||
RegistryManager.registerLootings();
|
||||
RegistryManager.registerTags();
|
||||
RegistryManager.registerItemGroup();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.container;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
||||
import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack;
|
||||
import net.fabricmc.api.EnvType;
|
||||
@ -27,21 +25,20 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
|
||||
private final Integer containerWidth = 176;
|
||||
|
||||
public BackpackScreen(BackpackScreenHandler handler, PlayerInventory inventory, Text text) {
|
||||
super(handler, inventory, Text.translatable("container.quickiefabric.backpack"));
|
||||
super(handler, inventory, Text.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
this.titleX = (this.width - this.containerWidth) / 2;
|
||||
this.playerInventoryTitleY = -1000;
|
||||
}
|
||||
|
||||
private void drawSlots(DrawContext context, int guiX, int guiY) {
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShaderTexture(0, SLOT_TEXTURE);
|
||||
context.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
for (int y = 0; y < (ItemBackpack.SLOTSIZE / 9); y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.drawSlots(context, guiX, guiY);
|
||||
context.drawTexture(SLOT_TEXTURE, guiX + 7 + (x * 18), guiY + 17 + (y * 18), 0, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,12 +52,10 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
|
||||
|
||||
@Override
|
||||
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
int guiX = this.titleX;
|
||||
context.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiX = (this.width - this.containerWidth) / 2;
|
||||
int guiY = (this.height - this.containerHeight) / 2;
|
||||
super.renderBackground(context);
|
||||
|
||||
context.drawTexture(TEXTURE, guiX, guiY, 0, 0, containerWidth, containerHeight);
|
||||
drawSlots(context, guiX, guiY);
|
||||
}
|
||||
}
|
||||
|
@ -99,11 +99,9 @@ public class BackpackScreenHandler extends ScreenHandler {
|
||||
} else {
|
||||
super.onSlotClick(slotId, quickCraftData, actionType, playerEntity);
|
||||
}
|
||||
} else {
|
||||
if (playerEntity.getEntityWorld().isClient) {
|
||||
playerEntity.getEntityWorld().playSound(null, BlockPos.ofFloored(playerEntity.getPos()), SoundEvents.ENTITY_VILLAGER_NO,
|
||||
SoundCategory.PLAYERS, 1f, 1f);
|
||||
}
|
||||
} else if (playerEntity.getEntityWorld().isClient) {
|
||||
playerEntity.getEntityWorld().playSound(null, BlockPos.ofFloored(playerEntity.getPos()),
|
||||
SoundEvents.ENTITY_VILLAGER_NO, SoundCategory.PLAYERS, 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.container;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
@ -21,6 +19,8 @@ import net.minecraft.util.Identifier;
|
||||
public class BlockStackerScreen extends HandledScreen<BlockStackerScreenHandler>
|
||||
implements ScreenHandlerProvider<BlockStackerScreenHandler> {
|
||||
private final static Identifier TEXTURE = new Identifier(RegistryManager.QUICKIEFABRIC, "textures/gui/blockstacker.png");
|
||||
private final Integer containerHeight = 222;
|
||||
private final Integer containerWidth = 176;
|
||||
|
||||
public BlockStackerScreen(BlockStackerScreenHandler handler, PlayerInventory inventory, Text text) {
|
||||
super(handler, inventory, text);
|
||||
@ -29,7 +29,6 @@ public class BlockStackerScreen extends HandledScreen<BlockStackerScreenHandler>
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
this.titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,9 +39,11 @@ public class BlockStackerScreen extends HandledScreen<BlockStackerScreenHandler>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(DrawContext drawContext, float delta, int mouseX, int mouseY) {
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
super.renderBackground(drawContext);
|
||||
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
|
||||
context.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiX = (this.width - this.containerWidth) / 2;
|
||||
int guiY = (this.height - this.containerHeight) / 2;
|
||||
context.drawTexture(TEXTURE, guiX, guiY, 0, 0, containerWidth, containerHeight);
|
||||
super.renderBackground(context);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
@ -66,69 +67,73 @@ public class RegistryManager {
|
||||
public static final ScreenHandlerType<BlockStackerScreenHandler> BLOCKSTACKER_SCREEN_HANDLER = ScreenHandlerRegistry
|
||||
.registerSimple(RegistryManager.STACKER_IDENTIFIER, BlockStackerScreenHandler::new);
|
||||
|
||||
public static final ItemGroup QUICKIEFABRIC_GROUP = FabricItemGroup.builder()
|
||||
.displayName(Text.literal(QUICKIEFABRIC))
|
||||
.icon(() -> new ItemStack(QuickieItems.SPEEDPOWDER))
|
||||
.entries((enabledFeatures, stacks) -> {
|
||||
stacks.add(new ItemStack(QuickieItems.SALPETER));
|
||||
stacks.add(new ItemStack(QuickieItems.SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieItems.SPEEDPOWDER));
|
||||
stacks.add(new ItemStack(QuickieItems.LEVELUP));
|
||||
stacks.add(new ItemStack(QuickieItems.PENCIL));
|
||||
stacks.add(new ItemStack(QuickieItems.ROTTEN_FLESH_STRIPES));
|
||||
stacks.add(new ItemStack(QuickieItems.CARROTSTACK));
|
||||
stacks.add(new ItemStack(QuickieItems.COTTON));
|
||||
stacks.add(new ItemStack(QuickieItems.COTTONSEED));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_BROWN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_WHITE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_BLACK));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_BLUE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_CYAN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_GREEN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_PINK));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_RED));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_YELLOW));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_DARKGRAY));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_LIGHTGRAY));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_LIGHTGREEN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_MAGENTA));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_ORANGE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_PURPLE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_LIGHTBLUE));
|
||||
stacks.add(new ItemStack(QuickieItems.BAG));
|
||||
stacks.add(new ItemStack(QuickieItems.STUB));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERPICKAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERSHOVEL));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERHOE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERWATERHOE));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DIRT_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_NETHER_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_DEEPSLATESULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.LAVAHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.EMPTYLAVAHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ITEMHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.MONSTERHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.KELPSTACK));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_DOWN));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_EAST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_SOUTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_WEST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_NORTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILLSTOP));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERUP));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERDOWN));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKEREAST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERWEST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERNORTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERSOUTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSPREADER));
|
||||
}).build();
|
||||
public static final RegistryKey<ItemGroup> QUICKIEFABRIC_GROUP = RegistryKey.of(RegistryKeys.ITEM_GROUP,
|
||||
new Identifier(QUICKIEFABRIC, "itemgroups"));
|
||||
|
||||
public static final void registerItemGroup() {
|
||||
Registry.register(Registries.ITEM_GROUP, QUICKIEFABRIC_GROUP,
|
||||
FabricItemGroup.builder().icon(() -> new ItemStack(QuickieItems.SPEEDPOWDER))
|
||||
.displayName(Text.literal(QUICKIEFABRIC)).entries((enabledFeatures, stacks) -> {
|
||||
stacks.add(new ItemStack(QuickieItems.SALPETER));
|
||||
stacks.add(new ItemStack(QuickieItems.SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieItems.SPEEDPOWDER));
|
||||
stacks.add(new ItemStack(QuickieItems.LEVELUP));
|
||||
stacks.add(new ItemStack(QuickieItems.PENCIL));
|
||||
stacks.add(new ItemStack(QuickieItems.ROTTEN_FLESH_STRIPES));
|
||||
stacks.add(new ItemStack(QuickieItems.CARROTSTACK));
|
||||
stacks.add(new ItemStack(QuickieItems.COTTON));
|
||||
stacks.add(new ItemStack(QuickieItems.COTTONSEED));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_BROWN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_WHITE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_BLACK));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_BLUE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_CYAN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_GREEN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_PINK));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_RED));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_YELLOW));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_DARKGRAY));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_LIGHTGRAY));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_LIGHTGREEN));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_MAGENTA));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_ORANGE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_PURPLE));
|
||||
stacks.add(new ItemStack(QuickieItems.BACKPACK_LIGHTBLUE));
|
||||
stacks.add(new ItemStack(QuickieItems.BAG));
|
||||
stacks.add(new ItemStack(QuickieItems.STUB));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERPICKAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERSHOVEL));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERHOE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERWATERHOE));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DIRT_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_NETHER_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_DEEPSLATESULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.LAVAHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.EMPTYLAVAHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ITEMHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.MONSTERHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.KELPSTACK));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_DOWN));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_EAST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_SOUTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_WEST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILL_NORTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DRILLSTOP));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERUP));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERDOWN));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKEREAST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERWEST));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERNORTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSTACKERSOUTH));
|
||||
stacks.add(new ItemStack(QuickieBlocks.BLOCKSPREADER));
|
||||
}).build());
|
||||
}
|
||||
|
||||
private static final void registerBlock(Block block, String name) {
|
||||
Registry.register(Registries.BLOCK, new Identifier(QUICKIEFABRIC, name), block);
|
||||
@ -274,8 +279,8 @@ public class RegistryManager {
|
||||
BiomeSelectors.foundInOverworld(), FeaturesManager.overworldOres());
|
||||
|
||||
// Nether features
|
||||
BiomeModifications.create(new Identifier(QUICKIEFABRIC, "nether_features"))
|
||||
.add(ModificationPhase.ADDITIONS, BiomeSelectors.foundInTheNether(), FeaturesManager.netherOres());
|
||||
BiomeModifications.create(new Identifier(QUICKIEFABRIC, "nether_features")).add(ModificationPhase.ADDITIONS,
|
||||
BiomeSelectors.foundInTheNether(), FeaturesManager.netherOres());
|
||||
}
|
||||
|
||||
public static final void registerLootings() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user