Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 21:10:05 +01:00
Remove UUID fields in ForgeWorld when creating entities.
Dieser Commit ist enthalten in:
Ursprung
9c72a3c439
Commit
505d45237d
@ -32,6 +32,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack;
|
|||||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import com.sk89q.worldedit.internal.helper.MCDirections;
|
import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Direction;
|
import com.sk89q.worldedit.util.Direction;
|
||||||
@ -539,9 +540,13 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
net.minecraft.entity.Entity createdEntity = EntityList.createEntityByName(entity.getTypeId(), world);
|
net.minecraft.entity.Entity createdEntity = EntityList.createEntityByName(entity.getTypeId(), world);
|
||||||
if (createdEntity != null) {
|
if (createdEntity != null) {
|
||||||
CompoundTag tag = entity.getNbtData();
|
CompoundTag nativeTag = entity.getNbtData();
|
||||||
if (tag != null) {
|
if (nativeTag != null) {
|
||||||
createdEntity.readFromNBT(NBTConverter.toNative(entity.getNbtData()));
|
NBTTagCompound tag = NBTConverter.toNative(entity.getNbtData());
|
||||||
|
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
|
||||||
|
tag.removeTag(name);
|
||||||
|
}
|
||||||
|
createdEntity.readFromNBT(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), (float) Math.toDegrees(location.getYaw()), (float) Math.toDegrees(location.getPitch()));
|
createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), (float) Math.toDegrees(location.getYaw()), (float) Math.toDegrees(location.getPitch()));
|
||||||
|
45
src/main/java/com/sk89q/worldedit/internal/Constants.java
Normale Datei
45
src/main/java/com/sk89q/worldedit/internal/Constants.java
Normale Datei
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* WorldEdit, a Minecraft world manipulation toolkit
|
||||||
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||||
|
* Copyright (C) WorldEdit team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.internal;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class Constants {
|
||||||
|
|
||||||
|
private Constants() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of top level NBT fields that should not be copied to a world,
|
||||||
|
* such as UUIDLeast and UUIDMost.
|
||||||
|
*/
|
||||||
|
public static final List<String> NO_COPY_ENTITY_NBT_FIELDS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
NO_COPY_ENTITY_NBT_FIELDS = Collections.unmodifiableList(Arrays.asList(
|
||||||
|
"UUIDLeast", "UUIDMost", // Bukkit and Vanilla
|
||||||
|
"WorldUUIDLeast", "WorldUUIDMost", // Bukkit and Vanilla
|
||||||
|
"PersistentIDMSB", "PersistentIDLSB" // Forge
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren