mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Fixes pasting of blueprints with crops, etc.
https://github.com/BentoBoxWorld/BentoBox/issues/702 Also fixes pasting of entities in the ground when they are on blocks like crops that are slightly less than an integer block high.
This commit is contained in:
parent
c725a397e1
commit
0fd25f02cd
@ -50,6 +50,11 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class BlueprintClipboard {
|
||||
|
||||
/**
|
||||
* These are materials that should be treated as attachables even though they officially are not
|
||||
*/
|
||||
private static final List<Material> ATTACHABLES = Arrays.asList(Material.WATER, Material.LAVA,
|
||||
Material.WHEAT, Material.POTATOES, Material.CARROTS, Material.BEETROOTS, Material.SUGAR_CANE);
|
||||
private @Nullable Blueprint blueprint;
|
||||
private @Nullable Location pos1;
|
||||
private @Nullable Location pos2;
|
||||
@ -125,9 +130,9 @@ public class BlueprintClipboard {
|
||||
List<LivingEntity> ents = world.getLivingEntities().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(e -> !(e instanceof Player))
|
||||
.filter(e -> new Vector(e.getLocation().getBlockX(),
|
||||
e.getLocation().getBlockY(),
|
||||
e.getLocation().getBlockZ()).equals(v))
|
||||
.filter(e -> new Vector(Math.rint(e.getLocation().getX()),
|
||||
Math.rint(e.getLocation().getY()),
|
||||
Math.rint(e.getLocation().getZ())).equals(v))
|
||||
.collect(Collectors.toList());
|
||||
if (copyBlock(v.toLocation(world), origin, copyAir, ents)) {
|
||||
count++;
|
||||
@ -240,7 +245,8 @@ public class BlueprintClipboard {
|
||||
b.setSignLines(Arrays.asList(sign.getLines()));
|
||||
}
|
||||
// Set block data
|
||||
if (blockState.getData() instanceof Attachable) {
|
||||
if (blockState.getData() instanceof Attachable
|
||||
|| ATTACHABLES.contains(blockState.getType())) {
|
||||
// Placeholder for attachment
|
||||
bpBlocks.put(pos, new BlueprintBlock("minecraft:air"));
|
||||
bpAttachable.put(pos, b);
|
||||
|
@ -198,7 +198,7 @@ public class BlueprintPaster {
|
||||
}
|
||||
}
|
||||
}
|
||||
block.setBlockData(bd);
|
||||
block.setBlockData(bd, false);
|
||||
setBlockState(island, block, bpBlock);
|
||||
// pos1 and pos2 update
|
||||
updatePos(world, entry.getKey());
|
||||
|
@ -79,7 +79,7 @@ public class BlueprintsManager {
|
||||
this.plugin = plugin;
|
||||
this.blueprintBundles = new HashMap<>();
|
||||
this.blueprints = new HashMap<>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
GsonBuilder builder = new GsonBuilder()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.enableComplexMapKeySerialization()
|
||||
|
@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.panels.Panel;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
|
Loading…
Reference in New Issue
Block a user