Skip to content

Commit

Permalink
Merge branch 'master' into rp
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris authored Jul 3, 2024
2 parents f116382 + ff1e1dd commit 5b52769
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 39 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
- 'LICENSE'
- 'Jenkinsfile '
- 'README.md'
- 'licenseheader.txt'

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
Copyright (c) 2019-2024 GeyserMC. http://geysermc.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sourceSets {
blossom {
val info = GitInfo()
javaSources {
property("version", "${info.version} (${info.gitVersion})")
property("version", info.version)
property("gitVersion", info.gitVersion)
property("buildNumber", info.buildNumber.toString())
property("branch", info.branch)
Expand Down Expand Up @@ -156,4 +156,4 @@ tasks.register<DownloadFilesTask>("downloadBedrockData") {
suffixedFiles = listOf("block_palette.nbt", "creative_items.json", "runtime_item_states.json")

destinationDir = "$projectDir/src/main/resources/bedrock"
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/geysermc/geyser/GeyserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public void reloadGeyser() {
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean isProductionEnvironment() {
// First is if Blossom runs, second is if Blossom doesn't run
//noinspection ConstantConditions,MismatchedStringCase - changes in production
//noinspection ConstantConditions - changes in production
return !("git-local/dev-0000000".equals(GeyserImpl.GIT_VERSION) || "${gitVersion}".equals(GeyserImpl.GIT_VERSION));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

@Builder
@Value
public class BlockMappings implements DefinitionRegistry<GeyserBedrockBlock> {
public class BlockMappings implements DefinitionRegistry<BlockDefinition> {
GeyserBedrockBlock bedrockAir;
BlockDefinition bedrockWater;
BlockDefinition bedrockMovingBlock;
Expand Down Expand Up @@ -134,7 +134,7 @@ public BlockDefinition getStructureBlockFromMode(String mode) {
}

@Override
public boolean isRegistered(GeyserBedrockBlock bedrockBlock) {
public boolean isRegistered(BlockDefinition bedrockBlock) {
return getDefinition(bedrockBlock.getRuntimeId()) == bedrockBlock;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import org.cloudburstmc.protocol.bedrock.packet.*;
import org.cloudburstmc.protocol.common.DefinitionRegistry;
import org.cloudburstmc.protocol.common.util.OptionalBoolean;
import org.geysermc.api.util.BedrockPlatform;
import org.geysermc.api.util.InputMode;
Expand Down Expand Up @@ -1466,7 +1465,7 @@ public void sendForm(org.geysermc.cumulus.util.FormBuilder<?, ?> formBuilder) {

private void startGame() {
this.upstream.getCodecHelper().setItemDefinitions(this.itemMappings);
this.upstream.getCodecHelper().setBlockDefinitions((DefinitionRegistry) this.blockMappings); //FIXME
this.upstream.getCodecHelper().setBlockDefinitions(this.blockMappings);
this.upstream.getCodecHelper().setCameraPresetDefinitions(CameraDefinitions.CAMERA_DEFINITIONS);

StartGamePacket startGamePacket = new StartGamePacket();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.geysermc.geyser.text.MinecraftLocale;
import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.geyser.util.InventoryUtils;
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.AttributeType;
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.ModifierOperation;
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.*;
Expand Down Expand Up @@ -209,7 +210,7 @@ private static void addAttributeLore(ItemAttributeModifiers modifiers, BedrockIt
Map<ItemAttributeModifiers.EquipmentSlotGroup, List<String>> slotsToModifiers = new HashMap<>();
for (ItemAttributeModifiers.Entry entry : modifiers.getModifiers()) {
// convert the modifier tag to a lore entry
String loreEntry = attributeToLore(entry.getModifier(), language);
String loreEntry = attributeToLore(entry.getAttribute(), entry.getModifier(), language);
if (loreEntry == null) {
continue; // invalid or failed
}
Expand Down Expand Up @@ -254,13 +255,13 @@ private static void addAttributeLore(ItemAttributeModifiers modifiers, BedrockIt
}

@Nullable
private static String attributeToLore(ItemAttributeModifiers.AttributeModifier modifier, String language) {
private static String attributeToLore(int attribute, ItemAttributeModifiers.AttributeModifier modifier, String language) {
double amount = modifier.getAmount();
if (amount == 0) {
return null;
}

String name = modifier.getId().asMinimalString();
String name = AttributeType.Builtin.from(attribute).getIdentifier().asMinimalString();
// the namespace does not need to be present, but if it is, the java client ignores it as of pre-1.20.5

ModifierOperation operation = modifier.getOperation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

@Translator(packet = ClientboundLevelParticlesPacket.class)
public class JavaLevelParticlesTranslator extends PacketTranslator<ClientboundLevelParticlesPacket> {
private static final int MAX_PARTICLES = 100;

@Override
public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) {
Expand All @@ -71,7 +72,8 @@ public void translate(GeyserSession session, ClientboundLevelParticlesPacket pac
session.sendUpstreamPacket(particleCreateFunction.apply(position));
} else {
Random random = ThreadLocalRandom.current();
for (int i = 0; i < packet.getAmount(); i++) {
int amount = Math.min(MAX_PARTICLES, packet.getAmount());
for (int i = 0; i < amount; i++) {
double offsetX = random.nextGaussian() * (double) packet.getOffsetX();
double offsetY = random.nextGaussian() * (double) packet.getOffsetY();
double offsetZ = random.nextGaussian() * (double) packet.getOffsetZ();
Expand Down Expand Up @@ -213,4 +215,4 @@ private static NbtMap buildVec3PositionTag(Vector3f position) {
.putFloat("z", position.getZ())
.build();
}
}
}
2 changes: 1 addition & 1 deletion core/src/main/resources/mappings
Submodule mappings updated 1 files
+1 −1 items.json
24 changes: 0 additions & 24 deletions licenseheader.txt

This file was deleted.

0 comments on commit 5b52769

Please sign in to comment.