mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Added config options to change the harvest level of the Weight and Bore Lenses and defined said harvest levels properly in the check for what they can break/displace.
This commit is contained in:
1 parent
69f6d26de0
commit
a9ba227055
4 files changed
+29
-14
No files matched your search
@@ -88,6 +88,8 @@ public final class ConfigHandler {
|
||||
public static boolean ringOfOdinFireResist = true;
|
||||
public static boolean enderStuff19Enabled = true;
|
||||
public static boolean invertMagnetRing = false;
|
||||
public static int harvestLevelWeight = 2;
|
||||
public static int harvestLevelBore = 3;
|
||||
|
||||
public static int flowerQuantity = 2;
|
||||
public static int flowerDensity = 2;
|
||||
@@ -245,6 +247,12 @@ public final class ConfigHandler {
|
||||
desc = "Set this to true to invert the Ring of Magnetization's controls (from shift to stop to shift to work)";
|
||||
invertMagnetRing = loadPropBool("magnetRing.invert", desc, invertMagnetRing);
|
||||
|
||||
desc = "The harvest level of the Mana Lens: Weight. 3 is diamond level. Defaults to 2 (iron level)";
|
||||
harvestLevelWeight = loadPropInt("harvestLevel.weightLens", desc, harvestLevelWeight);
|
||||
|
||||
desc = "The harvest level of the Mana Lens: Bore. 3 is diamond level. Defaults to 3";
|
||||
harvestLevelBore = loadPropInt("harvestLevel.boreLens", desc, harvestLevelBore);
|
||||
|
||||
desc = "The quantity of Botania flower patches to generate in the world, defaults to 2, the lower the number the less patches generate.";
|
||||
flowerQuantity = loadPropInt("worldgen.flower.quantity", desc, flowerQuantity);
|
||||
|
||||
|
||||
@@ -37,21 +37,23 @@ public class LensMine extends Lens {
|
||||
int y = pos.blockY;
|
||||
int z = pos.blockZ;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
ItemStack composite = ((ItemLens) ModItems.lens).getCompositeLens(stack);
|
||||
boolean warp = composite != null && composite.getItem() == ModItems.lens && composite.getItemDamage() == ItemLens.WARP;
|
||||
|
||||
|
||||
if(warp && (block == ModBlocks.pistonRelay || block == Blocks.piston || block == Blocks.piston_extension || block == Blocks.piston_head))
|
||||
return false;
|
||||
|
||||
int harvestLevel = ConfigHandler.harvestLevelBore;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
float hardness = block.getBlockHardness(world, x, y, z);
|
||||
int neededHarvestLevel = block.getHarvestLevel(meta);
|
||||
int mana = burst.getMana();
|
||||
|
||||
ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
|
||||
if((coords.posX != x || coords.posY != y || coords.posZ != z) && !(tile instanceof IManaBlock) && block != null && hardness != -1 && hardness < 50F && (burst.isFake() || mana >= 24)) {
|
||||
if((coords.posX != x || coords.posY != y || coords.posZ != z) && !(tile instanceof IManaBlock) && neededHarvestLevel <= harvestLevel && hardness != -1 && hardness < 50F && (burst.isFake() || mana >= 24)) {
|
||||
List<ItemStack> items = new ArrayList();
|
||||
|
||||
items.addAll(block.getDrops(world, x, y, z, meta, 0));
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
public class LensWeight extends Lens {
|
||||
|
||||
@@ -25,10 +26,14 @@ public class LensWeight extends Lens {
|
||||
int x = pos.blockX;
|
||||
int y = pos.blockY;
|
||||
int z = pos.blockZ;
|
||||
int harvestLevel = ConfigHandler.harvestLevelWeight;
|
||||
|
||||
Block block = entity.worldObj.getBlock(x, y, z);
|
||||
Block blockBelow = entity.worldObj.getBlock(x, y - 1, z);
|
||||
int meta = entity.worldObj.getBlockMetadata(x, y, z);
|
||||
if(blockBelow.isAir(entity.worldObj, x, y - 1, z) && block.getBlockHardness(entity.worldObj, x, y, z) != -1 && entity.worldObj.getTileEntity(x, y, z) == null && block.canSilkHarvest(entity.worldObj, null, x, y, z, meta)) {
|
||||
int neededHarvestLevel = block.getHarvestLevel(meta);
|
||||
|
||||
if(blockBelow.isAir(entity.worldObj, x, y - 1, z) && block.getBlockHardness(entity.worldObj, x, y, z) != -1 && neededHarvestLevel <= harvestLevel && entity.worldObj.getTileEntity(x, y, z) == null && block.canSilkHarvest(entity.worldObj, null, x, y, z, meta)) {
|
||||
EntityFallingBlock falling = new EntityFallingBlock(entity.worldObj, x + 0.5, y + 0.5, z + 0.5, block, meta);
|
||||
if(!entity.worldObj.isRemote)
|
||||
entity.worldObj.spawnEntityInWorld(falling);
|
||||
|
||||
Reference in new issue
Block a user