mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Keep the server placement check inside Iris
- Ask canSurvive from Iris itself instead of VolmLib, by runtime names on Bukkit and directly on modded - Platforms bind their rule through PlantPlacement, block states answer from the table when none is bound - Route sugar cane through the same check - Bind the rule on Bukkit enable and modded bootstrap, restore it on shutdown
This commit is contained in:
1 parent
202d9bbbd4
commit
60a9b5c7c4
15 files changed
+602
-73
No files matched your search
+7
-5
@@ -1,24 +1,26 @@
|
||||
package art.arcane.iris.platform.bukkit;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.nms.INMS;
|
||||
import art.arcane.iris.generation.block.PlantPlacement;
|
||||
import art.arcane.iris.platform.bukkit.plugin.IrisService;
|
||||
import io.papermc.paper.event.server.ServerResourcesReloadedEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
/** Lets the server's placement rules apply again after a resource reload, which may have changed the block tags they read. */
|
||||
/** Lets the server's own rules decide where plants can stand, and asks them again after a resource reload. */
|
||||
public class BlockRulesSVC implements IrisService {
|
||||
private PlantPlacement.ServerRule previousRule;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
previousRule = PlantPlacement.bindServerRule(BukkitPlacementRules::canPlaceOnto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
PlantPlacement.restoreServerRule(previousRule);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResourcesReloaded(ServerResourcesReloadedEvent event) {
|
||||
if (INMS.isBound()) {
|
||||
INMS.get().forgetBlockRules();
|
||||
}
|
||||
BukkitPlacementRules.forgetServerRules();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user