This file contains hidden or 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
public final class LegacyKnockbackUtil { | |
private static final int TPS = ServerFlag.SERVER_TICKS_PER_SECOND; | |
private static final double HORIZONTAL_KNOCKBACK = 0.4 * TPS; | |
private static final double VERTICAL_KNOCKBACK = HORIZONTAL_KNOCKBACK; | |
private static final double EXTRA_HORIZONTAL_KNOCKBACK = 0.5 * TPS; | |
private static final double EXTRA_VERTICAL_KNOCKBACK = 0.1 * TPS; | |
private static final double LIMIT_VERTICAL_KNOCKBACK = 0.5 * TPS; | |
public static void takeKnockback(@NotNull Entity target, @NotNull Vec direction, double strength) { | |
Vec newVelocity = target.getVelocity() |
This file contains hidden or 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
public class ArgumentSound extends ArgumentRegistry<Key> { | |
public ArgumentSound(String id) { | |
super(id); | |
suggestionType = SuggestionType.AVAILABLE_SOUNDS; | |
} | |
@Override | |
public String parser() { | |
return "minecraft:resource_location"; | |
} |
This file contains hidden or 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
public class ArgumentPotion extends ArgumentRegistry<PotionEffect> { | |
private static final String[] VALUES = PotionEffect.values().stream().map(potion -> potion.namespace().toString()).toArray(String[]::new); | |
public ArgumentPotion(String id) { | |
super(id); | |
setSuggestionCallback((sender, ctx, suggestion) -> { | |
for (String value : VALUES) { | |
System.out.println(suggestion.getInput()); | |
if (!value.startsWith(suggestion.getInput()) && !value.startsWith("minecraft:" + suggestion.getInput())) continue; | |
suggestion.addEntry(new SuggestionEntry(value)); |