mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Requested patches
This commit is contained in:
parent
8070b211ab
commit
d56a63e712
@ -15,7 +15,7 @@ import org.bukkit.Location;
|
|||||||
@Snippet("command")
|
@Snippet("command")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Desc("Represents a color")
|
@Desc("Represents a set of Iris commands")
|
||||||
@Data
|
@Data
|
||||||
public class IrisCommand {
|
public class IrisCommand {
|
||||||
|
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Snippet("command-registry")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Desc("Represents a casting location for a command")
|
||||||
|
@Data
|
||||||
|
public class IrisCommandRegistry {
|
||||||
|
@ArrayType(min = 1, type = IrisCommand.class)
|
||||||
|
@Desc("Run commands, at the exact location of the player")
|
||||||
|
private KList<IrisCommand> rawCommands = new KList<>();
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@MinNumber(-8)
|
||||||
|
@MaxNumber(8)
|
||||||
|
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||||
|
private double commandOffsetX = 0;
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@MinNumber(-8)
|
||||||
|
@MaxNumber(8)
|
||||||
|
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||||
|
private double commandOffsetY = 0;
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@MinNumber(-8)
|
||||||
|
@MaxNumber(8)
|
||||||
|
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||||
|
private double commandOffsetZ = 0;
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@Desc("Randomize the altX from -altX to altX")
|
||||||
|
private boolean commandRandomAltX = true;
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@Desc("Randomize the altY from -altY to altY")
|
||||||
|
private boolean commandRandomAltY = false;
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@Desc("Randomize the altZ from -altZ to altZ")
|
||||||
|
private boolean commandRandomAltZ = true;
|
||||||
|
@DependsOn({"rawCommands"})
|
||||||
|
@Desc("Randomize location for all separate commands (true), or run all on the same location (false)")
|
||||||
|
private boolean commandAllRandomLocations = true;
|
||||||
|
|
||||||
|
public void run(Player p) {
|
||||||
|
if (rawCommands.isNotEmpty()) {
|
||||||
|
Location part = p.getLocation().clone().add(
|
||||||
|
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||||
|
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||||
|
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
||||||
|
for (IrisCommand rawCommand : rawCommands) {
|
||||||
|
rawCommand.run(part);
|
||||||
|
if (commandAllRandomLocations) {
|
||||||
|
part = p.getLocation().clone().add(
|
||||||
|
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||||
|
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||||
|
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -147,36 +147,10 @@ public class IrisEffect {
|
|||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The chance is 1 in CHANCE per interval")
|
@Desc("The chance is 1 in CHANCE per interval")
|
||||||
private int chance = 50;
|
private int chance = 50;
|
||||||
@ArrayType(min = 1, type = IrisCommand.class)
|
@ArrayType(min = 1, type = IrisCommandRegistry.class)
|
||||||
@Desc("Run commands, at the exact location of the player")
|
@Desc("Run commands, with configurable location parameters")
|
||||||
private KList<IrisCommand> rawCommands = new KList<>();
|
private IrisCommandRegistry commandRegistry = null;
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@MinNumber(-8)
|
|
||||||
@MaxNumber(8)
|
|
||||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
|
||||||
private double commandOffsetX = 0;
|
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@MinNumber(-8)
|
|
||||||
@MaxNumber(8)
|
|
||||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
|
||||||
private double commandOffsetY = 0;
|
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@MinNumber(-8)
|
|
||||||
@MaxNumber(8)
|
|
||||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
|
||||||
private double commandOffsetZ = 0;
|
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@Desc("Randomize the altX from -altX to altX")
|
|
||||||
private boolean commandRandomAltX = true;
|
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@Desc("Randomize the altY from -altY to altY")
|
|
||||||
private boolean commandRandomAltY = false;
|
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@Desc("Randomize the altZ from -altZ to altZ")
|
|
||||||
private boolean commandRandomAltZ = true;
|
|
||||||
@DependsOn({"rawCommands"})
|
|
||||||
@Desc("Randomize location for all separate commands (true), or run all on the same location (false)")
|
|
||||||
private boolean commandAllRandomLocations = true;
|
|
||||||
|
|
||||||
public boolean canTick() {
|
public boolean canTick() {
|
||||||
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
||||||
@ -247,20 +221,8 @@ public class IrisEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawCommands.isNotEmpty()) {
|
if (commandRegistry != null) {
|
||||||
Location part = p.getLocation().clone().add(
|
commandRegistry.run(p);
|
||||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
|
||||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
|
||||||
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
|
||||||
for (IrisCommand rawCommand : rawCommands) {
|
|
||||||
rawCommand.run(part);
|
|
||||||
if (commandAllRandomLocations) {
|
|
||||||
part = p.getLocation().clone().add(
|
|
||||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
|
||||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
|
||||||
commandRandomAltZ ? RNG.r.d(-commandOffsetZ, commandOffsetZ) : commandOffsetZ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (potionStrength > -1) {
|
if (potionStrength > -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user