mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
* Remove Bedrock only banner patterns from the creative inventory * Add sound for tadpole bucket * Fix lily pad and frogspawn placing on mobile/single stacks * Workaround? Fix? for bucket usage on mobile * Simplify math and update position+rotation whenever ServerboundUseItemPacket is sent * Rotate the player back after using an item and fix glass bottles * ITEM_USE actionType 1 does not need the rotation fix Increase delay for look back * Add some checks * Prevent buckets and spawn eggs from being unintentionally placed when interacting with special blocks As of 1.19 Bedrock no longer sends a PlayerActionPacket with action=BLOCK_INTERACT. Bedrock now sends action=ITEM_USE_ON_START before and action=ITEM_USE_ON_STOP after using an item on a block. However, this is not useful as it is sent for all block interactions. * Fix inventory transactions being rejected after restoreCorrectBlock The held item's netId is always 0 in the InventoryTransactionPacket. * Touch ups * Fix lookAt for different poses and sneaking + cauldron + bucket interactions Fix boat items being desynced when placing them very close to collision Fix bottles being desynced when tapping above water Resend the held item if we do encounter a desync * Avoid getting blockstate twice and fix comment * Use generated interaction data * Fix glass bottles being double filled and phantom water bottles/water buckets * Don't update the entire inventory on useItem * Use Geyser's inventory copy for check * Use ItemTranslator#getBedrockItemMapping to avoid NBT translation * mappings Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
92 lines
4 KiB
Java
92 lines
4 KiB
Java
/*
|
|
* Copyright (c) 2019-2022 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
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*
|
|
* @author GeyserMC
|
|
* @link https://github.com/GeyserMC/Geyser
|
|
*/
|
|
|
|
package org.geysermc.geyser.registry;
|
|
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|
import org.geysermc.geyser.registry.loader.RegistryLoaders;
|
|
import org.geysermc.geyser.registry.populator.BlockRegistryPopulator;
|
|
import org.geysermc.geyser.registry.type.BlockMapping;
|
|
import org.geysermc.geyser.registry.type.BlockMappings;
|
|
import org.geysermc.geyser.util.collection.Object2IntBiMap;
|
|
|
|
/**
|
|
* Holds all the block registries in Geyser.
|
|
*/
|
|
public class BlockRegistries {
|
|
/**
|
|
* A versioned registry which holds {@link BlockMappings} for each version. These block mappings contain
|
|
* primarily Bedrock version-specific data.
|
|
*/
|
|
public static final VersionedRegistry<BlockMappings> BLOCKS = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new));
|
|
|
|
/**
|
|
* A mapped registry which stores Java to Bedrock block identifiers.
|
|
*/
|
|
public static final SimpleMappedRegistry<String, String> JAVA_TO_BEDROCK_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new));
|
|
|
|
/**
|
|
* A registry which stores Java IDs to {@link BlockMapping}, containing miscellaneous information about
|
|
* blocks and their behavior in many cases.
|
|
*/
|
|
public static final ArrayRegistry<BlockMapping> JAVA_BLOCKS = ArrayRegistry.create(RegistryLoaders.empty(() -> new BlockMapping[] {}));
|
|
|
|
/**
|
|
* A (bi)mapped registry containing the Java IDs to identifiers.
|
|
*/
|
|
public static final MappedRegistry<String, Integer, Object2IntBiMap<String>> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(Object2IntBiMap::new));
|
|
|
|
/**
|
|
* A registry which stores unique Java IDs to its clean identifier
|
|
* This is used in the statistics form.
|
|
*/
|
|
public static final ArrayRegistry<String> CLEAN_JAVA_IDENTIFIERS = ArrayRegistry.create(RegistryLoaders.empty(() -> new String[] {}));
|
|
|
|
/**
|
|
* A registry containing all the waterlogged blockstates.
|
|
*/
|
|
public static final SimpleRegistry<IntSet> WATERLOGGED = SimpleRegistry.create(RegistryLoaders.empty(IntOpenHashSet::new));
|
|
|
|
/**
|
|
* A registry containing all blockstates which are always interactive.
|
|
*/
|
|
public static final SimpleRegistry<IntSet> INTERACTIVE = SimpleRegistry.create(RegistryLoaders.empty(IntOpenHashSet::new));
|
|
|
|
/**
|
|
* A registry containing all blockstates which are interactive if the player has the may build permission.
|
|
*/
|
|
public static final SimpleRegistry<IntSet> INTERACTIVE_MAY_BUILD = SimpleRegistry.create(RegistryLoaders.empty(IntOpenHashSet::new));
|
|
|
|
static {
|
|
BlockRegistryPopulator.populate();
|
|
}
|
|
|
|
public static void init() {
|
|
// no-op
|
|
}
|
|
} |