Skip to content

Commit

Permalink
ported rule undeadDontBurnInSunlight
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Jun 18, 2023
1 parent 4108cbd commit c9fb56d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
24 changes: 24 additions & 0 deletions patches/net/minecraft/entity/monster/AbstractSkeleton.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- a/net/minecraft/entity/monster/AbstractSkeleton.java
+++ b/net/minecraft/entity/monster/AbstractSkeleton.java
@@ -3,6 +3,8 @@
import java.time.LocalDate;
import java.time.temporal.ChronoField;
import javax.annotation.Nullable;
+
+import carpet.settings.CarpetSettings;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.CreatureAttribute;
import net.minecraft.entity.EntityCreature;
@@ -131,6 +133,12 @@
flag = false;
}

+ // TISCM undeadDontBurnInSunlight
+ if (CarpetSettings.undeadDontBurnInSunlight)
+ {
+ flag = false;
+ }
+
if (flag)
{
this.setFire(8);
25 changes: 25 additions & 0 deletions patches/net/minecraft/entity/monster/EntityPhantom.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- a/net/minecraft/entity/monster/EntityPhantom.java
+++ b/net/minecraft/entity/monster/EntityPhantom.java
@@ -2,6 +2,8 @@

import java.util.List;
import javax.annotation.Nullable;
+
+import carpet.settings.CarpetSettings;
import net.minecraft.entity.CreatureAttribute;
import net.minecraft.entity.EntityBodyHelper;
import net.minecraft.entity.EntityFlying;
@@ -152,7 +154,12 @@
{
if (this.isInDaylight())
{
- this.setFire(8);
+ // TISCM undeadDontBurnInSunlight wrapped setFire call
+// this.setFire(8);
+ if (CarpetSettings.undeadDontBurnInSunlight)
+ {
+ this.setFire(8);
+ }
}

super.livingTick();
18 changes: 16 additions & 2 deletions patches/net/minecraft/entity/monster/EntityZombie.java.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
--- a/net/minecraft/entity/monster/EntityZombie.java
+++ b/net/minecraft/entity/monster/EntityZombie.java
@@ -5,6 +5,8 @@
@@ -5,6 +5,9 @@
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable;
+
+import carpet.commands.lifetime.spawning.LiteralSpawningReason;
+import carpet.settings.CarpetSettings;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.CreatureAttribute;
@@ -368,6 +370,8 @@
@@ -283,6 +286,12 @@
flag = false;
}

+ // TISCM undeadDontBurnInSunlight
+ if (CarpetSettings.undeadDontBurnInSunlight)
+ {
+ flag = false;
+ }
+
if (flag)
{
this.setFire(8);
@@ -368,6 +377,8 @@

if (!this.world.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.world.checkNoEntityCollision(entityzombie, entityzombie.getBoundingBox()) && this.world.isCollisionBoxesEmpty(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsAnyLiquid(entityzombie.getBoundingBox()))
{
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/carpet/settings/CarpetSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,13 @@ public String validate(CommandSource source, ParsedRule<String> currentRule, Str
}
}

@Rule(
desc = "Prevent undead creatures burning in sunlight",
extra = "Their helmets will still get damaged in sunlight though",
category = CREATIVE
)
public static boolean undeadDontBurnInSunlight = false;


// /$$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$
//|__ $$__/|_ $$_/ /$$__ $$ /$$__ $$| $$$ /$$$
Expand Down

0 comments on commit c9fb56d

Please sign in to comment.