Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feature/1.17
Dieser Commit ist enthalten in:
Commit
7b0099e869
@ -32,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
||||
<artifactId>bedrock-v431</artifactId>
|
||||
<version>9947665</version>
|
||||
<version>530a0e3</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -59,7 +59,7 @@ public class AreaEffectCloudEntity extends Entity {
|
||||
metadata.put(EntityData.EFFECT_COLOR, entityMetadata.getValue());
|
||||
} else if (entityMetadata.getId() == 11) {
|
||||
Particle particle = (Particle) entityMetadata.getValue();
|
||||
int particleId = EffectRegistry.getParticleId(particle.getType());
|
||||
int particleId = EffectRegistry.getParticleId(session, particle.getType());
|
||||
if (particleId != -1) {
|
||||
metadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId);
|
||||
}
|
||||
|
@ -49,7 +49,9 @@ public class CatEntity extends TameableEntity {
|
||||
@Override
|
||||
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||
super.updateBedrockMetadata(entityMetadata, session);
|
||||
if (entityMetadata.getId() == 17) {
|
||||
if (entityMetadata.getId() == 16) {
|
||||
metadata.put(EntityData.SCALE, (boolean) entityMetadata.getValue() ? 0.8f : 0.4f);
|
||||
} else if (entityMetadata.getId() == 17) {
|
||||
// Update collar color if tamed
|
||||
if (metadata.getFlags().getFlag(EntityFlag.TAMED)) {
|
||||
metadata.put(EntityData.COLOR, collarColor);
|
||||
@ -76,6 +78,9 @@ public class CatEntity extends TameableEntity {
|
||||
}
|
||||
metadata.put(EntityData.VARIANT, variantColor);
|
||||
}
|
||||
if (entityMetadata.getId() == 20) {
|
||||
metadata.getFlags().setFlag(EntityFlag.RESTING, (boolean) entityMetadata.getValue());
|
||||
}
|
||||
if (entityMetadata.getId() == 22) {
|
||||
collarColor = (byte) (int) entityMetadata.getValue();
|
||||
// Needed or else wild cats are a red color
|
||||
|
@ -46,7 +46,7 @@ public class VillagerEntity extends AbstractMerchantEntity {
|
||||
/**
|
||||
* A map of Java profession IDs to Bedrock IDs
|
||||
*/
|
||||
private static final Int2IntMap VILLAGER_VARIANTS = new Int2IntOpenHashMap();
|
||||
public static final Int2IntMap VILLAGER_PROFESSIONS = new Int2IntOpenHashMap();
|
||||
/**
|
||||
* A map of all Java region IDs (plains, savanna...) to Bedrock
|
||||
*/
|
||||
@ -54,21 +54,21 @@ public class VillagerEntity extends AbstractMerchantEntity {
|
||||
|
||||
static {
|
||||
// Java villager profession IDs -> Bedrock
|
||||
VILLAGER_VARIANTS.put(0, 0);
|
||||
VILLAGER_VARIANTS.put(1, 8);
|
||||
VILLAGER_VARIANTS.put(2, 11);
|
||||
VILLAGER_VARIANTS.put(3, 6);
|
||||
VILLAGER_VARIANTS.put(4, 7);
|
||||
VILLAGER_VARIANTS.put(5, 1);
|
||||
VILLAGER_VARIANTS.put(6, 2);
|
||||
VILLAGER_VARIANTS.put(7, 4);
|
||||
VILLAGER_VARIANTS.put(8, 12);
|
||||
VILLAGER_VARIANTS.put(9, 5);
|
||||
VILLAGER_VARIANTS.put(10, 13);
|
||||
VILLAGER_VARIANTS.put(11, 14);
|
||||
VILLAGER_VARIANTS.put(12, 3);
|
||||
VILLAGER_VARIANTS.put(13, 10);
|
||||
VILLAGER_VARIANTS.put(14, 9);
|
||||
VILLAGER_PROFESSIONS.put(0, 0);
|
||||
VILLAGER_PROFESSIONS.put(1, 8);
|
||||
VILLAGER_PROFESSIONS.put(2, 11);
|
||||
VILLAGER_PROFESSIONS.put(3, 6);
|
||||
VILLAGER_PROFESSIONS.put(4, 7);
|
||||
VILLAGER_PROFESSIONS.put(5, 1);
|
||||
VILLAGER_PROFESSIONS.put(6, 2);
|
||||
VILLAGER_PROFESSIONS.put(7, 4);
|
||||
VILLAGER_PROFESSIONS.put(8, 12);
|
||||
VILLAGER_PROFESSIONS.put(9, 5);
|
||||
VILLAGER_PROFESSIONS.put(10, 13);
|
||||
VILLAGER_PROFESSIONS.put(11, 14);
|
||||
VILLAGER_PROFESSIONS.put(12, 3);
|
||||
VILLAGER_PROFESSIONS.put(13, 10);
|
||||
VILLAGER_PROFESSIONS.put(14, 9);
|
||||
|
||||
VILLAGER_REGIONS.put(0, 1);
|
||||
VILLAGER_REGIONS.put(1, 2);
|
||||
@ -88,7 +88,7 @@ public class VillagerEntity extends AbstractMerchantEntity {
|
||||
if (entityMetadata.getId() == 18) {
|
||||
VillagerData villagerData = (VillagerData) entityMetadata.getValue();
|
||||
// Profession
|
||||
metadata.put(EntityData.VARIANT, VILLAGER_VARIANTS.get(villagerData.getProfession()));
|
||||
metadata.put(EntityData.VARIANT, VILLAGER_PROFESSIONS.get(villagerData.getProfession()));
|
||||
//metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason?
|
||||
// Region
|
||||
metadata.put(EntityData.MARK_VARIANT, VILLAGER_REGIONS.get(villagerData.getType()));
|
||||
|
@ -48,8 +48,10 @@ public class ZombieVillagerEntity extends ZombieEntity {
|
||||
}
|
||||
if (entityMetadata.getId() == 20) {
|
||||
VillagerData villagerData = (VillagerData) entityMetadata.getValue();
|
||||
// Region - only one used on Bedrock
|
||||
metadata.put(EntityData.VARIANT, VillagerEntity.VILLAGER_PROFESSIONS.get(villagerData.getProfession())); // Actually works properly with the OptionalPack
|
||||
metadata.put(EntityData.MARK_VARIANT, VillagerEntity.VILLAGER_REGIONS.get(villagerData.getType()));
|
||||
// Used with the OptionalPack
|
||||
metadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1);
|
||||
}
|
||||
super.updateBedrockMetadata(entityMetadata, session);
|
||||
}
|
||||
|
@ -32,10 +32,9 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import lombok.NonNull;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
@ -51,11 +50,6 @@ public class EffectRegistry {
|
||||
public static final Map<SoundEffect, Effect> SOUND_EFFECTS = new HashMap<>();
|
||||
public static final Int2ObjectMap<SoundEvent> RECORDS = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
/**
|
||||
* Java particle type to Bedrock particle ID
|
||||
* Used for area effect clouds.
|
||||
*/
|
||||
private static final Object2IntMap<ParticleType> PARTICLE_TO_ID = new Object2IntOpenHashMap<>();
|
||||
/**
|
||||
* Java particle type to Bedrock level event
|
||||
*/
|
||||
@ -84,11 +78,7 @@ public class EffectRegistry {
|
||||
while (particlesIterator.hasNext()) {
|
||||
Map.Entry<String, JsonNode> entry = particlesIterator.next();
|
||||
JsonNode bedrockId = entry.getValue().get("bedrockId");
|
||||
JsonNode bedrockIdNumeric = entry.getValue().get("bedrockNumericId");
|
||||
JsonNode eventType = entry.getValue().get("eventType");
|
||||
if (bedrockIdNumeric != null) {
|
||||
PARTICLE_TO_ID.put(ParticleType.valueOf(entry.getKey().toUpperCase()), bedrockIdNumeric.asInt());
|
||||
}
|
||||
if (bedrockId != null) {
|
||||
PARTICLE_TO_STRING.put(ParticleType.valueOf(entry.getKey().toUpperCase()), bedrockId.asText());
|
||||
}
|
||||
@ -164,11 +154,19 @@ public class EffectRegistry {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for area effect clouds.
|
||||
*
|
||||
* @param type the Java particle to search for
|
||||
* @return the Bedrock integer ID of the particle, or -1 if it does not exist
|
||||
*/
|
||||
public static int getParticleId(@NonNull ParticleType type) {
|
||||
return PARTICLE_TO_ID.getOrDefault(type, -1);
|
||||
public static int getParticleId(GeyserSession session, @NonNull ParticleType type) {
|
||||
LevelEventType levelEventType = getParticleLevelEventType(type);
|
||||
if (levelEventType == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Remove the legacy bit applied to particles for LevelEventType serialization
|
||||
return session.getUpstream().getSession().getPacketCodec().getHelper().getLevelEventId(levelEventType) & ~0x4000;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 53e13b7a0d2ea14df71ed0c9582d29a9b4fb4453
|
||||
Subproject commit c5925b01cf8e7d8b284cf359e927145b9b4694aa
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren