Skip to content

Commit

Permalink
Allow frogs to attack slime and magma cubes, toggle for irong golem d…
Browse files Browse the repository at this point in the history
…amage. No longer 1.18 compatible
  • Loading branch information
RhythmicSys committed Nov 9, 2022
1 parent 76e02a6 commit c3e8c41
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ADHDMC</groupId>
<artifactId>NerfFarms</artifactId>
<version>0.2.1</version>
<version>0.3.1</version>
<packaging>jar</packaging>

<name>NerfFarms</name>
Expand Down Expand Up @@ -74,7 +74,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/adhdmc/nerffarms/NerfFarms.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ private void configDefaults() {
config.addDefault("require-line-of-sight", true);
config.addDefault("skeletons-can-damage-creepers", true);
config.addDefault("withers-can-damage-entities", true);
config.addDefault("frogs-can-eat-slimes", true);
config.addDefault("frogs-can-eat-magma-cubes", true);
config.addDefault("iron-golems-can-damage-entities", false);
config.addDefault("max-total-distance", 15);
config.addDefault("blacklisted-damage-types", Arrays.asList("BLOCK_EXPLOSION", "CONTACT", "CRAMMING",
"DRAGON_BREATH", "DROWNING", "DRYOUT", "FALL", "FALLING_BLOCK", "FIRE", "FIRE_TICK", "FREEZE", "HOT_FLOOR",
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/adhdmc/nerffarms/config/ConfigToggle.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public enum ConfigToggle {
ONLY_NERF_HOSTILES(true),
ALLOW_SKELETON_CREEPER_DAMAGE(true),
ALLOW_WITHER_DAMAGE(true),
ALLOW_FROG_SLIME_DAMAGE(true),
ALLOW_FROG_MAGMA_CUBE_DAMAGE(true),
ALLOW_IRON_GOLEM_DAMAGE(false),
//Nerfing checks
REQUIRE_PATH(true),
REQUIRE_OPEN_SURROUNDINGS(true),
Expand All @@ -30,6 +33,9 @@ public static void reloadToggles(){
ONLY_NERF_HOSTILES.setEnabled(NerfFarms.plugin.getConfig().getBoolean("only-nerf-hostiles"));
ALLOW_SKELETON_CREEPER_DAMAGE.setEnabled(NerfFarms.plugin.getConfig().getBoolean("skeletons-can-damage-creepers"));
ALLOW_WITHER_DAMAGE.setEnabled(NerfFarms.plugin.getConfig().getBoolean("withers-can-damage-entities"));
ALLOW_FROG_MAGMA_CUBE_DAMAGE.setEnabled(NerfFarms.plugin.getConfig().getBoolean("frogs-can-eat-slimes"));
ALLOW_FROG_MAGMA_CUBE_DAMAGE.setEnabled(NerfFarms.plugin.getConfig().getBoolean("frogs-can-eat-magma-cubes"));
ALLOW_IRON_GOLEM_DAMAGE.setEnabled(NerfFarms.plugin.getConfig().getBoolean("iron-golems-can-damage-entities"));
REQUIRE_PATH.setEnabled(NerfFarms.plugin.getConfig().getBoolean("require-path"));
REQUIRE_OPEN_SURROUNDINGS.setEnabled(NerfFarms.plugin.getConfig().getBoolean("require-open-surroundings"));
REQUIRE_LINE_OF_SIGHT.setEnabled(NerfFarms.plugin.getConfig().getBoolean("require-line-of-sight"));
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/adhdmc/nerffarms/listener/MobDamageListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ private boolean checkLineOfSight(EntityDamageByEntityEvent event, Entity entity,
private boolean checkDamager(EntityDamageByEntityEvent event, Entity entity, PersistentDataContainer mobPDC, double hitDamage) {
NerfFarms.debugLvl1("Performing checkDamager on " + entity.getName());
Entity damager = CheckUtils.getRealDamager(event);
if (damager instanceof IronGolem && ConfigToggle.ALLOW_IRON_GOLEM_DAMAGE.isEnabled()) {
NerfFarms.debugLvl2("Skipping nerf on " + entity.getName() + "because 'Iron golems can damage entities' is 'true'. Returning true");
return true;
}
if (damager instanceof Wither && ConfigToggle.ALLOW_WITHER_DAMAGE.isEnabled()) {
NerfFarms.debugLvl2("Skipping nerf on " + entity.getName() + "because 'Withers can damage entities' is 'true'. Returning true");
return true;
Expand All @@ -327,6 +331,16 @@ private boolean checkDamager(EntityDamageByEntityEvent event, Entity entity, Per
NerfFarms.debugLvl2("Skipping nerf on " + entity.getName() + "because 'Skeletons can damage creepers' is 'true'. Returning true (non-projectile damage)");
return true;
}
if (damager instanceof Frog && entity instanceof Slime slimeEntity) {
if (slimeEntity.getType().equals(EntityType.MAGMA_CUBE) && ConfigToggle.ALLOW_FROG_MAGMA_CUBE_DAMAGE.isEnabled()) {
NerfFarms.debugLvl2("Skipping nerf on " + entity.getName() + "because 'frogs can eat magma cubes' is 'true'. Returning true");
return true;
}
if (slimeEntity.getType().equals(EntityType.SLIME) && ConfigToggle.ALLOW_FROG_SLIME_DAMAGE.isEnabled()) {
NerfFarms.debugLvl2("Skipping nerf on " + entity.getName() + "because 'frogs can eat slime' is 'true'. Returning true");
return true;
}
}
if (!(damager instanceof Player)) {
NerfFarms.debugLvl1("Damager is not a player, returning true");
addPDCDamage(event, mobPDC, hitDamage);
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ skeletons-can-damage-creepers: true

withers-can-damage-entities: true

frogs-can-eat-slimes: true

frogs-can-eat-magma-cubes: true

#[DROPS|EXP|BOTH|NEITHER]

modification-type: "BOTH"
Expand Down

0 comments on commit c3e8c41

Please sign in to comment.