diff options
author | â€huajijam <strhuaji@gmail.com> | 2019-03-18 20:52:30 +0800 |
---|---|---|
committer | â€huajijam <strhuaji@gmail.com> | 2019-03-18 20:52:30 +0800 |
commit | 8b090e1fd20eb4c301996b5e1dfeb78353e595e4 (patch) | |
tree | 52152dd767d195c76baa8fd8bacb14b105aaa146 /src/Java/gtPlusPlus/plugin/villagers | |
parent | 40d7e5da9f5b84213e2c3e4596fdc69b94bd523e (diff) | |
download | GT5-Unofficial-8b090e1fd20eb4c301996b5e1dfeb78353e595e4.tar.gz GT5-Unofficial-8b090e1fd20eb4c301996b5e1dfeb78353e595e4.tar.bz2 GT5-Unofficial-8b090e1fd20eb4c301996b5e1dfeb78353e595e4.zip |
fix a bug
Diffstat (limited to 'src/Java/gtPlusPlus/plugin/villagers')
3 files changed, 38 insertions, 87 deletions
diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java index 98e6d7ae1a..4dc5a15b4b 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java @@ -169,15 +169,10 @@ public class EntityBaseVillager extends EntityVillager { */ protected float getField_82191_bN() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); try { - v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); - try { - return v82191 != null ? v82191.getFloat(this) : 0f; - } catch (IllegalArgumentException | IllegalAccessException e) { - return 0f; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getFloat(this) : 0f; + } catch (IllegalArgumentException | IllegalAccessException e) { return 0f; } } @@ -190,15 +185,10 @@ public class EntityBaseVillager extends EntityVillager { } protected boolean getNeedsInitilization() { - Field v82191; + Field v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); try { - v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); - try { - return v82191 != null ? v82191.getBoolean(this) : false; - } catch (IllegalArgumentException | IllegalAccessException e) { - return false; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getBoolean(this) : false; + } catch (IllegalArgumentException | IllegalAccessException e) { return false; } } @@ -213,20 +203,16 @@ public class EntityBaseVillager extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; MerchantRecipeList o; + v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { - v82191 = ReflectionUtils.getField(getClass(), "buyingList"); - try { - o = (MerchantRecipeList) v82191.get(this); - Logger.WARNING("Is BuyingList Valid? "+(v82191 != null)); - return v82191 != null ? o : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - return null; - } - } catch (NoSuchFieldException e1) { - e1.printStackTrace(); + o = (MerchantRecipeList) v82191.get(this); + Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); + return v82191 != null ? o : null; + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); return null; } + } protected void setBuyingList(MerchantRecipeList f) { @@ -238,29 +224,19 @@ public class EntityBaseVillager extends EntityVillager { } protected Village getVillageObject() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "villageObj"); try { - v82191 = ReflectionUtils.getField(getClass(), "villageObj"); - try { - return v82191 != null ? (Village) v82191.get(this) : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - return null; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (Village) v82191.get(this) : null; + } catch (IllegalArgumentException | IllegalAccessException e) { return null; } } protected String getLastBuyingPlayer() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); try { - v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); - try { - return v82191 != null ? (String) v82191.get(this) : ""; - } catch (IllegalArgumentException | IllegalAccessException e) { - return ""; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (String) v82191.get(this) : ""; + } catch (IllegalArgumentException | IllegalAccessException e) { return ""; } } diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java index 6e7234297e..967647cff6 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java @@ -157,15 +157,10 @@ public class EntityNativeAustralian extends EntityVillager { */ protected float getField_82191_bN() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); try { - v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); - try { - return v82191 != null ? v82191.getFloat(this) : 0f; - } catch (IllegalArgumentException | IllegalAccessException e) { - return 0f; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getFloat(this) : 0f; + } catch (IllegalArgumentException | IllegalAccessException e) { return 0f; } } @@ -178,15 +173,10 @@ public class EntityNativeAustralian extends EntityVillager { } protected boolean getNeedsInitilization() { - Field v82191; + Field v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); try { - v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); - try { - return v82191 != null ? v82191.getBoolean(this) : false; - } catch (IllegalArgumentException | IllegalAccessException e) { - return false; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getBoolean(this) : false; + } catch (IllegalArgumentException | IllegalAccessException e) { return false; } } @@ -201,18 +191,13 @@ public class EntityNativeAustralian extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; MerchantRecipeList o; + v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { - v82191 = ReflectionUtils.getField(getClass(), "buyingList"); - try { - o = (MerchantRecipeList) v82191.get(this); - Logger.WARNING("Is BuyingList Valid? "+(v82191 != null)); - return v82191 != null ? o : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - return null; - } - } catch (NoSuchFieldException e1) { - e1.printStackTrace(); + o = (MerchantRecipeList) v82191.get(this); + Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); + return v82191 != null ? o : null; + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); return null; } } @@ -226,29 +211,19 @@ public class EntityNativeAustralian extends EntityVillager { } protected Village getVillageObject() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "villageObj"); try { - v82191 = ReflectionUtils.getField(getClass(), "villageObj"); - try { - return v82191 != null ? (Village) v82191.get(this) : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - return null; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (Village) v82191.get(this) : null; + } catch (IllegalArgumentException | IllegalAccessException e) { return null; } } protected String getLastBuyingPlayer() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); try { - v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); - try { - return v82191 != null ? (String) v82191.get(this) : ""; - } catch (IllegalArgumentException | IllegalAccessException e) { - return ""; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (String) v82191.get(this) : ""; + } catch (IllegalArgumentException | IllegalAccessException e) { return ""; } } diff --git a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java index 232b6b6e87..45b8c9941b 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java +++ b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java @@ -221,7 +221,7 @@ public class TileEntityGenericSpawner extends TileEntityMobSpawner { } } }*/ - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { + } catch (IllegalArgumentException | IllegalAccessException e) { } } return false; |