diff --git a/pom.xml b/pom.xml
index e77861ff..ce5e289e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
sefiraat
https://sonarcloud.io
- e1,e2
+ e1,e2,e3
java:S6212
**
@@ -113,6 +113,12 @@
b8f7dc
provided
+
+ com.github.TheBusyBiscuit
+ ExoticGarden
+ a2c4b6d
+ provided
+
org.jetbrains
annotations
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java b/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java
index 802ad6cf..05a3554d 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java
@@ -22,7 +22,6 @@
import io.github.sefiraat.crystamaehistoria.slimefun.Tools;
import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
import io.github.sefiraat.crystamaehistoria.stories.StoriesManager;
-import io.github.sefiraat.crystamaehistoria.utils.CrystaTag;
import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
import io.github.thebusybiscuit.slimefun4.libraries.dough.collections.Pair;
import org.apache.commons.lang.Validate;
@@ -155,8 +154,6 @@ public void enable() {
getAddonCommand().addSub(new TestSpell());
getAddonCommand().addSub(new OpenSpellCompendium());
getAddonCommand().addSub(new OpenStoryCompendium());
-
- CrystaTag.getCachedValues();
}
private void setupBstats() {
@@ -217,5 +214,4 @@ private void setupSlimefun() {
Gadgets.setup();
Tools.setup();
}
-
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/GetBlockColors.java b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/GetBlockColors.java
deleted file mode 100644
index aa7c5fbc..00000000
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/GetBlockColors.java
+++ /dev/null
@@ -1,59 +0,0 @@
-//package io.github.sefiraat.crystamaehistoria.commands;
-//
-//import io.github.mooy1.infinitylib.commands.SubCommand;
-//import org.bukkit.Color;
-//import org.bukkit.Material;
-//import org.bukkit.block.Block;
-//import org.bukkit.command.CommandSender;
-// import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock;
-//import org.bukkit.entity.Player;
-//
-//import javax.annotation.ParametersAreNonnullByDefault;
-//import java.io.BufferedWriter;
-//import java.io.File;
-//import java.io.FileWriter;
-//import java.io.IOException;
-//import java.util.List;
-//
-//public class GetBlockColors extends SubCommand {
-//
-// public GetBlockColors() {
-// super("block_color", "Generates block colors", true);
-// }
-//
-// @Override
-// @ParametersAreNonnullByDefault
-// protected void execute(CommandSender sender, String[] args) {
-// if (sender instanceof Player) {
-// Player player = (Player) sender;
-// Block block = player.getLocation().getBlock();
-// try (BufferedWriter writer = new BufferedWriter(new FileWriter(new File("block_colors.yml")))) {
-// for (Material material : Material.values()) {
-// if (material.isBlock()) {
-// block.setType(material);
-// Color color = Color.fromRGB(((CraftBlock) block).getNMS().getBlock().s().al);
-// writeLine(writer,
-// material.name() + ": [" +
-// + color.getRed() + ", "
-// + color.getGreen() + ", "
-// + color.getBlue() + "]"
-// );
-// }
-// }
-// } catch (IOException exception) {
-// exception.printStackTrace();
-// }
-// }
-// }
-//
-// private static void writeLine(BufferedWriter writer, String line) throws IOException {
-// writer.write(line);
-// writer.newLine();
-// }
-//
-// @Override
-// protected void complete(CommandSender commandSender, String[] strings, List list) {
-//
-// }
-//
-//}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenSpellCompendium.java b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenSpellCompendium.java
index e5b82b36..674cdb7c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenSpellCompendium.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenSpellCompendium.java
@@ -1,14 +1,8 @@
package io.github.sefiraat.crystamaehistoria.commands;
import io.github.mooy1.infinitylib.commands.SubCommand;
-import io.github.sefiraat.crystamaehistoria.magic.CastInformation;
-import io.github.sefiraat.crystamaehistoria.magic.SpellType;
-import io.github.sefiraat.crystamaehistoria.magic.spells.core.Spell;
import io.github.sefiraat.crystamaehistoria.slimefun.ItemGroups;
-import io.github.sefiraat.crystamaehistoria.slimefun.itemgroups.SpellCollectionFlexGroup;
-import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
-import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
@@ -39,6 +33,6 @@ protected void execute(CommandSender sender, String[] args) {
@Override
@ParametersAreNonnullByDefault
protected void complete(CommandSender commandSender, String[] strings, List list) {
-
+ // Not required
}
}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenStoryCompendium.java b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenStoryCompendium.java
index 3259aa68..1cbfb6c6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenStoryCompendium.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/OpenStoryCompendium.java
@@ -33,6 +33,6 @@ protected void execute(CommandSender sender, String[] args) {
@Override
@ParametersAreNonnullByDefault
protected void complete(CommandSender commandSender, String[] strings, List list) {
-
+ // Not required
}
}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ArmorStandInteract.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ArmorStandInteract.java
index 4fffcd39..6bd799e6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ArmorStandInteract.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ArmorStandInteract.java
@@ -16,8 +16,10 @@ public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
@EventHandler
public void onArmorDispense(BlockDispenseArmorEvent e) {
- if (e.getTargetEntity() instanceof ArmorStand) {
- if (ArmourStandUtils.isDisplayStand((ArmorStand) e.getTargetEntity())) e.setCancelled(true);
+ if (e.getTargetEntity() instanceof ArmorStand
+ && ArmourStandUtils.isDisplayStand((ArmorStand) e.getTargetEntity())
+ ) {
+ e.setCancelled(true);
}
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ListenerManager.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ListenerManager.java
index f851d177..b3588e21 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ListenerManager.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/ListenerManager.java
@@ -7,7 +7,7 @@ public class ListenerManager {
public ListenerManager() {
addListener(new ArmorStandInteract());
- addListener(new PlayerInteract());
+ addListener(new SpellCastListener());
addListener(new SpellEffectListener());
addListener(new CrystalBreakListener());
addListener(new BlockRemovalListener());
@@ -17,6 +17,7 @@ public ListenerManager() {
addListener(new EndermanInhibitorListener());
addListener(new MobCandleListener());
addListener(new DisplayItemListener());
+ addListener(new MiscListener());
}
private void addListener(Listener listener) {
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java
new file mode 100644
index 00000000..452be015
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java
@@ -0,0 +1,24 @@
+package io.github.sefiraat.crystamaehistoria.listeners;
+
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MysteriousTicker;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import org.bukkit.block.Block;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+public class MiscListener implements Listener {
+
+ @EventHandler
+ public void onDontTouchMyCrap(PlayerInteractEvent e) {
+ Block block = e.getClickedBlock();
+ if (e.getAction() == Action.RIGHT_CLICK_BLOCK && block != null) {
+ SlimefunItem slimefunItem = BlockStorage.check(block);
+ if (slimefunItem instanceof MysteriousTicker) {
+ e.setCancelled(true);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java
index 20a88ff9..3fca8279 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java
@@ -2,7 +2,7 @@
import io.github.sefiraat.crystamaehistoria.magic.DisplayItem;
import io.github.sefiraat.crystamaehistoria.slimefun.Materials;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.ExpCollector;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.ExpCollector;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasin;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.RefactingLens;
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType;
@@ -62,7 +62,7 @@ private void liquefactionBasin(Player player, SlimefunItem blockItem, Block clic
for (Map.Entry entry : cacheMap.entrySet()) {
final Integer integer = entry.getValue();
final StoryType storyType = entry.getKey();
- final ItemStack itemStack = Materials.DUMMY_CRYSTAL_MAP.get(storyType).getItem().clone();
+ final ItemStack itemStack = Materials.getDummyCrystalMap().get(storyType).getItem().clone();
final double xOffset = (space * xPos) - evenOffset;
final Vector pointVector = new Vector(xOffset, 0, 0)
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/PlayerInteract.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellCastListener.java
similarity index 78%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/listeners/PlayerInteract.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellCastListener.java
index aa9f0580..37caa047 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/PlayerInteract.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellCastListener.java
@@ -3,7 +3,6 @@
import io.github.sefiraat.crystamaehistoria.magic.CastInformation;
import io.github.sefiraat.crystamaehistoria.magic.CastResult;
import io.github.sefiraat.crystamaehistoria.magic.spells.core.InstanceStave;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.MysteriousTicker;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.stave.SpellSlot;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.stave.Stave;
import io.github.sefiraat.crystamaehistoria.utils.Keys;
@@ -11,19 +10,16 @@
import io.github.sefiraat.crystamaehistoria.utils.datatypes.PersistentStaveDataType;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-public class PlayerInteract implements Listener {
+public class SpellCastListener implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent e) {
@@ -49,7 +45,7 @@ public void onInteract(PlayerInteractEvent e) {
);
stack.setItemMeta(itemMeta);
staveInstance.buildLore();
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(
+ player.sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(
ThemeType.SUCCESS.getColor() + "Casting spell: " + castInformation.getSpellType().getId()
));
} else {
@@ -59,16 +55,4 @@ public void onInteract(PlayerInteractEvent e) {
}
}
}
-
- @EventHandler
- public void onDontTouchMyCrap(PlayerInteractEvent e) {
- Block block = e.getClickedBlock();
- if (e.getAction() == Action.RIGHT_CLICK_BLOCK && block != null) {
- SlimefunItem slimefunItem = BlockStorage.check(block);
- if (slimefunItem instanceof MysteriousTicker) {
- e.setCancelled(true);
- }
- }
- }
-
}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellEffectListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellEffectListener.java
index ee02f088..c2421a8e 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellEffectListener.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/SpellEffectListener.java
@@ -26,7 +26,6 @@
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
-import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.inventory.ItemStack;
@@ -109,13 +108,6 @@ public void onFallingBlockLands(EntityChangeBlockEvent event) {
}
}
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void onEggThrow(PlayerEggThrowEvent event) {
- if (CrystamaeHistoria.getProjectileMap().containsKey(event.getEgg().getUniqueId())) {
- event.setHatching(false);
- }
- }
-
private boolean entityHitAllowed(CastInformation castInformation, Entity hitEntity) {
final Player player = Bukkit.getPlayer(castInformation.getCaster());
return hitEntity instanceof LivingEntity
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java
index dbdd9118..ae5846d0 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java
@@ -69,7 +69,6 @@
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.TimeCompression;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.TimeDilation;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.Tracer;
-import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.TunnelBore;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.Vacuum;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.WitherWeather;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasinCache;
@@ -150,7 +149,6 @@ public enum SpellType {
TIME_COMPRESSION(new TimeCompression()),
TIME_DILATION(new TimeDilation()),
TRACER(new Tracer()),
- TUNNEL_BORE(new TunnelBore()),
VACUUM(new Vacuum()),
WITHER_WEATHER(new WitherWeather());
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java
index e67b7264..cc576d76 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java
@@ -50,13 +50,11 @@ private void castBlood(CastInformation castInformation, Location location, doubl
getDamage(castInformation)
);
ParticleUtils.displayParticleEffect(livingEntity, 2, 10, dustOptions);
- if (iteration <= 5) {
- if (livingEntity.getHealth() <= 0) {
- GeneralUtils.pushEntity(castInformation.getCaster(), castInformation.getCastLocation(), entity, 5);
- ParticleUtils.displayParticleEffect(livingEntity, 4, 20, dustOptions);
- entity.remove();
- castBlood(castInformation, livingEntity.getLocation(), 2, iteration + 1);
- }
+ if (iteration <= 5 && livingEntity.getHealth() <= 0) {
+ GeneralUtils.pushEntity(castInformation.getCaster(), castInformation.getCastLocation(), entity, 5);
+ ParticleUtils.displayParticleEffect(livingEntity, 4, 20, dustOptions);
+ entity.remove();
+ castBlood(castInformation, livingEntity.getLocation(), 2, iteration + 1);
}
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java
index 6d96f668..855d8d26 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java
@@ -53,6 +53,7 @@ public void projectileHit(CastInformation castInformation) {
final Location location = castInformation.getProjectileLocation();
final double range = getProjectileAoe(castInformation);
final int density = 50;
+
for (double height = 0; height <= Math.PI; height += Math.PI / density) {
for (int i = 0; i < range; i++) {
final double r = i * Math.sin(height);
@@ -63,45 +64,48 @@ public void projectileHit(CastInformation castInformation) {
final Location pointLocation = location.clone().add(x, y, z);
final Block block = pointLocation.getBlock();
final Material material = block.getType();
- final Collection entities = pointLocation.getWorld().getNearbyEntities(
- pointLocation,
- 0.5,
- 0.5,
- 0.5
- );
if (Tag.WOOL.isTagged(material)) {
- convertBlock(caster, block, Tag.WOOL);
+ processBlock(caster, block, Tag.WOOL);
} else if (SlimefunTag.TERRACOTTA.isTagged(material)) {
- convertBlock(caster, block, SlimefunTag.TERRACOTTA);
+ processBlock(caster, block, SlimefunTag.TERRACOTTA);
} else if (CrystaTag.GLAZED_TERRACOTTA.isTagged(material)) {
- convertBlock(caster, block, CrystaTag.GLAZED_TERRACOTTA);
+ processBlock(caster, block, CrystaTag.GLAZED_TERRACOTTA);
} else if (SlimefunTag.CONCRETE_POWDERS.isTagged(material)) {
- convertBlock(caster, block, SlimefunTag.CONCRETE_POWDERS);
+ processBlock(caster, block, SlimefunTag.CONCRETE_POWDERS);
} else if (CrystaTag.CONCRETE_BLOCKS.isTagged(material)) {
- convertBlock(caster, block, CrystaTag.CONCRETE_BLOCKS);
+ processBlock(caster, block, CrystaTag.CONCRETE_BLOCKS);
} else if (Tag.CARPETS.isTagged(material)) {
- convertBlock(caster, block, Tag.CARPETS);
+ processBlock(caster, block, Tag.CARPETS);
}
+ }
+ }
+ }
+ processEntities(location, caster);
+ }
- for (Entity entity : entities) {
- if (entity instanceof Colorable
- && GeneralUtils.hasPermission(caster, pointLocation, Interaction.INTERACT_ENTITY)
- ) {
- final int randomValue = ThreadLocalRandom.current().nextInt(
- 0,
- (int) Arrays.stream(DyeColor.values()).count()
- );
- ((Colorable) entity).setColor(DyeColor.values()[randomValue]);
- }
- }
+ private void processEntities(Location location, UUID caster) {
+ final Collection entities = location.getWorld().getNearbyEntities(
+ location,
+ 0.5,
+ 0.5,
+ 0.5
+ );
- }
+ for (Entity entity : entities) {
+ if (entity instanceof Colorable
+ && GeneralUtils.hasPermission(caster, entity.getLocation(), Interaction.INTERACT_ENTITY)
+ ) {
+ final int randomValue = ThreadLocalRandom.current().nextInt(
+ 0,
+ (int) Arrays.stream(DyeColor.values()).count()
+ );
+ ((Colorable) entity).setColor(DyeColor.values()[randomValue]);
}
}
}
- private void convertBlock(UUID caster, Block block, Tag tag) {
+ private void processBlock(UUID caster, Block block, Tag tag) {
if (GeneralUtils.hasPermission(caster, block, Interaction.PLACE_BLOCK)) {
final List list = tag.getValues().stream().toList();
final int randomValue = ThreadLocalRandom.current().nextInt(0, list.size());
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java
index 6264ecd7..490d9f34 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java
@@ -52,16 +52,16 @@ public void projectileHit(CastInformation castInformation) {
for (int y = -range; y < range; y++) {
for (int x = -range; x < range; x++) {
for (int z = -range; z < range; z++) {
- if (Math.sqrt((double) (x * x) + (y * y) + (z * z)) <= range) {
- final Block block = location.getWorld().getBlockAt(
- x + location.getBlockX(),
- y + location.getBlockY(),
- z + location.getBlockZ());
- if (!blocks.contains(block)
- && GeneralUtils.hasPermission(caster, block, Interaction.BREAK_BLOCK)
- ) {
- blocks.add(block);
- }
+ if (Math.sqrt((double) (x * x) + (y * y) + (z * z)) > range) {
+ continue;
+ }
+
+ final Block block = location.getWorld().getBlockAt(
+ x + location.getBlockX(),
+ y + location.getBlockY(),
+ z + location.getBlockZ());
+ if (!blocks.contains(block) && GeneralUtils.hasPermission(caster, block, Interaction.BREAK_BLOCK)) {
+ blocks.add(block);
}
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java
index ce092c59..6fae0340 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java
@@ -33,7 +33,7 @@ public void cast(CastInformation castInformation) {
final Location location = castInformation.getCasterAsPlayer().getLocation().clone().add(0, 1, 0);
final double range = getRange(castInformation);
final double effectRange = range * 0.75;
- final int density = 30;
+ final int density = 20;
// Particles
for (double height = 0; height <= Math.PI; height += Math.PI / density) {
final double r = range * Math.sin(height);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java
index a6a73792..89775bff 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java
@@ -33,7 +33,7 @@ public EasterEgg() {
@ParametersAreNonnullByDefault
public void cast(CastInformation castInformation) {
Location location = castInformation.getCastLocation().add(0, 1, 0);
- for (String string : ThemeType.EGG_NAMES) {
+ for (String string : ThemeType.getEggNames()) {
final List list = CrystaTag.SPAWN_EGGS.getValues().stream().toList();
final int randomValue = ThreadLocalRandom.current().nextInt(0, list.size());
DisplayItem displayItem = new DisplayItem(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
index f3eb98f8..3656762a 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
@@ -48,7 +48,6 @@ public void cast(CastInformation castInformation) {
&& GeneralUtils.hasPermission(castInformation.getCaster(), entity.getLocation(), Interaction.INTERACT_ENTITY)
&& entity.getUniqueId() != castInformation.getCaster()
) {
- // Todo mobs dont spin?
Location newLocation = entity.getLocation().clone();
newLocation.setYaw(entity.getLocation().getYaw() + 10F);
entity.teleport(newLocation);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java
index f18e1a14..db911ec4 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java
@@ -45,8 +45,8 @@ public void cast(CastInformation castInformation) {
// Bonemealing
for (int i = 0; i < castInformation.getStaveLevel() * 3; i++) {
- final int x = (int) ThreadLocalRandom.current().nextDouble(-range, range);
- final int z = (int) ThreadLocalRandom.current().nextDouble(-range, range);
+ final int x = ThreadLocalRandom.current().nextInt((int) -range, (int) range);
+ final int z = ThreadLocalRandom.current().nextInt((int) -range, (int) range);
final Block potentialBlock = location.add(x, 0, z).getBlock();
if (Tag.CROPS.isTagged(potentialBlock.getType())) {
potentialBlock.applyBoneMeal(BlockFace.UP);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java
index f65ac874..d3371609 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java
@@ -18,9 +18,19 @@
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
public class PlutosDecent extends Spell {
+ protected static final List MATERIALS = new ArrayList<>();
+
+ static {
+ MATERIALS.add(Material.BLACKSTONE_SLAB);
+ MATERIALS.add(Material.BLACKSTONE_STAIRS);
+ MATERIALS.add(Material.BLACKSTONE_WALL);
+ MATERIALS.add(Material.CRACKED_POLISHED_BLACKSTONE_BRICKS);
+ }
+
public PlutosDecent() {
SpellCoreBuilder spellCoreBuilder = new SpellCoreBuilder(25, false, 60, false, 75, true)
.makeDamagingSpell(5, true, 1, false)
@@ -65,7 +75,7 @@ private void spawnBlocks(CastInformation castInformation, List blocks) {
MagicFallingBlock magicFallingBlock = SpellUtils.summonMagicFallingBlock(
castInformation,
block.getLocation().add(0, 40, 0),
- Material.BLACKSTONE_STAIRS,
+ MATERIALS.get(ThreadLocalRandom.current().nextInt(MATERIALS.size())),
5
);
magicFallingBlock.setVelocity(block.getLocation(), 2);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java
index 45e5e111..82acc924 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java
@@ -23,8 +23,6 @@
public class Ravage extends Spell {
- // TODO Riding ravagers removed until Paper patches
-
public Ravage() {
SpellCoreBuilder spellCoreBuilder = new SpellCoreBuilder(5, true, 0, false, 50, true)
.makeInstantSpell(this::cast)
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java
index 16e2e68b..beafbe9d 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java
@@ -43,12 +43,11 @@ public void tick(CastInformation castInformation) {
final Block block = castInformation.getTargetedBlockOnCast().getRelative(xOffset, 0, zOffset);
final Block blockBelow = block.getRelative(BlockFace.DOWN);
- if (GeneralUtils.tryBreakBlock(castInformation.getCaster(), block)) {
- if (GeneralUtils.tryBreakBlock(castInformation.getCaster(), blockBelow)
- && castInformation.getCurrentTick() % 5 == 0
- ) {
- blockBelow.setType(Material.TORCH);
- }
+ if (GeneralUtils.tryBreakBlock(castInformation.getCaster(), block)
+ && GeneralUtils.tryBreakBlock(castInformation.getCaster(), blockBelow)
+ && castInformation.getCurrentTick() % 5 == 0
+ ) {
+ blockBelow.setType(Material.TORCH);
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java
index 6408dc50..e7c9c23e 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java
@@ -29,7 +29,7 @@
public class Tracer extends Spell {
- public static final Map COLOR_MAP = new LinkedHashMap<>();
+ protected static final Map COLOR_MAP = new LinkedHashMap<>();
static {
COLOR_MAP.put("player", Color.fromRGB(255, 255, 255));
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java
index a3a25e05..57a0ec79 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java
@@ -19,6 +19,10 @@
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.UUID;
+/**
+ * Removed due to issues. Will be replaced with a raycast version of the same spell.
+ * Given the powerful nature of the spell, I want this to await tier 2 spells first.
+ */
public class TunnelBore extends Spell {
public TunnelBore() {
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/runnables/spells/TunnelBoreRunnable.java b/src/main/java/io/github/sefiraat/crystamaehistoria/runnables/spells/TunnelBoreRunnable.java
index 8ec44dce..c052e942 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/runnables/spells/TunnelBoreRunnable.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/runnables/spells/TunnelBoreRunnable.java
@@ -14,6 +14,10 @@
import java.util.List;
import java.util.UUID;
+/**
+ * Removed due to issues. Will be replaced with a raycast version of the same spell.
+ * Given the powerful nature of the spell, I want this to await tier 2 spells first.
+ */
public class TunnelBoreRunnable extends BukkitRunnable {
private final LivingEntity bore;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java
index dc2eb31e..e87ad1ff 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java
@@ -1,14 +1,15 @@
package io.github.sefiraat.crystamaehistoria.slimefun;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.CursedEarth;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.EnderInhibitor;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.ExpCollector;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.MobCandle;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.MobFan;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.MobLamp;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.MobMat;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets.MysteriousTicker;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.CursedEarth;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.EnderInhibitor;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.ExpCollector;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.GreenHouseGlass;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MobCandle;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MobFan;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MobLamp;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MobMat;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MysteriousTicker;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.DummyLiquefactionBasinCrafting;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasinCache;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.RecipeItem;
@@ -69,6 +70,10 @@ public class Gadgets {
private static MysteriousTicker mysteriousPottedPlant;
@Getter
private static MysteriousTicker mysteriousPlant;
+ @Getter
+ private static GreenHouseGlass greenHouseGlass;
+ @Getter
+ private static GreenHouseGlass focusedGreenHouseGlass;
public static void setup() {
@@ -76,6 +81,7 @@ public static void setup() {
final ItemStack uniqueVoid = Materials.CRYSTAL_MAP.get(StoryRarity.UNIQUE).get(StoryType.VOID).getItem();
final ItemStack amalgamateDustRare = Materials.getAmalgamateDustRare().getItem();
+ final ItemStack amalgamateDustEpic = Materials.getAmalgamateDustEpic().getItem();
// Abstraction Lamp
RecipeItem abstractionLampRecipe = new RecipeItem(
@@ -89,7 +95,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_LAMP_1",
new ItemStack(Material.LANTERN),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Abstraction Lamp",
"The abstraction lamp will push all",
"nearby mobs away from it.",
@@ -115,7 +121,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_LAMP_2",
new ItemStack(Material.SOUL_LANTERN),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Dispersion Lamp",
"The dispersion lamp will push all",
"nearby mobs away from it.",
@@ -141,7 +147,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_FAN_1",
new ItemStack(Material.REDSTONE_LAMP),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Inversion Vacuum",
"Creates a magically induced vacuum",
"that pulls entities away from the",
@@ -166,7 +172,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_FAN_2",
new ItemStack(Material.NOTE_BLOCK),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Antipodal Vacuum",
"Creates a magically induced vacuum",
"that pulls entities away from the",
@@ -194,7 +200,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_DIRT_1",
new ItemStack(Material.BROWN_WOOL),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Cursed Earth",
"Dark magics seep from this dirt giving",
"a very ominous vibe!",
@@ -235,7 +241,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_DIRT_2",
new ItemStack(Material.BLACK_WOOL),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Dreadful Dirt",
"Dark magics seep from this dirt giving",
"a very ominous vibe!",
@@ -264,7 +270,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_PLATE_1",
new ItemStack(Material.CRIMSON_PRESSURE_PLATE),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Searing Plate",
"A plate that is magically super-heated.",
"Anything standing on this plate gets",
@@ -291,7 +297,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_PLATE_2",
new ItemStack(Material.WARPED_PRESSURE_PLATE),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Doomed Plate",
"A plate that is magically super-heated.",
"Anything standing on this plate gets",
@@ -318,7 +324,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_PLATE_3",
new ItemStack(Material.POLISHED_BLACKSTONE_PRESSURE_PLATE),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Eviscerating Plate",
"A plate that is magically super-heated.",
"Anything standing on this plate gets",
@@ -345,7 +351,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_EXP_COLLECTOR_1",
new ItemStack(Material.LIGHTNING_ROD),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Basic Exp Collector",
"Infusing the Exp Collector with",
"magic now allows it to work",
@@ -392,7 +398,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_ENDER_INHIBITOR_1",
new ItemStack(Material.REDSTONE_TORCH),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Basic Ender Inhibitor",
"By using an Enderman's own resonance",
"against it, we can stop theme teleporting",
@@ -417,7 +423,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_ENDER_INHIBITOR_2",
new ItemStack(Material.SOUL_TORCH),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Advanced Ender Inhibitor",
"By using an Enderman's own resonance",
"against it, we can stop theme teleporting",
@@ -448,7 +454,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_CANDLE_1",
new ItemStack(Material.BLACK_CANDLE),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Dim Verache Candle",
"This candle stops mobs spawning",
"in a radius around it.",
@@ -475,7 +481,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_CANDLE_2",
new ItemStack(Material.BROWN_CANDLE),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Bright Verache Candle",
"This candle stops mobs spawning",
"in a radius around it.",
@@ -502,7 +508,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MOB_CANDLE_3",
new ItemStack(Material.WHITE_CANDLE),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Scintillating Verache Candle",
"This candle stops mobs spawning",
"in a radius around it.",
@@ -523,11 +529,10 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_MYSTERIOUS_POTTED_PLANT",
new ItemStack(Material.FLOWER_POT),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Mysterious Potted Plant",
"Just a pinch of magic can make",
- "wonderful things happen...",
- ""
+ "wonderful things happen..."
),
RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[]{
@@ -540,7 +545,7 @@ null, new ItemStack(Material.FLOWER_POT), null,
block -> ParticleUtils.displayParticleEffect(
block.getLocation().add(0.5, 0.5, 0.5),
Particle.WAX_OFF,
- 0.3 ,
+ 0.3,
2
)
);
@@ -557,10 +562,9 @@ null, new ItemStack(Material.FLOWER_POT), null,
ThemeType.themedSlimefunItemStack(
"CRY_MYSTERIOUS_PLANT",
new ItemStack(Material.OXEYE_DAISY),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Mysterious Plant",
- "Removing it from that pot took work.",
- ""
+ "Removing it from that pot took work."
),
DummyLiquefactionBasinCrafting.TYPE,
mysteriousPlantRecipe.getDisplayRecipe(),
@@ -574,6 +578,52 @@ null, new ItemStack(Material.FLOWER_POT), null,
)
);
+ // Green House Glass
+ greenHouseGlass = new GreenHouseGlass(
+ ItemGroups.GADGETS,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_CROP_GLASS_1",
+ new ItemStack(Material.GLASS),
+ ThemeType.GADGET,
+ "Greenhouse Glass",
+ "Crops under this glass will grow faster.",
+ "Works during the day in light worlds only.",
+ "",
+ ThemeType.CLICK_INFO.getColor() + "Rate: " + ThemeType.PASSIVE.getColor() + "5"
+ ),
+ RecipeType.MAGIC_WORKBENCH,
+ new ItemStack[]{
+ amalgamateDustEpic, new ItemStack(Material.GLASS), amalgamateDustEpic,
+ new ItemStack(Material.GLASS), SlimefunItems.POWER_CRYSTAL, new ItemStack(Material.GLASS),
+ amalgamateDustEpic, new ItemStack(Material.GLASS), amalgamateDustEpic,
+ },
+ 5
+ );
+
+ // Focused Green House Glass
+ RecipeItem focusedGreenHouseGlassRecipe = new RecipeItem(
+ mysteriousPottedPlant.getItem(),
+ StoryType.ALCHEMICAL, 15,
+ StoryType.ANIMAL, 40,
+ StoryType.PHILOSOPHICAL, 30
+ );
+ focusedGreenHouseGlass = new GreenHouseGlass(
+ ItemGroups.GADGETS,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_CROP_GLASS_2",
+ new ItemStack(Material.YELLOW_STAINED_GLASS),
+ ThemeType.GADGET,
+ "Focused Greenhouse Glass",
+ "Crops under this glass will grow faster.",
+ "Works during the day in light worlds only.",
+ "",
+ ThemeType.CLICK_INFO.getColor() + "Rate: " + ThemeType.PASSIVE.getColor() + "10"
+ ),
+ DummyLiquefactionBasinCrafting.TYPE,
+ focusedGreenHouseGlassRecipe.getDisplayRecipe(),
+ 10
+ );
+
// Slimefun Registry
abstractionLamp.register(plugin);
dispersionLamp.register(plugin);
@@ -593,6 +643,8 @@ null, new ItemStack(Material.FLOWER_POT), null,
scintillatingMobCandle.register(plugin);
mysteriousPottedPlant.register(plugin);
mysteriousPlant.register(plugin);
+ greenHouseGlass.register(plugin);
+ focusedGreenHouseGlass.register(plugin);
// Liquefaction Recipes
LiquefactionBasinCache.addCraftingRecipe(abstractionLamp, abstractionLampRecipe);
@@ -615,5 +667,7 @@ null, new ItemStack(Material.FLOWER_POT), null,
LiquefactionBasinCache.addCraftingRecipe(scintillatingMobCandle, scintillatingMobCandleRecipe);
LiquefactionBasinCache.addCraftingRecipe(mysteriousPlant, mysteriousPlantRecipe);
+
+ LiquefactionBasinCache.addCraftingRecipe(focusedGreenHouseGlass, focusedGreenHouseGlassRecipe);
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Materials.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Materials.java
index 9244b62d..4b1965c9 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Materials.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Materials.java
@@ -26,8 +26,8 @@
@UtilityClass
public class Materials {
- public static final Map DUMMY_CRYSTAL_MAP = new EnumMap<>(StoryType.class);
- public static final Map> CRYSTAL_MAP = new EnumMap<>(StoryRarity.class);
+ protected static final Map DUMMY_CRYSTAL_MAP = new EnumMap<>(StoryType.class);
+ protected static final Map> CRYSTAL_MAP = new EnumMap<>(StoryRarity.class);
@Getter
private static SlimefunItem amalgamateDustCommon;
@@ -437,4 +437,12 @@ public static void setup() {
LiquefactionBasinCache.addCraftingRecipe(imbuedGlass, imbuedGlassRecipe);
LiquefactionBasinCache.addCraftingRecipe(uncannyPearl, uncannyPearlRecipe);
}
+
+ public static Map getDummyCrystalMap() {
+ return DUMMY_CRYSTAL_MAP;
+ }
+
+ public static Map> getCrystalMap() {
+ return CRYSTAL_MAP;
+ }
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Mechanisms.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Mechanisms.java
index 6a82fd83..64c5a172 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Mechanisms.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Mechanisms.java
@@ -8,7 +8,6 @@
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.RecipeItem;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.realisationaltar.RealisationAltar;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.staveconfigurator.StaveConfigurator;
-import io.github.sefiraat.crystamaehistoria.stories.definition.StoryRarity;
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
@@ -53,7 +52,6 @@ public static void setup() {
final CrystamaeHistoria plugin = CrystamaeHistoria.getInstance();
- final ItemStack uniqueVoid = Materials.CRYSTAL_MAP.get(StoryRarity.UNIQUE).get(StoryType.VOID).getItem();
final ItemStack amalgamateDustRare = Materials.getAmalgamateDustRare().getItem();
final ItemStack amalgamateIngotUncommon = Materials.getAmalgamateIngotUncommon().getItem();
@@ -259,7 +257,8 @@ null, new ItemStack(Material.BOOK), null,
"Liquefaction Basin (Tier 1)",
"The liquefaction basin can take",
"Crystals and convert them into their liquid",
- "Crystamae form. Used for magical crafting",
+ "Crystamae form. Used for magical crafting.",
+ "Danger: Do not break while filled!",
"",
"Holds up to 500 Liquefied Crysta."
),
@@ -283,7 +282,8 @@ SlimefunItems.REINFORCED_ALLOY_INGOT, new ItemStack(Material.CAULDRON), Slimefun
"Liquefaction Basin (Tier 2)",
"The liquefaction basin can take",
"Crystals and convert them into their liquid",
- "Crystamae form. Used for magical crafting",
+ "Crystamae form. Used for magical crafting.",
+ "Danger: Do not break while filled!",
"",
"Holds up to 1000 Liquefied Crysta."
),
@@ -313,7 +313,8 @@ SlimefunItems.REINFORCED_ALLOY_INGOT, new ItemStack(Material.CAULDRON), Slimefun
"Liquefaction Basin (Tier 3)",
"The liquefaction basin can take",
"Crystals and convert them into their liquid",
- "Crystamae form. Used for magical crafting",
+ "Crystamae form. Used for magical crafting.",
+ "Danger: Do not break while filled!",
"",
"Holds up to 2500 Liquefied Crysta."
),
@@ -339,7 +340,8 @@ SlimefunItems.REINFORCED_ALLOY_INGOT, new ItemStack(Material.CAULDRON), Slimefun
"Liquefaction Basin (Tier 4)",
"The liquefaction basin can take",
"Crystals and convert them into their liquid",
- "Crystamae form. Used for magical crafting",
+ "Crystamae form. Used for magical crafting.",
+ "Danger: Do not break while filled!",
"",
"Holds up to 5000 Liquefied Crysta."
),
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Tools.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Tools.java
index dd141485..e0b74f82 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Tools.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Tools.java
@@ -1,6 +1,7 @@
package io.github.sefiraat.crystamaehistoria.slimefun;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.DummyLiquefactionBasinCrafting;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasinCache;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.RecipeItem;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.RefactingLens;
@@ -60,7 +61,7 @@ public static void setup() {
"A blank plate that has the potential to",
"store magical energy"
),
- RecipeType.ORE_WASHER,
+ DummyLiquefactionBasinCrafting.TYPE,
inertPlateRecipe.getDisplayRecipe(),
1
);
@@ -77,7 +78,7 @@ public static void setup() {
"A magically charged plate storing magic",
"potential."
),
- RecipeType.ORE_WASHER,
+ DummyLiquefactionBasinCrafting.TYPE,
new ItemStack[]{null, null, null, null, new ItemStack(Material.AMETHYST_CLUSTER), null, null, null, null},
1
);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/CursedEarth.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/CursedEarth.java
similarity index 97%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/CursedEarth.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/CursedEarth.java
index e23511b2..31c3bed6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/CursedEarth.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/CursedEarth.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.sefiraat.crystamaehistoria.utils.ParticleUtils;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/EnderInhibitor.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java
similarity index 97%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/EnderInhibitor.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java
index 588e5f7f..9b9d88b7 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/EnderInhibitor.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/ExpCollector.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/ExpCollector.java
similarity index 91%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/ExpCollector.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/ExpCollector.java
index f009c0a9..905439a8 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/ExpCollector.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/ExpCollector.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.mooy1.infinitylib.machines.TickingMenuBlock;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.RefactingLens;
@@ -29,6 +29,9 @@
public class ExpCollector extends TickingMenuBlock {
+ protected static final String ID_UUID = "CH_UUID";
+ protected static final String ID_VOLUME = "EXP_VOLUME";
+
protected static final int[] BACKGROUND_SLOTS = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
};
@@ -64,9 +67,9 @@ protected void onBreak(BlockBreakEvent e, BlockMenu menu) {
@ParametersAreNonnullByDefault
protected void onPlace(BlockPlaceEvent e, Block b) {
final UUID uuid = e.getPlayer().getUniqueId();
- BlockStorage.addBlockInfo(b, "CH_UUID", uuid.toString());
+ BlockStorage.addBlockInfo(b, ID_UUID, uuid.toString());
blockOwnerMap.put(b.getLocation(), uuid);
- BlockStorage.addBlockInfo(b, "EXP_VOLUME", String.valueOf(0));
+ BlockStorage.addBlockInfo(b, ID_VOLUME, String.valueOf(0));
volumeMap.put(b.getLocation(), 0);
}
@@ -101,7 +104,7 @@ protected void tick(Block block, BlockMenu blockMenu) {
}
private void syncValue(Block block) {
- BlockStorage.addBlockInfo(block, "EXP_VOLUME", String.valueOf(volumeMap.get(block.getLocation())));
+ BlockStorage.addBlockInfo(block, ID_VOLUME, String.valueOf(volumeMap.get(block.getLocation())));
}
@Override
@@ -114,11 +117,11 @@ protected void setup(BlockMenuPreset blockMenuPreset) {
@ParametersAreNonnullByDefault
protected void onNewInstance(BlockMenu menu, Block block) {
Location location = block.getLocation();
- String owner = BlockStorage.getLocationInfo(location, "CH_UUID");
+ String owner = BlockStorage.getLocationInfo(location, ID_UUID);
if (owner != null) {
blockOwnerMap.put(location, UUID.fromString(owner));
}
- String volumeString = BlockStorage.getLocationInfo(location, "EXP_VOLUME");
+ String volumeString = BlockStorage.getLocationInfo(location, ID_VOLUME);
if (volumeString != null) {
volumeMap.put(location, Integer.parseInt(volumeString));
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java
new file mode 100644
index 00000000..6ad7cbbd
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java
@@ -0,0 +1,105 @@
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
+
+import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.TickingBlockNoGui;
+import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
+import io.github.sefiraat.crystamaehistoria.utils.ParticleUtils;
+import io.github.sefiraat.crystamaehistoria.utils.TimePeriod;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import lombok.Getter;
+import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import org.bukkit.FluidCollisionMode;
+import org.bukkit.Location;
+import org.bukkit.Particle;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.Ageable;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.RayTraceResult;
+import org.jetbrains.annotations.NotNull;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+public class GreenHouseGlass extends TickingBlockNoGui {
+
+
+ @Getter
+ private final int rate;
+ @Getter
+ private final Map blockOwnerMap = new HashMap<>();
+
+ @ParametersAreNonnullByDefault
+ public GreenHouseGlass(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, int rate) {
+ super(category, item, recipeType, recipe);
+ this.rate = rate;
+ }
+
+ @Override
+ protected void onTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ if (!GeneralUtils.testChance(this.rate, 100) || TimePeriod.isLight(block.getWorld())) {
+ return;
+ }
+
+ final BlockFace direction = BlockFace.DOWN;
+ final Location location = block.getLocation().subtract(0, 1, 0);
+
+ RayTraceResult result = location.getWorld().rayTrace(
+ location,
+ direction.getDirection(),
+ 30,
+ FluidCollisionMode.ALWAYS,
+ false,
+ 0.1,
+ null
+ );
+
+ if (result == null) {
+ return;
+ }
+
+ final Block testBlock = result.getHitBlock();
+ if (testBlock == null || testBlock.isSolid()) {
+ return;
+ }
+
+ final BlockData blockData = testBlock.getBlockData();
+ if (blockData instanceof Ageable) {
+ Ageable ageable = (Ageable) blockData;
+ if (ageable.getAge() < ageable.getMaximumAge()) {
+ ageable.setAge(ageable.getAge() + 1);
+ ParticleUtils.displayParticleEffect(testBlock.getLocation().add(.5, .5, .5), Particle.SPELL_WITCH, 0.5, 2);
+ testBlock.setBlockData(ageable);
+ }
+ }
+ }
+
+ @Override
+ protected void onFirstTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ blockOwnerMap.put(
+ block.getLocation(),
+ UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), "CH_UUID"))
+ );
+ }
+
+ @Override
+ protected void onPlace(@NotNull BlockPlaceEvent event) {
+ final UUID uuid = event.getPlayer().getUniqueId();
+ BlockStorage.addBlockInfo(event.getBlock(), "CH_UUID", uuid.toString());
+ blockOwnerMap.put(event.getBlock().getLocation(), uuid);
+ }
+
+ @Override
+ protected void onBreak(@NotNull BlockBreakEvent blockBreakEvent, @NotNull ItemStack itemStack, @NotNull List list) {
+ // No on break
+ }
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobCandle.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java
similarity index 98%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobCandle.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java
index 49a61206..56010f3f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobCandle.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.TickingBlockNoGui;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobFan.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java
similarity index 74%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobFan.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java
index cfdbbfd6..d903fc76 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobFan.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.mooy1.infinitylib.machines.TickingMenuBlock;
import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
@@ -12,6 +12,7 @@
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.FluidCollisionMode;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.block.Block;
@@ -21,7 +22,8 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.BlockIterator;
+import org.bukkit.util.RayTraceResult;
+import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -30,6 +32,9 @@
public class MobFan extends TickingMenuBlock {
+ protected static final String ID_DIRECTION = "CH_DIRECTION";
+ protected static final String ID_UUID = "CH_UUID";
+
protected static final int[] BACKGROUND_SLOTS = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 27, 28, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
};
@@ -51,8 +56,8 @@ public MobFan(ItemGroup category, SlimefunItemStack item, RecipeType recipeType,
new BlockPlaceHandler(false) {
@Override
public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
- BlockStorage.addBlockInfo(event.getBlock(), "CH_UUID", event.getPlayer().getUniqueId().toString());
- BlockStorage.addBlockInfo(event.getBlock(), "CH_DIRECTION", BlockFace.SELF.name());
+ BlockStorage.addBlockInfo(event.getBlock(), ID_UUID, event.getPlayer().getUniqueId().toString());
+ BlockStorage.addBlockInfo(event.getBlock(), ID_DIRECTION, BlockFace.SELF.name());
}
},
new BlockBreakHandler(false, false) {
@@ -67,7 +72,7 @@ public void onPlayerBreak(BlockBreakEvent blockBreakEvent, ItemStack itemStack,
@Override
@ParametersAreNonnullByDefault
protected void onNewInstance(BlockMenu menu, Block b) {
- BlockFace direction = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "CH_DIRECTION"));
+ BlockFace direction = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), ID_DIRECTION));
setDirection(menu, direction);
menu.addMenuClickHandler(SET_NORTH, (player, i, itemStack, clickAction) -> setDirection(menu, BlockFace.NORTH));
@@ -81,7 +86,7 @@ protected void onNewInstance(BlockMenu menu, Block b) {
@ParametersAreNonnullByDefault
private boolean setDirection(BlockMenu blockMenu, BlockFace blockFace) {
- BlockStorage.addBlockInfo(blockMenu.getBlock(), "CH_DIRECTION", blockFace.name());
+ BlockStorage.addBlockInfo(blockMenu.getBlock(), ID_DIRECTION, blockFace.name());
blockMenu.replaceExistingItem(SET_UP, GuiElements.getDirectionalSlotPane(BlockFace.UP, false));
blockMenu.replaceExistingItem(SET_DOWN, GuiElements.getDirectionalSlotPane(BlockFace.DOWN, false));
@@ -128,58 +133,50 @@ private boolean setDirection(BlockMenu blockMenu, BlockFace blockFace) {
@Override
@ParametersAreNonnullByDefault
protected void tick(Block block, BlockMenu blockMenu) {
- final BlockFace direction = BlockFace.valueOf(BlockStorage.getLocationInfo(block.getLocation(), "CH_DIRECTION"));
- final UUID owner = UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), "CH_UUID"));
- if (direction != BlockFace.SELF) {
- final Location location = block.getLocation();
- final BlockIterator iterator = new BlockIterator(
- location.getWorld(),
- location.toVector().add(direction.getDirection()),
- direction.getDirection(),
- 0,
- (int) range
- );
-
- while (iterator.hasNext()) {
- final Block testBlock = iterator.next();
- if (testBlock.isSolid()) {
- break;
- }
- final Location testLocation = testBlock.getLocation().add(0.5, 0.5, 0.5);
- for (Entity entity : block.getWorld().getNearbyEntities(testLocation, 0.5, 0.5, 0.5)) {
- if (entity instanceof Player) {
- Player player = (Player) entity;
- if (player.getGameMode() != GameMode.SURVIVAL) {
- return;
- }
+ final BlockFace direction = BlockFace.valueOf(BlockStorage.getLocationInfo(block.getLocation(), ID_DIRECTION));
+ final Vector facingVector = direction.getDirection();
+ final UUID owner = UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), ID_UUID));
+
+ if (direction == BlockFace.SELF) {
+ return;
+ }
+
+ final Location location = block.getLocation();
+ final RayTraceResult result = location.getWorld().rayTraceBlocks(
+ location.add(facingVector),
+ facingVector,
+ range,
+ FluidCollisionMode.ALWAYS,
+ false
+ );
+
+ if (result == null) {
+ return;
+ }
+
+ double finalRange = range;
+
+ Block foundBlock = result.getHitBlock();
+ if (foundBlock != null) {
+ finalRange = foundBlock.getLocation().distance(block.getLocation());
+ }
+
+ for (int i = 0; i < finalRange + 0.5; i++) {
+ Location offsetLocation = location.clone().add(direction.getDirection().clone().multiply(i));
+ for (Entity entity : block.getWorld().getNearbyEntities(offsetLocation, 0.5, 0.5, 0.5)) {
+ if (entity instanceof Player) {
+ Player player = (Player) entity;
+ if (player.getGameMode() != GameMode.SURVIVAL) {
+ return;
}
- GeneralUtils.pushEntity(
- owner,
- location.clone().add(0, 0.2, 0),
- entity,
- 1
- );
}
-
+ GeneralUtils.pushEntity(
+ owner,
+ facingVector,
+ entity,
+ 1
+ );
}
-
-// for (int i = 0; i < range + 0.5; i++) {
-// Location offsetLocation = location.clone().add(direction.getDirection().clone().multiply(i));
-// for (Entity entity : block.getWorld().getNearbyEntities(offsetLocation, 0.5, 0.5, 0.5)) {
-// if (entity instanceof Player) {
-// Player player = (Player) entity;
-// if (player.getGameMode() != GameMode.SURVIVAL) {
-// return;
-// }
-// }
-// GeneralUtils.pushEntity(
-// owner,
-// location.clone().add(0, 0.2, 0),
-// entity,
-// 1
-// );
-// }
-// }
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobLamp.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java
similarity index 97%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobLamp.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java
index a8e64913..7dfbdd69 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobLamp.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobMat.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java
similarity index 97%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobMat.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java
index 2a8eb942..d7e7f747 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MobMat.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.TickingBlockNoGui;
import io.github.sefiraat.crystamaehistoria.utils.ParticleUtils;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MysteriousTicker.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MysteriousTicker.java
similarity index 97%
rename from src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MysteriousTicker.java
rename to src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MysteriousTicker.java
index a11d5f55..90b3f490 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/gadgets/MysteriousTicker.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MysteriousTicker.java
@@ -1,4 +1,4 @@
-package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.gadgets;
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java
index 07ef8fa5..c49ce6ff 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java
@@ -150,7 +150,7 @@ private void displayDefinition(@Nonnull Player p, @Nonnull PlayerProfile profile
for (int i = 0; i < RECIPE.length; i++) {
int slot = RECIPE[i];
StoryType storyType = spellType.getSpell().getRecipe().getInput(i);
- ItemStack stack = Materials.DUMMY_CRYSTAL_MAP.get(storyType).getItem();
+ ItemStack stack = Materials.getDummyCrystalMap().get(storyType).getItem();
menu.replaceExistingItem(slot, stack);
menu.addMenuClickHandler(slot, ((player, slot2, itemStack, clickAction) -> false));
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java
index e19997d1..6eb18a3f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java
@@ -159,7 +159,7 @@ private void displayDefinition(@Nonnull Player p, @Nonnull PlayerProfile profile
int amount = entry.getValue();
if (amount > 0) {
StoryType type = entry.getKey();
- ItemStack itemStack = Materials.DUMMY_CRYSTAL_MAP.get(type).getItem().clone();
+ ItemStack itemStack = Materials.getDummyCrystalMap().get(type).getItem().clone();
itemStack.setAmount(entry.getValue());
menu.replaceExistingItem(CRYSTAMAE[type.getId() - 1], itemStack);
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java
index a1f54279..1173b42b 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java
@@ -95,12 +95,26 @@ protected int[] getOutputSlots() {
@ParametersAreNonnullByDefault
protected void onBreak(BlockBreakEvent event, BlockMenu blockMenu) {
super.onBreak(event, blockMenu);
- Location location = blockMenu.getLocation();
- LiquefactionBasinCache liquefactionBasinCache = cacheMap.remove(location);
+
+ final Location location = blockMenu.getLocation();
+ final LiquefactionBasinCache liquefactionBasinCache = cacheMap.remove(location);
+
+ boolean punish = false;
+
if (liquefactionBasinCache != null) {
liquefactionBasinCache.kill(location);
+ punish = liquefactionBasinCache.getFillLevel() > 0;
}
blockMenu.dropItems(location, INPUT_SLOT);
+ if (punish) {
+ blockMenu.getLocation().getWorld().createExplosion(
+ event.getPlayer(),
+ event.getBlock().getLocation(),
+ 2,
+ true,
+ false
+ );
+ }
}
@Override
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java
index b28b0e24..a2a765b5 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java
@@ -46,7 +46,6 @@
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
-import java.util.logging.Level;
import java.util.stream.Collectors;
@Getter
@@ -249,10 +248,9 @@ private void processChargedPlate(Item item, ChargedPlate plate) {
);
if (instancePlate == null) {
- CrystamaeHistoria.log(
- Level.SEVERE,
- "The charged plate used has not been configured correctly. /sf cheat charged plates will not" +
- " work in the Liquefaction Basin. If this is not the case, please raises an issue."
+ CrystamaeHistoria.getInstance().getLogger().warning(
+ "The charged plate used has not been configured correctly. /sf cheat charged plates will not " +
+ "work in the Liquefaction Basin. If this is not the case, please raises an issue."
);
item.remove();
return;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/RecipeItem.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/RecipeItem.java
index f565d940..2934ecb1 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/RecipeItem.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/RecipeItem.java
@@ -55,7 +55,7 @@ public ItemStack[] getDisplayRecipe() {
}
public ItemStack getDisplayCrystal(int index) {
- ItemStack itemStack = Materials.DUMMY_CRYSTAL_MAP.get(storyTypes.get(index)).getItem().clone();
+ ItemStack itemStack = Materials.getDummyCrystalMap().get(storyTypes.get(index)).getItem().clone();
ItemMeta itemMeta = itemStack.getItemMeta();
List list = new ArrayList<>();
list.add(ThemeType.CLICK_INFO.getColor() + "Minimum amount: " + ThemeType.PASSIVE.getColor() + amounts.get(index));
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/staveconfigurator/StaveConfigurator.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/staveconfigurator/StaveConfigurator.java
index be7ad871..90a037e2 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/staveconfigurator/StaveConfigurator.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/staveconfigurator/StaveConfigurator.java
@@ -81,28 +81,31 @@ protected void onNewInstance(@Nonnull BlockMenu blockMenu, @Nonnull Block b) {
rejectItems(blockMenu);
final ItemStack stave = blockMenu.getItemInSlot(STAVE_SLOT);
final SlimefunItem sfStave = SlimefunItem.getByItem(stave);
- if (stave != null && sfStave instanceof Stave) {
- final InstanceStave staveInstance = new InstanceStave(stave);
- final Map map = staveInstance.getSpellInstanceMap();
- if (map != null) {
- for (Map.Entry entry : map.entrySet()) {
- final SpellSlot spellSlot = entry.getKey();
- final InstancePlate instancePlate = map.get(spellSlot);
- final ItemStack plate = ChargedPlate.getChargedPlate(instancePlate);
- blockMenu.replaceExistingItem(getSlot(spellSlot), plate);
- }
+
+ if (stave == null || !(sfStave instanceof Stave)) {
+ return false;
+ }
+
+ final InstanceStave staveInstance = new InstanceStave(stave);
+ final Map map = staveInstance.getSpellInstanceMap();
+ if (map != null) {
+ for (Map.Entry entry : map.entrySet()) {
+ final SpellSlot spellSlot = entry.getKey();
+ final InstancePlate instancePlate = map.get(spellSlot);
+ final ItemStack plate = ChargedPlate.getChargedPlate(instancePlate);
+ blockMenu.replaceExistingItem(getSlot(spellSlot), plate);
}
- staveInstance.getSpellInstanceMap().clear();
- ItemMeta itemMeta = stave.getItemMeta();
- DataTypeMethods.setCustom(
- itemMeta,
- Keys.PDC_STAVE_STORAGE,
- PersistentStaveDataType.TYPE,
- staveInstance.getSpellInstanceMap()
- );
- stave.setItemMeta(itemMeta);
- staveInstance.buildLore();
}
+ staveInstance.getSpellInstanceMap().clear();
+ ItemMeta itemMeta = stave.getItemMeta();
+ DataTypeMethods.setCustom(
+ itemMeta,
+ Keys.PDC_STAVE_STORAGE,
+ PersistentStaveDataType.TYPE,
+ staveInstance.getSpellInstanceMap()
+ );
+ stave.setItemMeta(itemMeta);
+ staveInstance.buildLore();
return false;
});
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java
index 73022827..af7f878b 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java
@@ -15,12 +15,12 @@
import org.bukkit.inventory.meta.ItemMeta;
import javax.annotation.ParametersAreNonnullByDefault;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.logging.Level;
import java.util.stream.Collectors;
public class StoriesManager {
@@ -217,7 +217,9 @@ private void fillBlockDefinitions() {
blockDefinitionMap.put(material, blockDefinition);
}
}
- CrystamaeHistoria.log(Level.INFO, "Loaded: " + blockDefinitionMap.size() + " unique (block) stories.");
+ CrystamaeHistoria.getInstance().getLogger().info(
+ MessageFormat.format("Loaded: {0} unique (block) stories.", blockDefinitionMap.size())
+ );
}
@ParametersAreNonnullByDefault
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/Story.java b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/Story.java
index 5d7e08b8..466a3874 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/Story.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/Story.java
@@ -33,7 +33,6 @@ public class Story {
private final StoryShardProfile storyShardProfile;
@Nonnull
private final List storyStrings;
- private final int uniqueTier = 0;
@Setter
@Nullable
private BlockPosition blockPosition;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/definition/StoryShardProfile.java b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/definition/StoryShardProfile.java
index 56a5a178..1a5ee009 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/definition/StoryShardProfile.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/definition/StoryShardProfile.java
@@ -42,7 +42,7 @@ public void dropShards(StoryRarity rarity, Location location, int multiplier) {
StoryType storyType = entry.getKey();
int amount = entry.getValue() * multiplier;
if (amount > 0) {
- ItemStack itemStack = Materials.CRYSTAL_MAP.get(rarity).get(storyType).getItem().clone();
+ ItemStack itemStack = Materials.getCrystalMap().get(rarity).get(storyType).getItem().clone();
itemStack.setAmount(amount);
location.getWorld().dropItemNaturally(location, itemStack);
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/CrystaTag.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/CrystaTag.java
index 4abbbcfc..4e0052b0 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/CrystaTag.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/CrystaTag.java
@@ -18,7 +18,6 @@
import java.util.EnumSet;
import java.util.Locale;
import java.util.Set;
-import java.util.logging.Level;
public enum CrystaTag implements Tag {
@@ -35,12 +34,11 @@ public enum CrystaTag implements Tag {
CrystaTag() {
final String name = this.name().toLowerCase(Locale.ROOT);
final String fileLocation = "/tags/" + name + ".json";
- final JsonParser parser = new JsonParser();
try {
final InputStream stream = CrystamaeHistoria.class.getResourceAsStream(fileLocation);
final JsonReader reader = new JsonReader(new InputStreamReader(stream));
- final JsonObject object = (JsonObject) parser.parse(reader);
+ final JsonObject object = (JsonObject) JsonParser.parseReader(reader);
for (JsonElement element : object.get("values").getAsJsonArray()) {
final String tagString = element.getAsString();
@@ -48,17 +46,22 @@ public enum CrystaTag implements Tag {
if (material != null) {
materialList.add(material);
} else {
- CrystamaeHistoria.log(Level.WARNING, MessageFormat.format("Error with tag: {0}", tagString));
+ CrystamaeHistoria.getInstance().getLogger().warning(
+ MessageFormat.format("Error with tag: {0}", tagString)
+ );
}
}
-
} catch (JsonParseException e) {
- CrystamaeHistoria.log(Level.WARNING, MessageFormat.format("Error with tag: {0}", fileLocation));
+ CrystamaeHistoria.getInstance().getLogger().warning(
+ MessageFormat.format("Error with tag: {0}", fileLocation)
+ );
}
-
namespacedKey = new NamespacedKey(CrystamaeHistoria.getInstance(), name);
}
+ public void setup() {
+ // Just here to load the class during onEnable
+ }
@Override
public boolean isTagged(@NotNull Material material) {
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/GeneralUtils.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/GeneralUtils.java
index 03fe290b..b76009b5 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/GeneralUtils.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/GeneralUtils.java
@@ -149,6 +149,12 @@ public boolean pullEntity(UUID caster, Location pullToLocation, Entity pushed, d
return pushEntity(caster, vector, pushed);
}
+ @ParametersAreNonnullByDefault
+ public boolean pushEntity(UUID caster, Vector pushVector, Entity pushed, double force) {
+ return pushEntity(caster, pushVector.multiply(force), pushed);
+ }
+
+
@ParametersAreNonnullByDefault
public boolean pushEntity(UUID caster, Location pushFromLocation, Entity pushed, double force) {
Vector vector = pushed.getLocation().toVector()
@@ -228,6 +234,4 @@ public static Item spawnDisplayItem(ItemStack stack, Location location, String n
item.setPickupDelay(999999);
return item;
}
-
-
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/ParticleUtils.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/ParticleUtils.java
index 009da5eb..53bc8c0a 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/ParticleUtils.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/ParticleUtils.java
@@ -1,5 +1,6 @@
package io.github.sefiraat.crystamaehistoria.utils;
+import lombok.experimental.UtilityClass;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.World;
@@ -12,6 +13,7 @@
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
+@UtilityClass
public class ParticleUtils {
@ParametersAreNonnullByDefault
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/Skulls.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/Skulls.java
index 226dd135..b32a0a49 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/Skulls.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/Skulls.java
@@ -11,8 +11,6 @@
public enum Skulls {
- // TODO Replace with heads from Cheesy
-
CRYSTAL_ELEMENTAL("3b16a4c438f90e2193ae9877c4ec5d2a13c2bc679c113131ac98684e326c402f", StoryType.ELEMENTAL),
CRYSTAL_MECHANICAL("789f76df5f41dc45df1c1f2aa4acd286a7842fff774c073c27c3f2dda5fe2aa0", StoryType.MECHANICAL),
CRYSTAL_ALCHEMICAL("9caa807ee0b46a5031877438bc4ee5bcc202177b2b2e6fb0e3416438097d9266", StoryType.ALCHEMICAL),
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/TimePeriod.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/TimePeriod.java
new file mode 100644
index 00000000..e787d23c
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/TimePeriod.java
@@ -0,0 +1,127 @@
+package io.github.sefiraat.crystamaehistoria.utils;
+
+import lombok.Getter;
+import org.bukkit.World;
+
+public enum TimePeriod {
+ SUNRISE(23000, 23999),
+ DAY(24000, 11999),
+ SUNSET(12000, 12999),
+ NIGHT(13000, 22999),
+ WAKE_UP(24000, 24000),
+ BED_TIME_RAIN(12010, 12010),
+ BED_TIME_CLEAR(12542, 12542),
+ MOON_HIDE(167, 167),
+ MOON_SHOW(11834, 11834),
+ VILLAGER_WORK(2000, 8999),
+ VILLAGER_SOCIALISE(9000, 11999),
+ VILLAGER_BED_TIME(12000, 23999),
+ SKY_LIGHT_WAX_CLEAR(22331, 23961),
+ SKY_LIGHT_WAX_RAIN(22331, 23992),
+ SKY_LIGHT_WANE_CLEAR(12040, 13670),
+ SKY_LIGHT_WANE_RAIN(12010, 13670),
+ MOB_SPAWN_CLEAR(13188, 22812),
+ MOB_SPAWN_RAIN(12969, 23031);
+
+ @Getter
+ private final long start;
+ @Getter
+ private final long end;
+
+ TimePeriod(long start, long end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ public static boolean isDay(World world) {
+ return isDay(world.getTime());
+ }
+
+ public static boolean isDay(Long time) {
+ return time < 13000 || time > 24000;
+ }
+
+ public static boolean isNight(World world) {
+ return isNight(world.getTime());
+ }
+
+ public static boolean isNight(Long time) {
+ return !isDay(time);
+ }
+
+ public static boolean isActive(World world, TimePeriod timePeriod) {
+ return isActive(world.getTime(), timePeriod);
+ }
+
+ public static boolean isActive(Long time, TimePeriod timePeriod) {
+ return time >= timePeriod.getStart() && time <= timePeriod.getEnd();
+ }
+
+ public static boolean villagersAwake(World world) {
+ return villagersAwake(world.getTime());
+ }
+
+ public static boolean villagersAwake(Long time) {
+ return time >= WAKE_UP.getStart() && time <= VILLAGER_BED_TIME.getEnd();
+ }
+
+ /**
+ * Returns if the moon is still visible in the Sky.
+ *
+ * @param world The world to check.
+ * @return True if the moon is/would be out, false if not or wrong world type.
+ */
+ public static boolean moonOut(World world) {
+ if (world.getEnvironment() == World.Environment.NORMAL) {
+ return moonOut(world.getTime());
+ }
+ return false;
+ }
+
+ /**
+ * Returns if the moon is still visible in the Sky during the specified time.
+ * This method assumes the world is Overworld.
+ *
+ * @param time The time to check.
+ * @return True if the moon is/would be out
+ */
+ public static boolean moonOut(Long time) {
+ return time >= MOON_SHOW.getStart() && time <= MOON_HIDE.getEnd();
+ }
+
+ public static boolean naturalMobsCanSpawn(World world) {
+ long time = world.getTime();
+ return world.isClearWeather()
+ ? naturalMobsCanSpawn(time, false)
+ : naturalMobsCanSpawn(time, true);
+ }
+
+ public static boolean naturalMobsCanSpawn(long time, boolean rain) {
+ return rain
+ ? time >= MOB_SPAWN_RAIN.getStart() && time <= MOB_SPAWN_RAIN.getEnd()
+ : time >= MOB_SPAWN_CLEAR.getStart() && time <= MOB_SPAWN_CLEAR.getEnd();
+ }
+
+ /**
+ * Returns if the given world is light.
+ *
+ * @param world The world to check.
+ * @return True if past sunrise/before sunset or in a different world.
+ */
+ public static boolean isLight(World world) {
+ if (world.getEnvironment() == World.Environment.NORMAL) {
+ return isDay(world.getTime());
+ }
+ return false;
+ }
+
+ /**
+ * Returns if the given world is dark.
+ *
+ * @param world The world to check.
+ * @return True if past sunset/before sunrise or in a different world.
+ */
+ public static boolean isDark(World world) {
+ return !isLight(world);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractGoal.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractGoal.java
index 4da3f250..9d3c592e 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractGoal.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractGoal.java
@@ -62,55 +62,55 @@ public final void stop() {
public void tick() {
final Player player = removeOffline();
- if (player != null) {
- if (self.getTarget() != null && self.getTarget().equals(player)) {
- self.setTarget(null);
- return;
- }
-
- if (getTickCondition() && (self.getTarget() == null || self.getTarget().isDead())) {
- if (getTargetsEnemies()) {
- final List entities = new ArrayList<>(
- player.getWorld().getNearbyEntitiesByType(
- getTargetClass(),
- player.getLocation(),
- 10,
- 10,
- 10,
- entity -> {
- final UUID testOwner = DataTypeMethods.getCustom(entity, Keys.PDC_IS_SPAWN_OWNER, PersistentUUIDDataType.TYPE);
- if (testOwner == null) {
- return true;
- } else {
- return !testOwner.equals(owner);
- }
- }
- )
- );
-
- if (!entities.isEmpty()) {
- LivingEntity random = entities.get(ThreadLocalRandom.current().nextInt(entities.size()));
- self.setTarget(random);
- self.attack(random);
- return;
- }
- }
+ if (player == null || (self.getTarget() != null && self.getTarget().equals(player))) {
+ self.setTarget(null);
+ return;
+ }
- if (getFollowsPlayer()
- && self.getLocation().distance(player.getLocation()) > getStayNearDistance()
- ) {
- final Location location = player.getLocation().clone().add(
- ThreadLocalRandom.current().nextDouble(-1.5, 1.5),
- 0,
- ThreadLocalRandom.current().nextDouble(-1.5, 1.5)
- );
- self.getPathfinder().moveTo(location);
- }
+ if (!getTickCondition() || (self.getTarget() != null && !self.getTarget().isDead())) {
+ return;
+ }
- customActions(player);
+ if (getTargetsEnemies()) {
+ final List entities = new ArrayList<>(
+ player.getWorld().getNearbyEntitiesByType(
+ getTargetClass(),
+ player.getLocation(),
+ 10,
+ 10,
+ 10,
+ entity -> {
+ final UUID testOwner = DataTypeMethods.getCustom(entity, Keys.PDC_IS_SPAWN_OWNER, PersistentUUIDDataType.TYPE);
+ if (testOwner == null) {
+ return true;
+ } else {
+ return !testOwner.equals(owner);
+ }
+ }
+ )
+ );
+ if (!entities.isEmpty()) {
+ LivingEntity random = entities.get(ThreadLocalRandom.current().nextInt(entities.size()));
+ self.setTarget(random);
+ self.attack(random);
+ return;
}
}
+
+ if (getFollowsPlayer()
+ && self.getLocation().distance(player.getLocation()) > getStayNearDistance()
+ ) {
+ final Location location = player.getLocation().clone().add(
+ ThreadLocalRandom.current().nextDouble(-1.5, 1.5),
+ 0,
+ ThreadLocalRandom.current().nextDouble(-1.5, 1.5)
+ );
+ self.getPathfinder().moveTo(location);
+ }
+
+ customActions(player);
+
}
public void customActions(Player player) {
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractRidableGoal.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractRidableGoal.java
index 37e68295..159f7149 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractRidableGoal.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/AbstractRidableGoal.java
@@ -2,14 +2,17 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.block.Block;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.UUID;
-// TODO UNUSED
+/**
+ * Unused currently until the finer details around mob's facing direction can be sorted out.
+ *
+ * @param The mod type to use this goal.
+ */
public abstract class AbstractRidableGoal extends AbstractGoal {
protected AbstractRidableGoal(UUID owningPlayer) {
@@ -28,7 +31,6 @@ public void tick() {
self.setVelocity(eyeDirection.clone().multiply(getSpeed()));
} else {
// Non-flying mobs
- final Block block = destination.getBlock();
self.getPathfinder().moveTo(self.getLocation().add(0, 0, 1));
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/BatteringRamGoal.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/BatteringRamGoal.java
index 5d270436..2c88a87f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/BatteringRamGoal.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/BatteringRamGoal.java
@@ -23,11 +23,10 @@ public BatteringRamGoal(UUID owningPlayer) {
@Override
public void tick() {
-
double velX = Math.abs(self.getVelocity().getX());
double velZ = Math.abs(self.getVelocity().getZ());
- if (self.isOnGround() || (velX < 0.1 && velZ < 0.1)
- ) {
+
+ if (self.isOnGround() || (velX < 0.1 && velZ < 0.1)) {
ParticleUtils.displayParticleEffect(self, Particle.VILLAGER_ANGRY, 1, 5);
self.remove();
return;
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/HolyCowGoal.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/HolyCowGoal.java
index 848fcaf6..e0717dd0 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/HolyCowGoal.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/mobgoals/HolyCowGoal.java
@@ -25,75 +25,79 @@ public HolyCowGoal(UUID owningPlayer) {
public void tick() {
final Player player = removeOffline();
- if (player != null) {
- if (self.getTarget() != null && self.getTarget().equals(player)) {
- self.setTarget(null);
- return;
- }
+ if (player == null) {
+ return;
+ }
+
+ if (self.getTarget() != null && self.getTarget().equals(player)) {
+ self.setTarget(null);
+ return;
+ }
+
+ final List entitiesAroundCow = new ArrayList<>(
+ player.getWorld().getNearbyEntitiesByType(
+ Monster.class,
+ self.getLocation(),
+ 1,
+ 1,
+ 1,
+ entity -> {
+ final UUID testOwner = DataTypeMethods.getCustom(entity, Keys.PDC_IS_SPAWN_OWNER, PersistentUUIDDataType.TYPE);
+ if (testOwner == null) {
+ return true;
+ } else {
+ return !testOwner.equals(getOwner());
+ }
+ }
+ )
+ );
+
+ if (!entitiesAroundCow.isEmpty()) {
+ Entity entity = getSelf();
+ entity.getLocation().getWorld().createExplosion(player, entity.getLocation(), 10, false, false);
+ getSelf().remove();
+ return;
+ }
- final List entitiesAroundCow = new ArrayList<>(
+ if (self.getTarget() != null && !self.getTarget().isDead()) {
+ return;
+ }
+
+ if (getTargetsEnemies()) {
+ final List entities = new ArrayList<>(
player.getWorld().getNearbyEntitiesByType(
Monster.class,
- self.getLocation(),
- 1,
- 1,
- 1,
+ player.getLocation(),
+ 15,
+ 15,
+ 15,
entity -> {
final UUID testOwner = DataTypeMethods.getCustom(entity, Keys.PDC_IS_SPAWN_OWNER, PersistentUUIDDataType.TYPE);
if (testOwner == null) {
return true;
} else {
- return !testOwner.equals(getOwner());
+ return !testOwner.equals(owner);
}
}
)
);
- if (!entitiesAroundCow.isEmpty()) {
- Entity entity = getSelf();
- entity.getLocation().getWorld().createExplosion(player, entity.getLocation(), 10, false, false);
- getSelf().remove();
+ if (!entities.isEmpty()) {
+ int random = ThreadLocalRandom.current().nextInt(entities.size());
+ self.getPathfinder().moveTo(entities.get(random).getLocation());
return;
}
+ }
- if (self.getTarget() == null || self.getTarget().isDead()) {
- if (getTargetsEnemies()) {
- final List entities = new ArrayList<>(
- player.getWorld().getNearbyEntitiesByType(
- Monster.class,
- player.getLocation(),
- 15,
- 15,
- 15,
- entity -> {
- final UUID testOwner = DataTypeMethods.getCustom(entity, Keys.PDC_IS_SPAWN_OWNER, PersistentUUIDDataType.TYPE);
- if (testOwner == null) {
- return true;
- } else {
- return !testOwner.equals(owner);
- }
- }
- )
- );
-
- if (!entities.isEmpty()) {
- int random = ThreadLocalRandom.current().nextInt(entities.size());
- self.getPathfinder().moveTo(entities.get(random).getLocation());
- return;
- }
- }
-
- if (getFollowsPlayer()
- && self.getLocation().distance(player.getLocation()) > getStayNearDistance()
- ) {
- final Location location = player.getLocation().clone().add(
- ThreadLocalRandom.current().nextDouble(-1.5, 1.5),
- 0,
- ThreadLocalRandom.current().nextDouble(-1.5, 1.5)
- );
- self.getPathfinder().moveTo(location);
- }
- }
+ if (getFollowsPlayer()
+ && self.getLocation().distance(player.getLocation()) > getStayNearDistance()
+ ) {
+ final Location location = player.getLocation().clone().add(
+ ThreadLocalRandom.current().nextDouble(-1.5, 1.5),
+ 0,
+ ThreadLocalRandom.current().nextDouble(-1.5, 1.5)
+ );
+ self.getPathfinder().moveTo(location);
}
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/theme/ThemeType.java b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/theme/ThemeType.java
index 6a0318fc..c47c4a0b 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/utils/theme/ThemeType.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/utils/theme/ThemeType.java
@@ -34,6 +34,7 @@ public enum ThemeType {
CRYSTAL(ChatColor.of("#dbcea9"), "Crystal"),
MACHINE(ChatColor.of("#3295a8"), "Machine"),
MECHANISM(ChatColor.of("#3295a8"), "Mechanism"),
+ GADGET(ChatColor.of("#8732a8"), "Gadget"),
CHEST(ChatColor.of("#b89b1c"), "Chest"),
DROP(ChatColor.of("#bf307f"), "Rare Drop"),
BASE(ChatColor.of("#9e9e9e"), "Base Resource"),
@@ -65,14 +66,11 @@ public enum ThemeType {
TYPE_VOID(ChatColor.of("#222222"), "Void"),
TYPE_PHILOSOPHICAL(ChatColor.of("#4d4aa8"), "Philosophical");
- @Getter
- protected static final ThemeType[] cachedValues = values();
-
/**
* List of names to be given to ArmourStands, invisible but mods and Minimaps can see them :)
*/
@Nonnull
- public static final List EGG_NAMES = Arrays.asList(
+ protected static final List EGG_NAMES = Arrays.asList(
"TheBusyBiscuit",
"Alessio",
"Walshy",
@@ -102,6 +100,9 @@ public enum ThemeType {
"FN_FAL",
"supertechxter"
);
+
+ @Getter
+ protected static final ThemeType[] cachedValues = values();
private final ChatColor color;
private final String loreLine;
@@ -247,6 +248,11 @@ public static String getRandomEggName() {
return EGG_NAMES.get(rnd);
}
+ @Nonnull
+ public static List getEggNames() {
+ return EGG_NAMES;
+ }
+
public Particle.DustOptions getDustOptions(float size) {
return new Particle.DustOptions(
Color.fromRGB(