changed placeholder
This commit is contained in:
parent
156b7e6b61
commit
154c1cf936
@ -11,6 +11,7 @@ import org.bukkit.*;
|
|||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Transformation;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -29,9 +30,8 @@ public class PixelBlock {
|
|||||||
public List<Pixel> pixels = new ArrayList<>();
|
public List<Pixel> pixels = new ArrayList<>();
|
||||||
|
|
||||||
public Interaction hitbox;
|
public Interaction hitbox;
|
||||||
public ItemDisplay barrier;
|
public List<ItemDisplay> placeholderIcon = new ArrayList<>();
|
||||||
|
|
||||||
public long lastEntryTime;
|
|
||||||
public Location lastEntryLocation;
|
public Location lastEntryLocation;
|
||||||
public UUID ownerUUID;
|
public UUID ownerUUID;
|
||||||
public UUID blockUUID;
|
public UUID blockUUID;
|
||||||
@ -97,7 +97,6 @@ public class PixelBlock {
|
|||||||
getBlockTaskChain()
|
getBlockTaskChain()
|
||||||
.async(() -> {
|
.async(() -> {
|
||||||
this.lastEntryLocation = player.getLocation();
|
this.lastEntryLocation = player.getLocation();
|
||||||
this.lastEntryTime = System.currentTimeMillis();
|
|
||||||
Main.database.savePixelBlock(this);
|
Main.database.savePixelBlock(this);
|
||||||
})
|
})
|
||||||
.sync(() -> player.teleport(this.pixelWorld.getSpawnLocation()))
|
.sync(() -> player.teleport(this.pixelWorld.getSpawnLocation()))
|
||||||
@ -205,11 +204,29 @@ public class PixelBlock {
|
|||||||
newPixel.place(this.pixelBlockLocation);
|
newPixel.place(this.pixelBlockLocation);
|
||||||
|
|
||||||
Location itemDisplayLocation = this.pixelBlockLocation.clone().add(0.5, 0.5, 0.5);
|
Location itemDisplayLocation = this.pixelBlockLocation.clone().add(0.5, 0.5, 0.5);
|
||||||
this.barrier = (ItemDisplay) this.pixelBlockLocation.getWorld().spawnEntity(
|
|
||||||
|
for(int i = 0; i <= 90; i += 90) {
|
||||||
|
ItemDisplay verticalEntity = (ItemDisplay) this.pixelBlockLocation.getWorld().spawnEntity(
|
||||||
itemDisplayLocation,
|
itemDisplayLocation,
|
||||||
EntityType.ITEM_DISPLAY
|
EntityType.ITEM_DISPLAY
|
||||||
);
|
);
|
||||||
this.barrier.setItemStack(ItemStack.of(Material.BARRIER));
|
verticalEntity.setRotation(i, 0);
|
||||||
|
this.placeholderIcon.add(verticalEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemDisplay horizontalEntity = (ItemDisplay) this.pixelBlockLocation.getWorld().spawnEntity(
|
||||||
|
itemDisplayLocation,
|
||||||
|
EntityType.ITEM_DISPLAY
|
||||||
|
);
|
||||||
|
horizontalEntity.setRotation(0, 90);
|
||||||
|
this.placeholderIcon.add(horizontalEntity);
|
||||||
|
|
||||||
|
this.placeholderIcon.forEach(itemDisplay -> {
|
||||||
|
itemDisplay.setItemStack(ItemStack.of(Material.END_CRYSTAL));
|
||||||
|
Transformation transform = itemDisplay.getTransformation();
|
||||||
|
transform.getScale().set(0.5);
|
||||||
|
itemDisplay.setTransformation(transform);
|
||||||
|
});
|
||||||
|
|
||||||
spawnInteraction(true);
|
spawnInteraction(true);
|
||||||
} else {
|
} else {
|
||||||
@ -276,9 +293,9 @@ public class PixelBlock {
|
|||||||
this.hitbox = null;
|
this.hitbox = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(barrier != null) {
|
if(!placeholderIcon.isEmpty()) {
|
||||||
this.barrier.remove();
|
this.placeholderIcon.forEach(Entity::remove);
|
||||||
this.barrier = null;
|
this.placeholderIcon.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pixelBlockLocation.getWorld().getEntities().stream()
|
this.pixelBlockLocation.getWorld().getEntities().stream()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user