Readd special flowers to small_flowers tag, prevent endermen pickup with a mixin

This commit is contained in:
Vincent Lee committed 2020-07-20 09:43:48 -05:00
1 parent 4f0958ca1a
commit e76edee845
8 files changed
+42 -18

No files matched your search

@@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#botania:special_flowers"
]
}
@@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"#botania:mystical_flowers"
"#botania:mystical_flowers",
"#botania:special_flowers"
]
}
@@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#botania:special_flowers"
]
}
@@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"#botania:mystical_flowers"
"#botania:mystical_flowers",
"#botania:special_flowers"
]
}
@@ -116,8 +116,7 @@ public class BlockTagProvider extends BlockTagsProvider {
.func_240531_a_(ModTags.Blocks.FUNCTIONAL_SPECIAL_FLOWERS);
func_240522_a_(BlockTags.TALL_FLOWERS).func_240531_a_(ModTags.Blocks.DOUBLE_MYSTICAL_FLOWERS);
func_240522_a_(BlockTags.SMALL_FLOWERS).func_240531_a_(ModTags.Blocks.MYSTICAL_FLOWERS);
func_240522_a_(BlockTags.FLOWERS).func_240531_a_(ModTags.Blocks.SPECIAL_FLOWERS);
func_240522_a_(BlockTags.SMALL_FLOWERS).func_240531_a_(ModTags.Blocks.MYSTICAL_FLOWERS).func_240531_a_(ModTags.Blocks.SPECIAL_FLOWERS);
func_240522_a_(BlockTags.IMPERMEABLE).func_240534_a_(ModBlocks.elfGlass, ModBlocks.manaGlass, ModBlocks.bifrost, ModBlocks.bifrostPerm);
func_240522_a_(BlockTags.BEACON_BASE_BLOCKS).func_240534_a_(ModBlocks.manasteelBlock, ModBlocks.terrasteelBlock, ModBlocks.elementiumBlock,
@@ -52,8 +52,7 @@ public class ItemTagProvider extends ItemTagsProvider {
this.func_240521_a_(ModTags.Blocks.SPECIAL_FLOWERS, ModTags.Items.SPECIAL_FLOWERS);
this.func_240522_a_(ItemTags.TALL_FLOWERS).func_240531_a_(ModTags.Items.DOUBLE_MYSTICAL_FLOWERS);
this.func_240522_a_(ItemTags.SMALL_FLOWERS).func_240531_a_(ModTags.Items.MYSTICAL_FLOWERS);
this.func_240522_a_(ItemTags.FLOWERS).func_240531_a_(ModTags.Items.SPECIAL_FLOWERS);
this.func_240522_a_(ItemTags.SMALL_FLOWERS).func_240531_a_(ModTags.Items.MYSTICAL_FLOWERS).func_240531_a_(ModTags.Items.SPECIAL_FLOWERS);
this.func_240522_a_(ModTags.Items.BURST_VIEWERS).func_240532_a_(ModItems.monocle);
}
@@ -0,0 +1,35 @@
package vazkii.botania.mixin;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import vazkii.botania.common.lib.ModTags;
import java.util.Random;
/**
* This Mixin prevents Endermen from picking up special flowers, even though they are in the small_flowers tag
* and thus the endermen_holdable tag.
*
* We want them in the small_flowers tag so things such as suspicious stew crafting and bee pollination will work,
* but Endermen griefing Botania machinery setups is not good.
*/
@Mixin(targets = { "net.minecraft.entity.monster.EndermanEntity$TakeBlockGoal" })
public class MixinEndermanPickupBlock {
@Inject(
at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"),
method = "tick()V",
locals = LocalCapture.CAPTURE_FAILSOFT,
cancellable = true
)
private void dontTakeMagicFlowers(CallbackInfo ci, Random rand, World world, int i, int j, int k, BlockPos takePos, BlockState takeState) {
if (takeState.isIn(ModTags.Blocks.SPECIAL_FLOWERS)) {
ci.cancel();
}
}
}
@@ -19,6 +19,7 @@
"AccessorNearestAttackableTarget",
"AccessorRecipeManager",
"AccessorWitherEntity",
"MixinEndermanPickupBlock",
"MixinPlayerEntity"
],
"client": [