diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 7d6a697..876916f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -32,7 +32,7 @@ jobs: files-secondary: build/libs/*-@(dev|sources).jar version-type: beta loaders: forge - game-versions: 1.18.1 + game-versions: 1.18.2 java: 17 name: "" changelog: "https://github.com/Buuz135/SushiGoCrafting/commits/1.18" diff --git a/build.gradle b/build.gradle index 70a5fd0..7463157 100644 --- a/build.gradle +++ b/build.gradle @@ -35,7 +35,7 @@ sourceSets.main.resources { } minecraft { - mappings channel: 'official', version: '1.18.1' + mappings channel: 'official', version: '1.18.2' runs { client = { property 'mixin.env.remapRefMap', 'true' @@ -85,14 +85,14 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.18.1-39.0.36' - compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.2.1.69") + minecraft 'net.minecraftforge:forge:1.18.2-40.0.36' + compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174") // at runtime, use the full JEI jar - runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.2.1.69") - compileOnly fg.deobf ('com.hrznstudio:titanium:1.18-3.4.0-27') - runtimeOnly fg.deobf ('com.hrznstudio:titanium:1.18-3.4.0-27') - compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-64:api") - runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-64") + runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174") + compileOnly fg.deobf ('com.hrznstudio:titanium:1.18.2-3.5.0-32') + runtimeOnly fg.deobf ('com.hrznstudio:titanium:1.18.2-3.5.0-32') + compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.2-67:api") + runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.2-67") //runtimeOnly fg.deobf("curse.maven:diet-443570:3300992") //runtimeOnly fg.deobf("curse.maven:appleskin-248787:3395800") compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-1.18.1:9.0.0+30") diff --git a/gradle.properties b/gradle.properties index 838563c..26b2153 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx2G modGroup=com.buuz135 -modVersion=0.3.2 +modVersion=0.3.3 modBaseName=sushigocrafting -minecraftVersion=1.18.1 \ No newline at end of file +minecraftVersion=1.18.2 \ No newline at end of file diff --git a/src/main/java/com/buuz135/sushigocrafting/SushiGoCrafting.java b/src/main/java/com/buuz135/sushigocrafting/SushiGoCrafting.java index b80f2d5..b546649 100644 --- a/src/main/java/com/buuz135/sushigocrafting/SushiGoCrafting.java +++ b/src/main/java/com/buuz135/sushigocrafting/SushiGoCrafting.java @@ -14,6 +14,7 @@ import com.buuz135.sushigocrafting.recipe.CuttingBoardRecipe; import com.buuz135.sushigocrafting.recipe.FermentingBarrelRecipe; import com.buuz135.sushigocrafting.tile.machinery.*; +import com.buuz135.sushigocrafting.world.SeaWeedFeatureHolders; import com.buuz135.sushigocrafting.world.SushiTab; import com.buuz135.sushigocrafting.world.tree.AvocadoTree; import com.hrznstudio.titanium.event.handler.EventManager; @@ -23,10 +24,8 @@ import com.hrznstudio.titanium.reward.Reward; import com.hrznstudio.titanium.reward.RewardGiver; import com.hrznstudio.titanium.reward.RewardManager; -import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.data.tags.BlockTagsProvider; -import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Containers; @@ -38,6 +37,7 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.Level; @@ -46,10 +46,6 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; -import net.minecraft.world.level.levelgen.placement.*; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; @@ -112,17 +108,22 @@ public SushiGoCrafting() { CuttingBoardRecipe.SERIALIZER, FermentingBarrelRecipe.SERIALIZER )).subscribe(); - for (IFoodType value : FoodAPI.get().getFoodTypes()) { - FoodHelper.generateFood(value).forEach(item -> SushiContent.Items.REGISTRY.register(FoodHelper.getName(item), () -> item)); - } + EventManager.modGeneric(RegistryEvent.Register.class, Item.class).process(register -> { + for (IFoodType value : FoodAPI.get().getFoodTypes()) { + FoodHelper.generateFood(value).forEach(item -> { + var itemConfigured = item.setRegistryName(new ResourceLocation(MOD_ID, FoodHelper.getName(item))); + ((RegistryEvent.Register) register).getRegistry().register(itemConfigured); + }); + } + }).subscribe(); NBTManager.getInstance().scanTileClassForAnnotations(RollerTile.class); NBTManager.getInstance().scanTileClassForAnnotations(RiceCookerTile.class); NBTManager.getInstance().scanTileClassForAnnotations(CuttingBoardTile.class); NBTManager.getInstance().scanTileClassForAnnotations(CoolerBoxTile.class); NBTManager.getInstance().scanTileClassForAnnotations(FermentationBarrelTile.class); EventManager.forge(BiomeLoadingEvent.class).filter(biomeLoadingEvent -> biomeLoadingEvent.getCategory() == Biome.BiomeCategory.OCEAN).process(biomeLoadingEvent -> { - biomeLoadingEvent.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, - SushiContent.Features.SEAWEED.get().configured(FeatureConfiguration.NONE).placed(NoiseBasedCountPlacement.of(80, 80.0D, 0.0D), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome())); + biomeLoadingEvent.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, SeaWeedFeatureHolders.PLACEMENT); + //holder.configured(FeatureConfiguration.NONE).placed(NoiseBasedCountPlacement.of(80, 80.0D, 0.0D), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome())); //.decorated(Features.Decorators.TOP_SOLID_HEIGHTMAP.squared().decorated(FeatureDecorator.COUNT_NOISE_BIASED.configured(new NoiseCountFactorDecoratorConfiguration(80, 80.0D, 0.0D))))); }).subscribe(); EventManager.forge(BiomeLoadingEvent.class).filter(biomeLoadingEvent -> biomeLoadingEvent.getCategory() == Biome.BiomeCategory.OCEAN || biomeLoadingEvent.getCategory() == Biome.BiomeCategory.RIVER).process(biomeLoadingEvent -> { @@ -135,8 +136,8 @@ public SushiGoCrafting() { SpawnPlacements.register(SushiContent.EntityTypes.TUNA.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, AbstractFish::checkMobSpawnRules); }).subscribe(); EventManager.forge(BiomeLoadingEvent.class).filter(biomeLoadingEvent -> biomeLoadingEvent.getCategory() == Biome.BiomeCategory.PLAINS).process(biomeLoadingEvent -> { - biomeLoadingEvent.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, - Feature.TREE.configured(AvocadoTree.TREE).placed(PlacementUtils.countExtra(0, 0.05F, 1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0), PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(Blocks.OAK_SAPLING.defaultBlockState(), BlockPos.ZERO)), BiomeFilter.biome())); + biomeLoadingEvent.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, AvocadoTree.PLACEMENT); + //Feature.TREE.configured(AvocadoTree.TREE).placed(PlacementUtils.countExtra(0, 0.05F, 1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0), PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(Blocks.OAK_SAPLING.defaultBlockState(), BlockPos.ZERO)), BiomeFilter.biome())); //.decorated(Features.Decorators.HEIGHTMAP_SQUARE) //.decorated(FeatureDecorator.CHANCE.configured(new ChanceDecoratorConfiguration(6)))); }).subscribe(); diff --git a/src/main/java/com/buuz135/sushigocrafting/api/impl/FoodIngredient.java b/src/main/java/com/buuz135/sushigocrafting/api/impl/FoodIngredient.java index a59ce07..67152b6 100644 --- a/src/main/java/com/buuz135/sushigocrafting/api/impl/FoodIngredient.java +++ b/src/main/java/com/buuz135/sushigocrafting/api/impl/FoodIngredient.java @@ -20,10 +20,10 @@ public class FoodIngredient implements IFoodIngredient { public static FoodIngredient EMPTY = new FoodIngredient("empty", null, 0, IIngredientConsumer.WEIGHT, null, null, 0, 0, DietType.SUGARS); public static FoodIngredient RICE = new FoodIngredient("rice", SushiContent.Items.COOKED_RICE, 30, IIngredientConsumer.WEIGHT, null, new ModifyIngredientEffect(1.75f, 0), 0, 2, DietType.GRAINS); public static FoodIngredient NORI = new FoodIngredient("nori", SushiContent.Items.NORI_SHEET, 1, IIngredientConsumer.STACK, null, null, 1, 1, DietType.VEGETABLES); - public static FoodIngredient TUNA_FILLET = new FoodIngredient("tuna", SushiContent.Items.RAW_TUNA_FILLET, 30, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.createOptional(new ResourceLocation("forge", "raw_fishes/tuna"))), new AddIngredientEffect(SushiContent.Effects.ACQUIRED_TASTE, 30, 0), 3, 1, DietType.PROTEINS); - public static FoodIngredient SALMON_FILLET = new FoodIngredient("salmon", SushiContent.Items.RAW_SALMON_FILLET, 30, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.createOptional(new ResourceLocation("forge", "raw_fishes/salmon"))), new AddIngredientEffect(SushiContent.Effects.SMALL_BITES, 30, 0), 3, 1, DietType.PROTEINS); - public static FoodIngredient AVOCADO = new FoodIngredient("avocado", SushiContent.Items.AVOCADO_SLICES, 45, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.createOptional(new ResourceLocation("forge", "fruits/avocado"))), new ModifyIngredientEffect(1.20f, 1), 2, 2, DietType.FRUITS); - public static FoodIngredient CUCUMBER = new FoodIngredient("cucumber", SushiContent.Items.CUCUMBER_SLICES, 15, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.createOptional(new ResourceLocation("forge", "crops/cucumber"))), new ModifyIngredientEffect(1.25f, 0), 2, 2, DietType.VEGETABLES); + public static FoodIngredient TUNA_FILLET = new FoodIngredient("tuna", SushiContent.Items.RAW_TUNA_FILLET, 30, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.create(new ResourceLocation("forge", "raw_fishes/tuna"))), new AddIngredientEffect(SushiContent.Effects.ACQUIRED_TASTE, 30, 0), 3, 1, DietType.PROTEINS); + public static FoodIngredient SALMON_FILLET = new FoodIngredient("salmon", SushiContent.Items.RAW_SALMON_FILLET, 30, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.create(new ResourceLocation("forge", "raw_fishes/salmon"))), new AddIngredientEffect(SushiContent.Effects.SMALL_BITES, 30, 0), 3, 1, DietType.PROTEINS); + public static FoodIngredient AVOCADO = new FoodIngredient("avocado", SushiContent.Items.AVOCADO_SLICES, 45, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.create(new ResourceLocation("forge", "fruits/avocado"))), new ModifyIngredientEffect(1.20f, 1), 2, 2, DietType.FRUITS); + public static FoodIngredient CUCUMBER = new FoodIngredient("cucumber", SushiContent.Items.CUCUMBER_SLICES, 15, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.create(new ResourceLocation("forge", "crops/cucumber"))), new ModifyIngredientEffect(1.25f, 0), 2, 2, DietType.VEGETABLES); public static FoodIngredient SESAME = new FoodIngredient("sesame", SushiContent.Items.SESAME_SEED, 6, IIngredientConsumer.WEIGHT, null, new ModifyIngredientEffect(2, 0), 1, 1, DietType.GRAINS); public static FoodIngredient CRAB = new FoodIngredient("crab", SushiContent.Items.IMITATION_CRAB, 30, IIngredientConsumer.WEIGHT, () -> Ingredient.of(Items.COD), new AddIngredientEffect(() -> MobEffects.MOVEMENT_SPEED, 3, 0), 2, 1, DietType.PROTEINS); public static FoodIngredient WAKAME = new FoodIngredient("wakame", () -> Items.SEAGRASS, 1, IIngredientConsumer.STACK, null, null, 0, 1, DietType.VEGETABLES); @@ -32,7 +32,7 @@ public class FoodIngredient implements IFoodIngredient { public static FoodIngredient SHRIMP = new FoodIngredient("shrimp", SushiContent.Items.SHRIMP, 30, IIngredientConsumer.WEIGHT, null, new AddIngredientEffect(SushiContent.Effects.STEADY_HANDS, 60, 0), 2, 1, DietType.PROTEINS); public static FoodIngredient CHICKEN = new FoodIngredient("chicken", () -> Items.COOKED_CHICKEN, 30, IIngredientConsumer.WEIGHT, null, new AddIngredientEffect(() -> MobEffects.SLOW_FALLING, 10, 0), 2, 1, DietType.PROTEINS); public static FoodIngredient SOY_SAUCE = new FoodIngredient("soy_sauce", SushiContent.Items.SOY_SAUCE, 4, IIngredientConsumer.WEIGHT, null, new ModifyIngredientEffect(1, 1), 0, 0, DietType.GRAINS); - public static FoodIngredient WASABI = new FoodIngredient("wasabi", SushiContent.Items.WASABI_PASTE, 4, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.createOptional(new ResourceLocation("forge", "crops/wasabi_root"))), new AddIngredientEffect(() -> MobEffects.FIRE_RESISTANCE, 10, 0), 0, 0, DietType.VEGETABLES); + public static FoodIngredient WASABI = new FoodIngredient("wasabi", SushiContent.Items.WASABI_PASTE, 4, IIngredientConsumer.WEIGHT, () -> Ingredient.of(ItemTags.create(new ResourceLocation("forge", "crops/wasabi_root"))), new AddIngredientEffect(() -> MobEffects.FIRE_RESISTANCE, 10, 0), 0, 0, DietType.VEGETABLES); private final Supplier item; private final String name; diff --git a/src/main/java/com/buuz135/sushigocrafting/block/machinery/CoolerBoxBlock.java b/src/main/java/com/buuz135/sushigocrafting/block/machinery/CoolerBoxBlock.java index b22e9f5..b8415c1 100644 --- a/src/main/java/com/buuz135/sushigocrafting/block/machinery/CoolerBoxBlock.java +++ b/src/main/java/com/buuz135/sushigocrafting/block/machinery/CoolerBoxBlock.java @@ -1,6 +1,5 @@ package com.buuz135.sushigocrafting.block.machinery; -import com.buuz135.sushigocrafting.proxy.SushiContent; import com.buuz135.sushigocrafting.tile.machinery.CoolerBoxTile; import com.hrznstudio.titanium.block.RotatableBlock; import net.minecraft.ChatFormatting; @@ -49,12 +48,6 @@ public Item asItem() { return Item.byBlock(this); } - @Override - public BlockEntityType getTileEntityType() { - return SushiContent.TileEntities.COOLER_BOX.get(); - } - - @Nonnull @Override public RotationType getRotationType() { diff --git a/src/main/java/com/buuz135/sushigocrafting/block/machinery/CuttingBoardBlock.java b/src/main/java/com/buuz135/sushigocrafting/block/machinery/CuttingBoardBlock.java index 74765a3..7cb29f6 100644 --- a/src/main/java/com/buuz135/sushigocrafting/block/machinery/CuttingBoardBlock.java +++ b/src/main/java/com/buuz135/sushigocrafting/block/machinery/CuttingBoardBlock.java @@ -1,6 +1,5 @@ package com.buuz135.sushigocrafting.block.machinery; -import com.buuz135.sushigocrafting.proxy.SushiContent; import com.buuz135.sushigocrafting.tile.machinery.CuttingBoardTile; import com.hrznstudio.titanium.block.RotatableBlock; import net.minecraft.core.BlockPos; @@ -30,11 +29,6 @@ public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { return CuttingBoardTile::new; } - @Override - public BlockEntityType getTileEntityType() { - return SushiContent.TileEntities.CUTTING_BOARD.get(); - } - @Override public Item asItem() { return Item.byBlock(this); diff --git a/src/main/java/com/buuz135/sushigocrafting/block/machinery/FermentationBarrelBlock.java b/src/main/java/com/buuz135/sushigocrafting/block/machinery/FermentationBarrelBlock.java index 7d8015a..34a880a 100644 --- a/src/main/java/com/buuz135/sushigocrafting/block/machinery/FermentationBarrelBlock.java +++ b/src/main/java/com/buuz135/sushigocrafting/block/machinery/FermentationBarrelBlock.java @@ -1,6 +1,5 @@ package com.buuz135.sushigocrafting.block.machinery; -import com.buuz135.sushigocrafting.proxy.SushiContent; import com.buuz135.sushigocrafting.tile.machinery.FermentationBarrelTile; import com.hrznstudio.titanium.block.RotatableBlock; import net.minecraft.core.BlockPos; @@ -51,11 +50,6 @@ public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { return FermentationBarrelTile::new; } - @Override - public BlockEntityType getTileEntityType() { - return SushiContent.TileEntities.FERMENTATION_BARREL.get(); - } - @Override public RotationType getRotationType() { return RotationType.NONE; diff --git a/src/main/java/com/buuz135/sushigocrafting/block/machinery/RiceCookerBlock.java b/src/main/java/com/buuz135/sushigocrafting/block/machinery/RiceCookerBlock.java index 98d2367..1a74c25 100644 --- a/src/main/java/com/buuz135/sushigocrafting/block/machinery/RiceCookerBlock.java +++ b/src/main/java/com/buuz135/sushigocrafting/block/machinery/RiceCookerBlock.java @@ -1,6 +1,5 @@ package com.buuz135.sushigocrafting.block.machinery; -import com.buuz135.sushigocrafting.proxy.SushiContent; import com.buuz135.sushigocrafting.tile.machinery.RiceCookerTile; import com.hrznstudio.titanium.block.RotatableBlock; import net.minecraft.core.BlockPos; @@ -126,11 +125,6 @@ public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { return RiceCookerTile::new; } - @Override - public BlockEntityType getTileEntityType() { - return SushiContent.TileEntities.RICE_COOKER.get(); - } - @Override public RotationType getRotationType() { return RotationType.FOUR_WAY; diff --git a/src/main/java/com/buuz135/sushigocrafting/block/machinery/RollerBlock.java b/src/main/java/com/buuz135/sushigocrafting/block/machinery/RollerBlock.java index 6f1fe34..e1fc4ea 100644 --- a/src/main/java/com/buuz135/sushigocrafting/block/machinery/RollerBlock.java +++ b/src/main/java/com/buuz135/sushigocrafting/block/machinery/RollerBlock.java @@ -1,6 +1,5 @@ package com.buuz135.sushigocrafting.block.machinery; -import com.buuz135.sushigocrafting.proxy.SushiContent; import com.buuz135.sushigocrafting.tile.machinery.RollerTile; import com.hrznstudio.titanium.block.RotatableBlock; import net.minecraft.core.BlockPos; @@ -37,11 +36,6 @@ public Item asItem() { return Item.byBlock(this); } - @Override - public BlockEntityType getTileEntityType() { - return SushiContent.TileEntities.ROLLER.get(); - } - @Override public void attack(BlockState state, Level worldIn, BlockPos pos, Player player) { this.getTile(worldIn, pos).ifPresent(rollerTile -> rollerTile.onClick(player)); diff --git a/src/main/java/com/buuz135/sushigocrafting/block/plant/AvocadoLeavesBlock.java b/src/main/java/com/buuz135/sushigocrafting/block/plant/AvocadoLeavesBlock.java index 73bdb8c..e2555fc 100644 --- a/src/main/java/com/buuz135/sushigocrafting/block/plant/AvocadoLeavesBlock.java +++ b/src/main/java/com/buuz135/sushigocrafting/block/plant/AvocadoLeavesBlock.java @@ -31,6 +31,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.IForgeShearable; import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraftforge.registries.ForgeRegistries; import java.util.Random; @@ -60,7 +61,7 @@ private static BlockState updateDistance(BlockState state, LevelAccessor worldIn } private static int getDistance(BlockState neighbor) { - if (BlockTags.LOGS.contains(neighbor.getBlock())) { + if (ForgeRegistries.BLOCKS.tags().getTag(BlockTags.LOGS).contains(neighbor.getBlock())) { return 0; } else { return neighbor.getBlock() instanceof AvocadoLeavesBlock || neighbor.getBlock() instanceof LeavesBlock ? neighbor.getValue(DISTANCE) : 7; diff --git a/src/main/java/com/buuz135/sushigocrafting/datagen/SushiItemTagsProvider.java b/src/main/java/com/buuz135/sushigocrafting/datagen/SushiItemTagsProvider.java index 9d983d8..e651963 100644 --- a/src/main/java/com/buuz135/sushigocrafting/datagen/SushiItemTagsProvider.java +++ b/src/main/java/com/buuz135/sushigocrafting/datagen/SushiItemTagsProvider.java @@ -35,25 +35,25 @@ public void addTags() { this.copy(BlockTags.SAPLINGS, ItemTags.SAPLINGS); for (CustomCropBlock block : new CustomCropBlock[]{SushiContent.Blocks.RICE_CROP.get(), SushiContent.Blocks.CUCUMBER_CROP.get(), SushiContent.Blocks.SOY_CROP.get(), SushiContent.Blocks.WASABI_CROP.get(), SushiContent.Blocks.SESAME_CROP.get()}) { tag(Tags.Items.SEEDS).add(block.getBaseSeedId().asItem()); - tag(ItemTags.createOptional(new ResourceLocation("forge", "seeds/" + block.getBaseSeedId().asItem().getRegistryName().getPath()))).add(block.getBaseSeedId().asItem()); + tag(ItemTags.create(new ResourceLocation("forge", "seeds/" + block.getBaseSeedId().asItem().getRegistryName().getPath()))).add(block.getBaseSeedId().asItem()); } for (Item item : new Item[]{SushiContent.Items.RICE.get(), SushiContent.Items.CUCUMBER.get(), SushiContent.Items.SOY_BEAN.get(), SushiContent.Items.WASABI_ROOT.get(), SushiContent.Items.SESAME_SEED.get()}) { tag(Tags.Items.CROPS).add(item); - tag(ItemTags.createOptional(new ResourceLocation("forge", "crops/" + item.getRegistryName().getPath()))).add(item.asItem()); + tag(ItemTags.create(new ResourceLocation("forge", "crops/" + item.getRegistryName().getPath()))).add(item.asItem()); } tag(ItemTags.FISHES).add(SushiContent.Items.RAW_TUNA.get()).add(SushiContent.Items.SHRIMP.get()); - tag(ItemTags.createOptional(new ResourceLocation("forge", "raw_fishes"))).add(Items.SALMON).add(SushiContent.Items.SHRIMP.get()).add(SushiContent.Items.RAW_TUNA.get()); + tag(ItemTags.create(new ResourceLocation("forge", "raw_fishes"))).add(Items.SALMON).add(SushiContent.Items.SHRIMP.get()).add(SushiContent.Items.RAW_TUNA.get()); for (Item item : new Item[]{Items.SALMON, SushiContent.Items.SHRIMP.get(), SushiContent.Items.RAW_TUNA.get()}) { - tag(ItemTags.createOptional(new ResourceLocation("forge", "raw_fishes/" + (item.equals(SushiContent.Items.RAW_TUNA.get()) ? "tuna" : item.getRegistryName().getPath())))).add(item.asItem()); + tag(ItemTags.create(new ResourceLocation("forge", "raw_fishes/" + (item.equals(SushiContent.Items.RAW_TUNA.get()) ? "tuna" : item.getRegistryName().getPath())))).add(item.asItem()); } - tag(ItemTags.createOptional(new ResourceLocation("forge", "fruits"))).add(SushiContent.Items.AVOCADO.get()); - tag(ItemTags.createOptional(new ResourceLocation("forge", "fruits/avocado"))).add(SushiContent.Items.AVOCADO.get()); - tag(ItemTags.createOptional(new ResourceLocation("forge", "tools/knife"))).add(SushiContent.Items.KNIFE_CLEAVER.get()); + tag(ItemTags.create(new ResourceLocation("forge", "fruits"))).add(SushiContent.Items.AVOCADO.get()); + tag(ItemTags.create(new ResourceLocation("forge", "fruits/avocado"))).add(SushiContent.Items.AVOCADO.get()); + tag(ItemTags.create(new ResourceLocation("forge", "tools/knife"))).add(SushiContent.Items.KNIFE_CLEAVER.get()); for (Map.Entry> stringListEntry : FoodHelper.REGISTERED.entrySet()) { for (FoodItem foodItem : stringListEntry.getValue()) { for (IFoodIngredient foodIngredient : foodItem.getIngredientList()) { if (!foodIngredient.isEmpty()) { - tag(ItemTags.createOptional(new ResourceLocation("diet", foodIngredient.getDietType().name().toLowerCase(Locale.ROOT)))).add(foodItem); + tag(ItemTags.create(new ResourceLocation("diet", foodIngredient.getDietType().name().toLowerCase(Locale.ROOT)))).add(foodItem); } } } diff --git a/src/main/java/com/buuz135/sushigocrafting/datagen/SushiSerializableProvider.java b/src/main/java/com/buuz135/sushigocrafting/datagen/SushiSerializableProvider.java index c72e563..73b272e 100644 --- a/src/main/java/com/buuz135/sushigocrafting/datagen/SushiSerializableProvider.java +++ b/src/main/java/com/buuz135/sushigocrafting/datagen/SushiSerializableProvider.java @@ -37,7 +37,7 @@ public void add(Map map) { } } new FermentingBarrelRecipe(new ResourceLocation(SushiGoCrafting.MOD_ID, "cheese"), Ingredient.EMPTY, new FluidStack(ForgeMod.MILK.get(), 250), new ItemStack(SushiContent.Items.CHEESE.get())); - new FermentingBarrelRecipe(new ResourceLocation(SushiGoCrafting.MOD_ID, "soy"), Ingredient.of(ItemTags.createOptional(new ResourceLocation("forge", "crops/soy_bean"))), new FluidStack(Fluids.WATER, 250), new ItemStack(SushiContent.Items.SOY_SAUCE.get())); + new FermentingBarrelRecipe(new ResourceLocation(SushiGoCrafting.MOD_ID, "soy"), Ingredient.of(ItemTags.create(new ResourceLocation("forge", "crops/soy_bean"))), new FluidStack(Fluids.WATER, 250), new ItemStack(SushiContent.Items.SOY_SAUCE.get())); FermentingBarrelRecipe.RECIPES.forEach(fermentingBarrelRecipe -> map.put(fermentingBarrelRecipe, fermentingBarrelRecipe)); } } diff --git a/src/main/java/com/buuz135/sushigocrafting/proxy/SushiContent.java b/src/main/java/com/buuz135/sushigocrafting/proxy/SushiContent.java index dee1747..0c7d0ea 100644 --- a/src/main/java/com/buuz135/sushigocrafting/proxy/SushiContent.java +++ b/src/main/java/com/buuz135/sushigocrafting/proxy/SushiContent.java @@ -237,7 +237,7 @@ public static RegistryObject> getShrimp() { public static class LootSerializers { - public static final DeferredRegister> REGISTRY = DeferredRegister.create(ForgeRegistries.LOOT_MODIFIER_SERIALIZERS, SushiGoCrafting.MOD_ID); + public static final DeferredRegister> REGISTRY = DeferredRegister.create(ForgeRegistries.Keys.LOOT_MODIFIER_SERIALIZERS, SushiGoCrafting.MOD_ID); public static final RegistryObject> SEEDS = lootSerializer("grass_seeds", SeedsLootModifier.Serializer::new); public static final RegistryObject> ITEM_AMOUNT = lootSerializer("item_amount", ItemAmountLootModifier.Serializer::new); diff --git a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CoolerBoxTile.java b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CoolerBoxTile.java index 6d98427..2c356d2 100644 --- a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CoolerBoxTile.java +++ b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CoolerBoxTile.java @@ -24,7 +24,7 @@ public class CoolerBoxTile extends ActiveTile { private final InventoryComponent input; public CoolerBoxTile(BlockPos pos, BlockState state) { - super(SushiContent.Blocks.COOLER_BOX.get(), pos, state); + super(SushiContent.Blocks.COOLER_BOX.get(), SushiContent.TileEntities.COOLER_BOX.get(), pos, state); this.addInventory(this.input = new InventoryComponent("input", 44, 20, 5 * 4) .setRange(5, 4) .setInputFilter((stack, integer) -> stack.getItem() instanceof AmountItem) diff --git a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CuttingBoardTile.java b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CuttingBoardTile.java index f5e1248..fe5dd13 100644 --- a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CuttingBoardTile.java +++ b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/CuttingBoardTile.java @@ -12,7 +12,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -20,12 +20,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nonnull; public class CuttingBoardTile extends ActiveTile { - public static Tag KNIFE = TagUtil.getItemTag(new ResourceLocation("forge", "tools/knife")); + public static TagKey KNIFE = TagUtil.getItemTag(new ResourceLocation("forge", "tools/knife")); @Save private final InventoryComponent input; @@ -33,7 +34,7 @@ public class CuttingBoardTile extends ActiveTile { private int click; public CuttingBoardTile(BlockPos pos, BlockState state) { - super(SushiContent.Blocks.CUTTING_BOARD.get(), pos, state); + super(SushiContent.Blocks.CUTTING_BOARD.get(), SushiContent.TileEntities.CUTTING_BOARD.get(), pos, state); this.addInventory(this.input = new InventoryComponent("input", 0, 0, 1) .setInputFilter((stack, integer) -> accepts(stack)) ); @@ -44,7 +45,7 @@ public CuttingBoardTile(BlockPos pos, BlockState state) { public InteractionResult onActivated(Player player, InteractionHand hand, Direction facing, double hitX, double hitY, double hitZ) { ItemStack stack = player.getItemInHand(hand); if (!stack.isEmpty()) { - if (!this.input.getStackInSlot(0).isEmpty() && stack.is(KNIFE)) { + if (!this.input.getStackInSlot(0).isEmpty() && TagUtil.hasTag(ForgeRegistries.ITEMS, stack.getItem(), KNIFE)) { ++click; if (click > 5) { for (CuttingBoardRecipe recipe : RecipeUtil.getRecipes(this.level, CuttingBoardRecipe.SERIALIZER.getRecipeType())) { diff --git a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/FermentationBarrelTile.java b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/FermentationBarrelTile.java index eb1dfb4..cc0f2af 100644 --- a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/FermentationBarrelTile.java +++ b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/FermentationBarrelTile.java @@ -33,7 +33,7 @@ public class FermentationBarrelTile extends ActiveTile { private final InventoryComponent output; public FermentationBarrelTile(BlockPos pos, BlockState state) { - super(SushiContent.Blocks.FERMENTATION_BARREL.get(), pos, state); + super(SushiContent.Blocks.FERMENTATION_BARREL.get(), SushiContent.TileEntities.FERMENTATION_BARREL.get(), pos, state); addProgressBar(this.bar = new ProgressBarComponent(93, 48, 100) .setCanIncrease(FermentationBarrelTile::canStart) .setCanReset(FermentationBarrelTile::canStart) diff --git a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RiceCookerTile.java b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RiceCookerTile.java index 9eac143..6dec8b3 100644 --- a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RiceCookerTile.java +++ b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RiceCookerTile.java @@ -11,7 +11,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -28,7 +28,7 @@ public class RiceCookerTile extends ActiveTile { - public static Tag RICE = TagUtil.getItemTag(new ResourceLocation("forge", "crops/rice")); + public static TagKey RICE = TagUtil.getItemTag(new ResourceLocation("forge", "crops/rice")); @Save private final InventoryComponent input; @@ -45,7 +45,7 @@ public class RiceCookerTile extends ActiveTile { public RiceCookerTile(BlockPos pos, BlockState state) { - super(SushiContent.Blocks.RICE_COOKER.get(), pos, state); + super(SushiContent.Blocks.RICE_COOKER.get(), SushiContent.TileEntities.RICE_COOKER.get(), pos, state); this.burnTime = 0; addInventory(this.input = new InventoryComponent("input", 20, 38, 4) .setRange(2, 2) diff --git a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RollerTile.java b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RollerTile.java index 8a56341..12e97ac 100644 --- a/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RollerTile.java +++ b/src/main/java/com/buuz135/sushigocrafting/tile/machinery/RollerTile.java @@ -52,7 +52,7 @@ public class RollerTile extends ActiveTile { private final InventoryComponent spices; public RollerTile(BlockPos pos, BlockState state) { - super(SushiContent.Blocks.ROLLER.get(), pos, state); + super(SushiContent.Blocks.ROLLER.get(), SushiContent.TileEntities.ROLLER.get(), pos, state); int i = 0; int max = 0; this.craftProgress = 0; diff --git a/src/main/java/com/buuz135/sushigocrafting/world/SeaWeedFeatureHolders.java b/src/main/java/com/buuz135/sushigocrafting/world/SeaWeedFeatureHolders.java new file mode 100644 index 0000000..7061fc7 --- /dev/null +++ b/src/main/java/com/buuz135/sushigocrafting/world/SeaWeedFeatureHolders.java @@ -0,0 +1,17 @@ +package com.buuz135.sushigocrafting.world; + +import com.buuz135.sushigocrafting.proxy.SushiContent; +import net.minecraft.core.Holder; +import net.minecraft.data.worldgen.features.FeatureUtils; +import net.minecraft.data.worldgen.placement.PlacementUtils; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import net.minecraft.world.level.levelgen.placement.BiomeFilter; +import net.minecraft.world.level.levelgen.placement.InSquarePlacement; +import net.minecraft.world.level.levelgen.placement.NoiseBasedCountPlacement; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; + +public class SeaWeedFeatureHolders { + public static Holder> HOLDER = FeatureUtils.register("seaweed", SushiContent.Features.SEAWEED.get()); + public static Holder PLACEMENT = PlacementUtils.register("seaweed", HOLDER, NoiseBasedCountPlacement.of(80, 80.0D, 0.0D), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome()); +} diff --git a/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTree.java b/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTree.java index dfeb3e6..2877ea8 100644 --- a/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTree.java +++ b/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTree.java @@ -2,17 +2,24 @@ import com.buuz135.sushigocrafting.block.plant.AvocadoLeavesBlock; import com.buuz135.sushigocrafting.proxy.SushiContent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.data.worldgen.features.FeatureUtils; +import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.util.random.SimpleWeightedRandomList; import net.minecraft.util.valueproviders.ConstantInt; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.grower.AbstractTreeGrower; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize; import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer; -import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider; +import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider; +import net.minecraft.world.level.levelgen.placement.*; import javax.annotation.Nullable; import java.util.Random; @@ -20,7 +27,7 @@ public class AvocadoTree extends AbstractTreeGrower { public static TreeConfiguration TREE = new TreeConfiguration.TreeConfigurationBuilder( - SimpleStateProvider.simple(SushiContent.Blocks.AVOCADO_LOG.get().defaultBlockState()), + BlockStateProvider.simple(SushiContent.Blocks.AVOCADO_LOG.get().defaultBlockState()), new AvocadoTreeTrunkPlacer(4, 1, 0), new WeightedStateProvider(SimpleWeightedRandomList.builder() .add(SushiContent.Blocks.AVOCADO_LEAVES.get().defaultBlockState(), 6) @@ -28,9 +35,12 @@ public class AvocadoTree extends AbstractTreeGrower { .add(SushiContent.Blocks.AVOCADO_LEAVES.get().defaultBlockState().setValue(AvocadoLeavesBlock.STAGE, 2), 1)), new BlobFoliagePlacer(ConstantInt.of(1), ConstantInt.of(0), 3), new TwoLayersFeatureSize(1, 0, 1)).ignoreVines().build(); + public static Holder> HOLDER = FeatureUtils.register("avocado_tree", Feature.TREE, AvocadoTree.TREE); + public static Holder PLACEMENT = PlacementUtils.register("avocado_tree", AvocadoTree.HOLDER, PlacementUtils.countExtra(0, 0.05F, 1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0), PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(Blocks.OAK_SAPLING.defaultBlockState(), BlockPos.ZERO)), BiomeFilter.biome()); + @Nullable @Override - protected ConfiguredFeature getConfiguredFeature(Random randomIn, boolean largeHive) { - return Feature.TREE.configured(TREE); + protected Holder> getConfiguredFeature(Random randomIn, boolean largeHive) { + return HOLDER; } } diff --git a/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTreeTrunkPlacer.java b/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTreeTrunkPlacer.java index 3d7c021..70d9d24 100644 --- a/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTreeTrunkPlacer.java +++ b/src/main/java/com/buuz135/sushigocrafting/world/tree/AvocadoTreeTrunkPlacer.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacer; import net.minecraft.world.level.levelgen.feature.trunkplacers.StraightTrunkPlacer; +import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; import java.util.List; import java.util.Random; @@ -47,5 +48,8 @@ public List placeTrunk(LevelSimulatedReader rea return ImmutableList.of(new FoliagePlacer.FoliageAttachment(pos.above(treeHeight), 0, false)); } - + @Override + protected TrunkPlacerType type() { + return TrunkPlacerType.STRAIGHT_TRUNK_PLACER; + } }