Removed path node mixin

This commit is contained in:
paulevsGitch 2021-02-06 04:41:22 +03:00
parent bea2bef853
commit d7161e5904
4 changed files with 14 additions and 29 deletions

View file

@ -7,10 +7,12 @@ import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.blocks.basis.EndPlantBlock; import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -37,4 +39,9 @@ public class MurkweedBlock extends EndPlantBlock {
protected boolean isTerrain(BlockState state) { protected boolean isTerrain(BlockState state) {
return state.isOf(EndBlocks.SHADOW_GRASS); return state.isOf(EndBlocks.SHADOW_GRASS);
} }
@Override
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) {
return false;
}
} }

View file

@ -10,12 +10,14 @@ import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.loot.context.LootContextParameters; import net.minecraft.loot.context.LootContextParameters;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.blocks.basis.EndPlantBlock; import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -44,4 +46,9 @@ public class NeedlegrassBlock extends EndPlantBlock {
protected boolean isTerrain(BlockState state) { protected boolean isTerrain(BlockState state) {
return state.isOf(EndBlocks.SHADOW_GRASS); return state.isOf(EndBlocks.SHADOW_GRASS);
} }
@Override
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) {
return false;
}
} }

View file

@ -1,28 +0,0 @@
package ru.betterend.mixin.common;
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.CallbackInfoReturnable;
import net.minecraft.block.BlockState;
import net.minecraft.entity.ai.pathing.LandPathNodeMaker;
import net.minecraft.entity.ai.pathing.PathNodeType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import ru.betterend.registry.EndBlocks;
@Mixin(LandPathNodeMaker.class)
public class LandPathNodeMakerMixin {
@Inject(method = "getCommonNodeType", at = @At(value = "HEAD"), cancellable = true)
private static void beModifyPathNodes(BlockView blockView, BlockPos blockPos, CallbackInfoReturnable<PathNodeType> info) {
BlockState blockState = blockView.getBlockState(blockPos);
if (blockState.isOf(EndBlocks.NEEDLEGRASS) || blockState.isOf(EndBlocks.MURKWEED)) {
beCactusDamage(info);
}
}
private static void beCactusDamage(CallbackInfoReturnable<PathNodeType> info) {
info.setReturnValue(PathNodeType.DAMAGE_CACTUS);
}
}

View file

@ -15,7 +15,6 @@
"ServerPlayerEntityMixin", "ServerPlayerEntityMixin",
"ComposterBlockAccessor", "ComposterBlockAccessor",
"ChorusFlowerBlockMixin", "ChorusFlowerBlockMixin",
"LandPathNodeMakerMixin",
"EndPortalFeatureMixin", "EndPortalFeatureMixin",
"ChorusPlantBlockMixin", "ChorusPlantBlockMixin",
"RecipeManagerAccessor", "RecipeManagerAccessor",