mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-22 16:39:36 +00:00
3.5.2
This commit is contained in:
@@ -126,7 +126,7 @@ public interface Pot extends KeyItem {
|
||||
String getBlockState(boolean water, FertilizerType type);
|
||||
|
||||
/**
|
||||
* Is the pot a vanilla blocks
|
||||
* Is the pot a vanilla block
|
||||
*/
|
||||
boolean isVanillaBlock();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ plugins {
|
||||
allprojects {
|
||||
|
||||
project.group = "net.momirealms"
|
||||
project.version = "3.5.1"
|
||||
project.version = "3.5.2"
|
||||
|
||||
apply<JavaPlugin>()
|
||||
apply(plugin = "java")
|
||||
|
||||
@@ -52,16 +52,16 @@ dependencies {
|
||||
implementation(project(":oraxen-j21"))
|
||||
implementation(project(":legacy-api"))
|
||||
|
||||
implementation(files("libs/Sparrow-Heart-0.17.jar"))
|
||||
implementation("net.kyori:adventure-api:4.17.0")
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.3.3")
|
||||
implementation("net.kyori:adventure-text-minimessage:4.17.0")
|
||||
implementation("net.kyori:adventure-text-serializer-legacy:4.17.0")
|
||||
implementation("com.github.Xiao-MoMi:AntiGriefLib:0.11")
|
||||
implementation("com.github.Xiao-MoMi:Sparrow-Heart:0.16")
|
||||
// implementation("com.github.Xiao-MoMi:Sparrow-Heart:0.16")
|
||||
implementation("com.flowpowered:flow-nbt:2.0.2")
|
||||
implementation("com.saicone.rtag:rtag:1.5.4")
|
||||
implementation("com.saicone.rtag:rtag-item:1.5.4")
|
||||
compileOnly("de.tr7zw:item-nbt-api-plugin:2.13.0")
|
||||
implementation("com.github.luben:zstd-jni:1.5.6-2")
|
||||
}
|
||||
|
||||
|
||||
BIN
plugin/libs/Sparrow-Heart-0.17.jar
Normal file
BIN
plugin/libs/Sparrow-Heart-0.17.jar
Normal file
Binary file not shown.
@@ -2656,8 +2656,13 @@ public class ItemManagerImpl implements ItemManager {
|
||||
|
||||
@Override
|
||||
public void updatePotState(Location location, Pot pot, boolean hasWater, Fertilizer fertilizer) {
|
||||
Block block = location.getBlock();
|
||||
Pot currentPot = getPotByBlock(block);
|
||||
if (currentPot != pot) {
|
||||
plugin.getWorldManager().removePotAt(SimpleLocation.of(location));
|
||||
return;
|
||||
}
|
||||
if (pot.isVanillaBlock()) {
|
||||
Block block = location.getBlock();
|
||||
if (block.getBlockData() instanceof Farmland farmland) {
|
||||
farmland.setMoisture(hasWater ? 7 : 0);
|
||||
block.setBlockData(farmland);
|
||||
|
||||
@@ -217,23 +217,55 @@ public class MemoryPot extends AbstractCustomCropsBlock implements WorldPot {
|
||||
}
|
||||
|
||||
int water = getWater();
|
||||
if (water > 0) {
|
||||
if (--water <= 0) {
|
||||
loseWater = true;
|
||||
|
||||
SimpleLocation location = getLocation();
|
||||
Location bukkitLocation = location.getBukkitLocation();
|
||||
if (bukkitLocation == null) return;
|
||||
World world = bukkitLocation.getWorld();
|
||||
|
||||
outer: {
|
||||
if (water > 0) {
|
||||
if (pot.isRainDropAccepted()) {
|
||||
if (world.hasStorm() || (!world.isClearWeather() && !world.isThundering())) {
|
||||
double temperature = world.getTemperature(location.getX(), location.getY(), location.getZ());
|
||||
if (temperature > 0.15 && temperature < 0.85) {
|
||||
Block highest = world.getHighestBlockAt(location.getX(), location.getZ());
|
||||
if (highest.getLocation().getY() == location.getY()) {
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pot.isNearbyWaterAccepted()) {
|
||||
for (int i = -4; i <= 4; i++) {
|
||||
for (int j = -4; j <= 4; j++) {
|
||||
for (int k : new int[]{0, 1}) {
|
||||
Block block = bukkitLocation.clone().add(i,k,j).getBlock();
|
||||
if (block.getType() == Material.WATER || (block.getBlockData() instanceof Waterlogged waterlogged && waterlogged.isWaterlogged())) {
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (--water <= 0) {
|
||||
loseWater = true;
|
||||
}
|
||||
setWater(water);
|
||||
}
|
||||
setWater(water);
|
||||
}
|
||||
|
||||
if (loseFertilizer || loseWater) {
|
||||
Location location = getLocation().getBukkitLocation();
|
||||
CustomCropsPlugin.get().getScheduler().runTaskSync(() ->
|
||||
CustomCropsPlugin.get().getItemManager()
|
||||
.updatePotState(
|
||||
location,
|
||||
bukkitLocation,
|
||||
pot,
|
||||
getWater() > 0,
|
||||
getFertilizer()
|
||||
), location
|
||||
), bukkitLocation
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user