Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Add tameable entity features
Dieser Commit ist enthalten in:
Ursprung
da99bb16d5
Commit
af4edf159a
@ -41,15 +41,25 @@ public class CatEntity extends TameableEntity {
|
|||||||
@Override
|
@Override
|
||||||
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||||
if (entityMetadata.getId() == 18) {
|
if (entityMetadata.getId() == 18) {
|
||||||
|
// Different colors in Java and Bedrock for some reason
|
||||||
|
if ((int) entityMetadata.getValue() == 0) {
|
||||||
|
metadata.put(EntityData.VARIANT, 8);
|
||||||
|
} else if ((int) entityMetadata.getValue() == 8) {
|
||||||
|
// Assumption, need to test
|
||||||
|
metadata.put(EntityData.VARIANT, 0);
|
||||||
|
} else if ((int) entityMetadata.getValue() == 9) {
|
||||||
|
metadata.put(EntityData.VARIANT, 7);
|
||||||
|
} else {
|
||||||
metadata.put(EntityData.VARIANT, (int) entityMetadata.getValue());
|
metadata.put(EntityData.VARIANT, (int) entityMetadata.getValue());
|
||||||
}
|
}
|
||||||
|
System.out.println("Variant: " + entityMetadata.getValue());
|
||||||
|
}
|
||||||
if (entityMetadata.getId() == 21) {
|
if (entityMetadata.getId() == 21) {
|
||||||
// FIXME: Colors the whole animal instead of just collar
|
// Needed or else wild cats are that color
|
||||||
System.out.println("Color: " + (int) entityMetadata.getValue());
|
if (metadata.getFlags().getFlag(EntityFlag.TAMED)) {
|
||||||
metadata.getFlags().setFlag(EntityFlag.TAMED, true);
|
|
||||||
metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue());
|
metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue());
|
||||||
}
|
}
|
||||||
System.out.println("ID: " + entityMetadata.getId() + " Value: " + entityMetadata.getValue());
|
}
|
||||||
super.updateBedrockMetadata(entityMetadata, session);
|
super.updateBedrockMetadata(entityMetadata, session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.geysermc.connector.entity.living.animal.tameable;
|
||||||
|
|
||||||
|
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 org.geysermc.connector.entity.type.EntityType;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
|
public class ParrotEntity extends TameableEntity {
|
||||||
|
|
||||||
|
public ParrotEntity(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) {
|
||||||
|
// Parrot color
|
||||||
|
if (entityMetadata.getId() == 18) {
|
||||||
|
metadata.put(EntityData.VARIANT, entityMetadata.getValue());
|
||||||
|
}
|
||||||
|
super.updateBedrockMetadata(entityMetadata, session);
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ package org.geysermc.connector.entity.living.animal.tameable;
|
|||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||||
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.EntityData;
|
||||||
|
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;
|
||||||
|
|
||||||
@ -39,9 +40,14 @@ public class WolfEntity extends TameableEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||||
|
System.out.println("ID: " + entityMetadata.getId() + ", " + entityMetadata.getValue());
|
||||||
|
// "Begging" on wiki.vg, "Interested" in Nukkit - the tilt of the head
|
||||||
|
if (entityMetadata.getId() == 18) {
|
||||||
|
metadata.getFlags().setFlag(EntityFlag.INTERESTED, (boolean) entityMetadata.getValue());
|
||||||
|
}
|
||||||
if (entityMetadata.getId() == 19) {
|
if (entityMetadata.getId() == 19) {
|
||||||
// FIXME: Colors the whole animal instead of just collar
|
metadata.put(EntityData.INTERACTIVE_TAG, "action.interact.dye");
|
||||||
// metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue());
|
metadata.put(EntityData.COLOR, entityMetadata.getValue());
|
||||||
}
|
}
|
||||||
super.updateBedrockMetadata(entityMetadata, session);
|
super.updateBedrockMetadata(entityMetadata, session);
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,8 @@ import lombok.Getter;
|
|||||||
import org.geysermc.connector.entity.*;
|
import org.geysermc.connector.entity.*;
|
||||||
import org.geysermc.connector.entity.living.*;
|
import org.geysermc.connector.entity.living.*;
|
||||||
import org.geysermc.connector.entity.living.animal.*;
|
import org.geysermc.connector.entity.living.animal.*;
|
||||||
import org.geysermc.connector.entity.living.animal.tameable.CatEntity;
|
|
||||||
import org.geysermc.connector.entity.living.animal.tameable.TameableEntity;
|
|
||||||
import org.geysermc.connector.entity.living.animal.horse.*;
|
import org.geysermc.connector.entity.living.animal.horse.*;
|
||||||
import org.geysermc.connector.entity.living.animal.tameable.WolfEntity;
|
import org.geysermc.connector.entity.living.animal.tameable.*;
|
||||||
import org.geysermc.connector.entity.living.monster.*;
|
import org.geysermc.connector.entity.living.monster.*;
|
||||||
import org.geysermc.connector.entity.living.monster.raid.AbstractIllagerEntity;
|
import org.geysermc.connector.entity.living.monster.raid.AbstractIllagerEntity;
|
||||||
import org.geysermc.connector.entity.living.monster.raid.RaidParticipantEntity;
|
import org.geysermc.connector.entity.living.monster.raid.RaidParticipantEntity;
|
||||||
@ -62,7 +60,7 @@ public enum EntityType {
|
|||||||
POLAR_BEAR(PolarBearEntity.class, 28, 1.4f, 1.3f),
|
POLAR_BEAR(PolarBearEntity.class, 28, 1.4f, 1.3f),
|
||||||
LLAMA(LlamaEntity.class, 29, 1.87f, 0.9f),
|
LLAMA(LlamaEntity.class, 29, 1.87f, 0.9f),
|
||||||
TRADER_LLAMA(TraderLlamaEntity.class, 29, 1.187f, 0.9f),
|
TRADER_LLAMA(TraderLlamaEntity.class, 29, 1.187f, 0.9f),
|
||||||
PARROT(TameableEntity.class, 30, 0.9f, 0.5f),
|
PARROT(ParrotEntity.class, 30, 0.9f, 0.5f),
|
||||||
DOLPHIN(WaterEntity.class, 31, 0.6f, 0.9f),
|
DOLPHIN(WaterEntity.class, 31, 0.6f, 0.9f),
|
||||||
ZOMBIE(ZombieEntity.class, 32, 1.8f, 0.6f, 0.6f, 1.62f),
|
ZOMBIE(ZombieEntity.class, 32, 1.8f, 0.6f, 0.6f, 1.62f),
|
||||||
CREEPER(CreeperEntity.class, 33, 1.7f, 0.6f, 0.6f, 1.62f),
|
CREEPER(CreeperEntity.class, 33, 1.7f, 0.6f, 0.6f, 1.62f),
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren