Merge pull request #920 from VolmitSoftware/Development

Development
This commit is contained in:
Brian Fopiano 2022-10-28 13:14:47 -07:00 committed by GitHub
commit a64272620f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 58 deletions

View File

@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1" 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 nmsVersion = "1.19.2" //[NMS]
def apiVersion = '1.19' def apiVersion = '1.19'
def specialSourceVersion = '1.11.0' //[NMS] def specialSourceVersion = '1.11.0' //[NMS]

View File

@ -87,7 +87,7 @@ import java.util.Map;
@SuppressWarnings("CanBeFinal") @SuppressWarnings("CanBeFinal")
public class Iris extends VolmitPlugin implements Listener { 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<Runnable> syncJobs = new ShurikenQueue<>(); private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();

View File

@ -24,20 +24,19 @@ import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
import com.volmit.iris.util.math.Position2; import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.plugin.VolmitSender; import com.volmit.iris.util.plugin.VolmitSender;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.EnderSignal; import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; 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.ChunkLoadEvent;
import org.bukkit.event.world.WorldSaveEvent; import org.bukkit.event.world.WorldSaveEvent;
import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.inventory.EquipmentSlot;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -100,35 +99,40 @@ public abstract class EngineAssignedWorldManager extends EngineAssignedComponent
} }
@EventHandler @EventHandler
public void on(EntitySpawnEvent e) { public void onItemUse(PlayerInteractEvent e) {
if(e.getEntity().getWorld().equals(getTarget().getWorld().realWorld())) { if(e.getItem() == null || e.getHand() != EquipmentSlot.HAND)
if(e.getEntityType().equals(EntityType.ENDER_SIGNAL)) { return;
KList<Position2> p = getEngine().getDimension().getStrongholds(getEngine().getSeedManager().getSpawn()); if(e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR)
Position2 px = new Position2(e.getEntity().getLocation().getBlockX(), e.getEntity().getLocation().getBlockZ()); return;
Position2 pr = null; if(e.getPlayer().getWorld().equals(getTarget().getWorld().realWorld()) && e.getItem().getType() == Material.ENDER_EYE) {
double d = Double.MAX_VALUE; KList<Position2> positions = getEngine().getDimension().getStrongholds(getEngine().getSeedManager().getSpawn());
if(positions.isEmpty())
return;
Iris.debug("Ps: " + p.size()); Position2 playerPos = new Position2(e.getPlayer().getLocation().getBlockX(), e.getPlayer().getLocation().getBlockZ());
Position2 pr = positions.get(0);
double d = pr.distance(playerPos);
for(Position2 i : p) { for(Position2 pos : positions) {
Iris.debug("- " + i.getX() + " " + i.getZ()); double distance = pos.distance(playerPos);
} if(distance < d) {
d = distance;
for(Position2 i : p) { pr = pos;
double dx = i.distance(px);
if(dx < d) {
d = dx;
pr = i;
}
}
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());
} }
} }

View File

@ -98,7 +98,7 @@ public class PlannedStructure {
int zz = i.getPosition().getZ() + sz; int zz = i.getPosition().getZ() + sz;
RNG rngf = new RNG(Cache.key(xx, zz)); RNG rngf = new RNG(Cache.key(xx, zz));
int offset = i.getPosition().getY() - startHeight; int offset = i.getPosition().getY() - startHeight;
int height = 0; int height;
if(i.getStructure().getStructure().getLockY() == -1) { if(i.getStructure().getStructure().getLockY() == -1) {
if(i.getStructure().getStructure().getOverrideYRange() != null) { if(i.getStructure().getStructure().getOverrideYRange() != null) {

View File

@ -190,31 +190,33 @@ public interface EngineMantle extends IObjectPlacer {
@ChunkCoordinates @ChunkCoordinates
default void generateMatter(int x, int z, boolean multicore, ChunkContext context) { default void generateMatter(int x, int z, boolean multicore, ChunkContext context) {
if(!getEngine().getDimension().isUseMantle()) { synchronized(this) {
return; 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);
}
});
});
} }
}
burst.complete(); 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();
}
} }
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) { default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) {

View File

@ -249,9 +249,9 @@ public class Mantle {
*/ */
@ChunkCoordinates @ChunkCoordinates
public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator) { public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator) {
if(!hasTectonicPlate(x >> 5, z >> 5)) { /*if(!hasTectonicPlate(x >> 5, z >> 5)) {
return; return;
} }*/
get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).iterate(type, iterator); get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).iterate(type, iterator);
} }