mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Remove outdated code for .50/.60, fix bug with reloading geyser on standalone
This commit is contained in:
@@ -236,6 +236,9 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
|
|||||||
// Event must be fired after CommandRegistry has subscribed its listener.
|
// Event must be fired after CommandRegistry has subscribed its listener.
|
||||||
// Also, the subscription for the Permissions class is created when Geyser is initialized.
|
// Also, the subscription for the Permissions class is created when Geyser is initialized.
|
||||||
cloud.fireRegisterPermissionsEvent();
|
cloud.fireRegisterPermissionsEvent();
|
||||||
|
} else {
|
||||||
|
// This isn't ideal - but geyserLogger#start won't ever finish, leading to a reloading deadlock
|
||||||
|
geyser.setReloading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gui != null) {
|
if (gui != null) {
|
||||||
|
|||||||
@@ -185,7 +185,8 @@ public class GeyserImpl implements GeyserApi, EventRegistrar {
|
|||||||
/**
|
/**
|
||||||
* Determines if we're currently reloading. Replaces per-bootstrap reload checks
|
* Determines if we're currently reloading. Replaces per-bootstrap reload checks
|
||||||
*/
|
*/
|
||||||
private volatile boolean isReloading;
|
@Setter
|
||||||
|
private boolean isReloading;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if Geyser is currently enabled. This is used to determine if {@link #disable()} should be called during {@link #shutdown()}.
|
* Determines if Geyser is currently enabled. This is used to determine if {@link #disable()} should be called during {@link #shutdown()}.
|
||||||
|
|||||||
@@ -87,10 +87,8 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
|
|||||||
@Override
|
@Override
|
||||||
protected void initializeMetadata() {
|
protected void initializeMetadata() {
|
||||||
super.initializeMetadata();
|
super.initializeMetadata();
|
||||||
if (GameProtocol.is1_21_70orHigher(session)) {
|
// Without this flag you cant stand on boats
|
||||||
// Without this flag you cant stand on boats
|
setFlag(EntityFlag.COLLIDABLE, true);
|
||||||
setFlag(EntityFlag.COLLIDABLE, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -89,14 +89,6 @@ public final class GameProtocol {
|
|||||||
|
|
||||||
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
|
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
|
||||||
|
|
||||||
public static boolean isPreCreativeInventoryRewrite(int protocolVersion) {
|
|
||||||
return protocolVersion < 776;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean is1_21_70orHigher(GeyserSession session) {
|
|
||||||
return session.protocolVersion() >= Bedrock_v786.CODEC.getProtocolVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isTheOneVersionWithBrokenForms(GeyserSession session) {
|
public static boolean isTheOneVersionWithBrokenForms(GeyserSession session) {
|
||||||
return session.protocolVersion() == Bedrock_v786.CODEC.getProtocolVersion();
|
return session.protocolVersion() == Bedrock_v786.CODEC.getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ import org.geysermc.geyser.item.Items;
|
|||||||
import org.geysermc.geyser.item.type.BlockItem;
|
import org.geysermc.geyser.item.type.BlockItem;
|
||||||
import org.geysermc.geyser.item.type.Item;
|
import org.geysermc.geyser.item.type.Item;
|
||||||
import org.geysermc.geyser.level.block.property.Properties;
|
import org.geysermc.geyser.level.block.property.Properties;
|
||||||
import org.geysermc.geyser.network.GameProtocol;
|
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.BlockMappings;
|
import org.geysermc.geyser.registry.type.BlockMappings;
|
||||||
@@ -185,9 +184,6 @@ public class ItemRegistryPopulator {
|
|||||||
|
|
||||||
// Used for custom items
|
// Used for custom items
|
||||||
int nextFreeBedrockId = 0;
|
int nextFreeBedrockId = 0;
|
||||||
// TODO yeet
|
|
||||||
List<ItemDefinition> componentItemData = new ObjectArrayList<>();
|
|
||||||
|
|
||||||
Int2ObjectMap<ItemDefinition> registry = new Int2ObjectOpenHashMap<>();
|
Int2ObjectMap<ItemDefinition> registry = new Int2ObjectOpenHashMap<>();
|
||||||
Map<String, ItemDefinition> definitions = new Object2ObjectLinkedOpenHashMap<>();
|
Map<String, ItemDefinition> definitions = new Object2ObjectLinkedOpenHashMap<>();
|
||||||
|
|
||||||
@@ -252,13 +248,7 @@ public class ItemRegistryPopulator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<CreativeItemGroup> creativeItemGroups;
|
List<CreativeItemGroup> creativeItemGroups = CreativeItemRegistryPopulator.readCreativeItemGroups(palette, creativeItems);
|
||||||
if (GameProtocol.isPreCreativeInventoryRewrite(palette.protocolVersion)) {
|
|
||||||
creativeItemGroups = new ArrayList<>();
|
|
||||||
} else {
|
|
||||||
creativeItemGroups = CreativeItemRegistryPopulator.readCreativeItemGroups(palette, creativeItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockMappings blockMappings = BlockRegistries.BLOCKS.forVersion(palette.protocolVersion());
|
BlockMappings blockMappings = BlockRegistries.BLOCKS.forVersion(palette.protocolVersion());
|
||||||
|
|
||||||
Set<Item> javaOnlyItems = new ObjectOpenHashSet<>();
|
Set<Item> javaOnlyItems = new ObjectOpenHashSet<>();
|
||||||
@@ -511,9 +501,6 @@ public class ItemRegistryPopulator {
|
|||||||
.build(), creativeNetId.get(), customItem.creativeCategory().getAsInt());
|
.build(), creativeNetId.get(), customItem.creativeCategory().getAsInt());
|
||||||
creativeItems.add(creativeItemData);
|
creativeItems.add(creativeItemData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComponentItemData - used to register some custom properties
|
|
||||||
componentItemData.add(customMapping.itemDefinition());
|
|
||||||
customItemOptions.add(Pair.of(customItem.customItemOptions(), customMapping.itemDefinition()));
|
customItemOptions.add(Pair.of(customItem.customItemOptions(), customMapping.itemDefinition()));
|
||||||
registry.put(customMapping.integerId(), customMapping.itemDefinition());
|
registry.put(customMapping.integerId(), customMapping.itemDefinition());
|
||||||
|
|
||||||
@@ -578,7 +565,6 @@ public class ItemRegistryPopulator {
|
|||||||
ItemDefinition definition = new SimpleItemDefinition("geysermc:furnace_minecart", furnaceMinecartId, ItemVersion.DATA_DRIVEN, true, registerFurnaceMinecart(furnaceMinecartId));
|
ItemDefinition definition = new SimpleItemDefinition("geysermc:furnace_minecart", furnaceMinecartId, ItemVersion.DATA_DRIVEN, true, registerFurnaceMinecart(furnaceMinecartId));
|
||||||
definitions.put("geysermc:furnace_minecart", definition);
|
definitions.put("geysermc:furnace_minecart", definition);
|
||||||
registry.put(definition.getRuntimeId(), definition);
|
registry.put(definition.getRuntimeId(), definition);
|
||||||
componentItemData.add(definition);
|
|
||||||
|
|
||||||
mappings.set(Items.FURNACE_MINECART.javaId(), ItemMapping.builder()
|
mappings.set(Items.FURNACE_MINECART.javaId(), ItemMapping.builder()
|
||||||
.javaItem(Items.FURNACE_MINECART)
|
.javaItem(Items.FURNACE_MINECART)
|
||||||
@@ -609,7 +595,6 @@ public class ItemRegistryPopulator {
|
|||||||
int customItemId = nextFreeBedrockId++;
|
int customItemId = nextFreeBedrockId++;
|
||||||
NonVanillaItemRegistration registration = CustomItemRegistryPopulator.registerCustomItem(customItem, customItemId, palette.protocolVersion);
|
NonVanillaItemRegistration registration = CustomItemRegistryPopulator.registerCustomItem(customItem, customItemId, palette.protocolVersion);
|
||||||
|
|
||||||
componentItemData.add(registration.mapping().getBedrockDefinition());
|
|
||||||
ItemMapping mapping = registration.mapping();
|
ItemMapping mapping = registration.mapping();
|
||||||
Item javaItem = registration.javaItem();
|
Item javaItem = registration.javaItem();
|
||||||
while (javaItem.javaId() >= mappings.size()) {
|
while (javaItem.javaId() >= mappings.size()) {
|
||||||
@@ -672,7 +657,6 @@ public class ItemRegistryPopulator {
|
|||||||
.creativeItems(creativeItems)
|
.creativeItems(creativeItems)
|
||||||
.creativeItemGroups(creativeItemGroups)
|
.creativeItemGroups(creativeItemGroups)
|
||||||
.itemDefinitions(registry)
|
.itemDefinitions(registry)
|
||||||
.componentItemData(componentItemData)
|
|
||||||
.storedItems(new StoredItemMappings(javaItemToMapping))
|
.storedItems(new StoredItemMappings(javaItemToMapping))
|
||||||
.javaOnlyItems(javaOnlyItems)
|
.javaOnlyItems(javaOnlyItems)
|
||||||
.buckets(buckets)
|
.buckets(buckets)
|
||||||
|
|||||||
@@ -71,8 +71,6 @@ public class ItemMappings implements DefinitionRegistry<ItemDefinition> {
|
|||||||
|
|
||||||
List<ItemDefinition> buckets;
|
List<ItemDefinition> buckets;
|
||||||
List<ItemDefinition> boats;
|
List<ItemDefinition> boats;
|
||||||
|
|
||||||
List<ItemDefinition> componentItemData; // TODO get rid of?
|
|
||||||
Int2ObjectMap<String> customIdMappings;
|
Int2ObjectMap<String> customIdMappings;
|
||||||
|
|
||||||
Object2ObjectMap<CustomBlockData, ItemDefinition> customBlockItemDefinitions;
|
Object2ObjectMap<CustomBlockData, ItemDefinition> customBlockItemDefinitions;
|
||||||
|
|||||||
@@ -810,15 +810,9 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
sentSpawnPacket = true;
|
sentSpawnPacket = true;
|
||||||
syncEntityProperties();
|
syncEntityProperties();
|
||||||
|
|
||||||
if (GameProtocol.isPreCreativeInventoryRewrite(this.protocolVersion())) {
|
ItemComponentPacket componentPacket = new ItemComponentPacket();
|
||||||
ItemComponentPacket componentPacket = new ItemComponentPacket();
|
componentPacket.getItems().addAll(itemMappings.getItemDefinitions().values());
|
||||||
componentPacket.getItems().addAll(itemMappings.getComponentItemData());
|
upstream.sendPacket(componentPacket);
|
||||||
upstream.sendPacket(componentPacket);
|
|
||||||
} else {
|
|
||||||
ItemComponentPacket componentPacket = new ItemComponentPacket();
|
|
||||||
componentPacket.getItems().addAll(itemMappings.getItemDefinitions().values());
|
|
||||||
upstream.sendPacket(componentPacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false);
|
ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user