Skip to content

feat: improve output with better-entity usage #3114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean setNext(T next) {
ReflectionUtils.setFailsafeFieldValue(field, root, next);
return true;
} catch (Throwable e) {
e.printStackTrace();
LOGGER.error(e);
return false;
}
}
Expand All @@ -80,7 +80,7 @@ public ExtentTraverser<T> last() {
}

@Nullable
public <U extends Extent> U findAndGet(Class<U> clazz) {
public <U extends Extent> U findAndGet(Class<? super U> clazz) {
ExtentTraverser<U> traverser = find(clazz);
return (traverser != null) ? traverser.get() : null;
}
Expand All @@ -97,7 +97,7 @@ public <U extends Extent> ExtentTraverser<U> find(Class<U> clazz) {
}
return null;
} catch (Throwable e) {
e.printStackTrace();
LOGGER.error(e);
return null;
}
}
Expand All @@ -114,7 +114,7 @@ public <U extends Extent> ExtentTraverser<U> find(Object object) {
}
return null;
} catch (Throwable e) {
e.printStackTrace();
LOGGER.error(e);
return null;
}
}
Expand All @@ -135,7 +135,7 @@ public ExtentTraverser<T> next() {
}
return null;
} catch (Throwable e) {
e.printStackTrace();
LOGGER.error(e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.metadata.EntityProperties;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.CombinedRegionFunction;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.RegionMaskingFilter;
Expand All @@ -63,11 +63,9 @@
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.FlatRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -483,15 +481,19 @@ public static Collection<Entity> getEntities(Extent source, Region region) {
extent = clip.getExtent();
}
IQueueExtent<IQueueChunk> queue = null;
if (Settings.settings().EXPERIMENTAL.IMPROVED_ENTITY_EDITS) {
if (Settings.settings().EXPERIMENTAL.IMPROVED_ENTITY_EDITS && !(source instanceof Clipboard)) {
ParallelQueueExtent parallel = new ExtentTraverser<>(extent).findAndGet(ParallelQueueExtent.class);
if (parallel != null) {
queue = parallel.getExtent();
} else {
queue = new ExtentTraverser<>(extent).findAndGet(SingleThreadQueueExtent.class);
}
if (queue == null) {
LOGGER.warn("Could not find IQueueExtent instance for entity retrieval, OncePerChunkExtent will not work.");
LOGGER.warn("Could not find IQueueExtent from `" + source.getClass().getName() +
"` instance for entity retrieval, OncePerChunkExtent will not work.");
if (Settings.settings().ENABLED_COMPONENTS.DEBUG) {
ExtentTraverser.printNestedExtents(source);
}
}
}
if (queue == null) {
Expand Down
Loading