Merge pull request #103 from D3v1s0m/2.X

Command usage in near command and properties
This commit is contained in:
Pyr 2023-10-23 18:05:57 +02:00 committed by GitHub
commit 868cf1ae82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

@ -20,6 +20,7 @@ public class NearCommand implements CommandHandler {
@Override
public void run(CommandContext context) throws CommandExecutionException {
context.setUsage(context.getLabel() + " near <radius>");
Player player = context.ensureSenderIsPlayer();
int raw = context.parse(Integer.class);
double radius = Math.pow(raw, 2);

@ -264,6 +264,18 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
register(new BooleanProperty("show_base", endCrystalIndex, true, false));
}
// Guardian
if (ver.isOlderThan(ServerVersion.V_1_11)) {
int guardianIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) guardianIndex = 12;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_9)) guardianIndex = 11;
else guardianIndex = 16;
register(new BitsetProperty("is_elder", guardianIndex, 0x04, false, legacyBooleans));
register(new BitsetProperty("is_retracting_spikes", guardianIndex++, 0x02, false, legacyBooleans));
linkProperties("is_elder", "is_retracting_spikes");
// TODO: add guardian beam target
}
// Horse
if (ver.isNewerThanOrEquals(ServerVersion.V_1_8) && ver.isOlderThan(ServerVersion.V_1_9)) {
register(new EncodedByteProperty<>("horse_type", HorseType.HORSE, 19, obj -> (byte) obj.ordinal()));

@ -96,7 +96,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
.addEquipmentProperties());
register(builder(p, "guardian", EntityTypes.GUARDIAN)
.setHologramOffset(-1.125));
.setHologramOffset(-1.125)
.addProperties("is_elder", "is_retracting_spikes"));
register(builder(p, "horse", EntityTypes.HORSE)
.setHologramOffset(-0.375)