4Vx¼ް
4Vx¼ް
PDCPlayerRealms developerS Community
Created by 月猫ch on 3/14/2025 in #help-forum
FOVの変化なしで移動速度の低下
(default movement speed) / (default walk speed) * (changed walk speed)
f = (float)((double)f * (((dms / dws * cws) / cws + 1.0D) / 2.0D));
(default movement speed) / (default walk speed) * (changed walk speed)
f = (float)((double)f * (((dms / dws * cws) / cws + 1.0D) / 2.0D));
11 replies
PDCPlayerRealms developerS Community
Created by 月猫ch on 3/14/2025 in #help-forum
FOVの変化なしで移動速度の低下
うん、動作することは確認した
11 replies
PDCPlayerRealms developerS Community
Created by 月猫ch on 3/14/2025 in #help-forum
FOVの変化なしで移動速度の低下
f = (float)((double)f * ((this.getAttributeValue(Attributes.MOVEMENT_SPEED) / (double)this.abilities.getWalkSpeed() + 1.0D) / 2.0D));
f = (float)((double)f * ((this.getAttributeValue(Attributes.MOVEMENT_SPEED) / (double)this.abilities.getWalkSpeed() + 1.0D) / 2.0D));
speedによるfovの変化の仕方がこれ
function set_walk_speed(p: player, speed: number):
add "{Attributes:[{Base:%0.10000000149011612 * {_speed} / 0.20000000298023224%d,Name:""generic.movementSpeed""}]}" to nbt of {_p}
set walk speed of {_p} to {_speed}
function set_walk_speed(p: player, speed: number):
add "{Attributes:[{Base:%0.10000000149011612 * {_speed} / 0.20000000298023224%d,Name:""generic.movementSpeed""}]}" to nbt of {_p}
set walk speed of {_p} to {_speed}
skbee以外でもattributesをいじれるaddonでmovement_speedとwalk speedの比が変わらないようにする
11 replies
PDCPlayerRealms developerS Community
Created by gladiolus8789 on 1/18/2025 in #help-forum
同じ文字を繰り返した文字列を生成したい
確かにstringbuilderで結合されてるけど追加するたびにインスタンス生成してるから最適化されてるとは言えないかも
24 replies
PDCPlayerRealms developerS Community
Created by gladiolus8789 on 1/18/2025 in #help-forum
同じ文字を繰り返した文字列を生成したい
メモリとCPUはトレードオフの関係にあるけど 高水準な言語では配列が自動で拡張されるからあまり馴染みがないかもしれない 低水準に近い言語では要素数を恣意的に決めることが多いと思う 200個連続させる場合はs("aa", 100)でもできる
24 replies
PDCPlayerRealms developerS Community
Created by gladiolus8789 on 1/18/2025 in #help-forum
同じ文字を繰り返した文字列を生成したい
variables:
#100
{reserved} = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

function s(letter: text, repeats: number) :: text:
set {_} to subtext of {reserved} from 0 to {_repeats}
replace "0" in {_} with {_letter}
return {_}

command /a:
trigger:
send s("a", 50)
variables:
#100
{reserved} = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

function s(letter: text, repeats: number) :: text:
set {_} to subtext of {reserved} from 0 to {_repeats}
replace "0" in {_} with {_letter}
return {_}

command /a:
trigger:
send s("a", 50)
より速く処理したいなら自分の使う分だけ予め0を入力しておいてsubtextとreplaceを使う loopで1文字ずつ追加するより約7倍速い
24 replies