Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-17 05:40:06 +01:00
Update to 1.21.3
Dieser Commit ist enthalten in:
Ursprung
bbf14d4f63
Commit
9a86585f3e
@ -3,7 +3,7 @@
|
||||
bom-newest = "1.37"
|
||||
cloud-paper = "2.0.0-20240516.054251-69"
|
||||
coreprotect = "22.4"
|
||||
paper = "1.21.1-R0.1-SNAPSHOT"
|
||||
paper = "1.21.3-R0.1-SNAPSHOT"
|
||||
plotsquared = "7.3.8"
|
||||
reflection-remapper = "0.1.2-20240315.033304-2"
|
||||
viaversion-api = "5.0.1"
|
||||
|
@ -27,7 +27,7 @@ public class DisallowedBlocks {
|
||||
|
||||
for (String disallowedBlock : disallowedBlocks) {
|
||||
try {
|
||||
var parsed = BlockStateParser.parseForTesting(BuiltInRegistries.BLOCK.asLookup(), new StringReader(disallowedBlock), false);
|
||||
var parsed = BlockStateParser.parseForTesting(BuiltInRegistries.BLOCK, new StringReader(disallowedBlock), false);
|
||||
|
||||
parsed.left().ifPresent(result -> {
|
||||
disallowedPredicates.add(blockState -> {
|
||||
|
@ -8,6 +8,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -25,6 +26,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class BlueprintIo {
|
||||
|
||||
@ -91,9 +93,11 @@ public class BlueprintIo {
|
||||
long pos = blockPos.asLong();
|
||||
|
||||
String id = blockEntityCompound.getString("id");
|
||||
BlockEntityType<?> type = BuiltInRegistries.BLOCK_ENTITY_TYPE.get(VersionHelper.createResourceLocation(id));
|
||||
Optional<Holder.Reference<BlockEntityType<?>>> typeOptional = BuiltInRegistries.BLOCK_ENTITY_TYPE.get(VersionHelper.createResourceLocation(id));
|
||||
|
||||
if (type != null) {
|
||||
if (typeOptional.isPresent()) {
|
||||
BlockEntityType<?> type = typeOptional.get().value();
|
||||
|
||||
PalettedContainer<BlockState> container = blockMap.get(BlockPos.asLong(
|
||||
blockPos.getX() >> 4,
|
||||
blockPos.getY() >> 4,
|
||||
|
@ -17,7 +17,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.RelativeMovement;
|
||||
import net.minecraft.world.entity.Relative;
|
||||
import net.minecraft.world.entity.decoration.HangingEntity;
|
||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
@ -48,18 +48,18 @@ public class ManipulateEntityPacketListener implements PacketHandler {
|
||||
REMOVE_LIST
|
||||
}
|
||||
|
||||
public record ManipulateEntry(UUID uuid, @Nullable Set<RelativeMovement> relativeMovementSet, @Nullable Vec3 position,
|
||||
public record ManipulateEntry(UUID uuid, @Nullable Set<Relative> relativeMovementSet, @Nullable Vec3 position,
|
||||
float yaw, float pitch, CompoundTag merge, PassengerManipulation passengerManipulation, List<UUID> passengers) {
|
||||
public static ManipulateEntry read(FriendlyByteBuf friendlyByteBuf, Player player, AxiomPaper plugin) {
|
||||
UUID uuid = friendlyByteBuf.readUUID();
|
||||
|
||||
int flags = friendlyByteBuf.readByte();
|
||||
Set<RelativeMovement> relativeMovementSet = null;
|
||||
Set<Relative> relativeMovementSet = null;
|
||||
Vec3 position = null;
|
||||
float yaw = 0;
|
||||
float pitch = 0;
|
||||
if (flags >= 0) {
|
||||
relativeMovementSet = RelativeMovement.unpack(flags);
|
||||
relativeMovementSet = Relative.unpack(flags);
|
||||
position = new Vec3(friendlyByteBuf.readDouble(), friendlyByteBuf.readDouble(), friendlyByteBuf.readDouble());
|
||||
yaw = friendlyByteBuf.readFloat();
|
||||
pitch = friendlyByteBuf.readFloat();
|
||||
@ -128,11 +128,11 @@ public class ManipulateEntityPacketListener implements PacketHandler {
|
||||
|
||||
Vec3 entryPos = entry.position();
|
||||
if (entryPos != null && entry.relativeMovementSet != null) {
|
||||
double newX = entry.relativeMovementSet.contains(RelativeMovement.X) ? entity.position().x + entryPos.x : entryPos.x;
|
||||
double newY = entry.relativeMovementSet.contains(RelativeMovement.Y) ? entity.position().y + entryPos.y : entryPos.y;
|
||||
double newZ = entry.relativeMovementSet.contains(RelativeMovement.Z) ? entity.position().z + entryPos.z : entryPos.z;
|
||||
float newYaw = entry.relativeMovementSet.contains(RelativeMovement.Y_ROT) ? entity.getYRot() + entry.yaw : entry.yaw;
|
||||
float newPitch = entry.relativeMovementSet.contains(RelativeMovement.X_ROT) ? entity.getXRot() + entry.pitch : entry.pitch;
|
||||
double newX = entry.relativeMovementSet.contains(Relative.X) ? entity.position().x + entryPos.x : entryPos.x;
|
||||
double newY = entry.relativeMovementSet.contains(Relative.Y) ? entity.position().y + entryPos.y : entryPos.y;
|
||||
double newZ = entry.relativeMovementSet.contains(Relative.Z) ? entity.position().z + entryPos.z : entryPos.z;
|
||||
float newYaw = entry.relativeMovementSet.contains(Relative.Y_ROT) ? entity.getYRot() + entry.yaw : entry.yaw;
|
||||
float newPitch = entry.relativeMovementSet.contains(Relative.X_ROT) ? entity.getXRot() + entry.pitch : entry.pitch;
|
||||
|
||||
if (entity instanceof HangingEntity hangingEntity) {
|
||||
float changedYaw = newYaw - entity.getYRot();
|
||||
@ -148,7 +148,7 @@ public class ManipulateEntityPacketListener implements PacketHandler {
|
||||
|
||||
if (Integration.canPlaceBlock(player, new Location(player.getWorld(),
|
||||
containing.getX(), containing.getY(), containing.getZ()))) {
|
||||
entity.teleportTo(serverLevel, newX, newY, newZ, Set.of(), newYaw, newPitch);
|
||||
entity.teleportTo(serverLevel, newX, newY, newZ, Set.of(), newYaw, newPitch, true);
|
||||
}
|
||||
|
||||
entity.setYHeadRot(newYaw);
|
||||
|
@ -154,7 +154,7 @@ public class SetBlockBufferPacketListener implements PacketHandler {
|
||||
int cz = BlockPos.getZ(entry.getLongKey());
|
||||
PalettedContainer<BlockState> container = entry.getValue();
|
||||
|
||||
if (cy < world.getMinSection() || cy >= world.getMaxSection()) {
|
||||
if (cy < world.getMinSectionY() || cy > world.getMaxSectionY()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class SetBlockBufferPacketListener implements PacketHandler {
|
||||
}
|
||||
|
||||
// Update Light
|
||||
sectionLightChanged |= LightEngine.hasDifferentLightProperties(chunk, blockPos, old, blockState);
|
||||
sectionLightChanged |= LightEngine.hasDifferentLightProperties(old, blockState);
|
||||
|
||||
// Update Poi
|
||||
Optional<Holder<PoiType>> newPoi = containerMaybeHasPoi ? PoiTypes.forState(blockState) : Optional.empty();
|
||||
@ -312,11 +312,12 @@ public class SetBlockBufferPacketListener implements PacketHandler {
|
||||
boolean nowHasOnlyAir = section.hasOnlyAir();
|
||||
if (hasOnlyAir != nowHasOnlyAir) {
|
||||
world.getChunkSource().getLightEngine().updateSectionStatus(SectionPos.of(cx, cy, cz), nowHasOnlyAir);
|
||||
world.getChunkSource().onSectionEmptinessChanged(cx, cy, cz, nowHasOnlyAir);
|
||||
}
|
||||
|
||||
if (sectionChanged) {
|
||||
extension.sendChunk(cx, cz);
|
||||
chunk.setUnsaved(true);
|
||||
chunk.markUnsaved();
|
||||
}
|
||||
if (sectionLightChanged) {
|
||||
extension.lightChunk(cx, cz);
|
||||
@ -344,21 +345,21 @@ public class SetBlockBufferPacketListener implements PacketHandler {
|
||||
|
||||
Set<LevelChunk> changedChunks = new HashSet<>();
|
||||
|
||||
int minSection = world.getMinSection();
|
||||
int maxSection = world.getMaxSection();
|
||||
int minSection = world.getMinSectionY();
|
||||
int maxSection = world.getMaxSectionY();
|
||||
|
||||
Optional<Registry<Biome>> registryOptional = world.registryAccess().registry(Registries.BIOME);
|
||||
Optional<Registry<Biome>> registryOptional = world.registryAccess().lookup(Registries.BIOME);
|
||||
if (registryOptional.isEmpty()) return;
|
||||
|
||||
Registry<Biome> registry = registryOptional.get();
|
||||
|
||||
biomeBuffer.forEachEntry((x, y, z, biome) -> {
|
||||
int cy = y >> 2;
|
||||
if (cy < minSection || cy >= maxSection) {
|
||||
if (cy < minSection || cy > maxSection) {
|
||||
return;
|
||||
}
|
||||
|
||||
var holder = registry.getHolder(biome);
|
||||
var holder = registry.get(biome);
|
||||
if (holder.isPresent()) {
|
||||
var chunk = (LevelChunk) world.getChunk(x >> 2, z >> 2, ChunkStatus.FULL, false);
|
||||
if (chunk == null) return;
|
||||
@ -377,7 +378,7 @@ public class SetBlockBufferPacketListener implements PacketHandler {
|
||||
var chunkMap = world.getChunkSource().chunkMap;
|
||||
HashMap<ServerPlayer, List<LevelChunk>> map = new HashMap<>();
|
||||
for (LevelChunk chunk : changedChunks) {
|
||||
chunk.setUnsaved(true);
|
||||
chunk.markUnsaved();
|
||||
ChunkPos chunkPos = chunk.getPos();
|
||||
for (ServerPlayer serverPlayer2 : chunkMap.getPlayers(chunkPos, false)) {
|
||||
map.computeIfAbsent(serverPlayer2, serverPlayer -> new ArrayList<>()).add(chunk);
|
||||
|
@ -232,7 +232,7 @@ public class SetBlockPacketListener implements PacketHandler {
|
||||
|
||||
ServerLevel level = player.serverLevel();
|
||||
LevelChunk chunk = level.getChunk(cx, cz);
|
||||
chunk.setUnsaved(true);
|
||||
chunk.markUnsaved();
|
||||
|
||||
LevelChunkSection section = chunk.getSection(level.getSectionIndexFromSectionY(cy));
|
||||
boolean hasOnlyAir = section.hasOnlyAir();
|
||||
@ -295,7 +295,7 @@ public class SetBlockPacketListener implements PacketHandler {
|
||||
level.getChunkSource().blockChanged(blockPos);
|
||||
|
||||
// Update Light
|
||||
if (LightEngine.hasDifferentLightProperties(chunk, blockPos, old, blockState)) {
|
||||
if (LightEngine.hasDifferentLightProperties(old, blockState)) {
|
||||
// Note: Skylight Sources not currently needed on Paper due to Starlight
|
||||
// This might change in the future, so be careful!
|
||||
// chunk.getSkyLightSources().update(chunk, x, by, z);
|
||||
@ -322,6 +322,7 @@ public class SetBlockPacketListener implements PacketHandler {
|
||||
boolean nowHasOnlyAir = section.hasOnlyAir();
|
||||
if (hasOnlyAir != nowHasOnlyAir) {
|
||||
level.getChunkSource().getLightEngine().updateSectionStatus(SectionPos.of(cx, cy, cz), nowHasOnlyAir);
|
||||
level.getChunkSource().onSectionEmptinessChanged(cx, cy, cz, nowHasOnlyAir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.decoration.HangingEntity;
|
||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||
@ -96,7 +97,7 @@ public class SpawnEntityPacketListener implements PacketHandler {
|
||||
|
||||
AtomicBoolean useNewUuid = new AtomicBoolean(true);
|
||||
|
||||
Entity spawned = EntityType.loadEntityRecursive(tag, serverLevel, entity -> {
|
||||
Entity spawned = EntityType.loadEntityRecursive(tag, serverLevel, EntitySpawnReason.COMMAND, entity -> {
|
||||
if (!this.plugin.canEntityBeManipulated(entity.getType())) {
|
||||
return null;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren