diff --git a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/TerraformHangingSign.java b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/TerraformHangingSign.java new file mode 100644 index 00000000..ef44c203 --- /dev/null +++ b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/TerraformHangingSign.java @@ -0,0 +1,7 @@ +package com.terraformersmc.terraform.sign; + +import net.minecraft.util.Identifier; + +public interface TerraformHangingSign extends TerraformSign { + Identifier getGuiTexture(); +} diff --git a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformHangingSignBlock.java b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformHangingSignBlock.java index 5e54b703..f3c8c1ef 100644 --- a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformHangingSignBlock.java +++ b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformHangingSignBlock.java @@ -1,21 +1,28 @@ package com.terraformersmc.terraform.sign.block; -import com.terraformersmc.terraform.sign.TerraformSign; +import com.terraformersmc.terraform.sign.TerraformHangingSign; import net.minecraft.block.HangingSignBlock; import net.minecraft.util.Identifier; import net.minecraft.util.SignType; -public class TerraformHangingSignBlock extends HangingSignBlock implements TerraformSign { +public class TerraformHangingSignBlock extends HangingSignBlock implements TerraformHangingSign { private final Identifier texture; + private final Identifier guiTexture; - public TerraformHangingSignBlock(Identifier texture, Settings settings) { + public TerraformHangingSignBlock(Identifier texture, Identifier guiTexture, Settings settings) { super(settings, SignType.OAK); this.texture = texture; + this.guiTexture = guiTexture; } @Override public Identifier getTexture() { return texture; } + + @Override + public Identifier getGuiTexture() { + return guiTexture; + } } diff --git a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformWallHangingSignBlock.java b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformWallHangingSignBlock.java index 58f80b7c..a8f18ece 100644 --- a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformWallHangingSignBlock.java +++ b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/block/TerraformWallHangingSignBlock.java @@ -1,21 +1,28 @@ package com.terraformersmc.terraform.sign.block; -import com.terraformersmc.terraform.sign.TerraformSign; +import com.terraformersmc.terraform.sign.TerraformHangingSign; import net.minecraft.block.WallHangingSignBlock; import net.minecraft.util.Identifier; import net.minecraft.util.SignType; -public class TerraformWallHangingSignBlock extends WallHangingSignBlock implements TerraformSign { +public class TerraformWallHangingSignBlock extends WallHangingSignBlock implements TerraformHangingSign { private final Identifier texture; + private final Identifier guiTexture; - public TerraformWallHangingSignBlock(Identifier texture, Settings settings) { + public TerraformWallHangingSignBlock(Identifier texture, Identifier guiTexture, Settings settings) { super(settings, SignType.OAK); this.texture = texture; + this.guiTexture = guiTexture; } @Override public Identifier getTexture() { return texture; } + + @Override + public Identifier getGuiTexture() { + return guiTexture; + } } diff --git a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/mixin/MixinHangingSignEditScreen.java b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/mixin/MixinHangingSignEditScreen.java index 0e904764..3af5afcb 100644 --- a/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/mixin/MixinHangingSignEditScreen.java +++ b/terraform-wood-api-v1/src/main/java/com/terraformersmc/terraform/sign/mixin/MixinHangingSignEditScreen.java @@ -1,6 +1,6 @@ package com.terraformersmc.terraform.sign.mixin; -import com.terraformersmc.terraform.sign.TerraformSign; +import com.terraformersmc.terraform.sign.TerraformHangingSign; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.entity.SignBlockEntity; @@ -22,8 +22,9 @@ public class MixinHangingSignEditScreen { @Inject(method = "", at = @At("TAIL")) private void initSignTextureId(SignBlockEntity signBlockEntity, boolean filtered, CallbackInfo ci) { - if (signBlockEntity.getCachedState().getBlock() instanceof TerraformSign) { - this.texture = ((TerraformSign) signBlockEntity.getCachedState().getBlock()).getTexture(); + if (signBlockEntity.getCachedState().getBlock() instanceof TerraformHangingSign) { + Identifier guiTexture = ((TerraformHangingSign) signBlockEntity.getCachedState().getBlock()).getGuiTexture(); + this.texture = new Identifier(guiTexture.getNamespace(), guiTexture.getPath() + ".png"); } } } diff --git a/terraform-wood-api-v1/src/testmod/java/com/terraformersmc/terraform/wood/test/TerraformWoodTest.java b/terraform-wood-api-v1/src/testmod/java/com/terraformersmc/terraform/wood/test/TerraformWoodTest.java index f9dace44..dcb4e42f 100644 --- a/terraform-wood-api-v1/src/testmod/java/com/terraformersmc/terraform/wood/test/TerraformWoodTest.java +++ b/terraform-wood-api-v1/src/testmod/java/com/terraformersmc/terraform/wood/test/TerraformWoodTest.java @@ -38,6 +38,7 @@ public class TerraformWoodTest implements ModInitializer { protected static final Identifier SIGN_TEXTURE_ID = new Identifier(MOD_ID, "entity/signs/custom"); protected static final Identifier HANGING_SIGN_TEXTURE_ID = new Identifier(MOD_ID, "entity/signs/hanging/custom"); + protected static final Identifier HANGING_SIGN_GUI_TEXTURE_ID = new Identifier(MOD_ID, "textures/gui/hanging_signs/custom"); private static final Identifier CUSTOM_SIGN_ID = new Identifier(MOD_ID, "custom_sign"); private static final Identifier CUSTOM_WALL_SIGN_ID = new Identifier(MOD_ID, "custom_wall_sign"); private static final Identifier CUSTOM_HANGING_SIGN_ID = new Identifier(MOD_ID, "custom_hanging_sign"); @@ -71,8 +72,8 @@ public void onInitialize() { Block sign = new TerraformSignBlock(SIGN_TEXTURE_ID, FabricBlockSettings.copyOf(Blocks.OAK_SIGN)); Block wallSign = new TerraformWallSignBlock(SIGN_TEXTURE_ID, FabricBlockSettings.copyOf(Blocks.OAK_WALL_SIGN)); - Block hangingSign = new TerraformHangingSignBlock(HANGING_SIGN_TEXTURE_ID, FabricBlockSettings.copyOf(Blocks.OAK_HANGING_SIGN)); - Block wallHangingSign = new TerraformWallHangingSignBlock(HANGING_SIGN_TEXTURE_ID, FabricBlockSettings.copyOf(Blocks.OAK_WALL_HANGING_SIGN)); + Block hangingSign = new TerraformHangingSignBlock(HANGING_SIGN_TEXTURE_ID, HANGING_SIGN_GUI_TEXTURE_ID, FabricBlockSettings.copyOf(Blocks.OAK_HANGING_SIGN)); + Block wallHangingSign = new TerraformWallHangingSignBlock(HANGING_SIGN_TEXTURE_ID, HANGING_SIGN_GUI_TEXTURE_ID, FabricBlockSettings.copyOf(Blocks.OAK_WALL_HANGING_SIGN)); Item signItem = new SignItem(new Item.Settings().maxCount(16), sign, wallSign); Item hangingSignItem = new HangingSignItem(hangingSign, wallHangingSign, new Item.Settings().maxCount(16)); diff --git a/terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/boat/custom.png b/terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/boat/custom_boat.png similarity index 100% rename from terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/boat/custom.png rename to terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/boat/custom_boat.png diff --git a/terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/chest_boat/custom.png b/terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/chest_boat/custom_boat.png similarity index 100% rename from terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/chest_boat/custom.png rename to terraform-wood-api-v1/src/testmod/resources/assets/terraform/textures/entity/chest_boat/custom_boat.png