mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +00:00
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**
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ plugins {
|
|||||||
id "de.undercouch.download" version "5.0.1"
|
id "de.undercouch.download" version "5.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
version '2.1.0-1.18.2' // Needs to be version specific
|
version '2.1.1-1.18.2' // Needs to be version specific
|
||||||
def nmsVersion = "1.18.2"
|
def nmsVersion = "1.18.2"
|
||||||
def apiVersion = '1.18'
|
def apiVersion = '1.18'
|
||||||
def spigotJarVersion = '1.18.2-R0.1-SNAPSHOT'
|
def spigotJarVersion = '1.18.2-R0.1-SNAPSHOT'
|
||||||
|
|||||||
@@ -244,12 +244,12 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String string) {
|
public static void warn(String format, Object... objs) {
|
||||||
msg(C.YELLOW + string);
|
msg(C.YELLOW + String.format(format, objs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(String string) {
|
public static void error(String format, Object... objs) {
|
||||||
msg(C.RED + string);
|
msg(C.RED + String.format(format, objs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(String string) {
|
public static void debug(String string) {
|
||||||
|
|||||||
@@ -416,18 +416,21 @@ public class NMSBinding18_2 implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Object fieldFor(Class<?> returns, Object in) {
|
private static Object fieldFor(Class<?> returns, Object in) {
|
||||||
for(Field i : in.getClass().getFields()) {
|
return fieldForClass(returns, in.getClass(), in);
|
||||||
if(i.getType().equals(returns)) {
|
}
|
||||||
|
|
||||||
|
@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);
|
i.setAccessible(true);
|
||||||
try {
|
try {
|
||||||
Iris.info("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName());
|
Iris.info("[NMS] Found " + returnType.getSimpleName() + " in " + sourceType.getSimpleName() + "." + i.getName());
|
||||||
return i.get(in);
|
return (T)i.get(in);
|
||||||
} catch(IllegalAccessException e) {
|
} catch(IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -534,41 +534,47 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
} else if(config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.STILT)) {
|
} 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 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();
|
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
||||||
|
int xLength = (rotatedDimensions.getBlockX() / 2) + offset.getBlockX();
|
||||||
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) {
|
int minX = Math.min(x - xLength, x + xLength);
|
||||||
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) {
|
int maxX = Math.max(x - xLength, x + xLength);
|
||||||
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
|
int zLength = (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ();
|
||||||
|
int minZ = Math.min(z - zLength, z + zLength);
|
||||||
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 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;
|
bail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(h > y)
|
||||||
if(h > y) {
|
|
||||||
y = h;
|
y = h;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT)) {
|
} 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 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();
|
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
||||||
|
int xRadius = (rotatedDimensions.getBlockX() / 2);
|
||||||
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) {
|
int xLength = xRadius + offset.getBlockX();
|
||||||
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) {
|
int minX = Math.min(x - xLength, x + xLength);
|
||||||
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
|
int maxX = Math.max(x - xLength, x + xLength);
|
||||||
|
int zRadius = (rotatedDimensions.getBlockZ() / 2);
|
||||||
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 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;
|
bail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(h > y)
|
||||||
if(h > y) {
|
|
||||||
y = h;
|
y = h;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(config.getMode().equals(ObjectPlaceMode.MIN_HEIGHT)) {
|
} 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 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();
|
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);
|
data = config.getRotation().rotate(data, spinx, spiny, spinz);
|
||||||
xx = x + (int) Math.round(i.getX());
|
xx = x + (int) Math.round(i.getX());
|
||||||
|
|
||||||
int yy = y + (int) Math.round(i.getY());
|
int yy = y + (int) Math.round(i.getY());
|
||||||
zz = z + (int) Math.round(i.getZ());
|
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)) {
|
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR)) {
|
||||||
placer.set(xx, yy, zz, data);
|
placer.set(xx, yy, zz, data);
|
||||||
|
|
||||||
if(tile != null) {
|
if(tile != null) {
|
||||||
placer.setTile(xx, yy, zz, tile);
|
placer.setTile(xx, yy, zz, tile);
|
||||||
}
|
}
|
||||||
@@ -852,17 +858,14 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
|
|
||||||
int yg = placer.getHighest(xx, zz, getLoader(), true);
|
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);
|
((Waterlogged) d).setWaterlogged(true);
|
||||||
}
|
|
||||||
|
|
||||||
if(yv >= 0 && config.isBottom()) {
|
if(yv >= 0 && config.isBottom())
|
||||||
y += Math.floorDiv(h, 2);
|
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);
|
placer.set(xx, j, zz, d);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readLock.unlock();
|
readLock.unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user