mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Remove unnecessary reflection
This commit is contained in:
parent
ecedc1ff12
commit
1df5853f33
@ -11,7 +11,6 @@ import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
|||||||
import com.boydti.fawe.bukkit.adapter.mc1_14.nbt.LazyCompoundTag_1_14;
|
import com.boydti.fawe.bukkit.adapter.mc1_14.nbt.LazyCompoundTag_1_14;
|
||||||
import com.boydti.fawe.object.collection.AdaptedMap;
|
import com.boydti.fawe.object.collection.AdaptedMap;
|
||||||
import com.boydti.fawe.object.collection.BitArray4096;
|
import com.boydti.fawe.object.collection.BitArray4096;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
@ -41,7 +40,6 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import net.minecraft.server.v1_14_R1.BiomeBase;
|
import net.minecraft.server.v1_14_R1.BiomeBase;
|
||||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_14_R1.Chunk;
|
import net.minecraft.server.v1_14_R1.Chunk;
|
||||||
@ -352,7 +350,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
|
|
||||||
syncTasks[1] = () -> {
|
syncTasks[1] = () -> {
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
final Map<String, Tag> entityTagMap = nativeTag.getValue();
|
||||||
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
||||||
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
||||||
|
@ -11,7 +11,6 @@ import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
|||||||
import com.boydti.fawe.bukkit.adapter.mc1_15.nbt.LazyCompoundTag_1_15;
|
import com.boydti.fawe.bukkit.adapter.mc1_15.nbt.LazyCompoundTag_1_15;
|
||||||
import com.boydti.fawe.object.collection.AdaptedMap;
|
import com.boydti.fawe.object.collection.AdaptedMap;
|
||||||
import com.boydti.fawe.object.collection.BitArray4096;
|
import com.boydti.fawe.object.collection.BitArray4096;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
@ -41,7 +40,6 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import net.minecraft.server.v1_15_R1.BiomeBase;
|
import net.minecraft.server.v1_15_R1.BiomeBase;
|
||||||
import net.minecraft.server.v1_15_R1.BiomeStorage;
|
import net.minecraft.server.v1_15_R1.BiomeStorage;
|
||||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||||
@ -365,7 +363,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
|||||||
|
|
||||||
syncTasks[1] = () -> {
|
syncTasks[1] = () -> {
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
final Map<String, Tag> entityTagMap = nativeTag.getValue();
|
||||||
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
||||||
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
||||||
|
@ -6,11 +6,9 @@ import com.boydti.fawe.beta.IChunkSet;
|
|||||||
import com.boydti.fawe.beta.implementation.blocks.CharGetBlocks;
|
import com.boydti.fawe.beta.implementation.blocks.CharGetBlocks;
|
||||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||||
import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15.nbt.LazyCompoundTag_1_15;
|
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15_2.nbt.LazyCompoundTag_1_15_2;
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.nbt.LazyCompoundTag_1_15_2;
|
||||||
import com.boydti.fawe.object.collection.AdaptedMap;
|
import com.boydti.fawe.object.collection.AdaptedMap;
|
||||||
import com.boydti.fawe.object.collection.BitArray4096;
|
import com.boydti.fawe.object.collection.BitArray4096;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -354,7 +352,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
|
|
||||||
syncTasks[1] = () -> {
|
syncTasks[1] = () -> {
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
final Map<String, Tag> entityTagMap = nativeTag.getValue();
|
||||||
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
||||||
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.boydti.fawe.bukkit.wrapper.state;
|
package com.boydti.fawe.bukkit.wrapper.state;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -35,10 +34,10 @@ public final class AsyncDataContainer implements PersistentDataContainer {
|
|||||||
Map<String, Tag> raw;
|
Map<String, Tag> raw;
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
if (!create) return Collections.emptyMap();
|
if (!create) return Collections.emptyMap();
|
||||||
Map<String, Tag> map = ReflectionUtils.getMap(root.getValue());
|
Map<String, Tag> map = root.getValue();
|
||||||
map.put("PublicBukkitValues", new CompoundTag(raw = new HashMap<>()));
|
map.put("PublicBukkitValues", new CompoundTag(raw = new HashMap<>()));
|
||||||
} else {
|
} else {
|
||||||
raw = ReflectionUtils.getMap(tag.getValue());
|
raw = tag.getValue();
|
||||||
}
|
}
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.boydti.fawe.bukkit.wrapper.state;
|
|||||||
|
|
||||||
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
|
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
|
||||||
import com.boydti.fawe.bukkit.wrapper.AsyncBlockState;
|
import com.boydti.fawe.bukkit.wrapper.AsyncBlockState;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.StringTag;
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -58,7 +57,7 @@ public class AsyncSign extends AsyncBlockState implements Sign {
|
|||||||
public void setLine(int index, String line) throws IndexOutOfBoundsException {
|
public void setLine(int index, String line) throws IndexOutOfBoundsException {
|
||||||
CompoundTag nbt = getNbtData();
|
CompoundTag nbt = getNbtData();
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
Map<String, Tag> map = ReflectionUtils.getMap(nbt.getValue());
|
Map<String, Tag> map = nbt.getValue();
|
||||||
map.put("Text" + (index + 1), new StringTag(toJson(line)));
|
map.put("Text" + (index + 1), new StringTag(toJson(line)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,7 +91,7 @@ public class AsyncSign extends AsyncBlockState implements Sign {
|
|||||||
public void setColor(DyeColor color) {
|
public void setColor(DyeColor color) {
|
||||||
CompoundTag nbt = getNbtData();
|
CompoundTag nbt = getNbtData();
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
Map<String, Tag> map = ReflectionUtils.getMap(nbt.getValue());
|
Map<String, Tag> map = nbt.getValue();
|
||||||
map.put("Color", new StringTag(color.name().toLowerCase()));
|
map.put("Color", new StringTag(color.name().toLowerCase()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.boydti.fawe.object.changeset;
|
package com.boydti.fawe.object.changeset;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
@ -114,7 +113,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
|||||||
@Override
|
@Override
|
||||||
public void addTileCreate(CompoundTag nbt) {
|
public void addTileCreate(CompoundTag nbt) {
|
||||||
if (nbt.containsKey("items")) {
|
if (nbt.containsKey("items")) {
|
||||||
Map<String, Tag> map = ReflectionUtils.getMap(nbt.getValue());
|
Map<String, Tag> map = nbt.getValue();
|
||||||
map.remove("items");
|
map.remove("items");
|
||||||
}
|
}
|
||||||
super.addTileCreate(nbt);
|
super.addTileCreate(nbt);
|
||||||
|
@ -2,14 +2,12 @@ package com.boydti.fawe.object.clipboard;
|
|||||||
|
|
||||||
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
||||||
import com.boydti.fawe.object.IntegerTrio;
|
import com.boydti.fawe.object.IntegerTrio;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
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.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
@ -22,11 +20,8 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class CPUOptimizedClipboard extends LinearClipboard {
|
public class CPUOptimizedClipboard extends LinearClipboard {
|
||||||
|
|
||||||
@ -153,7 +148,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
for (Map.Entry<Integer, CompoundTag> entry : nbtMapIndex.entrySet()) {
|
for (Map.Entry<Integer, CompoundTag> entry : nbtMapIndex.entrySet()) {
|
||||||
int index = entry.getKey();
|
int index = entry.getKey();
|
||||||
CompoundTag tag = entry.getValue();
|
CompoundTag tag = entry.getValue();
|
||||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> values = tag.getValue();
|
||||||
if (!values.containsKey("x")) {
|
if (!values.containsKey("x")) {
|
||||||
int y = index / getArea();
|
int y = index / getArea();
|
||||||
index -= y * getArea();
|
index -= y * getArea();
|
||||||
@ -175,7 +170,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
public boolean setTile(int index, CompoundTag tag) {
|
public boolean setTile(int index, CompoundTag tag) {
|
||||||
nbtMapIndex.put(index, tag);
|
nbtMapIndex.put(index, tag);
|
||||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> values = tag.getValue();
|
||||||
values.remove("x");
|
values.remove("x");
|
||||||
values.remove("y");
|
values.remove("y");
|
||||||
values.remove("z");
|
values.remove("z");
|
||||||
|
@ -5,7 +5,6 @@ import com.boydti.fawe.config.Settings;
|
|||||||
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
||||||
import com.boydti.fawe.object.IntegerTrio;
|
import com.boydti.fawe.object.IntegerTrio;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -372,7 +371,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
|||||||
@Override
|
@Override
|
||||||
public boolean setTile(int x, int y, int z, CompoundTag tag) {
|
public boolean setTile(int x, int y, int z, CompoundTag tag) {
|
||||||
nbtMap.put(new IntegerTrio(x, y, z), tag);
|
nbtMap.put(new IntegerTrio(x, y, z), tag);
|
||||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> values = tag.getValue();
|
||||||
values.put("x", new IntTag(x));
|
values.put("x", new IntTag(x));
|
||||||
values.put("y", new IntTag(y));
|
values.put("y", new IntTag(y));
|
||||||
values.put("z", new IntTag(z));
|
values.put("z", new IntTag(z));
|
||||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.config.Settings;
|
|||||||
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
||||||
import com.boydti.fawe.object.IntegerTrio;
|
import com.boydti.fawe.object.IntegerTrio;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -12,7 +11,6 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
|||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard.ClipboardEntity;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard.ClipboardEntity;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
@ -199,7 +197,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
for (Map.Entry<Integer, CompoundTag> entry : nbtMapIndex.entrySet()) {
|
for (Map.Entry<Integer, CompoundTag> entry : nbtMapIndex.entrySet()) {
|
||||||
int index = entry.getKey();
|
int index = entry.getKey();
|
||||||
CompoundTag tag = entry.getValue();
|
CompoundTag tag = entry.getValue();
|
||||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> values = tag.getValue();
|
||||||
if (!values.containsKey("x")) {
|
if (!values.containsKey("x")) {
|
||||||
int y = index / getArea();
|
int y = index / getArea();
|
||||||
index -= y * getArea();
|
index -= y * getArea();
|
||||||
@ -270,7 +268,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
public boolean setTile(int index, CompoundTag tag) {
|
public boolean setTile(int index, CompoundTag tag) {
|
||||||
nbtMapIndex.put(index, tag);
|
nbtMapIndex.put(index, tag);
|
||||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> values = tag.getValue();
|
||||||
values.remove("x");
|
values.remove("x");
|
||||||
values.remove("y");
|
values.remove("y");
|
||||||
values.remove("z");
|
values.remove("z");
|
||||||
|
@ -3,7 +3,6 @@ package com.boydti.fawe.object.schematic;
|
|||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.ListTag;
|
import com.sk89q.jnbt.ListTag;
|
||||||
@ -231,7 +230,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
|||||||
BaseEntity state = entity.getState();
|
BaseEntity state = entity.getState();
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
CompoundTag nbt = state.getNbtData();
|
CompoundTag nbt = state.getNbtData();
|
||||||
Map<String, Tag> nbtMap = ReflectionUtils.getMap(nbt.getValue());
|
Map<String, Tag> nbtMap = nbt.getValue();
|
||||||
// Replace rotation data
|
// Replace rotation data
|
||||||
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
|
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
|
||||||
nbtMap.put("id", new StringTag(state.getType().getId()));
|
nbtMap.put("id", new StringTag(state.getType().getId()));
|
||||||
|
@ -2,8 +2,6 @@ package com.boydti.fawe.util;
|
|||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.boydti.fawe.object.brush.BrushSettings;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
@ -80,7 +78,7 @@ public final class BrushCache {
|
|||||||
}
|
}
|
||||||
nbt = new CompoundTag(map = new HashMap<>());
|
nbt = new CompoundTag(map = new HashMap<>());
|
||||||
} else {
|
} else {
|
||||||
map = ReflectionUtils.getMap(nbt.getValue());
|
map = nbt.getValue();
|
||||||
}
|
}
|
||||||
brushCache.remove(getKey(item));
|
brushCache.remove(getKey(item));
|
||||||
CompoundTag display = (CompoundTag) map.get("display");
|
CompoundTag display = (CompoundTag) map.get("display");
|
||||||
|
@ -432,14 +432,14 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setPosition(CompoundTag tag, int x, int y, int z) {
|
public static void setPosition(CompoundTag tag, int x, int y, int z) {
|
||||||
Map<String, Tag> value = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> value = tag.getValue();
|
||||||
value.put("x", new IntTag(x));
|
value.put("x", new IntTag(x));
|
||||||
value.put("y", new IntTag(y));
|
value.put("y", new IntTag(y));
|
||||||
value.put("z", new IntTag(z));
|
value.put("z", new IntTag(z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setEntityInfo(CompoundTag tag, Entity entity) {
|
public static void setEntityInfo(CompoundTag tag, Entity entity) {
|
||||||
Map<String, Tag> map = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> map = tag.getValue();
|
||||||
map.put("Id", new StringTag(entity.getState().getType().getId()));
|
map.put("Id", new StringTag(entity.getState().getType().getId()));
|
||||||
ListTag pos = (ListTag) map.get("Pos");
|
ListTag pos = (ListTag) map.get("Pos");
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
|
@ -73,25 +73,6 @@ public class ReflectionUtils {
|
|||||||
blankField(enumClass, "enumConstants"); // IBM JDK
|
blankField(enumClass, "enumConstants"); // IBM JDK
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Class<?> UNMODIFIABLE_MAP = Collections.unmodifiableMap(Collections.emptyMap())
|
|
||||||
.getClass();
|
|
||||||
|
|
||||||
public static <T, V> Map<T, V> getMap(Map<T, V> map) {
|
|
||||||
try {
|
|
||||||
Class<? extends Map> clazz = map.getClass();
|
|
||||||
if (clazz != UNMODIFIABLE_MAP) {
|
|
||||||
Fawe.debug("getMap is unused. Please report this to MattBDev on Github or Discord");
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
Field m = clazz.getDeclaredField("m");
|
|
||||||
m.setAccessible(true);
|
|
||||||
return (Map<T, V>) m.get(map);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> List<T> getList(List<T> list) {
|
public static <T> List<T> getList(List<T> list) {
|
||||||
try {
|
try {
|
||||||
Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class
|
Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class
|
||||||
|
@ -37,7 +37,6 @@ import static com.sk89q.worldedit.util.Direction.findClosest;
|
|||||||
import static com.sk89q.worldedit.util.Direction.values;
|
import static com.sk89q.worldedit.util.Direction.values;
|
||||||
|
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
|
||||||
import com.sk89q.jnbt.ByteTag;
|
import com.sk89q.jnbt.ByteTag;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -67,7 +66,6 @@ import java.util.Map;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
import java.util.HashMap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -335,7 +333,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
|||||||
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||||
|
|
||||||
if (newDirection != null) {
|
if (newDirection != null) {
|
||||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
Map<String, Tag> values = tag.getValue();
|
||||||
values.put("Rot", new ByteTag((byte) MCDirections.toRotation(newDirection)));
|
values.put("Rot", new ByteTag((byte) MCDirections.toRotation(newDirection)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user