mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 00:17:15 +00:00
commit
a64272620f
@ -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]
|
||||
|
@ -87,7 +87,7 @@ import java.util.Map;
|
||||
@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<Runnable> syncJobs = new ShurikenQueue<>();
|
||||
|
||||
|
@ -24,20 +24,19 @@ import com.volmit.iris.util.collection.KList;
|
||||
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 abstract class EngineAssignedWorldManager extends EngineAssignedComponent
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(EntitySpawnEvent e) {
|
||||
if(e.getEntity().getWorld().equals(getTarget().getWorld().realWorld())) {
|
||||
if(e.getEntityType().equals(EntityType.ENDER_SIGNAL)) {
|
||||
KList<Position2> 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;
|
||||
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<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) {
|
||||
Iris.debug("- " + i.getX() + " " + i.getZ());
|
||||
}
|
||||
|
||||
for(Position2 i : p) {
|
||||
double dx = i.distance(px);
|
||||
if(dx < d) {
|
||||
d = dx;
|
||||
pr = i;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class PlannedStructure {
|
||||
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) {
|
||||
|
@ -190,6 +190,7 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
|
||||
@ChunkCoordinates
|
||||
default void generateMatter(int x, int z, boolean multicore, ChunkContext context) {
|
||||
synchronized(this) {
|
||||
if(!getEngine().getDimension().isUseMantle()) {
|
||||
return;
|
||||
}
|
||||
@ -216,6 +217,7 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
|
||||
burst.complete();
|
||||
}
|
||||
}
|
||||
|
||||
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) {
|
||||
mc.raiseFlag(c.getFlag(), () -> c.generateLayer(writer, x, z, context));
|
||||
|
@ -249,9 +249,9 @@ public class Mantle {
|
||||
*/
|
||||
@ChunkCoordinates
|
||||
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;
|
||||
}
|
||||
}*/
|
||||
|
||||
get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).iterate(type, iterator);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user