Skip to content

Commit

Permalink
Fix various Fabric errors (network will need further research)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealWormbo committed Jul 28, 2024
1 parent 068f0ec commit ed3717b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -124,7 +125,7 @@

public class FabricCommonInitializer implements ModInitializer {
private static final Registry<Brew> BREW_REGISTRY = FabricRegistryBuilder.createDefaulted(BotaniaRegistries.BREWS, prefix("fallback")).buildAndRegister();
private static final Registry<StateIngredientType> STATE_INGREDIENT_TYPE_REGISTRY = FabricRegistryBuilder.createSimple(BotaniaRegistries.STATE_INGREDIENT_TYPE).buildAndRegister();
private static final MappedRegistry<StateIngredientType<?>> STATE_INGREDIENT_TYPE_REGISTRY = FabricRegistryBuilder.createSimple(BotaniaRegistries.STATE_INGREDIENT_TYPE).buildAndRegister();

@Override
public void onInitialize() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package vazkii.botania.fabric.data;

import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.world.item.Items;
Expand All @@ -11,8 +11,7 @@
import vazkii.botania.common.block.BotaniaBlocks;
import vazkii.botania.common.item.BotaniaItems;
import vazkii.botania.common.lib.BotaniaTags;

import java.util.function.Consumer;
import vazkii.botania.data.recipes.BotaniaRecipeProvider;

import static vazkii.botania.data.recipes.CraftingRecipeProvider.*;

Expand All @@ -22,7 +21,7 @@ public FabricRecipeProvider(PackOutput packOutput) {
}

@Override
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
public void buildRecipes(RecipeOutput consumer) {
// Quartz tag
ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, BotaniaBlocks.azulejo0)
.requires(Items.BLUE_DYE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.block.type.WoodTypeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeBuilder;
import net.fabricmc.fabric.api.object.builder.v1.block.type.WoodTypeBuilder;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
Expand Down Expand Up @@ -626,11 +626,28 @@ public RedStringContainerBlockEntity newRedStringContainer(BlockPos pos, BlockSt

@Override
public BlockSetType registerBlockSetType(String name, boolean canOpenByHand, SoundType soundType, SoundEvent doorClose, SoundEvent doorOpen, SoundEvent trapdoorClose, SoundEvent trapdoorOpen, SoundEvent pressurePlateClickOff, SoundEvent pressurePlateClickOn, SoundEvent buttonClickOff, SoundEvent buttonClickOn) {
return BlockSetTypeRegistry.register(prefix(name), canOpenByHand, soundType, doorClose, doorOpen, trapdoorClose, trapdoorOpen, pressurePlateClickOff, pressurePlateClickOn, buttonClickOff, buttonClickOn);
return BlockSetTypeBuilder.copyOf(BlockSetType.OAK)
.openableByHand(canOpenByHand)
.openableByWindCharge(canOpenByHand)
.soundGroup(soundType)
.doorCloseSound(doorClose)
.doorOpenSound(doorOpen)
.trapdoorCloseSound(trapdoorClose)
.trapdoorOpenSound(trapdoorOpen)
.pressurePlateClickOffSound(pressurePlateClickOff)
.pressurePlateClickOnSound(pressurePlateClickOn)
.buttonClickOffSound(buttonClickOff)
.buttonClickOnSound(buttonClickOn)
.register(prefix(name));
}

@Override
public WoodType registerWoodType(String name, BlockSetType setType, SoundType soundType, SoundType hangingSignSoundType, SoundEvent fenceGateClose, SoundEvent fenceGateOpen) {
return WoodTypeRegistry.register(prefix(name), setType, soundType, hangingSignSoundType, fenceGateClose, fenceGateOpen);
return WoodTypeBuilder.copyOf(WoodType.OAK)
.soundGroup(soundType)
.hangingSignSoundGroup(hangingSignSoundType)
.fenceGateCloseSound(fenceGateClose)
.fenceGateOpenSound(fenceGateOpen)
.register(prefix(name), setType);
}
}

0 comments on commit ed3717b

Please sign in to comment.