mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
[1.12] Fix special spawn event not firing in many cases. (#5389)
This commit is contained in:
1 parent
8670abca57
commit
1b15c127a6
2 files changed
+57
No files matched your search
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java
|
||||
@@ -234,6 +234,7 @@
|
||||
entity.func_70012_b(p_77840_2_, p_77840_4_, p_77840_6_, MathHelper.func_76142_g(p_77840_0_.field_73012_v.nextFloat() * 360.0F), 0.0F);
|
||||
entityliving.field_70759_as = entityliving.field_70177_z;
|
||||
entityliving.field_70761_aq = entityliving.field_70177_z;
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77840_0_, (float) p_77840_2_, (float) p_77840_4_, (float) p_77840_6_, null)) return null;
|
||||
entityliving.func_180482_a(p_77840_0_.func_175649_E(new BlockPos(entityliving)), (IEntityLivingData)null);
|
||||
p_77840_0_.func_72838_d(entity);
|
||||
entityliving.func_70642_aH();
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = SpecialSpawnTest.MOD_ID, name = "Special Spawn Test", version = "1.0", acceptableRemoteVersions = "*")
|
||||
@Mod.EventBusSubscriber(modid = SpecialSpawnTest.MOD_ID)
|
||||
public class SpecialSpawnTest
|
||||
{
|
||||
static final String MOD_ID = "special_spawn_test";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onSpecialSpawn(LivingSpawnEvent.SpecialSpawn event)
|
||||
{
|
||||
if (!ENABLED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getEntity() instanceof EntityPigZombie)
|
||||
{
|
||||
event.getEntity().setCustomNameTag("Called SpecialSpawn");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user