diff --git a/CHANGELOG.md b/CHANGELOG.md index 706510f..513be92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ ## Additions -- Add `elytra_repair_ingredients` tag which controls which blocks azalea's can be placed on +- Add `seagrass_cant_plant_on` tag which controls which blocks a seagrass can't be placed on diff --git a/README.md b/README.md index fcf2e85..d00fa19 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This can be usefull for compatibility (this avoids possible conflicts with Mixin - `nether_wart_plantable_on` which controls which blocks a nether wart can be placed on - `not_pushable_by_piston` which controls which blocks cannot be pushed by a piston - `sugar_cane_plantable_on` which controls which blocks a sugar cane can be placed on +- `seagrass_cant_plant_on` which controls which blocks a seagrass can't be placed on - `wither_rose_plantable_on` which controls which blocks a wither rose can be placed on ### Item Tags diff --git a/src/main/java/fr/mysteriousdev/quilt_tag_plus/mixin/SeagrassBlockMixin.java b/src/main/java/fr/mysteriousdev/quilt_tag_plus/mixin/SeagrassBlockMixin.java new file mode 100644 index 0000000..14a84bd --- /dev/null +++ b/src/main/java/fr/mysteriousdev/quilt_tag_plus/mixin/SeagrassBlockMixin.java @@ -0,0 +1,17 @@ +package fr.mysteriousdev.quilt_tag_plus.mixin; + +import fr.mysteriousdev.quilt_tag_plus.utils.ModBlockTags; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.SeagrassBlock; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(SeagrassBlock.class) +public class SeagrassBlockMixin { + @Redirect(method = "canPlantOnTop", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z")) + private boolean canPlantOnTop(BlockState instance, Block block) { + return instance.isIn(ModBlockTags.SEAGRASS_CANT_PLANT_ON); + } +} diff --git a/src/main/java/fr/mysteriousdev/quilt_tag_plus/mixin/TallSeagrassBlockMixin.java b/src/main/java/fr/mysteriousdev/quilt_tag_plus/mixin/TallSeagrassBlockMixin.java new file mode 100644 index 0000000..64a60c6 --- /dev/null +++ b/src/main/java/fr/mysteriousdev/quilt_tag_plus/mixin/TallSeagrassBlockMixin.java @@ -0,0 +1,17 @@ +package fr.mysteriousdev.quilt_tag_plus.mixin; + +import fr.mysteriousdev.quilt_tag_plus.utils.ModBlockTags; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.TallSeagrassBlock; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(TallSeagrassBlock.class) +public class TallSeagrassBlockMixin { + @Redirect(method = "canPlantOnTop", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z")) + private boolean canPlantOnTop(BlockState instance, Block block) { + return instance.isIn(ModBlockTags.SEAGRASS_CANT_PLANT_ON); + } +} diff --git a/src/main/java/fr/mysteriousdev/quilt_tag_plus/utils/ModBlockTags.java b/src/main/java/fr/mysteriousdev/quilt_tag_plus/utils/ModBlockTags.java index cf4c356..4c1c940 100644 --- a/src/main/java/fr/mysteriousdev/quilt_tag_plus/utils/ModBlockTags.java +++ b/src/main/java/fr/mysteriousdev/quilt_tag_plus/utils/ModBlockTags.java @@ -14,6 +14,7 @@ public class ModBlockTags { public static final TagKey NETHER_WART_PLANTABLE_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "nether_wart_plantable_on")); public static final TagKey NOT_PUSHABLE_BY_PISTON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "not_pushable_by_piston")); public static final TagKey SUGAR_CANE_PLANTABLE_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "sugar_cane_plantable_on")); + public static final TagKey SEAGRASS_CANT_PLANT_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "seagrass_cant_plant_on")); public static final TagKey WITHER_ROSE_PLANTABLE_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "wither_rose_plantable_on")); } diff --git a/src/main/resources/data/quilt_tag_plus/tags/block/seagrass_cant_plant_on.json b/src/main/resources/data/quilt_tag_plus/tags/block/seagrass_cant_plant_on.json new file mode 100644 index 0000000..ba86722 --- /dev/null +++ b/src/main/resources/data/quilt_tag_plus/tags/block/seagrass_cant_plant_on.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:magma_block", + "minecraft:gold_block" + ] +} diff --git a/src/main/resources/quilt_tag_plus.mixins.json b/src/main/resources/quilt_tag_plus.mixins.json index 018e022..891e987 100644 --- a/src/main/resources/quilt_tag_plus.mixins.json +++ b/src/main/resources/quilt_tag_plus.mixins.json @@ -7,16 +7,18 @@ "ChorusFlowerBlockMixin", "ChorusPlantBlockMixin", "ChorusPlantFeatureMixin", + "ElytraItemMixin", "EndCrystalItemMixin", "FurnaceMinecartEntityMixin", "IronGolemEntityMixin", "NetherWartBlockMixin", "PistonBlockMixin", "RespawnAnchorBlockMixin", + "SeagrassBlockMixin", "SugarCaneBlockMixin", + "TallSeagrassBlockMixin", "TntBlockMixin", - "WitherRoseBlockMixin", - "ElytraItemMixin" + "WitherRoseBlockMixin" ], "client": [], "injectors": {