mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 00:49:33 +00:00
2.2.4
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'net.momirealms'
|
group = 'net.momirealms'
|
||||||
version = '2.2.3'
|
version = '2.2.4'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -74,6 +74,7 @@ dependencies {
|
|||||||
implementation('net.kyori:adventure-text-minimessage:4.12.0')
|
implementation('net.kyori:adventure-text-minimessage:4.12.0')
|
||||||
implementation("de.tr7zw:item-nbt-api:2.11.1")
|
implementation("de.tr7zw:item-nbt-api:2.11.1")
|
||||||
implementation("org.bstats:bstats-bukkit:3.0.0")
|
implementation("org.bstats:bstats-bukkit:3.0.0")
|
||||||
|
implementation fileTree(dir:'libs',includes:['BiomeAPI.jar'])
|
||||||
}
|
}
|
||||||
|
|
||||||
def targetJavaVersion = 17
|
def targetJavaVersion = 17
|
||||||
@@ -109,6 +110,7 @@ shadowJar {
|
|||||||
relocate ('de.tr7zw', 'net.momirealms.customcrops.libs.de.tr7zw')
|
relocate ('de.tr7zw', 'net.momirealms.customcrops.libs.de.tr7zw')
|
||||||
relocate ('net.kyori', 'net.momirealms.customcrops.libs.net.kyori')
|
relocate ('net.kyori', 'net.momirealms.customcrops.libs.net.kyori')
|
||||||
relocate ('org.bstats', 'net.momirealms.customcrops.libs.org.bstats')
|
relocate ('org.bstats', 'net.momirealms.customcrops.libs.org.bstats')
|
||||||
|
relocate 'net.momirealms.biomeapi', 'net.momirealms.customcrops.libs.net.momirealms.biomeapi'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("delete", Delete).get().delete("build/libs/"+project.name+"-"+project.version+".jar")
|
tasks.register("delete", Delete).get().delete("build/libs/"+project.name+"-"+project.version+".jar")
|
||||||
|
|||||||
BIN
libs/BiomeAPI.jar
Normal file
BIN
libs/BiomeAPI.jar
Normal file
Binary file not shown.
@@ -641,6 +641,7 @@ public abstract class HandlerP extends Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkHarvestRequirements(Player player, Location location, Crop crop) {
|
protected boolean checkHarvestRequirements(Player player, Location location, Crop crop) {
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE) return true;
|
||||||
PlayerCondition playerCondition = new PlayerCondition(location, player);
|
PlayerCondition playerCondition = new PlayerCondition(location, player);
|
||||||
if (crop.getHarvestRequirements() != null) {
|
if (crop.getHarvestRequirements() != null) {
|
||||||
for (RequirementInterface requirement : crop.getHarvestRequirements()) {
|
for (RequirementInterface requirement : crop.getHarvestRequirements()) {
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
package net.momirealms.customcrops.integrations.customplugin.oraxen;
|
package net.momirealms.customcrops.integrations.customplugin.oraxen;
|
||||||
|
|
||||||
|
import dev.lone.itemsadder.api.CustomBlock;
|
||||||
|
import dev.lone.itemsadder.api.CustomStack;
|
||||||
|
import io.th0rgal.oraxen.api.OraxenBlocks;
|
||||||
import io.th0rgal.oraxen.api.OraxenItems;
|
import io.th0rgal.oraxen.api.OraxenItems;
|
||||||
import io.th0rgal.oraxen.api.events.OraxenFurnitureBreakEvent;
|
import io.th0rgal.oraxen.api.events.OraxenFurnitureBreakEvent;
|
||||||
import io.th0rgal.oraxen.api.events.OraxenFurnitureInteractEvent;
|
import io.th0rgal.oraxen.api.events.OraxenFurnitureInteractEvent;
|
||||||
@@ -24,6 +27,7 @@ import io.th0rgal.oraxen.api.events.OraxenNoteBlockBreakEvent;
|
|||||||
import io.th0rgal.oraxen.api.events.OraxenNoteBlockInteractEvent;
|
import io.th0rgal.oraxen.api.events.OraxenNoteBlockInteractEvent;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureFactory;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureFactory;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
||||||
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanic;
|
||||||
import io.th0rgal.oraxen.utils.drops.Drop;
|
import io.th0rgal.oraxen.utils.drops.Drop;
|
||||||
import net.momirealms.customcrops.api.crop.Crop;
|
import net.momirealms.customcrops.api.crop.Crop;
|
||||||
import net.momirealms.customcrops.config.BasicItemConfig;
|
import net.momirealms.customcrops.config.BasicItemConfig;
|
||||||
@@ -43,6 +47,9 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
@@ -136,33 +143,65 @@ public class OraxenFrameHandler extends OraxenHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onInteractNoteBlock(OraxenNoteBlockInteractEvent event) {
|
||||||
|
// final Player player = event.getPlayer();
|
||||||
|
// final ItemStack itemInHand = event.getItemInHand();
|
||||||
|
// final Block block = event.getBlock();
|
||||||
|
//
|
||||||
|
// String blockID = event.getMechanic().getItemID();
|
||||||
|
// if (!blockID.equals(BasicItemConfig.dryPot) && !blockID.equals(BasicItemConfig.wetPot)) return;
|
||||||
|
//
|
||||||
|
// Location potLoc = block.getLocation();
|
||||||
|
// Location seedLoc = potLoc.clone().add(0,1,0);
|
||||||
|
//
|
||||||
|
// if (super.tryMisc(player, itemInHand, potLoc)) return;
|
||||||
|
// if (event.getBlockFace() != BlockFace.UP) return;
|
||||||
|
//
|
||||||
|
// String id = OraxenItems.getIdByItem(itemInHand);
|
||||||
|
// if (id != null) {
|
||||||
|
// if (id.endsWith("_seeds")) {
|
||||||
|
// String cropName = id.substring(0, id.length() - 6);
|
||||||
|
// plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (MainConfig.enableConvert) {
|
||||||
|
// String cropName = MainConfig.vanilla2Crops.get(itemInHand.getType());
|
||||||
|
// if (cropName == null) return;
|
||||||
|
// plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInteractNoteBlock(OraxenNoteBlockInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final ItemStack itemInHand = event.getItemInHand();
|
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||||
final Block block = event.getBlock();
|
super.onPlayerInteract(event);
|
||||||
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
String blockID = event.getMechanic().getItemID();
|
|
||||||
if (!blockID.equals(BasicItemConfig.dryPot) && !blockID.equals(BasicItemConfig.wetPot)) return;
|
|
||||||
|
|
||||||
Location potLoc = block.getLocation();
|
|
||||||
Location seedLoc = potLoc.clone().add(0,1,0);
|
|
||||||
|
|
||||||
if (super.tryMisc(player, itemInHand, potLoc)) return;
|
|
||||||
if (event.getBlockFace() != BlockFace.UP) return;
|
if (event.getBlockFace() != BlockFace.UP) return;
|
||||||
|
Block block = event.getClickedBlock();
|
||||||
String id = OraxenItems.getIdByItem(itemInHand);
|
if (block == null) return;
|
||||||
if (id != null) {
|
NoteBlockMechanic noteBlockMechanic = OraxenBlocks.getNoteBlockMechanic(block);
|
||||||
if (id.endsWith("_seeds")) {
|
if (noteBlockMechanic != null) {
|
||||||
String cropName = id.substring(0, id.length() - 6);
|
final String blockID = noteBlockMechanic.getItemID();
|
||||||
|
if (!blockID.equals(BasicItemConfig.wetPot) && !blockID.equals(BasicItemConfig.dryPot)) return;
|
||||||
|
Location seedLoc = block.getLocation().clone().add(0,1,0);
|
||||||
|
ItemStack itemInHand = event.getItem();
|
||||||
|
Location potLoc = block.getLocation();
|
||||||
|
if (super.tryMisc(player, itemInHand, potLoc)) return;
|
||||||
|
String id = OraxenItems.getIdByItem(itemInHand);
|
||||||
|
if (id != null) {
|
||||||
|
if (id.endsWith("_seeds")) {
|
||||||
|
String cropName = id.substring(0, id.length() - 6);
|
||||||
|
plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (MainConfig.enableConvert) {
|
||||||
|
String cropName = MainConfig.vanilla2Crops.get(itemInHand.getType());
|
||||||
|
if (cropName == null) return;
|
||||||
plantSeed(seedLoc, cropName, player, itemInHand);
|
plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (MainConfig.enableConvert) {
|
|
||||||
String cropName = MainConfig.vanilla2Crops.get(itemInHand.getType());
|
|
||||||
if (cropName == null) return;
|
|
||||||
plantSeed(seedLoc, cropName, player, itemInHand);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
package net.momirealms.customcrops.integrations.customplugin.oraxen;
|
package net.momirealms.customcrops.integrations.customplugin.oraxen;
|
||||||
|
|
||||||
|
import io.th0rgal.oraxen.api.OraxenBlocks;
|
||||||
import io.th0rgal.oraxen.api.OraxenItems;
|
import io.th0rgal.oraxen.api.OraxenItems;
|
||||||
import io.th0rgal.oraxen.api.events.*;
|
import io.th0rgal.oraxen.api.events.*;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureFactory;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureFactory;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanic;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanic;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanicFactory;
|
|
||||||
import io.th0rgal.oraxen.utils.drops.Drop;
|
import io.th0rgal.oraxen.utils.drops.Drop;
|
||||||
import net.momirealms.customcrops.api.crop.Crop;
|
import net.momirealms.customcrops.api.crop.Crop;
|
||||||
import net.momirealms.customcrops.config.BasicItemConfig;
|
import net.momirealms.customcrops.config.BasicItemConfig;
|
||||||
@@ -40,6 +40,9 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class OraxenWireHandler extends OraxenHandler{
|
public class OraxenWireHandler extends OraxenHandler{
|
||||||
@@ -122,83 +125,159 @@ public class OraxenWireHandler extends OraxenHandler{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public void onInteractNoteBlock(OraxenNoteBlockInteractEvent event) {
|
// public void onInteractNoteBlock(OraxenNoteBlockInteractEvent event) {
|
||||||
if (event.isCancelled()) return;
|
// if (event.isCancelled()) return;
|
||||||
|
// if (event.getHand() != EquipmentSlot.HAND) return;
|
||||||
final ItemStack itemInHand = event.getItemInHand();
|
//
|
||||||
final Location potLoc = event.getBlock().getLocation();
|
// final ItemStack itemInHand = event.getItemInHand();
|
||||||
final Player player = event.getPlayer();
|
// final Location potLoc = event.getBlock().getLocation();
|
||||||
|
// final Player player = event.getPlayer();
|
||||||
if (super.tryMisc(event.getPlayer(), itemInHand, potLoc)) return;
|
//
|
||||||
if (event.getBlockFace() != BlockFace.UP) return;
|
// if (super.tryMisc(event.getPlayer(), itemInHand, potLoc)) return;
|
||||||
|
// if (event.getBlockFace() != BlockFace.UP) return;
|
||||||
Location seedLoc = potLoc.clone().add(0,1,0);
|
//
|
||||||
|
// Location seedLoc = potLoc.clone().add(0,1,0);
|
||||||
String id = OraxenItems.getIdByItem(itemInHand);
|
//
|
||||||
if (id != null) {
|
// String id = OraxenItems.getIdByItem(itemInHand);
|
||||||
if (id.endsWith("_seeds")) {
|
// if (id != null) {
|
||||||
String cropName = id.substring(0, id.length() - 6);
|
// if (id.endsWith("_seeds")) {
|
||||||
plantSeed(seedLoc, cropName, player, itemInHand);
|
// String cropName = id.substring(0, id.length() - 6);
|
||||||
}
|
// plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
}
|
// }
|
||||||
else if (MainConfig.enableConvert) {
|
// }
|
||||||
String cropName = MainConfig.vanilla2Crops.get(itemInHand.getType());
|
// else if (MainConfig.enableConvert) {
|
||||||
if (cropName == null) return;
|
// String cropName = MainConfig.vanilla2Crops.get(itemInHand.getType());
|
||||||
plantSeed(seedLoc, cropName, player, itemInHand);
|
// if (cropName == null) return;
|
||||||
}
|
// plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInteractStringBlock(OraxenStringBlockInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final Block block = event.getBlock();
|
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||||
final String id = event.getMechanic().getItemID();
|
super.onPlayerInteract(event);
|
||||||
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
if (!id.contains("_stage_")) return;
|
Block block = event.getClickedBlock();
|
||||||
|
if (block == null) return;
|
||||||
Location seedLoc = block.getLocation();
|
Location location = block.getLocation();
|
||||||
ItemStack itemInHand = event.getItemInHand();
|
final String blockID = customInterface.getBlockID(location);
|
||||||
if (!id.equals(BasicItemConfig.deadCrop)) {
|
if (blockID == null) return;
|
||||||
if (isRipe(id)) {
|
if (blockID.contains("_stage_")) {
|
||||||
if (MainConfig.canRightClickHarvest && !(MainConfig.emptyHand && itemInHand != null && itemInHand.getType() != Material.AIR)) {
|
ItemStack itemInHand = event.getItem();
|
||||||
if (!CCAntiGrief.testBreak(player, seedLoc)) return;
|
if (!blockID.equals(BasicItemConfig.deadCrop)) {
|
||||||
Crop crop = customInterface.getCropFromID(id);
|
if (isRipe(blockID)) {
|
||||||
if (crop == null) return;
|
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||||
if (!checkHarvestRequirements(player, seedLoc, crop)) {
|
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||||
event.setCancelled(true);
|
if (MainConfig.canRightClickHarvest && !(MainConfig.emptyHand && (mainHand.getType() != Material.AIR || offHand.getType() != Material.AIR))) {
|
||||||
|
if (!CCAntiGrief.testBreak(player, location)) return;
|
||||||
|
Crop crop = customInterface.getCropFromID(blockID);
|
||||||
|
if (crop == null) return;
|
||||||
|
if (!checkHarvestRequirements(player, location, crop)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
super.onInteractRipeCrop(location, crop, player);
|
||||||
|
if (crop.getReturnStage() != null) customInterface.placeWire(location, crop.getReturnStage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
block.setType(Material.AIR);
|
}
|
||||||
super.onInteractRipeCrop(seedLoc, crop, player);
|
//has next stage
|
||||||
if (crop.getReturnStage() != null) StringBlockMechanicFactory.setBlockModel(seedLoc.getBlock(), crop.getReturnStage());
|
else if (MainConfig.enableBoneMeal && itemInHand != null && itemInHand.getType() == Material.BONE_MEAL) {
|
||||||
|
if (!CCAntiGrief.testPlace(player, location)) return;
|
||||||
|
if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
|
||||||
|
if (Math.random() < MainConfig.boneMealChance) {
|
||||||
|
location.getWorld().spawnParticle(MainConfig.boneMealSuccess, location.clone().add(0.5,0.5, 0.5),3,0.2,0.2,0.2);
|
||||||
|
if (SoundConfig.boneMeal.isEnable()) {
|
||||||
|
AdventureUtil.playerSound(
|
||||||
|
player,
|
||||||
|
SoundConfig.boneMeal.getSource(),
|
||||||
|
SoundConfig.boneMeal.getKey(),
|
||||||
|
1,1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
customInterface.placeWire(location, customInterface.getNextStage(blockID));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//has next stage
|
super.tryMisc(player, itemInHand, location.clone().subtract(0,1,0));
|
||||||
else if (MainConfig.enableBoneMeal && itemInHand != null && itemInHand.getType() == Material.BONE_MEAL) {
|
}
|
||||||
if (!CCAntiGrief.testPlace(player, seedLoc)) return;
|
//interact pot (must have an item)
|
||||||
if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
|
else if (blockID.equals(BasicItemConfig.wetPot) || blockID.equals(BasicItemConfig.dryPot)) {
|
||||||
if (Math.random() < MainConfig.boneMealChance) {
|
ItemStack itemInHand = event.getItem();
|
||||||
seedLoc.getWorld().spawnParticle(MainConfig.boneMealSuccess, seedLoc.clone().add(0.5,0.5, 0.5),3,0.2,0.2,0.2);
|
if (super.tryMisc(player, itemInHand, location)) return;
|
||||||
if (SoundConfig.boneMeal.isEnable()) {
|
if (event.getBlockFace() != BlockFace.UP) return;
|
||||||
AdventureUtil.playerSound(
|
Location seedLoc = location.clone().add(0,1,0);
|
||||||
player,
|
String id = OraxenItems.getIdByItem(itemInHand);
|
||||||
SoundConfig.boneMeal.getSource(),
|
if (id != null) {
|
||||||
SoundConfig.boneMeal.getKey(),
|
if (id.endsWith("_seeds")) {
|
||||||
1,1
|
String cropName = id.substring(0, id.length() - 6);
|
||||||
);
|
plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
}
|
|
||||||
StringBlockMechanicFactory.setBlockModel(block, customInterface.getNextStage(id));
|
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
|
else if (MainConfig.enableConvert) {
|
||||||
|
String cropName = MainConfig.vanilla2Crops.get(itemInHand.getType());
|
||||||
|
if (cropName == null) return;
|
||||||
|
plantSeed(seedLoc, cropName, player, itemInHand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.tryMisc(player, event.getItemInHand(), block.getLocation().clone().subtract(0,1,0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onInteractStringBlock(OraxenStringBlockInteractEvent event) {
|
||||||
|
// if (event.isCancelled()) return;
|
||||||
|
// if (event.getHand() != EquipmentSlot.HAND) return;
|
||||||
|
//
|
||||||
|
// final Player player = event.getPlayer();
|
||||||
|
// final Block block = event.getBlock();
|
||||||
|
// final String id = event.getMechanic().getItemID();
|
||||||
|
//
|
||||||
|
// if (!id.contains("_stage_")) return;
|
||||||
|
//
|
||||||
|
// Location seedLoc = block.getLocation();
|
||||||
|
// ItemStack itemInHand = event.getItemInHand();
|
||||||
|
// if (!id.equals(BasicItemConfig.deadCrop)) {
|
||||||
|
// if (isRipe(id)) {
|
||||||
|
// if (MainConfig.canRightClickHarvest && !(MainConfig.emptyHand && itemInHand != null && itemInHand.getType() != Material.AIR)) {
|
||||||
|
// if (!CCAntiGrief.testBreak(player, seedLoc)) return;
|
||||||
|
// Crop crop = customInterface.getCropFromID(id);
|
||||||
|
// if (crop == null) return;
|
||||||
|
// if (!checkHarvestRequirements(player, seedLoc, crop)) {
|
||||||
|
// event.setCancelled(true);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// block.setType(Material.AIR);
|
||||||
|
// super.onInteractRipeCrop(seedLoc, crop, player);
|
||||||
|
// if (crop.getReturnStage() != null) StringBlockMechanicFactory.setBlockModel(seedLoc.getBlock(), crop.getReturnStage());
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //has next stage
|
||||||
|
// else if (MainConfig.enableBoneMeal && itemInHand != null && itemInHand.getType() == Material.BONE_MEAL) {
|
||||||
|
// if (!CCAntiGrief.testPlace(player, seedLoc)) return;
|
||||||
|
// if (player.getGameMode() != GameMode.CREATIVE) itemInHand.setAmount(itemInHand.getAmount() - 1);
|
||||||
|
// if (Math.random() < MainConfig.boneMealChance) {
|
||||||
|
// seedLoc.getWorld().spawnParticle(MainConfig.boneMealSuccess, seedLoc.clone().add(0.5,0.5, 0.5),3,0.2,0.2,0.2);
|
||||||
|
// if (SoundConfig.boneMeal.isEnable()) {
|
||||||
|
// AdventureUtil.playerSound(
|
||||||
|
// player,
|
||||||
|
// SoundConfig.boneMeal.getSource(),
|
||||||
|
// SoundConfig.boneMeal.getKey(),
|
||||||
|
// 1,1
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// StringBlockMechanicFactory.setBlockModel(block, customInterface.getNextStage(id));
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// super.tryMisc(player, event.getItemInHand(), block.getLocation().clone().subtract(0,1,0));
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBreakNoteBlock(OraxenNoteBlockBreakEvent event) {
|
public void onBreakNoteBlock(OraxenNoteBlockBreakEvent event) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package net.momirealms.customcrops.objects.requirements;
|
package net.momirealms.customcrops.objects.requirements;
|
||||||
|
|
||||||
|
import net.momirealms.biomeapi.BiomeAPI;
|
||||||
|
|
||||||
public class RequirementBiome extends Requirement implements RequirementInterface {
|
public class RequirementBiome extends Requirement implements RequirementInterface {
|
||||||
|
|
||||||
public RequirementBiome(String[] values, boolean mode, String msg) {
|
public RequirementBiome(String[] values, boolean mode, String msg) {
|
||||||
@@ -25,7 +27,7 @@ public class RequirementBiome extends Requirement implements RequirementInterfac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConditionMet(PlayerCondition playerCondition) {
|
public boolean isConditionMet(PlayerCondition playerCondition) {
|
||||||
String currentBiome = playerCondition.getLocation().getBlock().getBiome().getKey().toString();
|
String currentBiome = BiomeAPI.getBiome(playerCondition.getLocation());
|
||||||
if (mode) {
|
if (mode) {
|
||||||
for (String value : values) {
|
for (String value : values) {
|
||||||
if (!(currentBiome.equalsIgnoreCase(value))) {
|
if (!(currentBiome.equalsIgnoreCase(value))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user