mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 01:48:24 +01:00
Fix pasting of other display entities. Remove debug.
This commit is contained in:
parent
62a4f63040
commit
30d3fad81f
@ -12,6 +12,7 @@ import java.util.Optional;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Banner;
|
import org.bukkit.block.Banner;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -20,18 +21,11 @@ import org.bukkit.block.CreatureSpawner;
|
|||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.data.Attachable;
|
import org.bukkit.block.data.Attachable;
|
||||||
import org.bukkit.block.sign.Side;
|
import org.bukkit.block.sign.Side;
|
||||||
import org.bukkit.entity.AbstractHorse;
|
|
||||||
import org.bukkit.entity.Ageable;
|
|
||||||
import org.bukkit.entity.ChestedHorse;
|
|
||||||
import org.bukkit.entity.Display;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Horse;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Tameable;
|
|
||||||
import org.bukkit.entity.Villager;
|
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.Colorable;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -58,6 +52,10 @@ import world.bentobox.bentobox.hooks.ZNPCsPlusHook;
|
|||||||
*/
|
*/
|
||||||
public class BlueprintClipboard {
|
public class BlueprintClipboard {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to filter out hidden DisplayEntity armor stands when copying
|
||||||
|
*/
|
||||||
|
private static final NamespacedKey KEY = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity");
|
||||||
private @Nullable Blueprint blueprint;
|
private @Nullable Blueprint blueprint;
|
||||||
private @Nullable Location pos1;
|
private @Nullable Location pos1;
|
||||||
private @Nullable Location pos2;
|
private @Nullable Location pos2;
|
||||||
@ -75,6 +73,7 @@ public class BlueprintClipboard {
|
|||||||
private Optional<FancyNpcsHook> npc;
|
private Optional<FancyNpcsHook> npc;
|
||||||
private Optional<ZNPCsPlusHook> znpc;
|
private Optional<ZNPCsPlusHook> znpc;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a clipboard for blueprint
|
* Create a clipboard for blueprint
|
||||||
* @param blueprint - the blueprint to load into the clipboard
|
* @param blueprint - the blueprint to load into the clipboard
|
||||||
@ -149,6 +148,7 @@ public class BlueprintClipboard {
|
|||||||
// Add all the citizens for the area in one go. This is pretty fast.
|
// Add all the citizens for the area in one go. This is pretty fast.
|
||||||
bpEntities.putAll(npc.get().getNpcsInArea(world, vectorsToCopy, origin));
|
bpEntities.putAll(npc.get().getNpcsInArea(world, vectorsToCopy, origin));
|
||||||
}
|
}
|
||||||
|
// ZNPCsPlus NPCs
|
||||||
if (znpc.isPresent()) {
|
if (znpc.isPresent()) {
|
||||||
bpEntities.putAll(znpc.get().getNpcsInArea(world, vectorsToCopy, origin));
|
bpEntities.putAll(znpc.get().getNpcsInArea(world, vectorsToCopy, origin));
|
||||||
}
|
}
|
||||||
@ -163,6 +163,7 @@ public class BlueprintClipboard {
|
|||||||
List<Entity> ents = world.getEntities().stream()
|
List<Entity> ents = world.getEntities().stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(e -> !(e instanceof Player))
|
.filter(e -> !(e instanceof Player))
|
||||||
|
.filter(e -> !e.getPersistentDataContainer().has(KEY, PersistentDataType.STRING)) // Do not copy hidden display entities
|
||||||
.filter(e -> new Vector(e.getLocation().getBlockX(), e.getLocation().getBlockY(),
|
.filter(e -> new Vector(e.getLocation().getBlockX(), e.getLocation().getBlockY(),
|
||||||
e.getLocation().getBlockZ()).equals(v))
|
e.getLocation().getBlockZ()).equals(v))
|
||||||
.toList();
|
.toList();
|
||||||
@ -230,7 +231,6 @@ public class BlueprintClipboard {
|
|||||||
if (!copyAir && block.getType().equals(Material.AIR) && !ents.isEmpty()) {
|
if (!copyAir && block.getType().equals(Material.AIR) && !ents.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BentoBox.getInstance().logDebug("Saving blueprint block");
|
|
||||||
BlueprintBlock b = bluePrintBlock(pos, block, copyBiome);
|
BlueprintBlock b = bluePrintBlock(pos, block, copyBiome);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
this.bpBlocks.put(pos, b);
|
this.bpBlocks.put(pos, b);
|
||||||
@ -241,7 +241,6 @@ public class BlueprintClipboard {
|
|||||||
private BlueprintBlock bluePrintBlock(Vector pos, Block block, boolean copyBiome) {
|
private BlueprintBlock bluePrintBlock(Vector pos, Block block, boolean copyBiome) {
|
||||||
// Block state
|
// Block state
|
||||||
BlockState blockState = block.getState();
|
BlockState blockState = block.getState();
|
||||||
BentoBox.getInstance().logDebug("saving state");
|
|
||||||
BlueprintBlock b = new BlueprintBlock(block.getBlockData().getAsString());
|
BlueprintBlock b = new BlueprintBlock(block.getBlockData().getAsString());
|
||||||
|
|
||||||
if (copyBiome) {
|
if (copyBiome) {
|
||||||
@ -256,7 +255,6 @@ public class BlueprintClipboard {
|
|||||||
b.setGlowingText(side, sign.getSide(side).isGlowingText());
|
b.setGlowingText(side, sign.getSide(side).isGlowingText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BentoBox.getInstance().logDebug("Get block data");
|
|
||||||
// Set block data
|
// Set block data
|
||||||
if (blockState.getBlockData() instanceof Attachable) {
|
if (blockState.getBlockData() instanceof Attachable) {
|
||||||
// Placeholder for attachment
|
// Placeholder for attachment
|
||||||
@ -264,7 +262,6 @@ public class BlueprintClipboard {
|
|||||||
bpAttachable.put(pos, b);
|
bpAttachable.put(pos, b);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BentoBox.getInstance().logDebug("Check bedrock");
|
|
||||||
|
|
||||||
if (block.getType().equals(Material.BEDROCK)) {
|
if (block.getType().equals(Material.BEDROCK)) {
|
||||||
// Find highest bedrock
|
// Find highest bedrock
|
||||||
@ -276,7 +273,6 @@ public class BlueprintClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BentoBox.getInstance().logDebug("Chests");
|
|
||||||
// Chests
|
// Chests
|
||||||
if (blockState instanceof InventoryHolder ih) {
|
if (blockState instanceof InventoryHolder ih) {
|
||||||
b.setInventory(new HashMap<>());
|
b.setInventory(new HashMap<>());
|
||||||
@ -287,11 +283,9 @@ public class BlueprintClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BentoBox.getInstance().logDebug("Spawner");
|
|
||||||
if (blockState instanceof CreatureSpawner spawner) {
|
if (blockState instanceof CreatureSpawner spawner) {
|
||||||
b.setCreatureSpawner(getSpawner(spawner));
|
b.setCreatureSpawner(getSpawner(spawner));
|
||||||
}
|
}
|
||||||
BentoBox.getInstance().logDebug("Banners");
|
|
||||||
// Banners
|
// Banners
|
||||||
if (blockState instanceof Banner banner) {
|
if (blockState instanceof Banner banner) {
|
||||||
b.setBannerPatterns(banner.getPatterns());
|
b.setBannerPatterns(banner.getPatterns());
|
||||||
@ -320,67 +314,15 @@ public class BlueprintClipboard {
|
|||||||
private List<BlueprintEntity> setEntities(List<Entity> ents) {
|
private List<BlueprintEntity> setEntities(List<Entity> ents) {
|
||||||
List<BlueprintEntity> bpEnts = new ArrayList<>();
|
List<BlueprintEntity> bpEnts = new ArrayList<>();
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : ents) {
|
||||||
BlueprintEntity bpe = new BlueprintEntity();
|
BlueprintEntity bpe = new BlueprintEntity(entity);
|
||||||
|
|
||||||
bpe.setType(entity.getType());
|
|
||||||
bpe.setCustomName(entity.getCustomName());
|
|
||||||
if (entity instanceof Villager villager) {
|
|
||||||
setVillager(villager, bpe);
|
|
||||||
}
|
|
||||||
if (entity instanceof Colorable c && c.getColor() != null) {
|
|
||||||
bpe.setColor(c.getColor());
|
|
||||||
}
|
|
||||||
if (entity instanceof Tameable tameable) {
|
|
||||||
bpe.setTamed(tameable.isTamed());
|
|
||||||
}
|
|
||||||
if (entity instanceof ChestedHorse chestedHorse) {
|
|
||||||
bpe.setChest(chestedHorse.isCarryingChest());
|
|
||||||
}
|
|
||||||
// Only set if child. Most animals are adults
|
|
||||||
if (entity instanceof Ageable ageable && !ageable.isAdult()) {
|
|
||||||
bpe.setAdult(false);
|
|
||||||
}
|
|
||||||
if (entity instanceof AbstractHorse horse) {
|
|
||||||
bpe.setDomestication(horse.getDomestication());
|
|
||||||
bpe.setInventory(new HashMap<>());
|
|
||||||
for (int i = 0; i < horse.getInventory().getSize(); i++) {
|
|
||||||
ItemStack item = horse.getInventory().getItem(i);
|
|
||||||
if (item != null) {
|
|
||||||
bpe.getInventory().put(i, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entity instanceof Horse horse) {
|
|
||||||
bpe.setStyle(horse.getStyle());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mythic mob check
|
// Mythic mob check
|
||||||
mmh.filter(mm -> mm.isMythicMob(entity)).map(mm -> mm.getMythicMob(entity))
|
mmh.filter(mm -> mm.isMythicMob(entity)).map(mm -> mm.getMythicMob(entity))
|
||||||
.ifPresent(bpe::setMythicMobsRecord);
|
.ifPresent(bpe::setMythicMobsRecord);
|
||||||
|
|
||||||
// Display entities
|
|
||||||
if (entity instanceof Display disp) {
|
|
||||||
BentoBox.getInstance().logDebug("Storing display: " + disp.getAsString());
|
|
||||||
bpe.storeDisplay(disp);
|
|
||||||
}
|
|
||||||
bpEnts.add(bpe);
|
bpEnts.add(bpe);
|
||||||
}
|
}
|
||||||
return bpEnts;
|
return bpEnts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the villager stats
|
|
||||||
* @param v - villager
|
|
||||||
* @param bpe - Blueprint Entity
|
|
||||||
*/
|
|
||||||
private void setVillager(Villager v, BlueprintEntity bpe) {
|
|
||||||
bpe.setExperience(v.getVillagerExperience());
|
|
||||||
bpe.setLevel(v.getVillagerLevel());
|
|
||||||
bpe.setProfession(v.getProfession());
|
|
||||||
bpe.setVillagerType(v.getVillagerType());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the origin
|
* @return the origin
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,6 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
|||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a listener for the Display Objects pasted when a hologram is interacted with
|
* Provides a listener for the Display Objects pasted when a hologram is interacted with
|
||||||
@ -23,7 +22,6 @@ public class DisplayListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteractEntity(PlayerInteractAtEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractAtEntityEvent event) {
|
||||||
BentoBox.getInstance().logDebug(event.getEventName());
|
|
||||||
if (event.getRightClicked() instanceof ArmorStand) {
|
if (event.getRightClicked() instanceof ArmorStand) {
|
||||||
ArmorStand armorStand = (ArmorStand) event.getRightClicked();
|
ArmorStand armorStand = (ArmorStand) event.getRightClicked();
|
||||||
NamespacedKey key = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity");
|
NamespacedKey key = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity");
|
||||||
@ -36,15 +34,11 @@ public class DisplayListener implements Listener {
|
|||||||
world.getEntitiesByClass(Display.class).stream()
|
world.getEntitiesByClass(Display.class).stream()
|
||||||
.filter(e -> e.getUniqueId().equals(UUID.fromString(displayEntityUUID))).findFirst()
|
.filter(e -> e.getUniqueId().equals(UUID.fromString(displayEntityUUID))).findFirst()
|
||||||
.ifPresent(e -> {
|
.ifPresent(e -> {
|
||||||
User user = User.getInstance(event.getPlayer());
|
|
||||||
user.sendRawMessage("You interacted with a DisplayEntity! ");
|
|
||||||
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_GLASS_BREAK, 1F,
|
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_GLASS_BREAK, 1F,
|
||||||
1F);
|
1F);
|
||||||
e.remove();
|
e.remove();
|
||||||
|
|
||||||
});
|
});
|
||||||
// Perform actions related to the DisplayEntity
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package world.bentobox.bentobox.blueprints.dataobjects;
|
package world.bentobox.bentobox.blueprints.dataobjects;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -38,8 +39,6 @@ import org.bukkit.util.Vector;
|
|||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity.ItemDispRec.DisplayRec;
|
|
||||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity.ItemDispRec.TextDisplayRec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
@ -47,48 +46,82 @@ import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity.ItemDispRe
|
|||||||
*/
|
*/
|
||||||
public class BlueprintEntity {
|
public class BlueprintEntity {
|
||||||
|
|
||||||
// Npc storage
|
|
||||||
@Expose
|
|
||||||
private String npc;
|
|
||||||
|
|
||||||
// MythicMobs storage
|
// MythicMobs storage
|
||||||
public record MythicMobRecord(String type, String displayName, double level, float power, String stance) {
|
public record MythicMobRecord(String type, String displayName, double level, float power, String stance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GSON can serialize records, but the record class needs to be know in advance. So this breaks out the record entries
|
/**
|
||||||
@Expose
|
* Item Display Entity store
|
||||||
String MMtype;
|
* @since 3.2.0
|
||||||
@Expose
|
*/
|
||||||
Double MMLevel;
|
public record ItemDispRec(@Expose ItemStack item, @Expose ItemDisplayTransform itemDispTrans) {}
|
||||||
@Expose
|
|
||||||
String MMStance;
|
|
||||||
@Expose
|
|
||||||
Float MMpower;
|
|
||||||
|
|
||||||
@Expose
|
/**
|
||||||
private DyeColor color;
|
* Display Entity store
|
||||||
@Expose
|
* @since 3.2.0
|
||||||
private EntityType type;
|
*/
|
||||||
@Expose
|
public record DisplayRec(@Expose Billboard billboard, @Expose Brightness brightness, @Expose float height,
|
||||||
private String customName;
|
@Expose float width, @Expose Color glowColorOverride, @Expose int interpolationDelay,
|
||||||
@Expose
|
@Expose int interpolationDuration, @Expose float shadowRadius, @Expose float shadowStrength,
|
||||||
private Boolean tamed;
|
@Expose int teleportDuration, @Expose Transformation transformation, @Expose float range) {
|
||||||
@Expose
|
}
|
||||||
private Boolean chest;
|
|
||||||
|
/**
|
||||||
|
* TextDisplay entity store
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
public record TextDisplayRec(@Expose String text, @Expose TextAlignment alignment, @Expose Color bgColor,
|
||||||
|
@Expose BlockFace face, @Expose int lWidth, @Expose byte opacity, @Expose boolean isShadowed,
|
||||||
|
@Expose boolean isSeeThrough, @Expose boolean isDefaultBg) {
|
||||||
|
}
|
||||||
@Expose
|
@Expose
|
||||||
private Boolean adult;
|
private Boolean adult;
|
||||||
@Expose
|
@Expose
|
||||||
|
public BlueprintBlock blockDisp;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
private Boolean chest;
|
||||||
|
@Expose
|
||||||
|
private DyeColor color;
|
||||||
|
@Expose
|
||||||
|
private String customName;
|
||||||
|
@Expose
|
||||||
|
public DisplayRec displayRec;
|
||||||
|
@Expose
|
||||||
private Integer domestication;
|
private Integer domestication;
|
||||||
@Expose
|
@Expose
|
||||||
|
private Integer experience;
|
||||||
|
@Expose
|
||||||
private Map<Integer, ItemStack> inventory;
|
private Map<Integer, ItemStack> inventory;
|
||||||
@Expose
|
@Expose
|
||||||
private Style style;
|
public ItemDispRec itemDisp;
|
||||||
@Expose
|
@Expose
|
||||||
private Integer level;
|
private Integer level;
|
||||||
@Expose
|
@Expose
|
||||||
|
Double MMLevel;
|
||||||
|
@Expose
|
||||||
|
Float MMpower;
|
||||||
|
@Expose
|
||||||
|
String MMStance;
|
||||||
|
// GSON can serialize records, but the record class needs to be know in advance. So this breaks out the record entries
|
||||||
|
@Expose
|
||||||
|
String MMtype;
|
||||||
|
// Npc storage
|
||||||
|
@Expose
|
||||||
|
private String npc;
|
||||||
|
@Expose
|
||||||
private Profession profession;
|
private Profession profession;
|
||||||
@Expose
|
@Expose
|
||||||
private Integer experience;
|
private Style style;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
private Boolean tamed;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
public TextDisplayRec textDisp;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
private EntityType type;
|
||||||
@Expose
|
@Expose
|
||||||
private Villager.Type villagerType;
|
private Villager.Type villagerType;
|
||||||
// Position within the block
|
// Position within the block
|
||||||
@ -98,12 +131,104 @@ public class BlueprintEntity {
|
|||||||
private double y;
|
private double y;
|
||||||
@Expose
|
@Expose
|
||||||
private double z;
|
private double z;
|
||||||
|
@Expose
|
||||||
|
private boolean glowing;
|
||||||
|
@Expose
|
||||||
|
private boolean gravity;
|
||||||
|
@Expose
|
||||||
|
private boolean visualFire;
|
||||||
|
@Expose
|
||||||
|
private boolean silent;
|
||||||
|
@Expose
|
||||||
|
private boolean invulnerable;
|
||||||
|
@Expose
|
||||||
|
private int fireTicks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes an entity to a Blueprint Entity
|
||||||
|
* @param entity entity to serialize
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
public BlueprintEntity(Entity entity) {
|
||||||
|
this.setType(entity.getType());
|
||||||
|
this.setCustomName(entity.getCustomName());
|
||||||
|
this.setGlowing(entity.isGlowing());
|
||||||
|
this.setGravity(entity.hasGravity());
|
||||||
|
this.setVisualFire(entity.isVisualFire());
|
||||||
|
this.setSilent(entity.isSilent());
|
||||||
|
this.setInvulnerable(entity.isInvulnerable());
|
||||||
|
this.setFireTicks(entity.getFireTicks());
|
||||||
|
|
||||||
|
if (entity instanceof Villager villager) {
|
||||||
|
configVillager(villager);
|
||||||
|
}
|
||||||
|
if (entity instanceof Colorable c && c.getColor() != null) {
|
||||||
|
this.setColor(c.getColor());
|
||||||
|
}
|
||||||
|
if (entity instanceof Tameable tameable) {
|
||||||
|
this.setTamed(tameable.isTamed());
|
||||||
|
}
|
||||||
|
if (entity instanceof ChestedHorse chestedHorse) {
|
||||||
|
this.setChest(chestedHorse.isCarryingChest());
|
||||||
|
}
|
||||||
|
// Only set if child. Most animals are adults
|
||||||
|
if (entity instanceof Ageable ageable && !ageable.isAdult()) {
|
||||||
|
this.setAdult(false);
|
||||||
|
}
|
||||||
|
if (entity instanceof AbstractHorse horse) {
|
||||||
|
this.setDomestication(horse.getDomestication());
|
||||||
|
this.setInventory(new HashMap<>());
|
||||||
|
for (int i = 0; i < horse.getInventory().getSize(); i++) {
|
||||||
|
ItemStack item = horse.getInventory().getItem(i);
|
||||||
|
if (item != null) {
|
||||||
|
this.getInventory().put(i, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity instanceof Horse horse) {
|
||||||
|
this.setStyle(horse.getStyle());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display entities
|
||||||
|
if (entity instanceof Display disp) {
|
||||||
|
this.storeDisplay(disp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a blank BlueprintEntity
|
||||||
|
*/
|
||||||
|
public BlueprintEntity() {
|
||||||
|
// Blank constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the villager stats
|
||||||
|
* @param v - villager
|
||||||
|
* @param bpe - Blueprint Entity
|
||||||
|
*/
|
||||||
|
private void configVillager(Villager v) {
|
||||||
|
this.setExperience(v.getVillagerExperience());
|
||||||
|
this.setLevel(v.getVillagerLevel());
|
||||||
|
this.setProfession(v.getProfession());
|
||||||
|
this.setVillagerType(v.getVillagerType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the entity according to how it was stored
|
* Adjusts the entity according to how it was stored
|
||||||
* @since 1.8.0
|
* @since 1.8.0
|
||||||
*/
|
*/
|
||||||
public void configureEntity(Entity e) {
|
public void configureEntity(Entity e) {
|
||||||
|
// Set the general states
|
||||||
|
e.setGlowing(glowing);
|
||||||
|
e.setGravity(gravity);
|
||||||
|
e.setVisualFire(visualFire);
|
||||||
|
e.setSilent(silent);
|
||||||
|
e.setInvulnerable(invulnerable);
|
||||||
|
e.setFireTicks(fireTicks);
|
||||||
|
|
||||||
if (e instanceof Villager villager) {
|
if (e instanceof Villager villager) {
|
||||||
setVillager(villager);
|
setVillager(villager);
|
||||||
}
|
}
|
||||||
@ -133,83 +258,8 @@ public class BlueprintEntity {
|
|||||||
if (style != null && e instanceof Horse horse) {
|
if (style != null && e instanceof Horse horse) {
|
||||||
horse.setStyle(style);
|
horse.setStyle(style);
|
||||||
}
|
}
|
||||||
// Shift to the in-block location
|
// Shift to the in-block location (remove the 0.5 that the location serializer used)
|
||||||
Vector add = new Vector(x, y, z);
|
e.getLocation().add(new Vector(x - 0.5D, y, z - 0.5D));
|
||||||
BentoBox.getInstance().logDebug("entity is at " + e.getLocation().toVector() + " and adding " + add);
|
|
||||||
e.getLocation().add(add);
|
|
||||||
BentoBox.getInstance().logDebug("entity is now at " + e.getLocation().toVector());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param v - villager
|
|
||||||
* @since 1.16.0
|
|
||||||
*/
|
|
||||||
private void setVillager(Villager v) {
|
|
||||||
v.setProfession(profession == null ? Profession.NONE : profession);
|
|
||||||
v.setVillagerExperience(experience == null ? 0 : experience);
|
|
||||||
v.setVillagerLevel(level == null ? 0 : level);
|
|
||||||
v.setVillagerType(villagerType == null ? Villager.Type.PLAINS : villagerType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the color
|
|
||||||
*/
|
|
||||||
public DyeColor getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param color the color to set
|
|
||||||
*/
|
|
||||||
public void setColor(DyeColor color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
public EntityType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param type the type to set
|
|
||||||
*/
|
|
||||||
public void setType(EntityType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the customName
|
|
||||||
*/
|
|
||||||
public String getCustomName() {
|
|
||||||
return customName;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param customName the customName to set
|
|
||||||
*/
|
|
||||||
public void setCustomName(String customName) {
|
|
||||||
this.customName = customName;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the tamed
|
|
||||||
*/
|
|
||||||
public Boolean getTamed() {
|
|
||||||
return tamed;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param tamed the tamed to set
|
|
||||||
*/
|
|
||||||
public void setTamed(Boolean tamed) {
|
|
||||||
this.tamed = tamed;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the chest
|
|
||||||
*/
|
|
||||||
public Boolean getChest() {
|
|
||||||
return chest;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param chest the chest to set
|
|
||||||
*/
|
|
||||||
public void setChest(Boolean chest) {
|
|
||||||
this.chest = chest;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the adult
|
* @return the adult
|
||||||
@ -218,10 +268,22 @@ public class BlueprintEntity {
|
|||||||
return adult;
|
return adult;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param adult the adult to set
|
* @return the chest
|
||||||
*/
|
*/
|
||||||
public void setAdult(Boolean adult) {
|
public Boolean getChest() {
|
||||||
this.adult = adult;
|
return chest;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the color
|
||||||
|
*/
|
||||||
|
public DyeColor getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the customName
|
||||||
|
*/
|
||||||
|
public String getCustomName() {
|
||||||
|
return customName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the domestication
|
* @return the domestication
|
||||||
@ -230,10 +292,10 @@ public class BlueprintEntity {
|
|||||||
return domestication;
|
return domestication;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param domestication the domestication to set
|
* @return the experience
|
||||||
*/
|
*/
|
||||||
public void setDomestication(int domestication) {
|
public Integer getExperience() {
|
||||||
this.domestication = domestication;
|
return experience;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the inventory
|
* @return the inventory
|
||||||
@ -242,10 +304,31 @@ public class BlueprintEntity {
|
|||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param inventory the inventory to set
|
* @return the level
|
||||||
*/
|
*/
|
||||||
public void setInventory(Map<Integer, ItemStack> inventory) {
|
public Integer getLevel() {
|
||||||
this.inventory = inventory;
|
return level;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the mythicMobsRecord
|
||||||
|
*/
|
||||||
|
public MythicMobRecord getMythicMobsRecord() {
|
||||||
|
if (this.MMtype == null || this.MMLevel == null || this.MMpower == null || this.MMStance == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new MythicMobRecord(this.MMtype, this.getCustomName(), this.MMLevel, this.MMpower, this.MMStance);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the npc
|
||||||
|
*/
|
||||||
|
public String getNpc() {
|
||||||
|
return npc;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the profession
|
||||||
|
*/
|
||||||
|
public Profession getProfession() {
|
||||||
|
return profession;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the style
|
* @return the style
|
||||||
@ -253,53 +336,19 @@ public class BlueprintEntity {
|
|||||||
public Style getStyle() {
|
public Style getStyle() {
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param style the style to set
|
* @return the tamed
|
||||||
*/
|
*/
|
||||||
public void setStyle(Style style) {
|
public Boolean getTamed() {
|
||||||
this.style = style;
|
return tamed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the level
|
* @return the type
|
||||||
*/
|
*/
|
||||||
public Integer getLevel() {
|
public EntityType getType() {
|
||||||
return level;
|
return type;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param level the level to set
|
|
||||||
*/
|
|
||||||
public void setLevel(Integer level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the profession
|
|
||||||
*/
|
|
||||||
public Profession getProfession() {
|
|
||||||
return profession;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param profession the profession to set
|
|
||||||
*/
|
|
||||||
public void setProfession(Profession profession) {
|
|
||||||
this.profession = profession;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the experience
|
|
||||||
*/
|
|
||||||
public Integer getExperience() {
|
|
||||||
return experience;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param experience the experience to set
|
|
||||||
*/
|
|
||||||
public void setExperience(Integer experience) {
|
|
||||||
this.experience = experience;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -310,10 +359,93 @@ public class BlueprintEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param villagerType the villagerType to set
|
* @param adult the adult to set
|
||||||
*/
|
*/
|
||||||
public void setVillagerType(Villager.Type villagerType) {
|
public void setAdult(Boolean adult) {
|
||||||
this.villagerType = villagerType;
|
this.adult = adult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param chest the chest to set
|
||||||
|
*/
|
||||||
|
public void setChest(Boolean chest) {
|
||||||
|
this.chest = chest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param color the color to set
|
||||||
|
*/
|
||||||
|
public void setColor(DyeColor color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param customName the customName to set
|
||||||
|
*/
|
||||||
|
public void setCustomName(String customName) {
|
||||||
|
this.customName = customName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets any display entity properties to the location, e.g. holograms
|
||||||
|
* @param pos location
|
||||||
|
*/
|
||||||
|
public void setDisplay(Location pos) {
|
||||||
|
World world = pos.getWorld();
|
||||||
|
Location newPos = pos.clone().add(new Vector(x - 0.5D, y, z - 0.5D));
|
||||||
|
Display d = null;
|
||||||
|
if (this.blockDisp != null) {
|
||||||
|
// Block Display
|
||||||
|
d = world.spawn(newPos, BlockDisplay.class);
|
||||||
|
BlockData bd = Bukkit.createBlockData(this.blockDisp.getBlockData());
|
||||||
|
((BlockDisplay) d).setBlock(bd);
|
||||||
|
} else if (this.itemDisp != null) {
|
||||||
|
// Item Display
|
||||||
|
d = world.spawn(newPos, ItemDisplay.class);
|
||||||
|
((ItemDisplay) d).setItemStack(itemDisp.item());
|
||||||
|
((ItemDisplay) d).setItemDisplayTransform(itemDisp.itemDispTrans());
|
||||||
|
} else if (this.textDisp != null) {
|
||||||
|
// Text Display
|
||||||
|
d = world.spawn(newPos, TextDisplay.class);
|
||||||
|
((TextDisplay) d).setText(textDisp.text());
|
||||||
|
((TextDisplay) d).setAlignment(textDisp.alignment());
|
||||||
|
((TextDisplay) d).setBackgroundColor(textDisp.bgColor());
|
||||||
|
((TextDisplay) d).setLineWidth(textDisp.lWidth());
|
||||||
|
((TextDisplay) d).setTextOpacity(textDisp.opacity());
|
||||||
|
((TextDisplay) d).setShadowed(textDisp.isShadowed());
|
||||||
|
((TextDisplay) d).setSeeThrough(textDisp.isSeeThrough());
|
||||||
|
((TextDisplay) d).setBackgroundColor(textDisp.bgColor());
|
||||||
|
}
|
||||||
|
if (d != null && this.displayRec != null) {
|
||||||
|
d.setCustomName(getCustomName());
|
||||||
|
d.setBillboard(displayRec.billboard());
|
||||||
|
d.setBrightness(displayRec.brightness());
|
||||||
|
d.setDisplayHeight(displayRec.height());
|
||||||
|
d.setDisplayWidth(displayRec.width());
|
||||||
|
d.setGlowColorOverride(displayRec.glowColorOverride());
|
||||||
|
d.setInterpolationDelay(displayRec.interpolationDelay());
|
||||||
|
d.setInterpolationDuration(displayRec.interpolationDuration());
|
||||||
|
d.setShadowRadius(displayRec.shadowRadius());
|
||||||
|
d.setShadowStrength(displayRec.shadowStrength());
|
||||||
|
d.setTeleportDuration(displayRec.teleportDuration());
|
||||||
|
d.setTransformation(displayRec.transformation());
|
||||||
|
d.setViewRange(displayRec.range());
|
||||||
|
|
||||||
|
// Spawn an armor stand here so that we have a way to detect if a player interacts with the item
|
||||||
|
ArmorStand armorStand = (ArmorStand) world.spawnEntity(newPos, EntityType.ARMOR_STAND);
|
||||||
|
armorStand.setSmall(true); // Reduces size
|
||||||
|
armorStand.setGravity(false); // Prevents falling
|
||||||
|
armorStand.setInvisible(true);
|
||||||
|
NamespacedKey key = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity");
|
||||||
|
armorStand.getPersistentDataContainer().set(key, PersistentDataType.STRING, d.getUniqueId().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param domestication the domestication to set
|
||||||
|
*/
|
||||||
|
public void setDomestication(int domestication) {
|
||||||
|
this.domestication = domestication;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -324,13 +456,24 @@ public class BlueprintEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the mythicMobsRecord
|
* @param experience the experience to set
|
||||||
*/
|
*/
|
||||||
public MythicMobRecord getMythicMobsRecord() {
|
public void setExperience(Integer experience) {
|
||||||
if (this.MMtype == null || this.MMLevel == null || this.MMpower == null || this.MMStance == null) {
|
this.experience = experience;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
return new MythicMobRecord(this.MMtype, this.getCustomName(), this.MMLevel, this.MMpower, this.MMStance);
|
/**
|
||||||
|
* @param inventory the inventory to set
|
||||||
|
*/
|
||||||
|
public void setInventory(Map<Integer, ItemStack> inventory) {
|
||||||
|
this.inventory = inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param level the level to set
|
||||||
|
*/
|
||||||
|
public void setLevel(Integer level) {
|
||||||
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,41 +487,55 @@ public class BlueprintEntity {
|
|||||||
this.MMStance = mmr.stance();
|
this.MMStance = mmr.stance();
|
||||||
this.MMpower = mmr.power();
|
this.MMpower = mmr.power();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the npc
|
|
||||||
*/
|
|
||||||
public String getNpc() {
|
|
||||||
return npc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc the citizen to set
|
* @param npc the citizen to set
|
||||||
*/
|
*/
|
||||||
public void setNpc(String npc) {
|
public void setNpc(String npc) {
|
||||||
this.npc = npc;
|
this.npc = npc;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
@Expose
|
* @param profession the profession to set
|
||||||
public DisplayRec displayRec;
|
*/
|
||||||
@Expose
|
public void setProfession(Profession profession) {
|
||||||
public TextDisplayRec textDisp;
|
this.profession = profession;
|
||||||
@Expose
|
}
|
||||||
public BlueprintBlock blockDisp;
|
/**
|
||||||
@Expose
|
* @param style the style to set
|
||||||
public ItemDispRec itemDisp;
|
*/
|
||||||
|
public void setStyle(Style style) {
|
||||||
public record ItemDispRec(@Expose ItemStack item, @Expose ItemDisplayTransform itemDispTrans) {}
|
this.style = style;
|
||||||
|
|
||||||
public record DisplayRec(@Expose Billboard billboard, @Expose Brightness brightness, @Expose float height,
|
|
||||||
@Expose float width, @Expose Color glowColorOverride, @Expose int interpolationDelay,
|
|
||||||
@Expose int interpolationDuration, @Expose float shadowRadius, @Expose float shadowStrength,
|
|
||||||
@Expose int teleportDuration, @Expose Transformation transformation, @Expose float range) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public record TextDisplayRec(@Expose String text, @Expose TextAlignment alignment, @Expose Color bgColor,
|
/**
|
||||||
@Expose BlockFace face, @Expose int lWidth, @Expose byte opacity, @Expose boolean isShadowed,
|
* @param tamed the tamed to set
|
||||||
@Expose boolean isSeeThrough, @Expose boolean isDefaultBg) {
|
*/
|
||||||
|
public void setTamed(Boolean tamed) {
|
||||||
|
this.tamed = tamed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type the type to set
|
||||||
|
*/
|
||||||
|
public void setType(EntityType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param v - villager
|
||||||
|
* @since 1.16.0
|
||||||
|
*/
|
||||||
|
private void setVillager(Villager v) {
|
||||||
|
v.setProfession(profession == null ? Profession.NONE : profession);
|
||||||
|
v.setVillagerExperience(experience == null ? 0 : experience);
|
||||||
|
v.setVillagerLevel(level == null ? 0 : level);
|
||||||
|
v.setVillagerType(villagerType == null ? Villager.Type.PLAINS : villagerType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param villagerType the villagerType to set
|
||||||
|
*/
|
||||||
|
public void setVillagerType(Villager.Type villagerType) {
|
||||||
|
this.villagerType = villagerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -408,60 +565,86 @@ public class BlueprintEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets any display entity properties to the location, e.g. holograms
|
* @return the glowing
|
||||||
* @param pos location
|
|
||||||
*/
|
*/
|
||||||
public void setDisplay(Location pos) {
|
public boolean isGlowing() {
|
||||||
World world = pos.getWorld();
|
return glowing;
|
||||||
Location newPos = pos.clone().add(new Vector(x - 0.5D, y, z - 0.5D));
|
}
|
||||||
Display d = null;
|
|
||||||
if (this.blockDisp != null) {
|
/**
|
||||||
// Block Display
|
* @param glowing the glowing to set
|
||||||
d = world.spawn(newPos, BlockDisplay.class);
|
*/
|
||||||
BlockData bd = Bukkit.createBlockData(this.blockDisp.getBlockData());
|
public void setGlowing(boolean glowing) {
|
||||||
((BlockDisplay) d).setBlock(bd);
|
this.glowing = glowing;
|
||||||
} else if (this.itemDisp != null) {
|
}
|
||||||
// Item Display
|
|
||||||
d = world.spawn(newPos, ItemDisplay.class);
|
/**
|
||||||
((ItemDisplay) d).setItemStack(itemDisp.item());
|
* @return the gravity
|
||||||
((ItemDisplay) d).setItemDisplayTransform(itemDisp.itemDispTrans());
|
*/
|
||||||
} else if (this.textDisp != null) {
|
public boolean isGravity() {
|
||||||
BentoBox.getInstance().logDebug("Text display - " + textDisp.text());
|
return gravity;
|
||||||
// Text Display
|
}
|
||||||
d = world.spawn(newPos, TextDisplay.class);
|
|
||||||
((TextDisplay) d).setText(textDisp.text());
|
/**
|
||||||
((TextDisplay) d).setAlignment(textDisp.alignment());
|
* @param gravity the gravity to set
|
||||||
((TextDisplay) d).setBackgroundColor(textDisp.bgColor());
|
*/
|
||||||
((TextDisplay) d).setLineWidth(textDisp.lWidth());
|
public void setGravity(boolean gravity) {
|
||||||
((TextDisplay) d).setTextOpacity(textDisp.opacity());
|
this.gravity = gravity;
|
||||||
((TextDisplay) d).setShadowed(textDisp.isShadowed());
|
}
|
||||||
((TextDisplay) d).setSeeThrough(textDisp.isSeeThrough());
|
|
||||||
((TextDisplay) d).setBackgroundColor(textDisp.bgColor());
|
/**
|
||||||
}
|
* @return the visualFire
|
||||||
if (d != null && this.displayRec != null) {
|
*/
|
||||||
BentoBox.getInstance().logDebug("General display");
|
public boolean isVisualFire() {
|
||||||
d.setCustomName(getCustomName());
|
return visualFire;
|
||||||
d.setBillboard(displayRec.billboard());
|
}
|
||||||
d.setBrightness(displayRec.brightness());
|
|
||||||
d.setDisplayHeight(displayRec.height());
|
/**
|
||||||
d.setDisplayWidth(displayRec.width());
|
* @param visualFire the visualFire to set
|
||||||
d.setGlowColorOverride(displayRec.glowColorOverride());
|
*/
|
||||||
d.setInterpolationDelay(displayRec.interpolationDelay());
|
public void setVisualFire(boolean visualFire) {
|
||||||
d.setInterpolationDuration(displayRec.interpolationDuration());
|
this.visualFire = visualFire;
|
||||||
d.setShadowRadius(displayRec.shadowRadius());
|
}
|
||||||
d.setShadowStrength(displayRec.shadowStrength());
|
|
||||||
d.setTeleportDuration(displayRec.teleportDuration());
|
/**
|
||||||
d.setTransformation(displayRec.transformation());
|
* @return the silent
|
||||||
d.setViewRange(displayRec.range());
|
*/
|
||||||
}
|
public boolean isSilent() {
|
||||||
// Spawn an armor stand here so that we have a way to detect if a player interacts with the item
|
return silent;
|
||||||
ArmorStand armorStand = (ArmorStand) world.spawnEntity(newPos, EntityType.ARMOR_STAND);
|
}
|
||||||
armorStand.setSmall(true); // Reduces size
|
|
||||||
armorStand.setGravity(false); // Prevents falling
|
/**
|
||||||
//armorStand.setInvisible(true);
|
* @param silent the silent to set
|
||||||
//armorStand.setMarker(true); // No hitbox
|
*/
|
||||||
NamespacedKey key = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity");
|
public void setSilent(boolean silent) {
|
||||||
armorStand.getPersistentDataContainer().set(key, PersistentDataType.STRING, d.getUniqueId().toString());
|
this.silent = silent;
|
||||||
BentoBox.getInstance().logDebug("display set done");
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the invulnerable
|
||||||
|
*/
|
||||||
|
public boolean isInvulnerable() {
|
||||||
|
return invulnerable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param invulnerable the invulnerable to set
|
||||||
|
*/
|
||||||
|
public void setInvulnerable(boolean invulnerable) {
|
||||||
|
this.invulnerable = invulnerable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the fireTicks
|
||||||
|
*/
|
||||||
|
public int getFireTicks() {
|
||||||
|
return fireTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fireTicks the fireTicks to set
|
||||||
|
*/
|
||||||
|
public void setFireTicks(int fireTicks) {
|
||||||
|
this.fireTicks = fireTicks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,6 @@ public class DefaultPasteUtil {
|
|||||||
* @return true if Bukkit entity spawned, false another plugin entity spawned
|
* @return true if Bukkit entity spawned, false another plugin entity spawned
|
||||||
*/
|
*/
|
||||||
static boolean spawnBlueprintEntity(BlueprintEntity k, Location location, Island island) {
|
static boolean spawnBlueprintEntity(BlueprintEntity k, Location location, Island island) {
|
||||||
BentoBox.getInstance().logDebug("spawn blueprint entiy " + k + " at " + location);
|
|
||||||
// Display Entity (holograms, etc.)
|
// Display Entity (holograms, etc.)
|
||||||
k.setDisplay(location);
|
k.setDisplay(location);
|
||||||
// FancyNpc entity
|
// FancyNpc entity
|
||||||
|
Loading…
Reference in New Issue
Block a user