Added 4 different spawning options, and spawning height max and mins to natural spawn entries.

This commit is contained in:
Luis C.M committed 2022-06-29 03:36:52 -05:00
1 parent 7d0b124422
commit 4094f3e851
8 files changed
+177 -32

No files matched your search

+14
View File
@@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.EntityEvent;
@@ -22,6 +23,7 @@ import net.minecraftforge.event.world.WorldEvent;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.data.*;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.ScriptBlockPos;
import noppes.npcs.scripted.event.*;
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
import noppes.npcs.scripted.event.PlayerEvent.ContainerOpen;
@@ -35,6 +37,7 @@ import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.handler.data.INaturalSpawn;
import noppes.npcs.scripted.interfaces.item.IItemCustom;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
@@ -502,6 +505,17 @@ public class EventHooks {
}
}
public static boolean onCNPCNaturalSpawn(INaturalSpawn naturalSpawn, BlockPos blockPos, boolean animalSpawnPassed, boolean monsterSpawnPassed, boolean liquidSpawnPassed, boolean airSpawnPassed) {
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
if (handler.isEnabled()) {
IPos attemptPosition = new ScriptBlockPos(blockPos);
CustomNPCsEvent.CNPCNaturalSpawnEvent event = new CustomNPCsEvent.CNPCNaturalSpawnEvent(naturalSpawn, attemptPosition, animalSpawnPassed, monsterSpawnPassed, liquidSpawnPassed, airSpawnPassed);
handler.callScript("onCNPCNaturalSpawn", event);
return NpcAPI.EVENT_BUS.post(event);
}
return true;
}
public static void onCustomGuiButton(IPlayer player, ICustomGui gui, int buttonId) {
CustomGuiEvent.ButtonEvent event = new CustomGuiEvent.ButtonEvent(player, gui, buttonId);
CustomGuiController.onButton(event);