Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Cleanup and fixes
Dieser Commit ist enthalten in:
Ursprung
521b9f3dce
Commit
5162d4516d
@ -346,7 +346,7 @@ public class CommandRegistry implements EventRegistrar {
|
||||
|
||||
List<CommandOverloadData> data = new ArrayList<>();
|
||||
for (var node : commandTree.children()) {
|
||||
List<List<CommandParamData>> params = createParamData(node);
|
||||
List<List<CommandParamData>> params = createParamData(session, node);
|
||||
params.forEach(param -> data.add(new CommandOverloadData(false, param.toArray(CommandParamData[]::new))));
|
||||
}
|
||||
|
||||
@ -358,7 +358,13 @@ public class CommandRegistry implements EventRegistrar {
|
||||
});
|
||||
}
|
||||
|
||||
private List<List<CommandParamData>> createParamData(CommandNode<GeyserCommandSource> node) {
|
||||
private List<List<CommandParamData>> createParamData(GeyserSession session, CommandNode<GeyserCommandSource> node) {
|
||||
var command = node.command();
|
||||
if (command != null && !session.hasPermission(command.commandPermission().permissionString())) {
|
||||
// Triggers with subcommands like Geyser dump, stop, etc.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
CommandParamData data = new CommandParamData();
|
||||
var component = node.component();
|
||||
data.setName(component.name());
|
||||
@ -396,7 +402,7 @@ public class CommandRegistry implements EventRegistrar {
|
||||
// If a node has multiple children, this will need to be represented
|
||||
// by creating a new list/branch for each and cloning this node down each line.
|
||||
for (var child : children) {
|
||||
collectiveData.addAll(createParamData(child));
|
||||
collectiveData.addAll(createParamData(session, child));
|
||||
}
|
||||
collectiveData.forEach(list -> list.add(0, data));
|
||||
return collectiveData;
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package org.geysermc.geyser.inventory.recipe;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay;
|
||||
|
||||
/**
|
||||
@ -37,6 +36,5 @@ public interface GeyserRecipe {
|
||||
*/
|
||||
boolean isShaped();
|
||||
|
||||
@Nullable
|
||||
SlotDisplay result();
|
||||
}
|
||||
|
@ -25,13 +25,12 @@
|
||||
|
||||
package org.geysermc.geyser.inventory.recipe;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.ShapedCraftingRecipeDisplay;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record GeyserShapedRecipe(int width, int height, List<SlotDisplay> ingredients, @Nullable SlotDisplay result) implements GeyserRecipe {
|
||||
public record GeyserShapedRecipe(int width, int height, List<SlotDisplay> ingredients, SlotDisplay result) implements GeyserRecipe {
|
||||
|
||||
public GeyserShapedRecipe(ShapedCraftingRecipeDisplay data) {
|
||||
this(data.width(), data.height(), data.ingredients(), data.result());
|
||||
|
@ -25,13 +25,12 @@
|
||||
|
||||
package org.geysermc.geyser.inventory.recipe;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.ShapelessCraftingRecipeDisplay;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record GeyserShapelessRecipe(List<SlotDisplay> ingredients, @Nullable SlotDisplay result) implements GeyserRecipe {
|
||||
public record GeyserShapelessRecipe(List<SlotDisplay> ingredients, SlotDisplay result) implements GeyserRecipe {
|
||||
|
||||
public GeyserShapelessRecipe(ShapelessCraftingRecipeDisplay data) {
|
||||
this(data.ingredients(), data.result());
|
||||
|
@ -196,11 +196,10 @@ public final class BlockRegistryPopulator {
|
||||
GeyserBedrockBlock[] bedrockRuntimeMap = new GeyserBedrockBlock[blockStates.size()];
|
||||
for (int i = 0; i < blockStates.size(); i++) {
|
||||
NbtMap tag = blockStates.get(i);
|
||||
if (blockStateOrderedMap.containsKey(tag)) {
|
||||
GeyserBedrockBlock block = new GeyserBedrockBlock(i, tag);
|
||||
if (blockStateOrderedMap.put(tag, block) != null) {
|
||||
throw new AssertionError("Duplicate block states in Bedrock palette: " + tag);
|
||||
}
|
||||
GeyserBedrockBlock block = new GeyserBedrockBlock(i, tag);
|
||||
blockStateOrderedMap.put(tag, block);
|
||||
bedrockRuntimeMap[i] = block;
|
||||
}
|
||||
|
||||
|
@ -229,12 +229,12 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
|
||||
return;
|
||||
}
|
||||
if (vehicle instanceof ClientVehicle) {
|
||||
session.getPlayerEntity().setVehicleInput(packet.getAnalogMoveVector());
|
||||
session.getPlayerEntity().setVehicleInput(packet.getMotion());
|
||||
}
|
||||
|
||||
boolean sendMovement = false;
|
||||
if (vehicle instanceof AbstractHorseEntity && !(vehicle instanceof LlamaEntity)) {
|
||||
sendMovement = true;
|
||||
sendMovement = !(vehicle instanceof ClientVehicle);
|
||||
} else if (vehicle instanceof BoatEntity) {
|
||||
if (vehicle.getPassengers().size() == 1) {
|
||||
// The player is the only rider
|
||||
@ -261,16 +261,18 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator<Pla
|
||||
if (wasJumping && !holdingJump) {
|
||||
// Jump released
|
||||
// Yes, I'm fairly certain that entity ID is correct.
|
||||
int finalVehicleJumpStrength = GenericMath.floor(session.getInputCache().getJumpScale() * 100f);
|
||||
session.sendDownstreamGamePacket(new ServerboundPlayerCommandPacket(session.getPlayerEntity().getEntityId(),
|
||||
PlayerState.START_HORSE_JUMP, GenericMath.floor(session.getInputCache().getJumpScale() * 100f)));
|
||||
PlayerState.START_HORSE_JUMP, finalVehicleJumpStrength));
|
||||
session.getInputCache().setJumpingTicks(-10);
|
||||
session.getPlayerEntity().setVehicleJumpStrength(finalVehicleJumpStrength);
|
||||
} else if (!wasJumping && holdingJump) {
|
||||
session.getInputCache().setJumpingTicks(0);
|
||||
session.getInputCache().setJumpScale(0);
|
||||
} else if (holdingJump) {
|
||||
session.getInputCache().setJumpingTicks(++currentJumpingTicks);
|
||||
if (currentJumpingTicks < 10) {
|
||||
session.getInputCache().setJumpScale(session.getInputCache().getJumpScale() * 0.1F);
|
||||
session.getInputCache().setJumpScale(session.getInputCache().getJumpingTicks() * 0.1F);
|
||||
} else {
|
||||
session.getInputCache().setJumpScale(0.8f + 2.0f / (currentJumpingTicks - 9) * 0.1f);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren