mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-22 22:45:04 +01:00
Tidy up creaking entity code, remove debugging
This commit is contained in:
parent
a41d705c42
commit
f610a0d12b
6 changed files with 8 additions and 58 deletions
|
@ -32,7 +32,6 @@ import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
|
|||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.AddEntityPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelEventGenericPacket;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata;
|
||||
|
@ -41,14 +40,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataTyp
|
|||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/*
|
||||
* Relevant bits:
|
||||
* - LevelSoundEvent2Packet(sound=SPAWN, position=(233.5, 112.295, 4717.5), extraData=-1, identifier=minecraft:creaking, babySound=false, relativeVolumeDisabled=false)
|
||||
* - [11:29:34:768] [CLIENT BOUND] - LevelSoundEvent2Packet(sound=CREAKING_HEART_SPAWN, position=(233.0, 110.0, 4717.0), extraData=-1, identifier=minecraft:creaking, babySound=false, relativeVolumeDisabled=false)
|
||||
* - [11:29:34:768] [CLIENT BOUND] - LevelSoundEvent2Packet(sound=CREAKING_HEART_SPAWN, position=(235.0, 113.0, 4722.0), extraData=13734, identifier=, babySound=false, relativeVolumeDisabled=false)
|
||||
* - [11:29:34:768] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_MOB_BLOCK_SPAWN, position=(233.0, 110.0, 4717.0), data=769)
|
||||
*
|
||||
*/
|
||||
|
||||
public class CreakingEntity extends MonsterEntity {
|
||||
|
||||
private Vector3i homePosition;
|
||||
|
@ -70,53 +62,26 @@ public class CreakingEntity extends MonsterEntity {
|
|||
@Override
|
||||
public void addAdditionalSpawnData(AddEntityPacket addEntityPacket) {
|
||||
propertyManager.add(CREAKING_STATE, "neutral");
|
||||
propertyManager.add("minecraft:creaking_swaying_ticks", 0);
|
||||
propertyManager.add(CREAKING_SWAYING_TICKS, 0);
|
||||
propertyManager.applyIntProperties(addEntityPacket.getProperties().getIntProperties());
|
||||
}
|
||||
|
||||
public void setCanMove(EntityMetadata<Boolean,? extends MetadataType<Boolean>> booleanEntityMetadata) {
|
||||
if (booleanEntityMetadata.getValue()) {
|
||||
setFlag(EntityFlag.BODY_ROTATION_BLOCKED, false);
|
||||
|
||||
// unfreeze sound? SoundEvent.UNFREEZE
|
||||
propertyManager.add(CREAKING_STATE, "hostile_unobserved");
|
||||
updateBedrockEntityProperties();
|
||||
} else {
|
||||
setFlag(EntityFlag.BODY_ROTATION_BLOCKED, true);
|
||||
propertyManager.add(CREAKING_STATE, "hostile_observed");
|
||||
updateBedrockEntityProperties();
|
||||
}
|
||||
|
||||
GeyserImpl.getInstance().getLogger().warning("set can move; " + booleanEntityMetadata.toString());
|
||||
setFlag(EntityFlag.BODY_ROTATION_BLOCKED, !booleanEntityMetadata.getValue());
|
||||
propertyManager.add(CREAKING_STATE, booleanEntityMetadata.getValue() ? "hostile_unobserved" : "hostile_observed");
|
||||
updateBedrockEntityProperties();
|
||||
}
|
||||
|
||||
public void setActive(EntityMetadata<Boolean,? extends MetadataType<Boolean>> booleanEntityMetadata) {
|
||||
if (booleanEntityMetadata.getValue()) {
|
||||
// LevelSoundEvent2Packet addEntityPacket = new LevelSoundEvent2Packet();
|
||||
// addEntityPacket.setIdentifier("minecraft:creaking");
|
||||
// addEntityPacket.setPosition(position);
|
||||
// addEntityPacket.setBabySound(false);
|
||||
// addEntityPacket.setSound(SoundEvent.ACTIVATE);
|
||||
// addEntityPacket.setExtraData(-1);
|
||||
// session.sendUpstreamPacket(addEntityPacket);
|
||||
|
||||
// setFlag(EntityFlag.HIDDEN_WHEN_INVISIBLE, true);
|
||||
// setFlag(EntityFlag.BODY_ROTATION_BLOCKED, true);
|
||||
} else {
|
||||
if (!booleanEntityMetadata.getValue()) {
|
||||
propertyManager.add(CREAKING_STATE, "neutral");
|
||||
}
|
||||
GeyserImpl.getInstance().getLogger().warning("set active; " + booleanEntityMetadata.toString());
|
||||
}
|
||||
|
||||
public void setIsTearingDown(EntityMetadata<Boolean,? extends MetadataType<Boolean>> booleanEntityMetadata) {
|
||||
GeyserImpl.getInstance().getLogger().warning("set isTearingDown; " + booleanEntityMetadata.toString());
|
||||
if (booleanEntityMetadata.getValue()) {
|
||||
propertyManager.add(CREAKING_STATE, "crumbling");
|
||||
updateBedrockEntityProperties();
|
||||
// LevelEventPacket levelEventPacket = new LevelEventPacket();
|
||||
// levelEventPacket.setType(ParticleType.CREAKING_CRUMBLE);
|
||||
// levelEventPacket.setPosition(position);
|
||||
// levelEventPacket.setData(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +99,7 @@ public class CreakingEntity extends MonsterEntity {
|
|||
levelEventGenericPacket.setType(LevelEvent.PARTICLE_CREAKING_HEART_TRIAL);
|
||||
levelEventGenericPacket.setTag(
|
||||
NbtMap.builder()
|
||||
.putInt("CreakingAmount", 0)
|
||||
.putInt("CreakingAmount", 20)
|
||||
.putFloat("CreakingX", position.getX())
|
||||
.putFloat("CreakingY", position.getY())
|
||||
.putFloat("CreakingZ", position.getZ())
|
||||
|
@ -145,7 +110,6 @@ public class CreakingEntity extends MonsterEntity {
|
|||
.build()
|
||||
);
|
||||
|
||||
GeyserImpl.getInstance().getLogger().warning(levelEventGenericPacket.toString());
|
||||
session.sendUpstreamPacket(levelEventGenericPacket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.cloudburstmc.math.vector.Vector2f;
|
|||
import org.cloudburstmc.protocol.bedrock.BedrockDisconnectReasons;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.compat.BedrockCompat;
|
||||
import org.cloudburstmc.protocol.bedrock.data.ExperimentData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm;
|
||||
import org.cloudburstmc.protocol.bedrock.data.ResourcePackType;
|
||||
import org.cloudburstmc.protocol.bedrock.netty.codec.compression.CompressionStrategy;
|
||||
|
@ -249,14 +248,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||
stackPacket.getResourcePacks().add(new ResourcePackStackPacket.Entry(header.uuid().toString(), header.version().toString(), ""));
|
||||
}
|
||||
|
||||
if (GeyserImpl.getInstance().getConfig().isAddNonBedrockItems()) {
|
||||
// Allow custom items to work
|
||||
stackPacket.getExperiments().add(new ExperimentData("data_driven_items", true));
|
||||
}
|
||||
|
||||
// Required for experimental 1.21 features
|
||||
stackPacket.getExperiments().add(new ExperimentData("updateAnnouncedLive2023", true));
|
||||
|
||||
session.sendUpstreamPacket(stackPacket);
|
||||
break;
|
||||
|
||||
|
|
|
@ -150,7 +150,6 @@ import org.geysermc.geyser.item.type.BlockItem;
|
|||
import org.geysermc.geyser.level.BedrockDimension;
|
||||
import org.geysermc.geyser.level.JavaDimension;
|
||||
import org.geysermc.geyser.level.physics.CollisionManager;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.network.netty.LocalSession;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.registry.type.BlockMappings;
|
||||
|
@ -1671,8 +1670,6 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
startGamePacket.getExperiments().add(new ExperimentData("upcoming_creator_features", true));
|
||||
// Needed for certain molang queries used in blocks and items
|
||||
startGamePacket.getExperiments().add(new ExperimentData("experimental_molang_features", true));
|
||||
// Required for experimental 1.21 features
|
||||
startGamePacket.getExperiments().add(new ExperimentData("updateAnnouncedLive2023", true));
|
||||
|
||||
startGamePacket.setVanillaVersion("*");
|
||||
startGamePacket.setInventoriesServerAuthoritative(true);
|
||||
|
|
|
@ -40,7 +40,6 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.Serverbound
|
|||
public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator<SetLocalPlayerAsInitializedPacket> {
|
||||
@Override
|
||||
public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) {
|
||||
GeyserImpl.getInstance().getLogger().info(packet.toString());
|
||||
if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {
|
||||
if (!session.getUpstream().isInitialized()) {
|
||||
session.getUpstream().setInitialized(true);
|
||||
|
|
|
@ -170,7 +170,6 @@ final class BedrockBlockActions {
|
|||
if (session.getGameMode() != GameMode.CREATIVE) {
|
||||
// As of 1.16.210: item frame items are taken out here.
|
||||
// Survival also sends START_BREAK, but by attaching our process here adventure mode also works
|
||||
GeyserImpl.getInstance().getLogger().warning("abort break, not creative - item frame???");
|
||||
Entity itemFrameEntity = ItemFrameEntity.getItemFrameEntity(session, vector);
|
||||
if (itemFrameEntity != null) {
|
||||
ServerboundInteractPacket interactPacket = new ServerboundInteractPacket(itemFrameEntity.getEntityId(),
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 452312f88317cce019b8f336f485ffa7b2c19557
|
||||
Subproject commit 64032d7886e128858044e7e786479af3f1e876c8
|
Loading…
Reference in a new issue