From 418a52cbea888d32d52a25a8c9c3173b9843c9c7 Mon Sep 17 00:00:00 2001 From: Wolren <86470291+Wolren@users.noreply.github.com> Date: Wed, 22 May 2024 13:27:09 +0200 Subject: [PATCH] Attempted to fix generating of bed item textures (it's still broken) --- .../gay/pridecraft/joymod/JoyModClient.java | 3 +- .../pridecraft/joymod/block/ModBlocks.java | 35 +++-- .../joymod/block/custom/CustomBedBlock.java | 12 +- .../entity/custom/CustomBedBlockEntity.java | 7 +- .../assets/joymod/models/item/ace_bed.json | 121 +++++++++++++++++- 5 files changed, 151 insertions(+), 27 deletions(-) diff --git a/src/main/java/gay/pridecraft/joymod/JoyModClient.java b/src/main/java/gay/pridecraft/joymod/JoyModClient.java index 5390bf3..89a5c9c 100644 --- a/src/main/java/gay/pridecraft/joymod/JoyModClient.java +++ b/src/main/java/gay/pridecraft/joymod/JoyModClient.java @@ -1,7 +1,7 @@ package gay.pridecraft.joymod; -import gay.pridecraft.joymod.entity.ModEntities; import gay.pridecraft.joymod.block.ModBlocks; +import gay.pridecraft.joymod.entity.ModEntities; import gay.pridecraft.joymod.particle.ModParticles; import gay.pridecraft.joymod.particle.TotemOfPrideParticle; import gay.pridecraft.joymod.renderer.entity.*; @@ -13,7 +13,6 @@ import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback; -import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.block.entity.BlockEntityRendererFactories; import net.minecraft.util.Identifier; diff --git a/src/main/java/gay/pridecraft/joymod/block/ModBlocks.java b/src/main/java/gay/pridecraft/joymod/block/ModBlocks.java index c2fdca0..5b8f04a 100644 --- a/src/main/java/gay/pridecraft/joymod/block/ModBlocks.java +++ b/src/main/java/gay/pridecraft/joymod/block/ModBlocks.java @@ -10,60 +10,59 @@ import net.minecraft.block.CandleBlock; import net.minecraft.block.CandleCakeBlock; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.registry.Registry; import net.minecraft.registry.Registries; -import net.minecraft.util.DyeColor; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; public class ModBlocks { public static final Block GAY_BED = registerBlock("gay_bed", - new CustomBedBlock(DyeColor.RED, FabricBlockSettings.copyOf(Blocks.RED_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.RED_BED))); public static final Block ENBY_BED = registerBlock("enby_bed", - new CustomBedBlock(DyeColor.BLACK, FabricBlockSettings.copyOf(Blocks.BLACK_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.BLACK_BED))); public static final Block INTERSEX_BED = registerBlock("intersex_bed", - new CustomBedBlock(DyeColor.GREEN, FabricBlockSettings.copyOf(Blocks.GREEN_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.GREEN_BED))); public static final Block AGENDER_BED = registerBlock("agender_bed", - new CustomBedBlock(DyeColor.BROWN, FabricBlockSettings.copyOf(Blocks.BROWN_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.BROWN_BED))); public static final Block BIGENDER_BED = registerBlock("bigender_bed", - new CustomBedBlock(DyeColor.BLUE, FabricBlockSettings.copyOf(Blocks.BLUE_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.BLUE_BED))); public static final Block BISEXUAL_BED = registerBlock("bisexual_bed", - new CustomBedBlock(DyeColor.PURPLE, FabricBlockSettings.copyOf(Blocks.PURPLE_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.PURPLE_BED))); public static final Block MLM_BED = registerBlock("mlm_bed", - new CustomBedBlock(DyeColor.CYAN, FabricBlockSettings.copyOf(Blocks.CYAN_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.CYAN_BED))); public static final Block ACE_BED = registerBlock("ace_bed", - new CustomBedBlock(DyeColor.LIGHT_GRAY, FabricBlockSettings.copyOf(Blocks.LIGHT_GRAY_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.LIGHT_GRAY_BED))); public static final Block ARO_BED = registerBlock("aro_bed", - new CustomBedBlock(DyeColor.GRAY, FabricBlockSettings.copyOf(Blocks.GRAY_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.GRAY_BED))); public static final Block APLATONIC_BED = registerBlock("aplatonic_bed", - new CustomBedBlock(DyeColor.PINK, FabricBlockSettings.copyOf(Blocks.PINK_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.PINK_BED))); public static final Block GENDER_FLUID_BED = registerBlock("gender_fluid_bed", - new CustomBedBlock(DyeColor.LIME, FabricBlockSettings.copyOf(Blocks.LIME_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.LIME_BED))); public static final Block PAN_BED = registerBlock("pan_bed", - new CustomBedBlock(DyeColor.YELLOW, FabricBlockSettings.copyOf(Blocks.YELLOW_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.YELLOW_BED))); public static final Block TRANS_BED = registerBlock("trans_bed", - new CustomBedBlock(DyeColor.LIGHT_BLUE, FabricBlockSettings.copyOf(Blocks.LIGHT_BLUE_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.LIGHT_BLUE_BED))); public static final Block AROACE_BED = registerBlock("aroace_bed", - new CustomBedBlock(DyeColor.MAGENTA, FabricBlockSettings.copyOf(Blocks.MAGENTA_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.MAGENTA_BED))); public static final Block LESBIAN_BED = registerBlock("lesbian_bed", - new CustomBedBlock(DyeColor.ORANGE, FabricBlockSettings.copyOf(Blocks.ORANGE_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.ORANGE_BED))); public static final Block PROGRESS_BED = registerBlock("progress_bed", - new CustomBedBlock(DyeColor.WHITE, FabricBlockSettings.copyOf(Blocks.WHITE_BED))); + new CustomBedBlock(FabricBlockSettings.copyOf(Blocks.WHITE_BED))); public static final Block GAY_CANDLE = registerBlock("gay_candle", new CandleBlock(FabricBlockSettings.copyOf(Blocks.CANDLE))); diff --git a/src/main/java/gay/pridecraft/joymod/block/custom/CustomBedBlock.java b/src/main/java/gay/pridecraft/joymod/block/custom/CustomBedBlock.java index e7e125e..880f32e 100644 --- a/src/main/java/gay/pridecraft/joymod/block/custom/CustomBedBlock.java +++ b/src/main/java/gay/pridecraft/joymod/block/custom/CustomBedBlock.java @@ -2,18 +2,24 @@ package gay.pridecraft.joymod.block.custom; import gay.pridecraft.joymod.entity.custom.CustomBedBlockEntity; import net.minecraft.block.BedBlock; +import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.util.DyeColor; import net.minecraft.util.math.BlockPos; +import org.jetbrains.annotations.Nullable; public class CustomBedBlock extends BedBlock { - public CustomBedBlock(DyeColor color, Settings settings) { - super(color, settings); + public CustomBedBlock(Settings settings) { + super(DyeColor.WHITE, settings); } - @Override + @Nullable public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { return new CustomBedBlockEntity(pos, state); } + + public BlockRenderType getRenderType(BlockState state) { + return BlockRenderType.MODEL; + } } diff --git a/src/main/java/gay/pridecraft/joymod/entity/custom/CustomBedBlockEntity.java b/src/main/java/gay/pridecraft/joymod/entity/custom/CustomBedBlockEntity.java index bc07249..b73b830 100644 --- a/src/main/java/gay/pridecraft/joymod/entity/custom/CustomBedBlockEntity.java +++ b/src/main/java/gay/pridecraft/joymod/entity/custom/CustomBedBlockEntity.java @@ -7,22 +7,25 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; +import net.minecraft.util.DyeColor; import net.minecraft.util.math.BlockPos; public class CustomBedBlockEntity extends BlockEntity { public final SpriteIdentifier bedTexture; + public DyeColor color; public CustomBedBlockEntity(BlockPos pos, BlockState state) { super(ModEntities.CUSTOM_BED_BLOCK_ENTITY, pos, state); this.bedTexture = BedTextureProvider.getSpriteIdentifierForBed(state.getBlock()); + this.color = DyeColor.PINK; } public CustomBedBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { - super(type, pos, state); + super(ModEntities.CUSTOM_BED_BLOCK_ENTITY, pos, state); this.bedTexture = BedTextureProvider.getSpriteIdentifierForBed(state.getBlock()); } public BlockEntityUpdateS2CPacket toUpdatePacket() { return BlockEntityUpdateS2CPacket.create(this); } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/joymod/models/item/ace_bed.json b/src/main/resources/assets/joymod/models/item/ace_bed.json index 3d22676..cbde809 100644 --- a/src/main/resources/assets/joymod/models/item/ace_bed.json +++ b/src/main/resources/assets/joymod/models/item/ace_bed.json @@ -1,7 +1,124 @@ { - "parent": "minecraft:item/template_bed", "textures": { - "layer0": "joymod:block/ace_bed", + "1": "joymod:entity/bed/ace_bed", "particle": "minecraft:block/oak_planks" + }, + "elements": [ + { + "name": "head", + "from": [0, 3, 0], + "to": [16, 9, 16], + "rotation": {"angle": 0, "axis": "x", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [9.5, 0, 5.5, 1.5], "rotation": 180, "texture": "#1"}, + "east": {"uv": [0, 1.5, 1.5, 5.5], "rotation": 270, "texture": "#1"}, + "south": {"uv": [5.5, 1.5, 1.5, 0], "texture": "#1"}, + "west": {"uv": [5.5, 1.5, 7, 5.5], "rotation": 90, "texture": "#1"}, + "up": {"uv": [1.5, 1.5, 5.5, 5.5], "rotation": 180, "texture": "#1"}, + "down": {"uv": [7, 1.5, 11, 5.5], "texture": "#1"} + } + }, + { + "name": "foot", + "from": [0, 3, -16], + "to": [16, 9, 0], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [5.5, 5.5, 9.5, 7], "rotation": 180, "texture": "#1"}, + "east": {"uv": [0, 7, 1.5, 11], "rotation": 270, "texture": "#1"}, + "south": {"uv": [1.5, 5.5, 5.5, 7], "texture": "#1"}, + "west": {"uv": [5.5, 7, 7, 11], "rotation": 90, "texture": "#1"}, + "up": {"uv": [5.5, 11, 1.5, 7], "texture": "#1"}, + "down": {"uv": [11, 7, 7, 11], "texture": "#1"} + } + }, + { + "name": "leg1", + "from": [13, 0, 13], + "to": [16, 3, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [13.25, 2.25, 14, 3], "texture": "#1"}, + "east": {"uv": [12.5, 2.25, 13.25, 3], "texture": "#1"}, + "south": {"uv": [14.75, 2.25, 15.5, 3], "texture": "#1"}, + "west": {"uv": [14, 2.25, 14.75, 3], "texture": "#1"}, + "up": {"uv": [14, 2.25, 13.25, 1.5], "texture": "#1"}, + "down": {"uv": [14.75, 1.5, 14, 2.25], "texture": "#1"} + } + }, + { + "name": "leg2", + "from": [0, 0, 13], + "to": [3, 3, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [13.25, 5.25, 14, 6], "texture": "#1"}, + "east": {"uv": [12.5, 5.25, 13.25, 6], "texture": "#1"}, + "south": {"uv": [14.75, 5.25, 15.5, 6], "texture": "#1"}, + "west": {"uv": [14, 5.25, 14.75, 6], "texture": "#1"}, + "up": {"uv": [14, 5.25, 13.25, 4.5], "texture": "#1"}, + "down": {"uv": [14.75, 4.5, 14, 5.25], "texture": "#1"} + } + }, + { + "name": "leg3", + "from": [13, 0, -16], + "to": [16, 3, -13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [13.25, 0.75, 14, 1.5], "texture": "#1"}, + "east": {"uv": [12.5, 0.75, 13.25, 1.5], "texture": "#1"}, + "south": {"uv": [14.75, 0.75, 15.5, 1.5], "texture": "#1"}, + "west": {"uv": [14, 0.75, 14.75, 1.5], "texture": "#1"}, + "up": {"uv": [14, 0.75, 13.25, 0], "texture": "#1"}, + "down": {"uv": [14.75, 0, 14, 0.75], "texture": "#1"} + } + }, + { + "name": "leg4", + "from": [0, 0, -16], + "to": [3, 3, -13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [13.25, 3.75, 14, 4.5], "texture": "#1"}, + "east": {"uv": [12.5, 3.75, 13.25, 4.5], "texture": "#1"}, + "south": {"uv": [14.75, 3.75, 15.5, 4.5], "texture": "#1"}, + "west": {"uv": [14, 3.75, 14.75, 4.5], "texture": "#1"}, + "up": {"uv": [14, 3.75, 13.25, 3], "texture": "#1"}, + "down": {"uv": [14.75, 3, 14, 3.75], "texture": "#1"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [ 30, 160, 0 ], + "translation": [ 0, 3, -2], + "scale":[ 0.23, 0.23, 0.23] + }, + "firstperson_righthand": { + "rotation": [ 30, 160, 0 ], + "translation": [ 0, 3, 0], + "scale":[ 0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [ 30, 160, 0 ], + "translation": [ 2, 3, 0], + "scale":[ 0.5325, 0.5325, 0.5325] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 1, 2], + "scale":[ 0.25, 0.25, 0.25] + }, + "head": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 10, -8], + "scale":[ 1,1,1 ] + }, + "fixed": { + "rotation": [ 270, 0, 0 ], + "translation": [ 0, 4, -2], + "scale":[ 0.5, 0.5, 0.5] + } } } \ No newline at end of file