diff --git a/utils/auth.go b/utils/auth.go index baaf569..449a993 100644 --- a/utils/auth.go +++ b/utils/auth.go @@ -278,7 +278,7 @@ func (c *chain) Expired() bool { } exp := mm["exp"].(float64) t := time.Unix(int64(exp), 0) - return time.Until(t) < 30*time.Second + return time.Until(t) < 1*time.Hour } func (a *authsrv) readChain() (*chain, error) { diff --git a/utils/dumpstruct.go b/utils/dumpstruct.go index 5d9532f..d8280d3 100644 --- a/utils/dumpstruct.go +++ b/utils/dumpstruct.go @@ -9,10 +9,10 @@ import ( ) func DumpStruct(f io.StringWriter, inputStruct any) { - dumpValue(f, 0, reflect.ValueOf(inputStruct), true) + dumpValue(f, 0, reflect.ValueOf(inputStruct), true, false) } -func dumpValue(f io.StringWriter, level int, value reflect.Value, withType bool) { +func dumpValue(f io.StringWriter, level int, value reflect.Value, withType, isEntityMetadata bool) { tabs := strings.Repeat("\t", level) typeName := value.Type().String() @@ -38,7 +38,7 @@ func dumpValue(f io.StringWriter, level int, value reflect.Value, withType bool) f.WriteString(typeName + " Not Set") } else { f.WriteString(typeName + "{\n" + tabs + "\t") - dumpValue(f, level+1, val, false) + dumpValue(f, level+1, val, false, false) f.WriteString("\n" + tabs + "}") } return @@ -56,7 +56,7 @@ func dumpValue(f io.StringWriter, level int, value reflect.Value, withType bool) fieldType := valueType.Field(i) if fieldType.IsExported() { f.WriteString(tabs + "\t" + fieldType.Name + ": ") - dumpValue(f, level+1, value.Field(i), true) + dumpValue(f, level+1, value.Field(i), true, fieldType.Name == "EntityMetadata") f.WriteString(",\n") } else { f.WriteString(tabs + "\t" + fieldType.Name + " (unexported)\n") @@ -81,13 +81,23 @@ func dumpValue(f io.StringWriter, level int, value reflect.Value, withType bool) iter := value.MapRange() for iter.Next() { f.WriteString(tabs + "\t") - dumpValue(f, level+1, iter.Key(), false) + var kevV bool + if isEntityMetadata { + idx := int(iter.Key().Uint()) + if idx < len(entityDataKeys) { + f.WriteString(entityDataKeys[idx][len("EntityDataKey"):]) + kevV = true + } + } + if !kevV { + dumpValue(f, level+1, iter.Key(), false, false) + } f.WriteString(": ") elem := iter.Value() if isAny { elem = elem.Elem() } - dumpValue(f, level+1, elem, isAny) + dumpValue(f, level+1, elem, isAny, false) f.WriteString(",\n") } f.WriteString(tabs + "}") @@ -128,7 +138,7 @@ func dumpValue(f io.StringWriter, level int, value reflect.Value, withType bool) if isAny { elem = elem.Elem() } - dumpValue(f, level+1, elem, isAny) + dumpValue(f, level+1, elem, isAny, false) if isStructish { f.WriteString(",\n") } else if i == value.Len()-1 { @@ -174,3 +184,137 @@ func dumpValue(f io.StringWriter, level int, value reflect.Value, withType bool) } } } + +var entityDataKeys = []string{ + "EntityDataKeyFlags", + "EntityDataKeyStructuralIntegrity", + "EntityDataKeyVariant", + "EntityDataKeyColorIndex", + "EntityDataKeyName", + "EntityDataKeyOwner", + "EntityDataKeyTarget", + "EntityDataKeyAirSupply", + "EntityDataKeyEffectColor", + "EntityDataKeyEffectAmbience", + "EntityDataKeyJumpDuration", + "EntityDataKeyHurt", + "EntityDataKeyHurtDirection", + "EntityDataKeyRowTimeLeft", + "EntityDataKeyRowTimeRight", + "EntityDataKeyValue", + "EntityDataKeyDisplayTileRuntimeID", + "EntityDataKeyDisplayOffset", + "EntityDataKeyCustomDisplay", + "EntityDataKeySwell", + "EntityDataKeyOldSwell", + "EntityDataKeySwellDirection", + "EntityDataKeyChargeAmount", + "EntityDataKeyCarryBlockRuntimeID", + "EntityDataKeyClientEvent", + "EntityDataKeyUsingItem", + "EntityDataKeyPlayerFlags", + "EntityDataKeyPlayerIndex", + "EntityDataKeyBedPosition", + "EntityDataKeyPowerX", + "EntityDataKeyPowerY", + "EntityDataKeyPowerZ", + "EntityDataKeyAuxPower", + "EntityDataKeyFishX", + "EntityDataKeyFishZ", + "EntityDataKeyFishAngle", + "EntityDataKeyAuxValueData", + "EntityDataKeyLeashHolder", + "EntityDataKeyScale", + "EntityDataKeyHasNPC", + "EntityDataKeyNPCData", + "EntityDataKeyActions", + "EntityDataKeyAirSupplyMax", + "EntityDataKeyMarkVariant", + "EntityDataKeyContainerType", + "EntityDataKeyContainerSize", + "EntityDataKeyContainerStrengthModifier", + "EntityDataKeyBlockTarget", + "EntityDataKeyInventory", + "EntityDataKeyTargetA", + "EntityDataKeyTargetB", + "EntityDataKeyTargetC", + "EntityDataKeyAerialAttack", + "EntityDataKeyWidth", + "EntityDataKeyHeight", + "EntityDataKeyFuseTime", + "EntityDataKeySeatOffset", + "EntityDataKeySeatLockPassengerRotation", + "EntityDataKeySeatLockPassengerRotationDegrees", + "EntityDataKeySeatRotationOffset", + "EntityDataKeySeatRotationOffstDegrees", + "EntityDataKeyDataRadius", + "EntityDataKeyDataWaiting", + "EntityDataKeyDataParticle", + "EntityDataKeyPeekID", + "EntityDataKeyAttachFace", + "EntityDataKeyAttached", + "EntityDataKeyAttachedPosition", + "EntityDataKeyTradeTarget", + "EntityDataKeyCareer", + "EntityDataKeyHasCommandBlock", + "EntityDataKeyCommandName", + "EntityDataKeyLastCommandOutput", + "EntityDataKeyTrackCommandOutput", + "EntityDataKeyControllingSeatIndex", + "EntityDataKeyStrength", + "EntityDataKeyStrengthMax", + "EntityDataKeyDataSpellCastingColor", + "EntityDataKeyDataLifetimeTicks", + "EntityDataKeyPoseIndex", + "EntityDataKeyDataTickOffset", + "EntityDataKeyAlwaysShowNameTag", + "EntityDataKeyColorTwoIndex", + "EntityDataKeyNameAuthor", + "EntityDataKeyScore", + "EntityDataKeyBalloonAnchor", + "EntityDataKeyPuffedState", + "EntityDataKeyBubbleTime", + "EntityDataKeyAgent", + "EntityDataKeySittingAmount", + "EntityDataKeySittingAmountPrevious", + "EntityDataKeyEatingCounter", + "EntityDataKeyFlagsTwo", + "EntityDataKeyLayingAmount", + "EntityDataKeyLayingAmountPrevious", + "EntityDataKeyDataDuration", + "EntityDataKeyDataSpawnTime", + "EntityDataKeyDataChangeRate", + "EntityDataKeyDataChangeOnPickup", + "EntityDataKeyDataPickupCount", + "EntityDataKeyInteractText", + "EntityDataKeyTradeTier", + "EntityDataKeyMaxTradeTier", + "EntityDataKeyTradeExperience", + "EntityDataKeySkinID", + "EntityDataKeySpawningFrames", + "EntityDataKeyCommandBlockTickDelay", + "EntityDataKeyCommandBlockExecuteOnFirstTick", + "EntityDataKeyAmbientSoundInterval", + "EntityDataKeyAmbientSoundIntervalRange", + "EntityDataKeyAmbientSoundEventName", + "EntityDataKeyFallDamageMultiplier", + "EntityDataKeyNameRawText", + "EntityDataKeyCanRideTarget", + "EntityDataKeyLowTierCuredTradeDiscount", + "EntityDataKeyHighTierCuredTradeDiscount", + "EntityDataKeyNearbyCuredTradeDiscount", + "EntityDataKeyNearbyCuredDiscountTimeStamp", + "EntityDataKeyHitBox", + "EntityDataKeyIsBuoyant", + "EntityDataKeyFreezingEffectStrength", + "EntityDataKeyBuoyancyData", + "EntityDataKeyGoatHornCount", + "EntityDataKeyBaseRuntimeID", + "EntityDataKeyMovementSoundDistanceOffset", + "EntityDataKeyHeartbeatIntervalTicks", + "EntityDataKeyHeartbeatSoundEvent", + "EntityDataKeyPlayerLastDeathPosition", + "EntityDataKeyPlayerLastDeathDimension", + "EntityDataKeyPlayerHasDied", + "EntityDataKeyCollisionBox", +} diff --git a/utils/proxy/session.go b/utils/proxy/session.go index a8fd0de..5da4f30 100644 --- a/utils/proxy/session.go +++ b/utils/proxy/session.go @@ -384,7 +384,8 @@ func (s *Session) connectClient(ctx context.Context, connect *utils.ConnectInfo) } s.listener, err = minecraft.ListenConfig{ - StatusProvider: minecraft.NewStatusProvider(fmt.Sprintf("%s Proxy", connect.Name()), "Bedrocktool"), + AuthenticationDisabled: true, + StatusProvider: minecraft.NewStatusProvider(fmt.Sprintf("%s Proxy", connect.Name()), "Bedrocktool"), PacketFunc: func(header packet.Header, payload []byte, src, dst net.Addr, timeReceived time.Time) { if extraClientDebug != nil { pk, ok := DecodePacket(header, payload, s.Client.ShieldID())