mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-03-18 14:29:23 +01:00
Limit to 1.21.x Fix for 1.21.3
This commit is contained in:
parent
6d66242ef7
commit
3d411d24ff
61
pom.xml
61
pom.xml
@ -55,6 +55,7 @@
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.21.3-R0.1-SNAPSHOT</spigot.version>
|
||||
<paper.version>1.21.3-R0.1-SNAPSHOT</paper.version>
|
||||
<bentobox.version>2.7.1-SNAPSHOT</bentobox.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
@ -111,6 +112,10 @@
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
@ -139,6 +144,20 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Paper API -->
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>${paper.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- PaperLib -->
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
@ -172,14 +191,7 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Spigot NMS. Used for chunk deletion and pasting. -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc....</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>${spigot.version}</version>
|
||||
@ -191,24 +203,6 @@
|
||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc.</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc..</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.20.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc...</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -318,10 +312,17 @@
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<paperweight-mappings-namespace>spigot</paperweight-mappings-namespace>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -250,9 +250,11 @@ public class AdvancementsManager {
|
||||
}
|
||||
if (advConfig.getBoolean("settings.automatic-scoring")) {
|
||||
if (!a.getKey().getKey().contains("recipes") && a.getDisplay() != null) {
|
||||
float x = a.getDisplay().getX();
|
||||
float y = a.getDisplay().getY();
|
||||
return (int) Math.round(Math.sqrt(x * x + y * y));
|
||||
int score = 1;
|
||||
while (a.getParent() != null) {
|
||||
score++;
|
||||
}
|
||||
return score;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -396,8 +396,7 @@ public class NewAreaListener implements Listener {
|
||||
Location location = new Location(world, x, y, z);
|
||||
//BentoBox.getInstance().logDebug("Structure " + name + " will be placed at " + location);
|
||||
readyToBuild.computeIfAbsent(new Pair<>(x >> 4, z >> 4), k -> new ArrayList<>())
|
||||
.add(new StructureRecord(name, "minecraft:" + name, location,
|
||||
rotation, mirror, noMobs));
|
||||
.add(new StructureRecord(name, "minecraft:" + name, location, rotation, mirror, noMobs));
|
||||
this.itemsToBuild
|
||||
.add(new StructureRecord(name, "minecraft:" + name, location, rotation, mirror, noMobs));
|
||||
} else {
|
||||
@ -508,16 +507,21 @@ public class NewAreaListener implements Listener {
|
||||
}
|
||||
|
||||
private static void processJigsaw(Block b, StructureRotation structureRotation, boolean pasteMobs) {
|
||||
String data = nmsData(b);
|
||||
if (data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
BoxedJigsawBlock bjb = gson.fromJson(data, BoxedJigsawBlock.class);
|
||||
String finalState = correctDirection(bjb.getFinal_state(), structureRotation);
|
||||
BlockData bd = Bukkit.createBlockData(finalState);
|
||||
b.setBlockData(bd);
|
||||
if (!bjb.getPool().equalsIgnoreCase("minecraft:empty") && pasteMobs) {
|
||||
spawnMob(b, bjb);
|
||||
try {
|
||||
String data = nmsData(b);
|
||||
if (data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
BoxedJigsawBlock bjb = gson.fromJson(data, BoxedJigsawBlock.class);
|
||||
String finalState = correctDirection(bjb.getFinal_state(), structureRotation);
|
||||
BlockData bd = Bukkit.createBlockData(finalState);
|
||||
b.setBlockData(bd);
|
||||
if (!bjb.getPool().equalsIgnoreCase("minecraft:empty") && pasteMobs) {
|
||||
spawnMob(b, bjb);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
BentoBox.getInstance().logDebug("We have an error");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,15 +8,20 @@ import org.bukkit.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutTileEntityData;
|
||||
import net.minecraft.world.level.block.entity.TileEntity;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractMetaData {
|
||||
|
||||
public abstract String nmsData(Block block);
|
||||
|
||||
protected String getData(TileEntity te, String method, String field) {
|
||||
/*
|
||||
for (Method m : te.getClass().getMethods()) {
|
||||
BentoBox.getInstance().logDebug(m.getName() + " returns " + m.getReturnType() + " and has these parameters "
|
||||
+ m.getParameterTypes());
|
||||
}
|
||||
te.getUpdateTag();
|
||||
*/
|
||||
try {
|
||||
// Check if the method 'j' exists
|
||||
Method updatePacketMethod = te.getClass().getDeclaredMethod(method);
|
||||
@ -30,7 +35,7 @@ public abstract class AbstractMetaData {
|
||||
Field fieldC = packet.getClass().getDeclaredField(field);
|
||||
fieldC.setAccessible(true);
|
||||
NBTTagCompound nbtTag = (NBTTagCompound) fieldC.get(packet);
|
||||
|
||||
|
||||
return nbtTag.toString(); // This will show what you want
|
||||
//} else {
|
||||
// throw new ClassNotFoundException(
|
||||
|
@ -1,21 +0,0 @@
|
||||
package world.bentobox.boxed.nms.v1_20_4_R0_1_SNAPSHOT;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
|
||||
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.world.level.block.entity.TileEntity;
|
||||
import world.bentobox.boxed.nms.AbstractMetaData;
|
||||
|
||||
public class GetMetaData extends AbstractMetaData {
|
||||
|
||||
@Override
|
||||
public String nmsData(Block block) {
|
||||
Location w = block.getLocation();
|
||||
CraftWorld cw = (CraftWorld) w.getWorld(); // CraftWorld is NMS one
|
||||
TileEntity te = cw.getHandle().c_(new BlockPosition(w.getBlockX(), w.getBlockY(), w.getBlockZ()));
|
||||
|
||||
return getData(te, "j", "c");
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package world.bentobox.boxed.nms.v1_20_6_R0_1_SNAPSHOT;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_20_R4.CraftWorld;
|
||||
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.world.level.block.entity.TileEntity;
|
||||
import world.bentobox.boxed.nms.AbstractMetaData;
|
||||
|
||||
public class GetMetaData extends AbstractMetaData {
|
||||
|
||||
@Override
|
||||
public String nmsData(Block block) {
|
||||
Location w = block.getLocation();
|
||||
CraftWorld cw = (CraftWorld) w.getWorld(); // CraftWorld is NMS one
|
||||
TileEntity te = cw.getHandle().c_(new BlockPosition(w.getBlockX(), w.getBlockY(), w.getBlockZ()));
|
||||
return getData(te, "au_", "tag");
|
||||
}
|
||||
}
|
@ -1,5 +1,22 @@
|
||||
package world.bentobox.boxed.nms.v1_21_3_R0_1_SNAPSHOT;
|
||||
|
||||
public class GetMetaData extends world.bentobox.boxed.nms.v1_21_R0_1_SNAPSHOT.GetMetaData {
|
||||
// Identical to 1.21
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_21_R2.CraftWorld;
|
||||
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.world.level.block.entity.TileEntity;
|
||||
import world.bentobox.boxed.nms.AbstractMetaData;
|
||||
|
||||
public class GetMetaData extends AbstractMetaData {
|
||||
|
||||
@Override
|
||||
public String nmsData(Block block) {
|
||||
Location w = block.getLocation();
|
||||
CraftWorld cw = (CraftWorld) w.getWorld(); // CraftWorld is NMS one
|
||||
// for 1.13+ (we have use WorldServer)
|
||||
TileEntity te = cw.getHandle().c_(new BlockPosition(w.getBlockX(), w.getBlockY(), w.getBlockZ()));
|
||||
return getData(te, "getUpdatePacket", "tag");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user