Port to 1.18.2 (#2824)

* Port to 1.18.2-pre1

* 1.18.2-pre3

* Fix build.

* Fixes and cleanup

* Build fix?

* Update REI
This commit is contained in:
modmuss50 2022-02-28 09:18:27 +00:00 committed by GitHub
parent 4465ffa1aa
commit f7d5139332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 406 additions and 393 deletions

View file

@ -26,7 +26,6 @@ package techreborn.init;
import com.google.common.base.Preconditions;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.minecraft.block.*;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
@ -35,9 +34,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.Pair;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import reborncore.api.blockentity.IUpgrade;
@ -397,7 +398,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> ORES_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "ores"));
public static final TagKey<Item> ORES_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "ores"));
private final static Map<Ores, Ores> deepslateMap = new HashMap<>();
@ -437,7 +438,7 @@ public class TRContent {
public final String name;
public final Block block;
public final OreDistribution distribution;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
Ores(OreDistribution distribution, UniformIntProvider experienceDroppedFallback) {
name = this.toString().toLowerCase(Locale.ROOT);
@ -449,7 +450,7 @@ public class TRContent {
distribution != null ? distribution.experienceDropped : experienceDroppedFallback
);
InitUtils.setup(block, name + "_ore");
tag = TagFactory.ITEM.create(new Identifier("c",
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c",
(name.startsWith("deepslate_") ? name.substring(name.indexOf('_')+1): name) + "_ores"));
this.distribution = distribution;
}
@ -470,7 +471,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -495,7 +496,7 @@ public class TRContent {
*/
public static final String CHROME_TAG_NAME_BASE = "chromium";
public static final Tag.Identified<Item> STORAGE_BLOCK_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "storage_blocks"));
public static final TagKey<Item> STORAGE_BLOCK_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "storage_blocks"));
public enum StorageBlocks implements ItemConvertible, TagConvertible<Item> {
ADVANCED_ALLOY(5f, 6f),
@ -536,13 +537,13 @@ public class TRContent {
private final StairsBlock stairsBlock;
private final SlabBlock slabBlock;
private final WallBlock wallBlock;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
StorageBlocks(boolean isHot, float hardness, float resistance, String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
block = new BlockStorage(isHot, hardness, resistance);
InitUtils.setup(block, name + "_storage_block");
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block));
InitUtils.setup(stairsBlock, name + "_storage_block_stairs");
@ -572,7 +573,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -718,7 +719,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> DUSTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "dusts"));
public static final TagKey<Item> DUSTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "dusts"));
public enum Dusts implements ItemConvertible, TagConvertible<Item> {
ALMANDINE, ALUMINUM, AMETHYST, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
@ -729,13 +730,13 @@ public class TRContent {
private final String name;
private final Item item;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
Dusts(String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_dust");
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
}
Dusts() {
@ -756,12 +757,12 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
}
public static final Tag.Identified<Item> RAW_METALS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "raw_metals"));
public static final TagKey<Item> RAW_METALS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "raw_metals"));
public enum RawMetals implements ItemConvertible, TagConvertible<Item> {
IRIDIUM, LEAD, SILVER, TIN, TUNGSTEN;
@ -769,7 +770,7 @@ public class TRContent {
private final String name;
private final Item item;
private final ItemConvertible storageBlock;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
RawMetals() {
name = this.toString().toLowerCase(Locale.ROOT);
@ -783,7 +784,7 @@ public class TRContent {
}
storageBlock = blockVariant;
InitUtils.setup(item, "raw_" + name);
tag = TagFactory.ITEM.create(new Identifier("c", "raw_" + name + "_ores"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", "raw_" + name + "_ores"));
}
@Override
@ -792,7 +793,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -813,7 +814,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> SMALL_DUSTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "small_dusts"));
public static final TagKey<Item> SMALL_DUSTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "small_dusts"));
public enum SmallDusts implements ItemConvertible, TagConvertible<Item> {
ALMANDINE, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
@ -826,7 +827,7 @@ public class TRContent {
private final String name;
private final Item item;
private final ItemConvertible dust;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
SmallDusts(String tagNameBase, ItemConvertible dustVariant) {
name = this.toString().toLowerCase(Locale.ROOT);
@ -840,7 +841,7 @@ public class TRContent {
}
dust = dustVariant;
InitUtils.setup(item, name + "_small_dust");
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
}
SmallDusts(String tagNameBase) {
@ -869,7 +870,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -893,7 +894,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> GEMS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "gems"));
public static final TagKey<Item> GEMS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "gems"));
public enum Gems implements ItemConvertible, TagConvertible<Item> {
PERIDOT, RED_GARNET, RUBY("rubies"), SAPPHIRE("sapphires"), YELLOW_GARNET;
@ -901,7 +902,7 @@ public class TRContent {
private final String name;
private final Item item;
private final ItemConvertible storageBlock;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
Gems(String tagPlural) {
name = this.toString().toLowerCase(Locale.ROOT);
@ -915,7 +916,7 @@ public class TRContent {
}
storageBlock = blockVariant;
InitUtils.setup(item, name + "_gem");
tag = TagFactory.ITEM.create(new Identifier("c", tagPlural == null ? name + "_gems" : tagPlural));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", tagPlural == null ? name + "_gems" : tagPlural));
}
Gems() {
@ -936,7 +937,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -957,7 +958,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> INGOTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "ingots"));
public static final TagKey<Item> INGOTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "ingots"));
public enum Ingots implements ItemConvertible, TagConvertible<Item> {
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), ELECTRUM, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM_ALLOY, IRIDIUM,
@ -966,7 +967,7 @@ public class TRContent {
private final String name;
private final Item item;
private final ItemConvertible storageBlock;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
Ingots(String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
@ -980,7 +981,7 @@ public class TRContent {
}
storageBlock = blockVariant;
InitUtils.setup(item, name + "_ingot");
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
}
Ingots() {
@ -1001,7 +1002,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -1022,7 +1023,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> NUGGETS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "nuggets"));
public static final TagKey<Item> NUGGETS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "nuggets"));
public enum Nuggets implements ItemConvertible, TagConvertible<Item> {
ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), COPPER(Items.COPPER_INGOT, false), DIAMOND(Items.DIAMOND, true),
@ -1033,7 +1034,7 @@ public class TRContent {
private final Item item;
private final ItemConvertible ingot;
private final boolean ofGem;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
Nuggets(String tagNameBase, ItemConvertible ingotVariant, boolean ofGem) {
name = this.toString().toLowerCase(Locale.ROOT);
@ -1048,7 +1049,7 @@ public class TRContent {
ingot = ingotVariant;
this.ofGem = ofGem;
InitUtils.setup(item, name + "_nugget");
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
}
Nuggets(ItemConvertible ingotVariant, boolean ofGem) {
@ -1077,7 +1078,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
@ -1179,7 +1180,7 @@ public class TRContent {
}
}
public static final Tag.Identified<Item> PLATES_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "plates"));
public static final TagKey<Item> PLATES_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "plates"));
public enum Plates implements ItemConvertible, TagConvertible<Item> {
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CARBON, CHROME(CHROME_TAG_NAME_BASE), COAL, COPPER, DIAMOND, ELECTRUM, EMERALD, GOLD, INVAR,
@ -1189,13 +1190,13 @@ public class TRContent {
private final String name;
private final Item item;
private final Tag.Identified<Item> tag;
private final TagKey<Item> tag;
Plates(String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_plate");
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
}
Plates() {
@ -1216,7 +1217,7 @@ public class TRContent {
}
@Override
public Tag.Identified<Item> asTag() {
public TagKey<Item> asTag() {
return tag;
}
}