Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-17 00:20:09 +01:00
Undo
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:
Ursprung
f2f13f8c2f
Commit
d2d8e7a932
@ -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
|
||||
|
@ -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;
|
||||
|
@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.math.IntPair;
|
||||
import com.fastasyncworldedit.core.util.MathMan;
|
||||
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;
|
||||
@ -712,12 +711,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
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.math.IntPair;
|
||||
import com.fastasyncworldedit.core.util.MathMan;
|
||||
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;
|
||||
@ -712,12 +711,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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.math.IntPair;
|
||||
import com.fastasyncworldedit.core.util.MathMan;
|
||||
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 {
|
||||
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
|
||||
|
@ -9,7 +9,6 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
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;
|
||||
@ -118,22 +117,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
|
||||
|
@ -566,7 +566,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;
|
||||
|
@ -12,7 +12,6 @@ import com.fastasyncworldedit.core.math.IntPair;
|
||||
import com.fastasyncworldedit.core.util.MathMan;
|
||||
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;
|
||||
@ -681,12 +680,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
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren