9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-25 18:19:14 +00:00

Compare commits

..

17 Commits

Author SHA1 Message Date
Brian Fopiano
e3d4c32d03 Merge pull request #796 from VolmitSoftware/Development
**Changelog**

- Fixed a Memory Leak (There might be more, keep reports coming)
 - Fixed Iris wand selections (WE)
 - Added Iris Wand Worldedit compatibility [Make selection using Worldedit, then /Iris object want worldedit (/ir o w we) to then set your selection to a new iris wand]
2022-05-26 18:24:06 -07:00
Vatuu
9cd5c39bbe V+ 2022-05-27 03:17:58 +02:00
Vatuu
a1fbf25465 Please don't break or leak again. 2022-05-27 01:54:21 +02:00
Vatuu
ec74037f05 Added ability to create Iris Wand from WorldEdit selection. 2022-05-26 21:48:46 +02:00
Brian Fopiano
fff650b766 Merge pull request #795 from VolmitSoftware/Development
**Changelog:**
- Fixed Startup spam, Worldheight spam, and Entity ID spam from happening anymore
- Removes Raid Error From Villagers (Persistent raid)
- Minheight, MaxHeight, and STilt are now working as intended
- Fixed generation errors causing Holes in bedrock 
- generic math fixes internally

**This will require a world update to fix the Bedrock problems**
2022-05-21 20:26:19 -07:00
Vatuu
bae2a18e24 V+ 2022-05-22 05:18:13 +02:00
Vatuu
fd8a7ebb4c Properly fixed FAST_MAX_HEIGHT. 2022-05-22 05:08:28 +02:00
Vatuu
4a3a1491d4 Cleanup. 2022-05-22 04:25:39 +02:00
Vatuu
9aa2c5ed8a SPACE 2022-05-22 03:23:20 +02:00
Vatuu
d5699a7472 Totally didn't replace MIN_HEIGHT instead of FAST_MAX_HEIGHT 💀 2022-05-22 03:22:19 +02:00
Vatuu
df98f8f626 Added filter for duplicated entity uuid. 2022-05-22 03:07:46 +02:00
Vatuu
d37b298f07 Fixed bad math for MAX_HEIGHT and FAST_MAX_HEIGHT. 2022-05-22 03:02:50 +02:00
Vatuu
62f7fc17d1 Suppressed persistent raid error. 2022-05-21 18:41:04 +02:00
Brian Fopiano
6e4929246d Merge pull request #794 from VolmitSoftware/master
upstream merge
2022-05-20 19:48:19 -07:00
Vatuu
909461975a Chat filter. 2022-05-21 04:47:12 +02:00
DanMB
dec191e5e7 Web hate space 2022-05-19 16:23:11 -07:00
DanMB
07b0cd6f5a Img2 2022-05-19 16:20:25 -07:00
26 changed files with 163 additions and 62 deletions

View File

@@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.1.0-1.18.2' // Needs to be version specific
version '2.1.2-1.18.2' // Needs to be version specific
def nmsVersion = "1.18.2"
def apiVersion = '1.18'
def spigotJarVersion = '1.18.2-R0.1-SNAPSHOT'
@@ -74,6 +74,7 @@ repositories {
}
}
maven { url "https://dl.cloudsmith.io/public/arcane/archive/maven/" }
maven { url "https://maven.enginehub.org/repo/" }
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io"}
@@ -128,6 +129,7 @@ dependencies {
implementation 'io.th0rgal:oraxen:1.94.0'
implementation 'org.bukkit:craftbukkit:1.18.2-R0.1-SNAPSHOT:remapped-mojang'
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.9'
// Shaded
implementation 'com.dfsek:Paralithic:0.4.0'

View File

@@ -244,12 +244,12 @@ public class Iris extends VolmitPlugin implements Listener {
return f;
}
public static void warn(String string) {
msg(C.YELLOW + string);
public static void warn(String format, Object... objs) {
msg(C.YELLOW + String.format(format, objs));
}
public static void error(String string) {
msg(C.RED + string);
public static void error(String format, Object... objs) {
msg(C.RED + String.format(format, objs));
}
public static void debug(String string) {

View File

@@ -18,7 +18,9 @@
package com.volmit.iris.core.commands;
import com.mojang.datafixers.util.Pair;
import com.volmit.iris.Iris;
import com.volmit.iris.core.link.WorldEditLink;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.service.ObjectSVC;
import com.volmit.iris.core.service.StudioSVC;
@@ -41,12 +43,7 @@ import com.volmit.iris.util.format.C;
import com.volmit.iris.util.math.Direction;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.Queue;
import org.bukkit.ChatColor;
import org.bukkit.HeightMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.TileState;
@@ -426,6 +423,24 @@ public class CommandObject implements DecreeExecutor {
sender().sendMessage("Reverted " + actualReverts + " pastes!");
}
@Decree(description = "Gets an object wand and grabs the current WorldEdit selection.", aliases = "we", origin = DecreeOrigin.PLAYER, studio = true)
public void we() {
if(!Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
sender().sendMessage(C.RED + "You can't get a WorldEdit selection without WorldEdit, you know.");
return;
}
Pair<Location, Location> locs = WorldEditLink.getSelection(sender().player());
if(locs.getFirst() == null)
sender().sendMessage(C.RED + "You don't have a WorldEdit selection!");
else if(locs.getSecond() == null)
sender().sendMessage(C.RED + "You need a valid WorldRegion selection in the current world!");
else {
sender().player().getInventory().addItem(WandSVC.createWand(locs.getFirst(), locs.getSecond()));
sender().sendMessage(C.GREEN + "A fresh wand with your current WorldEdit selection on it!");
}
}
@Decree(description = "Get an object wand", sync = true)
public void wand() {
player().getInventory().addItem(WandSVC.createWand());

View File

@@ -0,0 +1,32 @@
package com.volmit.iris.core.link;
import com.mojang.datafixers.util.Pair;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.MissingSessionException;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class WorldEditLink {
public static Pair<Location, Location> getSelection(Player p) {
LocalSession session = WorldEdit.getInstance().getSessionManager().getIfPresent(BukkitAdapter.adapt(p));
try {
if(session == null)
throw new MissingSessionException();
Region r = session.getSelection(BukkitAdapter.adapt(p.getWorld()));
BlockVector3 p1 = r.getMinimumPoint();
BlockVector3 p2 = r.getMaximumPoint();
return new Pair<>(new Location(p.getWorld(), p1.getX(), p1.getY(), p1.getZ()), new Location(p.getWorld(), p2.getX(), p2.getY(), p2.getZ()));
} catch(MissingSessionException e) {
return new Pair<>(null, new Location(null, 0, 0, 0));
} catch(IncompleteRegionException e) {
return new Pair<>(new Location(null, 0, 0, 0), null);
}
}
}

View File

@@ -416,18 +416,21 @@ public class NMSBinding18_2 implements INMSBinding {
}
private static Object fieldFor(Class<?> returns, Object in) {
for(Field i : in.getClass().getFields()) {
if(i.getType().equals(returns)) {
return fieldForClass(returns, in.getClass(), in);
}
@SuppressWarnings("unchecked")
private static <T> T fieldForClass(Class<T> returnType, Class<?> sourceType, Object in) {
for(Field i : sourceType.getFields())
if(i.getType().equals(returnType)) {
i.setAccessible(true);
try {
Iris.info("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName());
return i.get(in);
Iris.info("[NMS] Found " + returnType.getSimpleName() + " in " + sourceType.getSimpleName() + "." + i.getName());
return (T)i.get(in);
} catch(IllegalAccessException e) {
e.printStackTrace();
}
}
}
return null;
}
}

View File

@@ -0,0 +1,61 @@
package com.volmit.iris.core.service;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.plugin.IrisService;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.message.Message;
public class LogFilterSVC implements IrisService, Filter {
private static final String HEIGHTMAP_MISMATCH = "Ignoring heightmap data for chunk";
private static final String RAID_PERSISTENCE = "Could not save data net.minecraft.world.entity.raid.PersistentRaid";
private static final String DUPLICATE_ENTITY_UUID = "UUID of added entity already exists";
private static final KList<String> FILTERS = new KList<>();
public void onEnable() {
FILTERS.add(HEIGHTMAP_MISMATCH, RAID_PERSISTENCE, DUPLICATE_ENTITY_UUID);
((Logger)LogManager.getRootLogger()).addFilter(this);
}
public void initialize() { }
public void start() { }
public void stop() { }
public void onDisable() { }
public boolean isStarted() { return true; }
public boolean isStopped() { return false; }
public State getState() {
try { return State.STARTED; }
catch (Exception var2) { return null; }
}
public Filter.Result getOnMatch() { return Result.NEUTRAL; }
public Filter.Result getOnMismatch() { return Result.NEUTRAL; }
public Result filter(LogEvent event) { return check(event.getMessage().getFormattedMessage()); }
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) { return check(msg.toString()); }
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) { return check(msg.getFormattedMessage()); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object... params) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { return check(message); }
private Result check(String string) {
if(FILTERS.stream().anyMatch(string::contains))
return Result.DENY;
return Result.NEUTRAL;
}
}

View File

@@ -233,20 +233,17 @@ public class IrisToolbelt {
return isIrisWorld(i) && access(i).isStudio();
}
public static void retainMantleDataForSlice(String className)
{
public static void retainMantleDataForSlice(String className) {
toolbeltConfiguration.put("retain.mantle." + className, true);
}
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of)
{
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of) {
PlatformChunkGenerator e = access(world);
if(e == null) {return null;}
return e.getEngine().getMantle().getMantle().get(x, y - world.getMinHeight(), z, of);
}
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of)
{
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of) {
PlatformChunkGenerator e = access(world);
if(e == null) {return;}
e.getEngine().getMantle().getMantle().remove(x, y - world.getMinHeight(), z, of);

View File

@@ -79,7 +79,6 @@ import java.util.stream.Stream;
public class IrisWorldManager extends EngineAssignedWorldManager {
private final Looper looper;
private final int id;
private final KMap<Long, Long> chunkCooldowns;
private final KList<Runnable> updateQueue = new KList<>();
private final ChronoLatch cl;
private final ChronoLatch clw;
@@ -99,7 +98,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
ecl = null;
cln = null;
clw = null;
chunkCooldowns = null;
looper = null;
chunkUpdater = null;
id = -1;
@@ -112,7 +110,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
cl = new ChronoLatch(3000);
ecl = new ChronoLatch(250);
clw = new ChronoLatch(1000, true);
chunkCooldowns = new KMap<>();
id = engine.getCacheID();
energy = 25;
looper = new Looper() {
@@ -255,14 +252,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
}
}
int chunkCooldownSeconds = 60;
for(Long i : chunkCooldowns.k()) {
if(M.ms() - chunkCooldowns.get(i) > TimeUnit.SECONDS.toMillis(chunkCooldownSeconds)) {
chunkCooldowns.remove(i);
}
}
int spawnBuffer = RNG.r.i(2, 12);
Chunk[] cc = getEngine().getWorld().realWorld().getLoadedChunks();
@@ -279,7 +268,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
}
spawnIn(c, false);
chunkCooldowns.put(Cache.key(c), M.ms());
}
energy -= (actuallySpawned / 2D);

View File

@@ -534,41 +534,47 @@ public class IrisObject extends IrisRegistrant {
} else if(config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.STILT)) {
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) {
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) {
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) {
int xLength = (rotatedDimensions.getBlockX() / 2) + offset.getBlockX();
int minX = Math.min(x - xLength, x + xLength);
int maxX = Math.max(x - xLength, x + xLength);
int zLength = (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ();
int minZ = Math.min(z - zLength, z + zLength);
int maxZ = Math.max(z - zLength, z + zLength);
for(int i = minX; i <= maxX; i++) {
for(int ii = minZ; ii <= maxZ; ii++) {
int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) {
bail = true;
break;
}
if(h > y) {
if(h > y)
y = h;
}
}
}
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT)) {
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) {
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) {
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) {
int xRadius = (rotatedDimensions.getBlockX() / 2);
int xLength = xRadius + offset.getBlockX();
int minX = Math.min(x - xLength, x + xLength);
int maxX = Math.max(x - xLength, x + xLength);
int zRadius = (rotatedDimensions.getBlockZ() / 2);
int zLength = zRadius + offset.getBlockZ();
int minZ = Math.min(z - zLength, z + zLength);
int maxZ = Math.max(z - zLength, z + zLength);
for(int i = minX; i <= maxX; i += Math.abs(xRadius) + 1) {
for(int ii = minZ; ii <= maxZ; ii += Math.abs(zRadius) + 1) {
int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) {
bail = true;
break;
}
if(h > y) {
if(h > y)
y = h;
}
}
}
} else if(config.getMode().equals(ObjectPlaceMode.MIN_HEIGHT)) {
y = 257;
y = rdata.getEngine().getHeight() + 1;
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
@@ -745,6 +751,7 @@ public class IrisObject extends IrisRegistrant {
data = config.getRotation().rotate(data, spinx, spiny, spinz);
xx = x + (int) Math.round(i.getX());
int yy = y + (int) Math.round(i.getY());
zz = z + (int) Math.round(i.getZ());
@@ -787,7 +794,6 @@ public class IrisObject extends IrisRegistrant {
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR)) {
placer.set(xx, yy, zz, data);
if(tile != null) {
placer.setTile(xx, yy, zz, tile);
}
@@ -852,17 +858,14 @@ public class IrisObject extends IrisRegistrant {
int yg = placer.getHighest(xx, zz, getLoader(), true);
if(config.isWaterloggable() && yg <= placer.getFluidHeight() && d instanceof Waterlogged) {
if(config.isWaterloggable() && yg <= placer.getFluidHeight() && d instanceof Waterlogged)
((Waterlogged) d).setWaterlogged(true);
}
if(yv >= 0 && config.isBottom()) {
if(yv >= 0 && config.isBottom())
y += Math.floorDiv(h, 2);
}
for(int j = lowest + y; j > yg - config.getOverStilt() - 1; j--) {
for(int j = lowest + y; j > yg - config.getOverStilt() - 1; j--)
placer.set(xx, j, zz, d);
}
}
readLock.unlock();

View File

@@ -22,4 +22,4 @@ commands:
aliases: [ ir, irs ]
api-version: ${apiversion}
hotload-dependencies: false
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller"]
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit"]

BIN
storepage/two/Footer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
storepage/two/Header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

BIN
storepage/two/Iris.xd Normal file

Binary file not shown.

BIN
storepage/two/NOTE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
storepage/two/NOTERED.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
storepage/two/c1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

BIN
storepage/two/c2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

BIN
storepage/two/c3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

BIN
storepage/two/c4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
storepage/two/c5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

BIN
storepage/two/dlshare.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
storepage/two/icard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

BIN
storepage/two/speed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB