multiple things
All checks were successful
Gitea Actions Demo / Build-Gradle (push) Successful in 3m22s

This commit is contained in:
Your Name
2025-07-22 15:47:37 +02:00
parent 445a85304e
commit 8e902aa251
41 changed files with 149 additions and 15 deletions

View File

@@ -1,2 +1,2 @@
Command: /opt/homebrew/Cellar/openjdk/23.0.2/libexec/openjdk.jdk/Contents/Home/bin/java -Xmx1G -classpath /Users/janik/.gradle/caches/modules-2/files-2.1/net.fabricmc/tiny-remapper/0.11.1/6c1f29838864ba8f495855edfc8ef17706fedb5d/tiny-remapper-0.11.1-fat.jar net.fabricmc.tinyremapper.Main /Users/janik/Desktop/MCPlugins/environmentex-1.0-SNAPSHOT.jar /Users/janik/Desktop/MCPlugins/environmentex/build/libs/environmentex-1.0-SNAPSHOT-reobf.jar /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/reobfMappings.tiny mojang spigot /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/mappedServerJar.jar --threads=1
[INFO] Finished after 944,74 ms.
[INFO] Finished after 844,07 ms.

View File

@@ -78,7 +78,8 @@ public class App extends JavaPlugin {
} catch (IOException e) {
e.printStackTrace();
}
SquidPrevention.removeSquidReceipes();
SquidPrevention.addCustomSquidRecipes();
getServer().recipeIterator().forEachRemaining(recipe -> {
if (recipe instanceof ShapelessRecipe) {
ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
@@ -460,6 +461,7 @@ public class App extends JavaPlugin {
pM.registerEvents(new BetterTotems(), this);
pM.registerEvents(new CustomMusicDiscs(), this);
pM.registerEvents(new PinFeature(), this);
pM.registerEvents(new SquidPrevention(), this);
getCommand("test").setExecutor(new EnvironmentExCommands());
getCommand("y").setExecutor(new EnvironmentExCommands());
getCommand("n").setExecutor(new EnvironmentExCommands());

View File

@@ -0,0 +1,61 @@
package de.hessj.environmentex;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.ShapelessRecipe;
public class SquidPrevention implements Listener {
@EventHandler
public void onSquidSpawn(EntitySpawnEvent event) {
if (event.getEntityType() == EntityType.SQUID || event.getEntityType() == EntityType.GLOW_SQUID) {
event.setCancelled(true);
}
}
public static void removeSquidReceipes() {
Iterator<Recipe> it = Bukkit.recipeIterator();
while (it.hasNext()) {
Recipe recipe = it.next();
if (recipe instanceof ShapelessRecipe sr &&
sr.getResult().getType() == Material.WRITABLE_BOOK) {
it.remove(); // remove the default Book and Quill recipe
}
}
}
public static void addCustomSquidRecipes() {
ItemStack bookAndQuill = new ItemStack(Material.WRITABLE_BOOK);
ShapelessRecipe customRecipe = new ShapelessRecipe(
new NamespacedKey("environmentex", "custom_book_and_quill"),
bookAndQuill);
customRecipe.addIngredient(Material.BOOK);
customRecipe.addIngredient(Material.FEATHER);
customRecipe.addIngredient(Material.BLACK_DYE);
Bukkit.addRecipe(customRecipe);
ItemStack blackdye = new ItemStack(Material.BLACK_DYE);
ShapelessRecipe blackcustomRecipe = new ShapelessRecipe(
new NamespacedKey("environmentex", "custom_black_dye"),
blackdye);
// Use RecipeChoice.MaterialChoice for multiple options
RecipeChoice choice = new RecipeChoice.MaterialChoice(Material.COAL, Material.CHARCOAL);
blackcustomRecipe.addIngredient(choice);
Bukkit.addRecipe(blackcustomRecipe);
}
}