Skip to content

Commit

Permalink
Merge pull request #83 from Sefiraat/feature/netheo
Browse files Browse the repository at this point in the history
Netheo
  • Loading branch information
Sefiraat authored Jul 19, 2022
2 parents 1302ae9 + 5a309cf commit 61d4c5e
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 4 deletions.
6 changes: 6 additions & 0 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@
<version>90e11bc</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Sefiraat</groupId>
<artifactId>Netheopoiesis</artifactId>
<version>8d1af6c570</version>
<scope>provided</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@
<version>90e11bc</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Sefiraat</groupId>
<artifactId>Netheopoiesis</artifactId>
<version>8d1af6c570</version>
<scope>provided</scope>
</dependency>

</dependencies>

Expand Down
12 changes: 10 additions & 2 deletions src/main/java/io/github/sefiraat/networks/Networks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.sefiraat.networks.commands.NetworksMain;
import io.github.sefiraat.networks.managers.ListenerManager;
import io.github.sefiraat.networks.managers.SupportedPluginManager;
import io.github.sefiraat.networks.slimefun.NetheoPlants;
import io.github.sefiraat.networks.slimefun.NetworkSlimefunItems;
import io.github.sefiraat.networks.slimefun.network.NetworkController;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
Expand Down Expand Up @@ -47,11 +48,11 @@ public void onEnable() {
saveDefaultConfig();
tryUpdate();

this.supportedPluginManager = new SupportedPluginManager();

setupSlimefun();

this.listenerManager = new ListenerManager();
this.supportedPluginManager = new SupportedPluginManager();

this.getCommand("networks").setExecutor(new NetworksMain());

setupMetrics();
Expand All @@ -69,6 +70,13 @@ && getDescription().getVersion().startsWith("DEV")

public void setupSlimefun() {
NetworkSlimefunItems.setup();
if (supportedPluginManager.isNetheopoiesis()){
try {
NetheoPlants.setup();
} catch (NoClassDefFoundError e) {
getLogger().severe("Netheopoiesis must be updated to meet Networks' requirements.");
}
}
}

public void setupMetrics() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
@Getter
public class SupportedPluginManager {

private final boolean isInfinityExpansion;
private final boolean infinityExpansion;
private final boolean netheopoiesis;

public SupportedPluginManager() {
isInfinityExpansion = Bukkit.getPluginManager().isPluginEnabled("InfinityExpansion");
this.infinityExpansion = Bukkit.getPluginManager().isPluginEnabled("InfinityExpansion");
this.netheopoiesis = Bukkit.getPluginManager().isPluginEnabled("Netheopoiesis");
}

}
104 changes: 104 additions & 0 deletions src/main/java/io/github/sefiraat/networks/slimefun/NetheoPlants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package io.github.sefiraat.networks.slimefun;

import dev.sefiraat.netheopoiesis.api.items.DoNothingSeed;
import dev.sefiraat.netheopoiesis.api.items.HarvestableSeed;
import dev.sefiraat.netheopoiesis.api.plant.Growth;
import dev.sefiraat.netheopoiesis.api.plant.GrowthStages;
import dev.sefiraat.netheopoiesis.api.plant.Placements;
import dev.sefiraat.netheopoiesis.implementation.Stacks;
import dev.sefiraat.netheopoiesis.utils.Skulls;
import dev.sefiraat.netheopoiesis.utils.Theme;
import io.github.sefiraat.networks.Networks;
import io.github.sefiraat.networks.utils.StackUtils;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import lombok.experimental.UtilityClass;

@UtilityClass
public class NetheoPlants {

// Stacks
public static final SlimefunItemStack STONE_CHUNK_SEED = Theme.themedSeed(
"NTW_STONE_CHUNK_SEED",
Skulls.SEED_PURPLE.getPlayerHead(),
Theme.SEED,
"Stone Chunk Seed",
new String[]{"This seed, when fully grown, will", "provide Stone Chunks when", "harvested."},
Stacks.getCanBePlacedOnLore("Nether Grass (or better)")
);

public static final SlimefunItemStack SYNTHETIC_SEED = Theme.themedSeed(
"NTW_SYNTHETIC_SEED",
Skulls.SEED_ORANGE.getPlayerHead(),
Theme.SEED,
"Synthetic Seed",
new String[]{"This seed does nothing."},
Stacks.getCanBePlacedOnLore("Nether Grass (or better)")
);

public static final SlimefunItemStack SYNTHETIC_EMERALD_SEED = Theme.themedSeed(
"NTW_SYNTHETIC_EMERALD_SEED",
Skulls.SEED_GREEN.getPlayerHead(),
Theme.SEED,
"Synthetic Emerald Seed",
new String[]{"This seed, when fully grown, will", "provide Synthetic Emeralds when", "harvested."},
Stacks.getCanBePlacedOnLore("Voracious Dirt (or better)")
);

public static final SlimefunItemStack SYNTHETIC_DIAMOND_SEED = Theme.themedSeed(
"NTW_SYNTHETIC_DIAMOND_SEED",
Skulls.SEED_GREEN.getPlayerHead(),
Theme.SEED,
"Synthetic Diamond Seed",
new String[]{"This seed, when fully grown, will", "provide Synthetic Diamonds when", "harvested."},
Stacks.getCanBePlacedOnLore("Voracious Dirt (or better)")
);

public static final SlimefunItemStack FRAGMENTED_SEED = Theme.themedSeed(
"NTW_FRAGMENTED_SEED",
Skulls.SEED_GREEN.getPlayerHead(),
Theme.SEED,
"Fragmented Seed",
new String[]{"This seed, when fully grown, will", "provide Synthetic Emerald Shards when", "harvested."},
Stacks.getCanBePlacedOnLore("Voracious Dirt (or better)")
);

public static void setup() {

final Networks plugin = Networks.getInstance();

new HarvestableSeed(STONE_CHUNK_SEED)
.setHarvestingResult(SlimefunItems.STONE_CHUNK)
.setGrowth(new Growth(GrowthStages.FUNGAL_PURPLE, Placements.NETHER_GRASS_AND_UP, 5, 0.05))
.addBreedingPair(Stacks.STONEY_SEED.getItemId(), Stacks.METALLIC_SEED.getItemId(), 0.2, 0.1)
.addFlavourProfile(0, 0, 0, 0, 0)
.tryRegister(plugin);

new DoNothingSeed(SYNTHETIC_SEED)
.setGrowth(new Growth(GrowthStages.SPIKEY_ORANGE, Placements.NETHER_GRASS_AND_UP, 0, 0.001))
.addBreedingPair(Stacks.COBBLED_SEED.getItemId(), Stacks.LEARNED_SEED.getItemId(), 0.01, 0)
.addFlavourProfile(0, 0, 5, 0, 0)
.tryRegister(plugin);

new HarvestableSeed(SYNTHETIC_EMERALD_SEED)
.setHarvestingResult(SlimefunItems.SYNTHETIC_EMERALD)
.setGrowth(new Growth(GrowthStages.VINEY_GREEN, Placements.VORACIOUS_AND_UP, 20, 0.05))
.addBreedingPair(SYNTHETIC_SEED.getItemId(), Stacks.VALUABLE_SEED.getItemId(), 0.01, 0.001)
.addFlavourProfile(0, 15, 0, 0, 0)
.tryRegister(plugin);

new HarvestableSeed(SYNTHETIC_DIAMOND_SEED)
.setHarvestingResult(SlimefunItems.SYNTHETIC_DIAMOND)
.setGrowth(new Growth(GrowthStages.VINEY_BLUE, Placements.VORACIOUS_AND_UP, 20, 0.05))
.addBreedingPair(SYNTHETIC_SEED.getItemId(), Stacks.PERFECTION_SEED.getItemId(), 0.01, 0.001)
.addFlavourProfile(15, 0, 0, 0, 0)
.tryRegister(plugin);

new HarvestableSeed(FRAGMENTED_SEED)
.setHarvestingResult(StackUtils.getAsQuantity(NetworksSlimefunItemStacks.SYNTHETIC_EMERALD_SHARD, 9))
.setGrowth(new Growth(GrowthStages.VINEY_GREEN, Placements.VORACIOUS_AND_UP, 10, 0.005))
.addBreedingPair(SYNTHETIC_SEED.getItemId(), Stacks.PERFECTION_SEED.getItemId(), 0.01, 0.001)
.addFlavourProfile(10, 0, 0, 0, 0)
.tryRegister(plugin);
}
}
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ depend:
- Slimefun
softdepend:
- InfinityExpansion
- Netheopoiesis
commands:
networks:
description: /networks
Expand Down

0 comments on commit 61d4c5e

Please sign in to comment.