Skip to content

Commit

Permalink
piglins are neutral when wearing a mining hat #30
Browse files Browse the repository at this point in the history
- can be disabled via config
  • Loading branch information
cech12 committed Sep 14, 2020
1 parent 31d00ea commit 3e923f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/cech12/usefulhats/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Config {
public static final ConfigType.Boolean MINING_HAT_DAMAGE_ENABLED = new ConfigType.Boolean(true);
public static final ConfigType.Integer MINING_HAT_DURABILITY = new ConfigType.Integer(450);
public static final ConfigType.Boolean MINING_HAT_NIGHT_VISION_ENABLED = new ConfigType.Boolean(true);
public static final ConfigType.Boolean MINING_HAT_MAKE_PIGLINS_NEUTRAL_ENABLED = new ConfigType.Boolean(true);
public static final ConfigType.Double MINING_HAT_SPEED_WITH_EFFICIENCY_0 = new ConfigType.Double(0.2);
public static final ConfigType.Double MINING_HAT_SPEED_WITH_EFFICIENCY_1 = new ConfigType.Double(0.4);
public static final ConfigType.Double MINING_HAT_SPEED_WITH_EFFICIENCY_2 = new ConfigType.Double(0.6);
Expand Down Expand Up @@ -232,6 +233,9 @@ public class Config {
MINING_HAT_NIGHT_VISION_ENABLED.configObj = common
.comment("Whether or not Night Vision effect of Mining Hat should be enabled in dark areas.")
.define("miningHatNightVisionEnabled", MINING_HAT_NIGHT_VISION_ENABLED.getDefaultValue());
MINING_HAT_MAKE_PIGLINS_NEUTRAL_ENABLED.configObj = common
.comment("Whether or not wearing a Mining Hat should make Piglins neutral.")
.define("miningHatMakePiglinsNeutralEnabled", MINING_HAT_NIGHT_VISION_ENABLED.getDefaultValue());
MINING_HAT_SPEED_WITH_EFFICIENCY_0.configObj = common
.comment("Mining Hat speed increase without Efficiency enchantment.")
.defineInRange("miningHatSpeedWithEfficiency0", MINING_HAT_SPEED_WITH_EFFICIENCY_0.getDefaultValue(), 0.0, 1.0);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/cech12/usefulhats/item/MiningHatItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ public void onUnequippedHatItem(LivingEntity entity, ItemStack oldStack) {
// disable effects when hat is removed from slot
this.removeEffect(entity, Effects.NIGHT_VISION, NIGHT_VISION_DURATION, NIGHT_VISION_AMPLIFIER);
}

@Override
public boolean makesPiglinsNeutral(ItemStack stack, LivingEntity wearer) {
return Config.MINING_HAT_MAKE_PIGLINS_NEUTRAL_ENABLED.getValue();
}
}

0 comments on commit 3e923f5

Please sign in to comment.