Skip to content

Commit

Permalink
Merge pull request #300 from FTBTeam/bugfix/1.20.1/stop-other-griefing
Browse files Browse the repository at this point in the history
[1.20.1] Backport mob griefing tag
  • Loading branch information
desht authored Jul 10, 2024
2 parents 7e99805 + fc4a8fa commit a1a13f4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added gui button to teleport to way point
* Added waypoint sharing
* Add option to show game time, real time and fps under the minimap
* Add entity tag `ftb:entity_mob_griefing_blacklist` to block mob griefing in claimed chunks

## [2001.3.1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ public static class Entities {
= TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "entity_interact_whitelist"));
public static final TagKey<EntityType<?>> NONLIVING_ENTITY_ATTACK_WHITELIST_TAG
= TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "nonliving_entity_attack_whitelist"));
public static final TagKey<EntityType<?>> ENTITY_MOB_GRIEFING_BLACKLIST_TAG
= TagKey.create(Registries.ENTITY_TYPE, FTBChunksAPI.rl("entity_mob_griefing_blacklist"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:enderman"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.architectury.platform.forge.EventBuses;
import dev.ftb.mods.ftbchunks.FTBChunks;
import dev.ftb.mods.ftbchunks.api.FTBChunksTags;
import dev.ftb.mods.ftbchunks.api.Protection;
import dev.ftb.mods.ftbchunks.data.ClaimedChunkImpl;
import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl;
Expand Down Expand Up @@ -51,7 +52,7 @@ private void mobGriefing(EntityMobGriefingEvent event) {
// we could do this for all mob griefing but that's arguably OP (could trivialize wither fights, for example)
// enderman block stealing is the most common annoyance, and this also has parity with the fabric support
// Note: explicit check for server-side needed due to Optifine brain-damage
if (event.getEntity() instanceof EnderMan && !event.getEntity().level().isClientSide()) {
if (event.getEntity().getType().is(FTBChunksTags.Entities.ENTITY_MOB_GRIEFING_BLACKLIST_TAG) && !event.getEntity().level().isClientSide()) {
ClaimedChunkImpl cc = ClaimedChunkManagerImpl.getInstance().getChunk(new ChunkDimPos(event.getEntity()));

if (cc != null && !cc.allowMobGriefing()) {
Expand Down

0 comments on commit a1a13f4

Please sign in to comment.