Allow mods to blacklist their blocks from Green Grove
This commit is contained in:
parent
f7682e5c29
commit
50bd8514ee
|
@ -6,6 +6,7 @@ Version 2.0.0-7
|
||||||
- Allow configuration of entity sacrificial values
|
- Allow configuration of entity sacrificial values
|
||||||
- [API] Allow setting of entity sacrificial values via API. Takes precedence over config values.
|
- [API] Allow setting of entity sacrificial values via API. Takes precedence over config values.
|
||||||
- [API] Method to easily get instances of Items and Blocks
|
- [API] Method to easily get instances of Items and Blocks
|
||||||
|
- [API] Allow mods to blacklist their blocks from the Green Grove ritual/sigil
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Version 2.0.0-6
|
Version 2.0.0-6
|
||||||
|
|
|
@ -20,9 +20,10 @@ public class BloodMagicAPI
|
||||||
{
|
{
|
||||||
@Getter
|
@Getter
|
||||||
private static final List<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
|
private static final List<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
|
private static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
|
||||||
|
@Getter
|
||||||
|
private static final ArrayList<Block> greenGroveBlacklist = new ArrayList<Block>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@ -159,4 +160,14 @@ public class BloodMagicAPI
|
||||||
if (!entitySacrificeValues.containsKey(entityClassName))
|
if (!entitySacrificeValues.containsKey(entityClassName))
|
||||||
entitySacrificeValues.put(entityClassName, sacrificeValue);
|
entitySacrificeValues.put(entityClassName, sacrificeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blacklists a block from the Green Grove Ritual and Sigil.
|
||||||
|
*
|
||||||
|
* @param block - Block to blacklist
|
||||||
|
*/
|
||||||
|
public static void blacklistFromGreenGrove(Block block) {
|
||||||
|
if (!greenGroveBlacklist.contains(block))
|
||||||
|
greenGroveBlacklist.add(block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.item.sigil;
|
package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.IGrowable;
|
import net.minecraft.block.IGrowable;
|
||||||
|
@ -49,15 +50,18 @@ public class ItemSigilGreenGrove extends ItemSigilToggleable
|
||||||
BlockPos blockPos = new BlockPos(ix, iy, iz);
|
BlockPos blockPos = new BlockPos(ix, iy, iz);
|
||||||
Block block = worldIn.getBlockState(blockPos).getBlock();
|
Block block = worldIn.getBlockState(blockPos).getBlock();
|
||||||
|
|
||||||
if (block instanceof IPlantable || block instanceof IGrowable)
|
if (!BloodMagicAPI.getGreenGroveBlacklist().contains(block))
|
||||||
{
|
{
|
||||||
if (worldIn.rand.nextInt(50) == 0)
|
if (block instanceof IPlantable || block instanceof IGrowable)
|
||||||
{
|
{
|
||||||
IBlockState preBlockState = worldIn.getBlockState(blockPos);
|
if (worldIn.rand.nextInt(50) == 0)
|
||||||
block.updateTick(worldIn, blockPos, worldIn.getBlockState(blockPos), worldIn.rand);
|
{
|
||||||
|
IBlockState preBlockState = worldIn.getBlockState(blockPos);
|
||||||
|
block.updateTick(worldIn, blockPos, worldIn.getBlockState(blockPos), worldIn.rand);
|
||||||
|
|
||||||
if (!worldIn.getBlockState(blockPos).equals(preBlockState))
|
if (!worldIn.getBlockState(blockPos).equals(preBlockState))
|
||||||
worldIn.playAuxSFX(2005, blockPos, 0);
|
worldIn.playAuxSFX(2005, blockPos, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.ritual;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.IGrowable;
|
import net.minecraft.block.IGrowable;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -50,10 +51,14 @@ public class RitualGreenGrove extends Ritual
|
||||||
{
|
{
|
||||||
IBlockState state = world.getBlockState(newPos);
|
IBlockState state = world.getBlockState(newPos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (block instanceof IPlantable || block instanceof IGrowable)
|
|
||||||
|
if (BloodMagicAPI.getGreenGroveBlacklist().contains(block))
|
||||||
{
|
{
|
||||||
block.updateTick(world, newPos, state, new Random());
|
if (block instanceof IPlantable || block instanceof IGrowable)
|
||||||
totalGrowths++;
|
{
|
||||||
|
block.updateTick(world, newPos, state, new Random());
|
||||||
|
totalGrowths++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalGrowths >= maxGrowths)
|
if (totalGrowths >= maxGrowths)
|
||||||
|
|
Loading…
Reference in a new issue