mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-02 02:34:24 +00:00
Merge upstream port lane c
This commit is contained in:
commit
55786d6297
50 files changed
+2014
-256
No files matched your search
@@ -1,6 +1,10 @@
|
||||
package art.arcane.iris.api.tree;
|
||||
|
||||
public interface TreeFellerRunHooks {
|
||||
default boolean requiresSneaking() {
|
||||
return true;
|
||||
}
|
||||
|
||||
TreeFellerRunHooks NONE = new TreeFellerRunHooks() {
|
||||
@Override
|
||||
public void onActivationAccepted() {
|
||||
|
||||
@@ -333,7 +333,7 @@ public class CommandFind implements DirectorExecutor {
|
||||
}
|
||||
|
||||
Set<String> configuredImportUrls = normalizedImportUrls(
|
||||
engine.getDimension().getDatapackImports());
|
||||
DatapackIngestService.configuredImports(engine.getDimension()));
|
||||
return new StructureExclusionReport(
|
||||
List.copyOf(exclusions), Set.copyOf(registeredKeys.keySet()),
|
||||
configuredImportUrls, registeredExcluded, configuredUnregistered,
|
||||
|
||||
+11
-13
@@ -520,21 +520,19 @@ public class CommandObject implements DirectorExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (WandSVC.isHoldingIrisWand(player)) {
|
||||
Location[] g = WandSVC.getCuboid(player);
|
||||
Location[] g = WandSVC.getCuboid(player);
|
||||
|
||||
if (g == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!here) {
|
||||
// TODO: WARNING HEIGHT
|
||||
g[0] = player.getTargetBlock(null, 256).getLocation().clone();
|
||||
} else {
|
||||
g[0] = player.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
||||
}
|
||||
player.getInventory().setItemInMainHand(WandSVC.createWand(g[0], g[1]));
|
||||
if (g == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!here) {
|
||||
// TODO: WARNING HEIGHT
|
||||
g[0] = player.getTargetBlock(null, 256).getLocation().clone();
|
||||
} else {
|
||||
g[0] = player.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
||||
}
|
||||
player.getInventory().setItemInMainHand(WandSVC.createWand(g[0], g[1]));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -112,6 +112,6 @@ public final class DatapackStructureScopeSVC implements IrisService {
|
||||
return Set.of();
|
||||
}
|
||||
return scopeIndex.declaredSources(
|
||||
generator.getTarget().getDimension().getDatapackImports());
|
||||
DatapackIngestService.configuredImports(generator.getTarget().getDimension()));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -220,7 +220,7 @@ public class TreeFellerSVC implements IrisService, IrisTreeFellerService {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void haltWhenSneakingStops(PlayerToggleSneakEvent event) {
|
||||
if (!event.isSneaking()) {
|
||||
runner.finishRuns(event.getPlayer().getUniqueId());
|
||||
runner.finishSneakRuns(event.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-1
@@ -526,10 +526,19 @@ final class TreeFellingRunner {
|
||||
private boolean isRunControlActive(FellingRun run, Player player) {
|
||||
return player.isOnline()
|
||||
&& player.getGameMode() == GameMode.SURVIVAL
|
||||
&& player.isSneaking()
|
||||
&& (!requiresSneaking(run) || player.isSneaking())
|
||||
&& player.getWorld().equals(run.candidate.world());
|
||||
}
|
||||
|
||||
private boolean requiresSneaking(FellingRun run) {
|
||||
try {
|
||||
return run.runHooks.requiresSneaking();
|
||||
} catch (RuntimeException error) {
|
||||
IrisLogging.reportError("An Iris tree-feller integration sneak requirement check failed.", error);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean reserveLogCost(FellingRun run) {
|
||||
try {
|
||||
return run.runHooks.reserveLogCost();
|
||||
@@ -611,11 +620,22 @@ final class TreeFellingRunner {
|
||||
}
|
||||
|
||||
void finishRuns(UUID playerId) {
|
||||
finishRuns(playerId, false);
|
||||
}
|
||||
|
||||
void finishSneakRuns(UUID playerId) {
|
||||
finishRuns(playerId, true);
|
||||
}
|
||||
|
||||
private void finishRuns(UUID playerId, boolean onlySneakRuns) {
|
||||
Set<FellingRun> runs = service.activeRuns.get(playerId);
|
||||
if (runs == null) {
|
||||
return;
|
||||
}
|
||||
for (FellingRun run : List.copyOf(runs)) {
|
||||
if (onlySneakRuns && !requiresSneaking(run)) {
|
||||
continue;
|
||||
}
|
||||
if (run.abortReason == null) {
|
||||
run.abortReason = "halted";
|
||||
}
|
||||
|
||||
@@ -27,11 +27,9 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import art.arcane.iris.Iris;
|
||||
import art.arcane.iris.core.IrisSettings;
|
||||
import art.arcane.iris.core.localization.IrisLanguage;
|
||||
import art.arcane.iris.core.localization.RuntimeUiMessages;
|
||||
import art.arcane.iris.core.edit.DustRevealer;
|
||||
import art.arcane.iris.core.link.WorldEditLink;
|
||||
import art.arcane.iris.core.wand.WandSelection;
|
||||
import art.arcane.iris.engine.object.prefab.IrisObject;
|
||||
import art.arcane.iris.util.project.matter.WorldMatter;
|
||||
@@ -333,26 +331,14 @@ public class WandSVC implements IrisService {
|
||||
}
|
||||
|
||||
public static Location[] getCuboid(Player p) {
|
||||
if (isHoldingIrisWand(p)) {
|
||||
if (isHoldingWand(p)) {
|
||||
return getCuboidFromItem(p.getInventory().getItemInMainHand());
|
||||
}
|
||||
|
||||
if (IrisSettings.get().getWorld().worldEditWandCUI) {
|
||||
Cuboid c = WorldEditLink.getSelection(p);
|
||||
|
||||
if (c != null) {
|
||||
return new Location[]{c.getLowerNE(), c.getUpperSW()};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isHoldingWand(Player p) {
|
||||
return isHoldingIrisWand(p) || (IrisSettings.get().getWorld().worldEditWandCUI && WorldEditLink.getSelection(p) != null);
|
||||
}
|
||||
|
||||
public static boolean isHoldingIrisWand(Player p) {
|
||||
ItemStack is = p.getInventory().getItemInMainHand();
|
||||
return is != null && isWand(is);
|
||||
}
|
||||
@@ -567,7 +553,7 @@ public class WandSVC implements IrisService {
|
||||
if (e.getHand() != EquipmentSlot.HAND)
|
||||
return;
|
||||
try {
|
||||
if (isHoldingIrisWand(e.getPlayer())) {
|
||||
if (isHoldingWand(e.getPlayer())) {
|
||||
activePlayers.put(e.getPlayer().getUniqueId(), e.getPlayer());
|
||||
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
|
||||
e.setCancelled(true);
|
||||
|
||||
Reference in new issue
Block a user