9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2026-01-04 15:41:30 +00:00

Compare commits

...

30 Commits

Author SHA1 Message Date
Brian Neumann-Fopiano
5a8ef99afa forgot the overworld , this is the V+ 2023-10-04 03:30:55 -04:00
Brian Neumann-Fopiano
571729cfe4 v+ 2023-10-04 03:24:32 -04:00
Brian Fopiano
c1de316ed6 Merge pull request #1036 from CrazyDev05/teleport
Add Teleport Command
2023-10-04 03:22:29 -04:00
Brian Fopiano
1e316acd64 Merge pull request #1037 from CrazyDev05/jigsaw_piece_mantle_panic_fix
Fix IrisJigsawPiece tectonic plate panic
2023-10-04 03:21:43 -04:00
CrazyDev22
f89460538d Fix NullPointerException 2023-10-03 14:20:40 +02:00
CrazyDev22
0bf0062c2c Fix IrisJigsawPiece tectonic plate panic 2023-10-01 22:28:03 +02:00
CrazyDev22
540d1b5801 Add Color Gradient 2023-10-01 17:45:40 +02:00
CrazyDev22
8f0d1b7b7b Add NullablePlayerHandler
Add Teleport Command
2023-10-01 16:50:50 +02:00
Brian Fopiano
5061791dcf Merge pull request #1034 from RePixelatedMC/master
Fixed - /iris object undo / Added - IrisLootEvent
2023-09-27 08:15:06 -04:00
Brian Fopiano
ce98264552 Merge pull request #1033 from CrazyDev05/jigsaw_loot_fix_2
Better Jigsaw loot fix
2023-09-27 08:14:51 -04:00
RePixelatedMC
15e6750e11 Merge pull request #1
IrisLootEvent
2023-09-27 10:31:43 +02:00
RePixelatedMC
7a20421580 Added IrisLootEvent.java and some debugging to that 2023-09-27 10:15:11 +02:00
RePixelatedMC
f42f06226c Optimized it thx coco 2023-09-25 15:12:45 +02:00
RePixelatedMC
cce3d74c52 Merge remote-tracking branch 'origin/master' 2023-09-25 15:03:41 +02:00
RePixelatedMC
7b9fb880f4 Also changed the color for the /iris o paste cmd 2023-09-25 15:02:33 +02:00
RePixelatedMC
2a9b0a54d9 Merge branch 'VolmitSoftware:master' into master 2023-09-25 14:37:08 +02:00
RePixelatedMC
373e9e9755 Fixed - /iris object undo
also added some colors
2023-09-25 14:30:21 +02:00
BuildTools
4115dd5797 remove debug info 2023-09-18 13:48:19 +02:00
BuildTools
57bfd251dc better fix for jigsaw loot 2023-09-18 13:45:03 +02:00
Brian Neumann-Fopiano
d324790f66 forgot the v+ lol 2023-09-17 15:54:08 -04:00
Brian Fopiano
99d3dba440 Merge pull request #1026 from CocoTheOwner/jigsawRotationFix
Disable initial rotation if set to true
2023-09-17 13:47:51 -04:00
Brian Fopiano
5a44e79ad1 Merge pull request #1022 from CrazyDev05/jigsaw_loot_fix
Jigsaw loot fix
2023-09-17 13:47:26 -04:00
CocoTheOwner
86808017db Disable initial rotation if set to true 2023-09-06 18:24:15 +02:00
CrazyDev22
f735db9843 Fix not finding IrisObjectPlacement for jigsaw structures 2023-09-02 10:31:34 +02:00
CrazyDev22
5a333c23ac Fix Exact BlockData Filter 2023-09-02 10:30:44 +02:00
Brian Neumann-Fopiano
4d2d51edfa v+ 2023-08-31 14:50:49 -04:00
Brian Fopiano
dcfd5a0cd8 Merge pull request #1010 from theDAVID543/master
fix bug
2023-08-31 14:41:28 -04:00
theDAVID543
a821c0da50 fix bug 2023-08-18 11:53:06 +08:00
Brian Neumann-Fopiano
804147e2c4 overworld bump 2023-08-12 11:47:42 -04:00
Brian Neumann-Fopiano
ed346291f9 oops v+ 2023-07-29 06:13:42 -04:00
14 changed files with 261 additions and 22 deletions

View File

@@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.7.3-1.20.1'
version '2.8.0-1.20.1'
def nmsVersion = '1.20.1' //[NMS]
def apiVersion = '1.20'
def specialSourceVersion = '1.11.0' //[NMS]
@@ -40,6 +40,7 @@ registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/s
registerCustomOutputTask('Coco', 'D://mcsm/plugins')
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.4/plugins')
registerCustomOutputTask('CrazyDev22', 'C://Users/Julian/Desktop/server/plugins')
// ========================== UNIX ==============================
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')

View File

@@ -91,7 +91,7 @@ import java.util.Map;
@SuppressWarnings("CanBeFinal")
public class Iris extends VolmitPlugin implements Listener {
public static final String OVERWORLD_TAG = "3005";
public static final String OVERWORLD_TAG = "3700";
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();

View File

@@ -31,6 +31,7 @@ import com.volmit.iris.util.decree.DecreeExecutor;
import com.volmit.iris.util.decree.DecreeOrigin;
import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.annotations.Param;
import com.volmit.iris.util.decree.specialhandlers.NullablePlayerHandler;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.parallel.BurstExecutor;
@@ -41,6 +42,8 @@ import com.volmit.iris.util.scheduling.jobs.QueueJob;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.io.IOException;
@@ -127,6 +130,31 @@ public class CommandIris implements DecreeExecutor {
}
}
@Decree(description = "Teleport to another world", aliases = {"tp"}, sync = true)
public void teleport(
@Param(description = "World to teleport to")
World world,
@Param(description = "Player to teleport", defaultValue = "---", customHandler = NullablePlayerHandler.class)
Player player
) {
if (player == null && sender().isPlayer())
player = sender().player();
final Player target = player;
if (target == null) {
sender().sendMessage(C.RED + "The specified player does not exist.");
return;
}
new BukkitRunnable() {
@Override
public void run() {
target.teleport(world.getSpawnLocation());
new VolmitSender(target).sendMessage(C.GREEN + "You have been teleported to " + world.getName() + ".");
}
}.runTask(Iris.instance);
}
@Decree(description = "Print version information")
public void version() {
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");

View File

@@ -341,7 +341,7 @@ public class CommandObject implements DecreeExecutor {
}
}
} else {
sender().sendMessage("Placed " + object);
sender().sendMessage(C.IRIS + "Placed " + object);
}
}
@@ -413,7 +413,7 @@ public class CommandObject implements DecreeExecutor {
ObjectSVC service = Iris.service(ObjectSVC.class);
int actualReverts = Math.min(service.getUndos().size(), amount);
service.revertChanges(actualReverts);
sender().sendMessage("Reverted " + actualReverts + " pastes!");
sender().sendMessage(C.BLUE + "Reverted " + actualReverts + C.BLUE +" pastes!");
}
@Decree(description = "Gets an object wand and grabs the current WorldEdit selection.", aliases = "we", origin = DecreeOrigin.PLAYER, studio = true)

View File

@@ -18,9 +18,11 @@
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.util.plugin.IrisService;
import com.volmit.iris.util.scheduling.J;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
@@ -68,19 +70,22 @@ public class ObjectSVC implements IrisService {
* @param blocks The blocks to remove
*/
private void revert(Map<Block, BlockData> blocks) {
int amount = 0;
Iterator<Map.Entry<Block, BlockData>> it = blocks.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Block, BlockData> entry = it.next();
BlockData data = entry.getValue();
entry.getKey().setBlockData(data, false);
it.remove();
Bukkit.getScheduler().runTask(Iris.instance, () -> {
int amount = 0;
while (it.hasNext()) {
Map.Entry<Block, BlockData> entry = it.next();
BlockData data = entry.getValue();
entry.getKey().setBlockData(data, false);
amount++;
it.remove();
if (amount > 200) {
J.s(() -> revert(blocks), 1);
amount++;
if (amount > 200) {
J.s(() -> revert(blocks), 1);
}
}
}
});
}
}
}

View File

@@ -49,6 +49,7 @@ import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterCavern;
import com.volmit.iris.util.matter.MatterUpdate;
import com.volmit.iris.util.matter.TileWrapper;
import com.volmit.iris.util.matter.slices.container.JigsawPieceContainer;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.scheduling.ChronoLatch;
@@ -345,6 +346,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
@BlockCoordinates
@Override
default void update(int x, int y, int z, Chunk c, RNG rf) {
Block block = c.getBlock(x, y, z);
BlockData data = block.getBlockData();
@@ -361,8 +363,17 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
KList<IrisLootTable> tables = getLootTables(rx, block);
try {
Bukkit.getPluginManager().callEvent(new IrisLootEvent(this, block, slot, tables));
if (!tables.isEmpty()){
Iris.debug("IrisLootEvent has been accessed");
}
if (tables.isEmpty())
return;
InventoryHolder m = (InventoryHolder) block.getState();
addItems(false, m.getInventory(), rx, tables, slot, x, y, z, 15);
} catch (Throwable e) {
Iris.reportError(e);
}
@@ -651,7 +662,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
}
default IrisPosition lookForRegion(IrisRegion reg, long timeout, Consumer<Integer> triesc) {
if (getWorld().hasRealWorld()) {
if (!getWorld().hasRealWorld()) {
Iris.error("Cannot GOTO without a bound world (headless mode)");
return null;
}
@@ -758,6 +769,15 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
String[] v = objectAt.split("\\Q@\\E");
String object = v[0];
int id = Integer.parseInt(v[1]);
JigsawPieceContainer container = getMantle().getMantle().get(x, y, z, JigsawPieceContainer.class);
if (container != null) {
IrisJigsawPiece piece = container.load(getData());
if (piece.getObject().equals(object))
return new PlacedObject(piece.getPlacementOptions(), getData().getObjectLoader().load(object), id, x, z);
}
IrisRegion region = getRegion(x, z);
for (IrisObjectPlacement i : region.getObjects()) {
@@ -777,7 +797,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
return new PlacedObject(null, getData().getObjectLoader().load(object), id, x, z);
}
int getCacheID();
default IrisBiome getBiomeOrMantle(Location l) {

View File

@@ -0,0 +1,32 @@
package com.volmit.iris.engine.framework;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.util.collection.KList;
import lombok.Getter;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@Getter
public class IrisLootEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private final Engine engine;
private final Block block;
private final InventorySlotType slot;
private final KList<IrisLootTable> tables;
public IrisLootEvent(Engine engine, Block block, InventorySlotType slot, KList<IrisLootTable> tables) {
this.engine = engine;
this.block = block;
this.slot = slot;
this.tables = tables;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -23,13 +23,18 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.mantle.Mantle;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.slices.JigsawPieceMatter;
import com.volmit.iris.util.matter.slices.container.JigsawPieceContainer;
import lombok.Data;
import org.bukkit.Axis;
import org.bukkit.World;
import org.bukkit.block.TileState;
import org.bukkit.block.data.BlockData;
@Data
public class PlannedStructure {
@@ -70,7 +75,7 @@ public class PlannedStructure {
}
}
public void place(IObjectPlacer placer, Mantle e, Engine eng) {
public void place(MantleWriter placer, Mantle e, Engine eng) {
IrisObjectPlacement options = new IrisObjectPlacement();
options.getRotation().setEnabled(false);
int startHeight = pieces.get(0).getPosition().getY();
@@ -80,7 +85,7 @@ public class PlannedStructure {
}
}
public void place(PlannedPiece i, int startHeight, IrisObjectPlacement o, IObjectPlacer placer, Mantle e, Engine eng) {
public void place(PlannedPiece i, int startHeight, IrisObjectPlacement o, MantleWriter placer, Mantle e, Engine eng) {
IrisObjectPlacement options = o;
if (i.getPiece().getPlacementOptions() != null) {
@@ -117,7 +122,70 @@ public class PlannedStructure {
}
int id = rng.i(0, Integer.MAX_VALUE);
vo.place(xx, height, zz, placer, options, rng, (b, data) -> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
JigsawPieceContainer container = JigsawPieceContainer.toContainer(i.getPiece());
vo.place(xx, height, zz, new IObjectPlacer() {
@Override
public int getHighest(int x, int z, IrisData data) {
return placer.getHighest(x, z, data);
}
@Override
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
return placer.getHighest(x, z, data, ignoreFluid);
}
@Override
public void set(int x, int y, int z, BlockData d) {
placer.setData(x, y, z, container);
placer.set(x, y, z, d);
}
@Override
public BlockData get(int x, int y, int z) {
placer.setData(x, y, z, container);
return placer.get(x, y, z);
}
@Override
public boolean isPreventingDecay() {
return placer.isPreventingDecay();
}
@Override
public boolean isCarved(int x, int y, int z) {
return placer.isCarved(x, y, z);
}
@Override
public boolean isSolid(int x, int y, int z) {
return placer.isSolid(x, y, z);
}
@Override
public boolean isUnderwater(int x, int z) {
return placer.isUnderwater(x, z);
}
@Override
public int getFluidHeight() {
return placer.getFluidHeight();
}
@Override
public boolean isDebugSmartBore() {
return placer.isDebugSmartBore();
}
@Override
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
placer.setTile(xx, yy, zz, tile);
}
@Override
public Engine getEngine() {
return placer.getEngine();
}
}, options, rng, (b, data) -> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
}
public void place(World world) {
@@ -256,7 +324,7 @@ public class PlannedStructure {
}
private void generateStartPiece() {
pieces.add(new PlannedPiece(this, position, getData().getJigsawPieceLoader().load(rng.pick(getStructure().getPieces())), 0, rng.nextInt(4), 0));
pieces.add(new PlannedPiece(this, position, getData().getJigsawPieceLoader().load(rng.pick(getStructure().getPieces())), 0, getStructure().isDisableInitialRotation() ? 0 : rng.nextInt(4), 0));
}
private void generateTerminators() {

View File

@@ -62,6 +62,9 @@ public class IrisJigsawStructure extends IrisRegistrant {
@Desc("Force Y to a specific value")
private int lockY = -1;
@Desc("Set to true to prevent rotating the initial structure piece")
private boolean disableInitialRotation = false;
private transient AtomicCache<Integer> maxDimension = new AtomicCache<>();
private void loadPool(String p, KList<String> pools, KList<String> pieces) {

View File

@@ -255,7 +255,7 @@ public class IrisObjectPlacement {
if (B.isStorageChest(data)) {
IrisLootTable picked = null;
if (cache.exact.containsKey(data.getMaterial()) && cache.exact.containsKey(data)) {
if (cache.exact.containsKey(data.getMaterial()) && cache.exact.get(data.getMaterial()).containsKey(data)) {
picked = cache.exact.get(data.getMaterial()).get(data).pullRandom();
} else if (cache.basic.containsKey(data.getMaterial())) {
picked = cache.basic.get(data.getMaterial()).pullRandom();

View File

@@ -0,0 +1,13 @@
package com.volmit.iris.util.decree.specialhandlers;
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
import com.volmit.iris.util.decree.handlers.PlayerHandler;
import org.bukkit.entity.Player;
public class NullablePlayerHandler extends PlayerHandler {
@Override
public Player parse(String in, boolean force) throws DecreeParsingException {
return getPossibilities(in).stream().filter((i) -> toString(i).equalsIgnoreCase(in)).findFirst().orElse(null);
}
}

View File

@@ -0,0 +1,35 @@
package com.volmit.iris.util.matter.slices;
import com.volmit.iris.util.data.palette.Palette;
import com.volmit.iris.util.matter.Sliced;
import com.volmit.iris.util.matter.slices.container.JigsawPieceContainer;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@Sliced
public class JigsawPieceMatter extends RawMatter<JigsawPieceContainer> {
public JigsawPieceMatter() {
this(1,1,1);
}
public JigsawPieceMatter(int width, int height, int depth) {
super(width, height, depth, JigsawPieceContainer.class);
}
@Override
public Palette<JigsawPieceContainer> getGlobalPalette() {
return null;
}
@Override
public void writeNode(JigsawPieceContainer b, DataOutputStream dos) throws IOException {
dos.writeUTF(b.getLoadKey());
}
@Override
public JigsawPieceContainer readNode(DataInputStream din) throws IOException {
return new JigsawPieceContainer(din.readUTF());
}
}

View File

@@ -0,0 +1,13 @@
package com.volmit.iris.util.matter.slices.container;
import com.volmit.iris.engine.object.IrisJigsawPiece;
public class JigsawPieceContainer extends RegistrantContainer<IrisJigsawPiece> {
public JigsawPieceContainer(String loadKey) {
super(IrisJigsawPiece.class, loadKey);
}
public static JigsawPieceContainer toContainer(IrisJigsawPiece piece) {
return new JigsawPieceContainer(piece.getLoadKey());
}
}

View File

@@ -0,0 +1,22 @@
package com.volmit.iris.util.matter.slices.container;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
public abstract class RegistrantContainer<T extends IrisRegistrant> {
private final Class<T> type;
private final String loadKey;
public RegistrantContainer(Class<T> type, String loadKey) {
this.type = type;
this.loadKey = loadKey;
}
public T load(IrisData data) {
return (T) data.getLoaders().get(type).load(loadKey);
}
public String getLoadKey() {
return loadKey;
}
}