Skip to content

Commit

Permalink
Add seagrass_cant_plant_on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur-GYT committed Jul 21, 2024
1 parent b8ab833 commit 67232a2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ModBlockTags {
public static final TagKey<Block> NETHER_WART_PLANTABLE_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "nether_wart_plantable_on"));
public static final TagKey<Block> NOT_PUSHABLE_BY_PISTON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "not_pushable_by_piston"));
public static final TagKey<Block> SUGAR_CANE_PLANTABLE_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "sugar_cane_plantable_on"));
public static final TagKey<Block> SEAGRASS_CANT_PLANT_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "seagrass_cant_plant_on"));
public static final TagKey<Block> WITHER_ROSE_PLANTABLE_ON = TagKey.of(RegistryKeys.BLOCK, Identifier.of(Main.MODID, "wither_rose_plantable_on"));

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"minecraft:magma_block",
"minecraft:gold_block"
]
}
6 changes: 4 additions & 2 deletions src/main/resources/quilt_tag_plus.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
"ChorusFlowerBlockMixin",
"ChorusPlantBlockMixin",
"ChorusPlantFeatureMixin",
"ElytraItemMixin",
"EndCrystalItemMixin",
"FurnaceMinecartEntityMixin",
"IronGolemEntityMixin",
"NetherWartBlockMixin",
"PistonBlockMixin",
"RespawnAnchorBlockMixin",
"SeagrassBlockMixin",
"SugarCaneBlockMixin",
"TallSeagrassBlockMixin",
"TntBlockMixin",
"WitherRoseBlockMixin",
"ElytraItemMixin"
"WitherRoseBlockMixin"
],
"client": [],
"injectors": {
Expand Down

0 comments on commit 67232a2

Please sign in to comment.