Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crashes related to Data Watchers #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/ckathode/weaponmod/PlayerWeaponData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

public abstract class PlayerWeaponData
{
public static final int BOOLEANS = 26, WARHAMMER_LAST_SMASH_TICKS = 27, FLAIL_ENTITY_ID = 28;
public static final int BOOLEANS = BalkonsWeaponMod.instance.modConfig.dataWatcherBooleansId,
WARHAMMER_LAST_SMASH_TICKS = BalkonsWeaponMod.instance.modConfig.dataWatcherWarhammerId,
FLAIL_ENTITY_ID = BalkonsWeaponMod.instance.modConfig.dataWatcherFlailId;
public static final int WARHAMMER_CHARGED = 1, FLAIL_THROWN = 2;

public static void initPlayerWeaponData(EntityPlayer player)
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/ckathode/weaponmod/WeaponModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public class WeaponModConfig
public boolean cannonDoesBlockDamage, dynamiteDoesBlockDamage;
public boolean canThrowKnife, canThrowSpear;
public boolean allCanPickup;

public int dataWatcherBooleansId;
public int dataWatcherWarhammerId;
public int dataWatcherFlailId;

private Map<String, EnableSetting> enableSettings;
private Map<String, ReloadTimeSetting> reloadTimeSettings;
Expand Down Expand Up @@ -58,6 +62,10 @@ public void loadConfig()
canThrowKnife = config.get("settings", "can-throw-knife", true).getBoolean(true);
canThrowSpear = config.get("settings", "can-throw-spear", true).getBoolean(true);
allCanPickup = config.get("settings", "pickup-all", true, "Change this to 'false' to allow only the thrower/shooter of the projectile to pick the item up. If set to 'true' everyone can pick the item up.").getBoolean(true);

dataWatcherBooleansId = config.get("settings", "datawatcher-booleans", 26, "Change this to another number to fix crashes related to 'duplicated id values'.").getInt(26);
dataWatcherWarhammerId = config.get("settings", "datawatcher-warhammer", 27, "Change this to another number to fix crashes related to 'duplicated id values'.").getInt(27);
dataWatcherFlailId = config.get("settings", "datawatcher-flail", 28, "Change this to another number to fix crashes related to 'duplicated id values'.").getInt(28);

for (EnableSetting es : enableSettings.values())
{
Expand Down