added derpy_snowgolem property

This commit is contained in:
D3v1s0m 2023-10-02 10:26:47 +05:30
parent e7601f8e4b
commit b3187883bb
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1
3 changed files with 35 additions and 4 deletions

@ -99,9 +99,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
// Guardian
registerType("is_elder", false); // TODO: ensure it only works till 1.10. Note: index is wrong on wiki.vg
// Show Golem
registerType("pumpkin", true); // TODO
// Shulker
registerType("attach_direction", null); // TODO: make a direction enum
registerType("shield_height", 0); // TODO: figure this out
@ -366,6 +363,16 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
linkProperties("wolf_angry", "tamed", "sitting");
}
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_9)) return;
// Snow Golem
int snowGolemIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) snowGolemIndex = 16;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) snowGolemIndex = 15;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_14)) snowGolemIndex = 14;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) snowGolemIndex = 12;
else snowGolemIndex = 10;
register(new DerpySnowgolemProperty(snowGolemIndex));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_10)) return;
// Polar Bear
int polarBearIndex;

@ -0,0 +1,23 @@
package lol.pyr.znpcsplus.entity.properties;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import org.bukkit.entity.Player;
import java.util.Map;
public class DerpySnowgolemProperty extends EntityPropertyImpl<Boolean> {
private final int index;
public DerpySnowgolemProperty(int index) {
super("derpy_snowgolem", false, Boolean.class);
this.index = index;
}
@Override
public void apply(Player player, PacketEntity entity, boolean isSpawned, Map<Integer, EntityData> properties) {
properties.put(index, new EntityData(index, EntityDataTypes.BYTE, (byte) (entity.getProperty(this) ? 0x00 : 0x10)));
}
}

@ -135,7 +135,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
register(builder(p, "slime", EntityTypes.SLIME)); // TODO: Hologram offset scaling with size property
register(builder(p, "snow_golem", EntityTypes.SNOW_GOLEM)
.setHologramOffset(-0.075));
.setHologramOffset(-0.075)
.addProperties("derpy_snowgolem"));
register(builder(p, "spider", EntityTypes.SPIDER)
.setHologramOffset(-1.075));