prevent cacti from being transformed
@@ -6,21 +6,27 @@ import com.ferreusveritas.dynamictrees.ModBlocks;
import com.ferreusveritas.dynamictrees.ModConstants;
import com.ferreusveritas.dynamictrees.api.TreeHelper;
import com.ferreusveritas.dynamictrees.api.network.MapSignal;
+import com.ferreusveritas.dynamictrees.api.substances.ISubstanceEffect;
import com.ferreusveritas.dynamictrees.blocks.BlockBranch;
import com.ferreusveritas.dynamictrees.blocks.BlockBranchCactus;
import com.ferreusveritas.dynamictrees.blocks.BlockCactusSapling;
+import com.ferreusveritas.dynamictrees.entities.EntityLingeringEffector;
import com.ferreusveritas.dynamictrees.systems.GrowSignal;
import com.ferreusveritas.dynamictrees.systems.nodemappers.NodeFindEnds;
+import com.ferreusveritas.dynamictrees.systems.substances.SubstanceTransform;
+import com.ferreusveritas.dynamictrees.util.CompatHelper;
import com.ferreusveritas.dynamictrees.util.MathHelper;
import com.ferreusveritas.dynamictrees.worldgen.JoCode;
import com.ferreusveritas.dynamictrees.worldgen.TreeCodeStore;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Biomes;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -220,4 +226,21 @@ public class TreeCactus extends DynamicTree {
return null;
}
+ // Prevent transformation potions from being used on Cacti
+ @Override
+ public boolean applySubstance(World world, BlockPos rootPos, BlockPos hitPos, EntityPlayer player, EnumHand hand, ItemStack itemStack) {
+ ISubstanceEffect effect = getSubstanceEffect(itemStack);
+
+ if (effect != null && !(effect instanceof SubstanceTransform)) {
+ if(effect.isLingering()) {
+ CompatHelper.spawnEntity(world, new EntityLingeringEffector(world, rootPos, effect));
+ return true;
+ } else {
+ return effect.apply(world, rootPos);
+ }
+ }
+
+ return false;
+ }
+
}
