Pass along if the respawn event was the result of the end being conquered or not (end respawning is really FUNKY code and uses death instead of 'change dimension')

This commit is contained in:
cpw 2016-11-27 23:58:19 -05:00
parent 12733656eb
commit b048c1a4b5
4 changed files with 25 additions and 12 deletions

View File

@ -129,21 +129,19 @@
p_72368_1_.field_71093_bK = p_72368_2_;
PlayerInteractionManager playerinteractionmanager;
@@ -483,7 +525,8 @@
@@ -483,6 +525,7 @@
EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager);
entityplayermp.field_71135_a = p_72368_1_.field_71135_a;
entityplayermp.func_71049_a(p_72368_1_, p_72368_3_);
- entityplayermp.func_145769_d(p_72368_1_.func_145782_y());
+ entityplayermp.field_71093_bK = p_72368_2_;
+ entityplayermp.func_145769_d(p_72368_1_.func_145782_y());
entityplayermp.func_145769_d(p_72368_1_.func_145782_y());
entityplayermp.func_174817_o(p_72368_1_);
entityplayermp.func_184819_a(p_72368_1_.func_184591_cq());
@@ -530,6 +573,7 @@
this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp);
entityplayermp.func_71116_b();
entityplayermp.func_70606_j(entityplayermp.func_110143_aJ());
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp, p_72368_3_);
return entityplayermp;
}

View File

@ -570,9 +570,9 @@ public class FMLCommonHandler
bus().post(new PlayerEvent.PlayerLoggedOutEvent(player));
}
public void firePlayerRespawnEvent(EntityPlayer player)
public void firePlayerRespawnEvent(EntityPlayer player, boolean endConquered)
{
bus().post(new PlayerEvent.PlayerRespawnEvent(player));
bus().post(new PlayerEvent.PlayerRespawnEvent(player, endConquered));
}
public void firePlayerItemPickupEvent(EntityPlayer player, EntityItem item)

View File

@ -492,16 +492,17 @@ public class Loader
/**
* Used to setup a testharness with a single dummy mod instance for use with various testing hooks
* @param dummycontainer A dummy container that will be returned as "active" for all queries
* @param containers A list of dummy containers that will be returned as "active" for all queries
*/
public void setupTestHarness(ModContainer dummycontainer)
public void setupTestHarness(ModContainer... containers)
{
modController = new LoadController(this);
mods = Lists.newArrayList(dummycontainer);
mods = Lists.newArrayList(containers);
namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
modController.transition(LoaderState.LOADING, false);
modController.transition(LoaderState.CONSTRUCTING, false);
ObjectHolderRegistry.INSTANCE.findObjectHolders(new ASMDataTable());
modController.forceActiveContainer(dummycontainer);
modController.forceActiveContainer(containers[0]);
}
/**
* Called from the hook to start mod loading. We trigger the

View File

@ -79,10 +79,24 @@ public class PlayerEvent extends Event {
}
public static class PlayerRespawnEvent extends PlayerEvent {
public PlayerRespawnEvent(EntityPlayer player)
private final boolean endConquered;
public PlayerRespawnEvent(EntityPlayer player, boolean endConquered)
{
super(player);
this.endConquered = endConquered;
}
/**
* Did this respawn event come from the player conquering the end?
* @return if this respawn was because the player conquered the end
*/
public boolean isEndConquered()
{
return this.endConquered;
}
}
public static class PlayerChangedDimensionEvent extends PlayerEvent {