From 7dd1d3881ad0c2989483ecf39c584f3c15935b03 Mon Sep 17 00:00:00 2001 From: Vatuu <21113232+Vatuu@users.noreply.github.com> Date: Fri, 28 Oct 2022 22:01:23 +0200 Subject: [PATCH 1/4] Fixed strongholds not generating properly. --- .../iris/engine/jigsaw/PlannedStructure.java | 2 +- .../iris/engine/mantle/EngineMantle.java | 44 ++++++++++--------- .../com/volmit/iris/util/mantle/Mantle.java | 4 +- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/jigsaw/PlannedStructure.java b/src/main/java/com/volmit/iris/engine/jigsaw/PlannedStructure.java index 4f60227ec..f58a48480 100644 --- a/src/main/java/com/volmit/iris/engine/jigsaw/PlannedStructure.java +++ b/src/main/java/com/volmit/iris/engine/jigsaw/PlannedStructure.java @@ -98,7 +98,7 @@ public void place(PlannedPiece i, int startHeight, IrisObjectPlacement o, IObjec int zz = i.getPosition().getZ() + sz; RNG rngf = new RNG(Cache.key(xx, zz)); int offset = i.getPosition().getY() - startHeight; - int height = 0; + int height; if(i.getStructure().getStructure().getLockY() == -1) { if(i.getStructure().getStructure().getOverrideYRange() != null) { diff --git a/src/main/java/com/volmit/iris/engine/mantle/EngineMantle.java b/src/main/java/com/volmit/iris/engine/mantle/EngineMantle.java index 6ee36836d..451e84ace 100644 --- a/src/main/java/com/volmit/iris/engine/mantle/EngineMantle.java +++ b/src/main/java/com/volmit/iris/engine/mantle/EngineMantle.java @@ -190,31 +190,33 @@ default int getRealRadius() { @ChunkCoordinates default void generateMatter(int x, int z, boolean multicore, ChunkContext context) { - if(!getEngine().getDimension().isUseMantle()) { - return; - } + synchronized(this) { + if(!getEngine().getDimension().isUseMantle()) { + return; + } - int s = getRealRadius(); - BurstExecutor burst = burst().burst(multicore); - MantleWriter writer = getMantle().write(this, x, z, s * 2); - for(int i = -s; i <= s; i++) { - for(int j = -s; j <= s; j++) { - int xx = i + x; - int zz = j + z; - burst.queue(() -> { - IrisContext.touch(getEngine().getContext()); - getMantle().raiseFlag(xx, zz, MantleFlag.PLANNED, () -> { - MantleChunk mc = getMantle().getChunk(xx, zz); - - for(MantleComponent k : getComponents()) { - generateMantleComponent(writer, xx, zz, k, mc, context); - } + int s = getRealRadius(); + BurstExecutor burst = burst().burst(multicore); + MantleWriter writer = getMantle().write(this, x, z, s * 2); + for(int i = -s; i <= s; i++) { + for(int j = -s; j <= s; j++) { + int xx = i + x; + int zz = j + z; + burst.queue(() -> { + IrisContext.touch(getEngine().getContext()); + getMantle().raiseFlag(xx, zz, MantleFlag.PLANNED, () -> { + MantleChunk mc = getMantle().getChunk(xx, zz); + + for(MantleComponent k : getComponents()) { + generateMantleComponent(writer, xx, zz, k, mc, context); + } + }); }); - }); + } } - } - burst.complete(); + burst.complete(); + } } default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) { diff --git a/src/main/java/com/volmit/iris/util/mantle/Mantle.java b/src/main/java/com/volmit/iris/util/mantle/Mantle.java index 8ad73f95a..f000a0572 100644 --- a/src/main/java/com/volmit/iris/util/mantle/Mantle.java +++ b/src/main/java/com/volmit/iris/util/mantle/Mantle.java @@ -249,9 +249,9 @@ public boolean hasTectonicPlate(int x, int z) { */ @ChunkCoordinates public void iterateChunk(int x, int z, Class type, Consumer4 iterator) { - if(!hasTectonicPlate(x >> 5, z >> 5)) { + /*if(!hasTectonicPlate(x >> 5, z >> 5)) { return; - } + }*/ get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).iterate(type, iterator); } From 34670759e93a98902093cec569920a82a5d4fa87 Mon Sep 17 00:00:00 2001 From: Vatuu <21113232+Vatuu@users.noreply.github.com> Date: Fri, 28 Oct 2022 22:02:05 +0200 Subject: [PATCH 2/4] Fixed eyes of enders not properly targeting strongholds. --- .../framework/EngineAssignedWorldManager.java | 64 ++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineAssignedWorldManager.java b/src/main/java/com/volmit/iris/engine/framework/EngineAssignedWorldManager.java index b6e85f86f..36e9d9b1a 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineAssignedWorldManager.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineAssignedWorldManager.java @@ -24,20 +24,19 @@ import com.volmit.iris.util.format.C; import com.volmit.iris.util.math.Position2; import com.volmit.iris.util.plugin.VolmitSender; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Sound; +import org.bukkit.*; import org.bukkit.entity.EnderSignal; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.WorldSaveEvent; import org.bukkit.event.world.WorldUnloadEvent; +import org.bukkit.inventory.EquipmentSlot; import java.util.concurrent.atomic.AtomicBoolean; @@ -100,35 +99,40 @@ public void on(WorldSaveEvent e) { } @EventHandler - public void on(EntitySpawnEvent e) { - if(e.getEntity().getWorld().equals(getTarget().getWorld().realWorld())) { - if(e.getEntityType().equals(EntityType.ENDER_SIGNAL)) { - KList p = getEngine().getDimension().getStrongholds(getEngine().getSeedManager().getSpawn()); - Position2 px = new Position2(e.getEntity().getLocation().getBlockX(), e.getEntity().getLocation().getBlockZ()); - Position2 pr = null; - double d = Double.MAX_VALUE; - - Iris.debug("Ps: " + p.size()); - - for(Position2 i : p) { - Iris.debug("- " + i.getX() + " " + i.getZ()); - } - - for(Position2 i : p) { - double dx = i.distance(px); - if(dx < d) { - d = dx; - pr = i; - } + public void onItemUse(PlayerInteractEvent e) { + if(e.getItem() == null || e.getHand() != EquipmentSlot.HAND) + return; + if(e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR) + return; + if(e.getPlayer().getWorld().equals(getTarget().getWorld().realWorld()) && e.getItem().getType() == Material.ENDER_EYE) { + KList positions = getEngine().getDimension().getStrongholds(getEngine().getSeedManager().getSpawn()); + if(positions.isEmpty()) + return; + + Position2 playerPos = new Position2(e.getPlayer().getLocation().getBlockX(), e.getPlayer().getLocation().getBlockZ()); + Position2 pr = positions.get(0); + double d = pr.distance(playerPos); + + for(Position2 pos : positions) { + double distance = pos.distance(playerPos); + if(distance < d) { + d = distance; + pr = pos; } + } - if(pr != null) { - e.getEntity().getWorld().playSound(e.getEntity().getLocation(), Sound.ITEM_TRIDENT_THROW, 1f, 1.6f); - Location ll = new Location(e.getEntity().getWorld(), pr.getX(), 40, pr.getZ()); - Iris.debug("ESignal: " + ll.getBlockX() + " " + ll.getBlockZ()); - ((EnderSignal) e.getEntity()).setTargetLocation(ll); + if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { + if(e.getItem().getAmount() > 1) { + e.getPlayer().getInventory().getItemInMainHand().setAmount(e.getItem().getAmount() - 1); + } else { + e.getPlayer().getInventory().setItemInMainHand(null); } } + + EnderSignal eye = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation().clone().add(0, 0.5F, 0), EnderSignal.class); + eye.setTargetLocation(new Location(e.getPlayer().getWorld(), pr.getX(), 40, pr.getZ())); + eye.getWorld().playSound(eye, Sound.ENTITY_ENDER_EYE_LAUNCH, 1, 1); + Iris.debug("ESignal: " + eye.getTargetLocation().getBlockX() + " " + eye.getTargetLocation().getBlockX()); } } From a28e5bb38af0e968b62ec0678337f78459e63f36 Mon Sep 17 00:00:00 2001 From: Vatuu <21113232+Vatuu@users.noreply.github.com> Date: Fri, 28 Oct 2022 22:03:23 +0200 Subject: [PATCH 3/4] Updated overworld version. --- src/main/java/com/volmit/iris/Iris.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index 4a0d6965d..953366dc4 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -87,7 +87,7 @@ @SuppressWarnings("CanBeFinal") public class Iris extends VolmitPlugin implements Listener { - public static final String OVERWORLD_TAG = "2090"; + public static final String OVERWORLD_TAG = "2091"; private static final Queue syncJobs = new ShurikenQueue<>(); From ef9966d02ba67a1dd6d2b77d0f7db7a0ec08c0ae Mon Sep 17 00:00:00 2001 From: Brian Neumann-Fopiano Date: Fri, 28 Oct 2022 13:07:11 -0700 Subject: [PATCH 4/4] V+ --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9559069b6..d1452e298 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ plugins { id "de.undercouch.download" version "5.0.1" } -version '2.3.6-1.19.2' // Needs to be version specific +version '2.3.7-1.19.2' // Needs to be version specific def nmsVersion = "1.19.2" //[NMS] def apiVersion = '1.19' def specialSourceVersion = '1.11.0' //[NMS]