Skip to content

Commit

Permalink
Hotfix 1.4.1-BETA
Browse files Browse the repository at this point in the history
Fixed a crash with LOTR v34.3
  • Loading branch information
CraftedMods committed Sep 13, 2018
1 parent f184c47 commit daba4df
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/.gradle/
/.classpath
/.project
/tempLibs/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog of PvPMode for Minecraft 1.7.10:

## 1.4.1-BETA
### LOTR compatibility:
* Fixed a crash with v34.3 when a player dies

## 1.4.0-BETA
### General changes:
* Determining the owner of an entity now recursively checks for it
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "1.4.0-BETA"
version = "1.4.1-BETA"
group= "vulcanforge.pvp-mode-mod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "pvp-mode"

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pvpmode/PvPMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import pvpmode.log.*;
import pvpmode.overrides.PvPOverrideManager;

@Mod(modid = "pvp-mode", name = "PvP Mode", version = "1.4.0-BETA", acceptableRemoteVersions = "*")
@Mod(modid = "pvp-mode", name = "PvP Mode", version = "1.4.1-BETA", acceptableRemoteVersions = "*")
public class PvPMode
{
public static Configuration config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package pvpmode.compatibility.modules.lotr;

import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.*;
import java.util.*;
import java.util.function.Function;
Expand All @@ -13,8 +12,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.*;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import pvpmode.*;
import pvpmode.compatibility.CompatibilityModule;
import pvpmode.compatibility.events.*;
Expand All @@ -38,11 +36,8 @@ public class LOTRModCompatibilityModule implements CompatibilityModule

private boolean areEnemyBiomeOverridesEnabled;
private boolean blockFTInPvP;
private boolean dropSkullWithKeepInventory;
private boolean areSafeBiomeOverridesEnabled;

private LOTREventHandler eventHandler;

@Override
public void load () throws IOException
{
Expand All @@ -53,9 +48,6 @@ public void load () throws IOException
"If true, the PvP mode enemy biome override condition for LOTR biomes will be enabled. Players who are an enemy of a faction are forced to have PvP enabled while they're in a biome which is clearly assignable to that faction. This is highly configurable.");
blockFTInPvP = PvPMode.config.getBoolean ("Block fast traveling in PvP", LOTR_CONFIGURATION_CATEGORY,
true, "If enabled, players cannot use the LOTR fast travel system while they're in PvP.");
dropSkullWithKeepInventory = PvPMode.config.getBoolean ("Always Drop Player Skulls",
LOTR_CONFIGURATION_CATEGORY, true,
"If true, players killed with a weapon with the headhunting modifier will drop their skulls even with keepInventory enabled.");
areSafeBiomeOverridesEnabled = PvPMode.config.getBoolean ("Enable safe biome override condition",
LOTR_CONFIGURATION_CATEGORY, false,
"If true, the PvP mode safe override condition for LOTR biomes will be enabled, which has a higher priority than the enemy override condition. Players who are aligned with a faction are forced to have PvP disabled while they're in a biome which is clearly assignable to that faction. This can also be applied without the alignment criterion. This is highly configurable.");
Expand All @@ -80,8 +72,6 @@ public void load () throws IOException
{
initGeneralBiomeOverrides (configurationFolder);
}

retrieveLOTREventHandler ();
}

private void initEnemyBiomeOverrides (Path configurationFolder) throws IOException
Expand Down Expand Up @@ -147,28 +137,6 @@ private void recreateFile (Path configurationFolder, String filename, String sho
FMLLog.info ("Recreated the %s", shortName);
}

private void retrieveLOTREventHandler ()
{
try
{
Field eventHandlerField = LOTRMod.class.getDeclaredField ("modEventHandler");
eventHandlerField.setAccessible (true);
eventHandler = (LOTREventHandler) eventHandlerField.get (null);
if (eventHandler != null)
{
FMLLog.info ("Successfully retrieved the LOTR event handler");
}
else
{
FMLLog.warning ("Couldn't retrieve the LOTR event handler - features depending on it won't be enabled");
}
}
catch (Exception e)
{
FMLLog.getLogger ().error ("Couldn't retrieve the LOTR event handler", e);
}
}

@SubscribeEvent
public void onEntityMasterExtraction (EntityMasterExtractionEvent event)
{
Expand Down Expand Up @@ -233,19 +201,4 @@ public void onAttackTargetSet (LivingSetAttackTargetEvent event)
}
}

@SubscribeEvent
public void onPlayerDeath (LivingDeathEvent event)
{
if (dropSkullWithKeepInventory && eventHandler != null
&& event.entityLiving.worldObj.getGameRules ().getGameRuleBooleanValue ("keepInventory"))
{
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
// The last two parameters are not used by the current implementation
eventHandler.onPlayerDrops (new PlayerDropsEvent (player, event.source, null, false));
}
}
}

}

0 comments on commit daba4df

Please sign in to comment.