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