-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/14.1-features' into 14.1-features
- Loading branch information
Showing
8 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/java/net/ltxprogrammer/changed/entity/MiningStrength.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,41 @@ | ||
package net.ltxprogrammer.changed.entity; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.DataResult; | ||
import net.minecraft.util.StringRepresentable; | ||
import net.minecraft.world.effect.MobEffect; | ||
import net.minecraft.world.effect.MobEffects; | ||
|
||
import java.util.Arrays; | ||
import java.util.function.Predicate; | ||
|
||
public enum MiningStrength implements StringRepresentable, Predicate<MobEffect> { | ||
STRONG("strong", MobEffects.DIG_SPEED::equals), | ||
NORMAL("normal", effect -> false), | ||
WEAK("weak", MobEffects.DIG_SLOWDOWN::equals); | ||
|
||
public static Codec<MiningStrength> CODEC = Codec.STRING.comapFlatMap(MiningStrength::fromSerial, MiningStrength::getSerializedName).orElse(NORMAL); | ||
|
||
public final String serialName; | ||
public final Predicate<MobEffect> shouldHaveEffect; | ||
|
||
MiningStrength(String serialName, Predicate<MobEffect> shouldHaveEffect) { | ||
this.serialName = serialName; | ||
this.shouldHaveEffect = shouldHaveEffect; | ||
} | ||
|
||
@Override | ||
public String getSerializedName() { | ||
return serialName; | ||
} | ||
|
||
public static DataResult<MiningStrength> fromSerial(String name) { | ||
return Arrays.stream(values()).filter(type -> type.serialName.equals(name)) | ||
.findFirst().map(DataResult::success).orElseGet(() -> DataResult.error(name + " is not a valid mining strength")); | ||
} | ||
|
||
@Override | ||
public boolean test(MobEffect effect) { | ||
return shouldHaveEffect.test(effect); | ||
} | ||
} |
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
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
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
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
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
Binary file added
BIN
+141 Bytes
src/main/resources/assets/changed/textures/abilities/use_waves_mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+168 Bytes
src/main/resources/assets/changed/textures/abilities/use_waves_pulse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.