-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand powdered snow advancement to check modded armor (#1202)
- Loading branch information
1 parent
16d7de6
commit 5b4b9b6
Showing
4 changed files
with
116 additions
and
9 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...esources/data/minecraft/advancement/adventure/walk_on_powder_snow_with_leather_boots.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"parent": "minecraft:adventure/sleep_in_bed", | ||
"criteria": { | ||
"walk_on_powder_snow_with_leather_boots": { | ||
"conditions": { | ||
"player": [ | ||
{ | ||
"condition": "minecraft:entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"stepping_on": { | ||
"block": { | ||
"blocks": "minecraft:powder_snow" | ||
} | ||
}, | ||
"type_specific": { | ||
"type": "neoforge:snow_boots" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"trigger": "minecraft:location" | ||
} | ||
}, | ||
"display": { | ||
"description": { | ||
"translate": "advancements.adventure.walk_on_powder_snow_with_leather_boots.description" | ||
}, | ||
"icon": { | ||
"count": 1, | ||
"id": "minecraft:leather_boots" | ||
}, | ||
"title": { | ||
"translate": "advancements.adventure.walk_on_powder_snow_with_leather_boots.title" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"walk_on_powder_snow_with_leather_boots" | ||
] | ||
], | ||
"sends_telemetry_event": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...n/java/net/neoforged/neoforge/common/advancements/critereon/SnowBootsEntityPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.common.advancements.critereon; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import net.minecraft.advancements.critereon.EntitySubPredicate; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.phys.Vec3; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class SnowBootsEntityPredicate implements EntitySubPredicate { | ||
public static final SnowBootsEntityPredicate INSTANCE = new SnowBootsEntityPredicate(); | ||
public static final MapCodec<SnowBootsEntityPredicate> CODEC = MapCodec.unit(INSTANCE); | ||
|
||
private SnowBootsEntityPredicate() {} | ||
|
||
@Override | ||
public MapCodec<SnowBootsEntityPredicate> codec() { | ||
return CODEC; | ||
} | ||
|
||
@Override | ||
public boolean matches(Entity entity, ServerLevel level, @Nullable Vec3 position) { | ||
return entity instanceof LivingEntity living && living.getItemBySlot(EquipmentSlot.FEET).canWalkOnPowderedSnow(living); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters