2019-07-29 22:20:48 +00:00
|
|
|
/*
|
2022-01-01 19:03:05 +00:00
|
|
|
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
2019-07-29 22:20:48 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
package org.geysermc.geyser.registry.type;
|
2021-07-13 01:19:40 +00:00
|
|
|
|
2022-10-30 00:23:21 +00:00
|
|
|
import it.unimi.dsi.fastutil.Pair;
|
2021-07-13 01:19:40 +00:00
|
|
|
import lombok.Builder;
|
|
|
|
import lombok.EqualsAndHashCode;
|
|
|
|
import lombok.Value;
|
2022-10-10 19:40:07 +00:00
|
|
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
2022-10-30 16:34:08 +00:00
|
|
|
import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition;
|
2022-10-30 00:23:21 +00:00
|
|
|
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
2022-07-02 16:50:16 +00:00
|
|
|
import org.geysermc.geyser.api.item.custom.CustomItemOptions;
|
2021-07-13 01:19:40 +00:00
|
|
|
|
2022-10-10 19:40:07 +00:00
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
2021-11-15 01:15:25 +00:00
|
|
|
import java.util.Set;
|
|
|
|
|
2021-07-13 01:19:40 +00:00
|
|
|
@Value
|
|
|
|
@Builder
|
|
|
|
@EqualsAndHashCode
|
|
|
|
public class ItemMapping {
|
2022-10-30 00:23:21 +00:00
|
|
|
public static final ItemMapping AIR = new ItemMapping(
|
|
|
|
"minecraft:air",
|
|
|
|
"minecraft:air",
|
|
|
|
0,
|
|
|
|
ItemDefinition.AIR,
|
|
|
|
0,
|
2022-10-30 16:34:08 +00:00
|
|
|
null, // Air is never sent in full over the network for this to serialize.
|
2022-10-30 00:23:21 +00:00
|
|
|
64,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null
|
|
|
|
, Collections.emptyList(),
|
|
|
|
0,
|
|
|
|
null,
|
|
|
|
false
|
|
|
|
);
|
2021-07-13 01:19:40 +00:00
|
|
|
|
|
|
|
String javaIdentifier;
|
|
|
|
String bedrockIdentifier;
|
|
|
|
int javaId;
|
2022-10-30 00:23:21 +00:00
|
|
|
ItemDefinition bedrockDefinition;
|
2021-07-13 01:19:40 +00:00
|
|
|
int bedrockData;
|
|
|
|
|
2021-04-06 04:14:06 +00:00
|
|
|
/**
|
2021-04-08 23:32:06 +00:00
|
|
|
* The Bedrock block runtime ID to render this item with. The specific state *does* matter in how this item is rendered and used as a crafting ingredient.
|
2021-04-06 04:14:06 +00:00
|
|
|
* Required since 1.16.220.
|
|
|
|
*/
|
2022-10-30 16:34:08 +00:00
|
|
|
BlockDefinition bedrockBlockDefinition;
|
2021-07-13 01:19:40 +00:00
|
|
|
int stackSize;
|
2020-04-23 06:01:33 +00:00
|
|
|
|
2021-07-13 01:19:40 +00:00
|
|
|
String toolType;
|
|
|
|
String toolTier;
|
|
|
|
|
|
|
|
String translationString;
|
|
|
|
|
2022-10-10 19:40:07 +00:00
|
|
|
@NonNull
|
2022-10-30 00:23:21 +00:00
|
|
|
List<Pair<CustomItemOptions, ItemDefinition>> customItemOptions;
|
2022-07-02 16:50:16 +00:00
|
|
|
|
2021-11-15 01:15:25 +00:00
|
|
|
int maxDamage;
|
|
|
|
|
|
|
|
Set<String> repairMaterials;
|
|
|
|
|
2022-02-25 03:49:10 +00:00
|
|
|
boolean hasSuspiciousStewEffect;
|
|
|
|
|
2021-07-13 01:19:40 +00:00
|
|
|
/**
|
|
|
|
* Gets if this item is a block.
|
|
|
|
*
|
|
|
|
* @return if this item is a block
|
|
|
|
*/
|
2021-04-06 04:14:06 +00:00
|
|
|
public boolean isBlock() {
|
2022-10-30 16:34:08 +00:00
|
|
|
return this.bedrockBlockDefinition != null;
|
2021-04-06 04:14:06 +00:00
|
|
|
}
|
|
|
|
|
2021-07-13 01:19:40 +00:00
|
|
|
/**
|
|
|
|
* Gets if this item has a translation string present.
|
|
|
|
*
|
|
|
|
* @return if this item has a translation string present
|
|
|
|
*/
|
|
|
|
public boolean hasTranslation() {
|
|
|
|
return this.translationString != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets if this item is a tool.
|
|
|
|
*
|
|
|
|
* @return if this item is a tool
|
|
|
|
*/
|
|
|
|
public boolean isTool() {
|
|
|
|
return this.toolType != null;
|
2019-07-30 02:25:13 +00:00
|
|
|
}
|
2022-07-02 16:50:16 +00:00
|
|
|
}
|