3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-19 09:20:08 +01:00
Minecraft has a lot of different methods between private and public to determine if structures can be placed. We cannot possibly cover all of them whilst also ensuring issues do not arise with generic "true"s
Dieser Commit ist enthalten in:
dordsor21 2024-06-07 20:51:45 +01:00
Ursprung 0e87ee5185
Commit ba30e5a197
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
15 geänderte Dateien mit 36 neuen und 127 gelöschten Zeilen

Datei anzeigen

@ -9,7 +9,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkAccess;
@ -122,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@Override
public BlockState getBlockState(final BlockPos pos) {
BlockState state = world.getBlockState(pos);
try {
state = new BlockState(
state.getBlock(),
state.getValues(),
PaperweightPlatformAdapter.getStatePropertiesCodec(state)
) {
@Override
public boolean is(Block block) {
return true;
}
};
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return state;
return world.getBlockState(pos);
}
@Override

Datei anzeigen

@ -547,7 +547,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
)) {
return null;
}
return new HashMap<>(populator.getLevel().capturedBlockStates);
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
} finally {
serverLevel.captureBlockStates = false;
serverLevel.captureTreeGeneration = false;

Datei anzeigen

@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.fastasyncworldedit.core.util.TaskManager;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.MapCodec;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.Refraction;
@ -693,12 +692,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
}
}
public static MapCodec<net.minecraft.world.level.block.state.BlockState> getStatePropertiesCodec(
net.minecraft.world.level.block.state.BlockState state
) throws IllegalAccessException {
return (MapCodec<net.minecraft.world.level.block.state.BlockState>) fieldPropertiesCodec.get(state);
}
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
@Override

Datei anzeigen

@ -9,7 +9,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkAccess;
@ -122,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@Override
public BlockState getBlockState(final BlockPos pos) {
BlockState state = world.getBlockState(pos);
try {
state = new BlockState(
state.getBlock(),
state.getValues(),
PaperweightPlatformAdapter.getStatePropertiesCodec(state)
) {
@Override
public boolean is(Block block) {
return true;
}
};
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return state;
return world.getBlockState(pos);
}
@Override

Datei anzeigen

@ -548,7 +548,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
)) {
return null;
}
return new HashMap<>(populator.getLevel().capturedBlockStates);
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
} finally {
serverLevel.captureBlockStates = false;
serverLevel.captureTreeGeneration = false;

Datei anzeigen

@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.fastasyncworldedit.core.util.TaskManager;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.MapCodec;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.Refraction;
@ -707,12 +706,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
}
}
public static MapCodec<net.minecraft.world.level.block.state.BlockState> getStatePropertiesCodec(
net.minecraft.world.level.block.state.BlockState state
) throws IllegalAccessException {
return (MapCodec<net.minecraft.world.level.block.state.BlockState>) fieldPropertiesCodec.get(state);
}
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
@Override

Datei anzeigen

@ -9,7 +9,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkAccess;
@ -122,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@Override
public BlockState getBlockState(final BlockPos pos) {
BlockState state = world.getBlockState(pos);
try {
state = new BlockState(
state.getBlock(),
state.getValues(),
PaperweightPlatformAdapter.getStatePropertiesCodec(state)
) {
@Override
public boolean is(Block block) {
return true;
}
};
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return state;
return world.getBlockState(pos);
}
@Override

Datei anzeigen

@ -551,7 +551,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
)) {
return null;
}
return new HashMap<>(populator.getLevel().capturedBlockStates);
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
} finally {
serverLevel.captureBlockStates = false;
serverLevel.captureTreeGeneration = false;

Datei anzeigen

@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.fastasyncworldedit.core.util.TaskManager;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.MapCodec;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.Refraction;
@ -680,12 +679,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
return List.of();
}
public static MapCodec<net.minecraft.world.level.block.state.BlockState> getStatePropertiesCodec(
net.minecraft.world.level.block.state.BlockState state
) throws IllegalAccessException {
return (MapCodec<net.minecraft.world.level.block.state.BlockState>) fieldPropertiesCodec.get(state);
}
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
@Override

Datei anzeigen

@ -9,7 +9,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkAccess;
@ -122,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@Override
public BlockState getBlockState(final BlockPos pos) {
BlockState state = world.getBlockState(pos);
try {
state = new BlockState(
state.getBlock(),
state.getValues(),
PaperweightPlatformAdapter.getStatePropertiesCodec(state)
) {
@Override
public boolean is(Block block) {
return true;
}
};
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return state;
return world.getBlockState(pos);
}
@Override

Datei anzeigen

@ -552,7 +552,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
return null;
}
return new HashMap<>(populator.getLevel().capturedBlockStates);
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
} finally {
serverLevel.captureBlockStates = false;
serverLevel.captureTreeGeneration = false;
@ -596,6 +601,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
populator,
biome -> true
);
if (!structureStart.isValid()) {
return null;
} else {

Datei anzeigen

@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.fastasyncworldedit.core.util.TaskManager;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.MapCodec;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.Refraction;
@ -680,12 +679,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
return List.of();
}
public static MapCodec<net.minecraft.world.level.block.state.BlockState> getStatePropertiesCodec(
net.minecraft.world.level.block.state.BlockState state
) throws IllegalAccessException {
return (MapCodec<net.minecraft.world.level.block.state.BlockState>) fieldPropertiesCodec.get(state);
}
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
@Override

Datei anzeigen

@ -1,6 +1,5 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R4;
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
@ -10,9 +9,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkSource;
@ -124,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@Override
public BlockState getBlockState(final BlockPos pos) {
BlockState state = world.getBlockState(pos);
try {
state = new BlockState(
state.getBlock(),
(Reference2ObjectArrayMap<Property<?>, Comparable<?>>) state.getValues(),
PaperweightPlatformAdapter.getStatePropertiesCodec(state)
) {
@Override
public boolean is(Block block) {
return true;
}
};
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return state;
return world.getBlockState(pos);
}
@Override

Datei anzeigen

@ -565,7 +565,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
)) {
return null;
}
return new HashMap<>(populator.getLevel().capturedBlockStates);
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
} finally {
serverLevel.captureBlockStates = false;
serverLevel.captureTreeGeneration = false;

Datei anzeigen

@ -10,7 +10,6 @@ import com.fastasyncworldedit.core.math.BitArrayUnstretched;
import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.fastasyncworldedit.core.util.TaskManager;
import com.mojang.serialization.MapCodec;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.Refraction;
@ -676,12 +675,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
return List.of();
}
public static MapCodec<net.minecraft.world.level.block.state.BlockState> getStatePropertiesCodec(
net.minecraft.world.level.block.state.BlockState state
) throws IllegalAccessException {
return (MapCodec<net.minecraft.world.level.block.state.BlockState>) fieldPropertiesCodec.get(state);
}
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
@Override