forked from GeyserMC/Geyser
Fix baby animal sizes
This should fix most baby animal sizes including Rabbits and their adult sizes!
This commit is contained in:
parent
6273c3b110
commit
efd5bae13b
3 changed files with 38 additions and 3 deletions
|
@ -28,6 +28,7 @@ package org.geysermc.connector.entity.living;
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType;
|
||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.EntityData;
|
||||||
import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
||||||
import org.geysermc.connector.entity.type.EntityType;
|
import org.geysermc.connector.entity.type.EntityType;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
@ -40,8 +41,12 @@ public class AgeableEntity extends CreatureEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||||
if (entityMetadata.getId() == 15) {
|
if (entityMetadata.getId() == 15 && entityType != EntityType.RABBIT) {
|
||||||
metadata.getFlags().setFlag(EntityFlag.BABY, (boolean) entityMetadata.getValue());
|
boolean isBaby = (boolean) entityMetadata.getValue();
|
||||||
|
metadata.getFlags().setFlag(EntityFlag.BABY, isBaby);
|
||||||
|
if (isBaby) {
|
||||||
|
metadata.put(EntityData.SCALE, .55f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.updateBedrockMetadata(entityMetadata, session);
|
super.updateBedrockMetadata(entityMetadata, session);
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.geysermc.connector.entity.living;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||||
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.EntityData;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
||||||
|
import org.geysermc.connector.entity.type.EntityType;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
|
public class RabbitEntity extends AnimalEntity {
|
||||||
|
public RabbitEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
|
||||||
|
super(entityId, geyserId, entityType, position, motion, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||||
|
if (entityMetadata.getId() == 15) {
|
||||||
|
boolean isBaby = (boolean) entityMetadata.getValue();
|
||||||
|
metadata.getFlags().setFlag(EntityFlag.BABY, isBaby);
|
||||||
|
if(isBaby) {
|
||||||
|
metadata.put(EntityData.SCALE, .35f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
metadata.put(EntityData.SCALE, .55f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.updateBedrockMetadata(entityMetadata, session);
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ public enum EntityType {
|
||||||
VILLAGER(AbstractMerchantEntity.class, 15, 1.8f, 0.6f, 0.6f, 1.62f),
|
VILLAGER(AbstractMerchantEntity.class, 15, 1.8f, 0.6f, 0.6f, 1.62f),
|
||||||
MOOSHROOM(AnimalEntity.class, 16, 1.4f, 0.9f),
|
MOOSHROOM(AnimalEntity.class, 16, 1.4f, 0.9f),
|
||||||
SQUID(WaterEntity.class, 17, 0.8f),
|
SQUID(WaterEntity.class, 17, 0.8f),
|
||||||
RABBIT(AnimalEntity.class, 18, 0.5f, 0.4f),
|
RABBIT(RabbitEntity.class, 18, 0.5f, 0.4f),
|
||||||
BAT(AmbientEntity.class, 19, 0.9f, 0.5f),
|
BAT(AmbientEntity.class, 19, 0.9f, 0.5f),
|
||||||
IRON_GOLEM(GolemEntity.class, 20, 2.7f, 1.4f),
|
IRON_GOLEM(GolemEntity.class, 20, 2.7f, 1.4f),
|
||||||
SNOW_GOLEM(GolemEntity.class, 21, 1.9f, 0.7f),
|
SNOW_GOLEM(GolemEntity.class, 21, 1.9f, 0.7f),
|
||||||
|
|
Loading…
Reference in a new issue