mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Optimized dust
This commit is contained in:
parent
b9f2530e2f
commit
48c1db6a8a
@ -665,7 +665,7 @@ public class CommandStudio implements DecreeExecutor {
|
||||
sender().sendMessage(C.RED + "Players only (this is a config error. Ask support to add DecreeOrigin.PLAYER to the command you tried to run)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sender().sendMessage(C.GREEN + "Spawning entity");
|
||||
entity.spawn(engine(), new Location(world(), location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
|
@ -28,8 +28,11 @@ import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@SuppressWarnings("InstantiationOfUtilityClass")
|
||||
public class BlockSignal {
|
||||
public static final AtomicInteger active = new AtomicInteger(0);
|
||||
public static void of(Block block, int ticks) {
|
||||
new BlockSignal(block, ticks);
|
||||
}
|
||||
@ -78,6 +81,7 @@ public class BlockSignal {
|
||||
}
|
||||
|
||||
public BlockSignal(Block block, int ticks) {
|
||||
active.incrementAndGet();
|
||||
Location tg = block.getLocation().clone().add(0.5, 0, 0.5).clone();
|
||||
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
|
||||
e.setGravity(false);
|
||||
@ -91,8 +95,8 @@ public class BlockSignal {
|
||||
e.setVelocity(new Vector(0, 0, 0));
|
||||
J.s(() -> {
|
||||
e.remove();
|
||||
active.decrementAndGet();
|
||||
BlockData type = block.getBlockData();
|
||||
|
||||
MultiBurst.burst.lazy(() -> {
|
||||
for (Player i : block.getWorld().getPlayers()) {
|
||||
i.sendBlockChange(block.getLocation(), block.getBlockData());
|
||||
|
@ -23,13 +23,17 @@ import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@Data
|
||||
public class DustRevealer {
|
||||
@ -47,6 +51,8 @@ public class DustRevealer {
|
||||
String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ());
|
||||
|
||||
if (a != null) {
|
||||
world.playSound(block.getLocation(), Sound.ITEM_LODESTONE_COMPASS_LOCK, 1f, 0.1f);
|
||||
|
||||
sender.sendMessage("Found object " + a);
|
||||
J.a(() -> {
|
||||
new DustRevealer(access, world, new BlockPosition(block.getX(), block.getY(), block.getZ()), a, new KList<>());
|
||||
@ -63,8 +69,17 @@ public class DustRevealer {
|
||||
this.hits = hits;
|
||||
|
||||
J.s(() -> {
|
||||
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 100);
|
||||
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 7);
|
||||
if(M.r(0.25))
|
||||
{
|
||||
world.playSound(block.toBlock(world).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, RNG.r.f(0.2f, 2f));
|
||||
}
|
||||
J.a(() -> {
|
||||
while(BlockSignal.active.get() > 128)
|
||||
{
|
||||
J.sleep(5);
|
||||
}
|
||||
|
||||
try {
|
||||
is(new BlockPosition(block.getX() + 1, block.getY(), block.getZ()));
|
||||
is(new BlockPosition(block.getX() - 1, block.getY(), block.getZ()));
|
||||
@ -97,7 +112,7 @@ public class DustRevealer {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}, RNG.r.i(3, 6));
|
||||
}, RNG.r.i(2,8));
|
||||
}
|
||||
|
||||
private boolean is(BlockPosition a) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user