added BlockSetType for edified wood, fixed HexAxtionTagProvider

This commit is contained in:
Talia-12 2023-06-21 17:01:36 +10:00
parent 76ba2f5f8a
commit 36b631eadb
7 changed files with 51 additions and 17 deletions

View file

@ -1,6 +1,7 @@
package at.petrak.hexcasting.common.blocks.decoration; package at.petrak.hexcasting.common.blocks.decoration;
import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.annotations.SoftImplement;
import at.petrak.hexcasting.common.lib.HexBlockSetTypes;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -9,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockHexDoor extends DoorBlock { public class BlockHexDoor extends DoorBlock {
public BlockHexDoor(Properties $$0) { public BlockHexDoor(Properties $$0) {
super($$0); super($$0, HexBlockSetTypes.EDIFIED_WOOD);
} }

View file

@ -1,6 +1,7 @@
package at.petrak.hexcasting.common.blocks.decoration; package at.petrak.hexcasting.common.blocks.decoration;
import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.annotations.SoftImplement;
import at.petrak.hexcasting.common.lib.HexBlockSetTypes;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -9,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockHexPressurePlate extends PressurePlateBlock { public class BlockHexPressurePlate extends PressurePlateBlock {
public BlockHexPressurePlate(Sensitivity $$0, Properties $$1) { public BlockHexPressurePlate(Sensitivity $$0, Properties $$1) {
super($$0, $$1); super($$0, $$1, HexBlockSetTypes.EDIFIED_WOOD);
} }

View file

@ -1,6 +1,7 @@
package at.petrak.hexcasting.common.blocks.decoration; package at.petrak.hexcasting.common.blocks.decoration;
import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.annotations.SoftImplement;
import at.petrak.hexcasting.common.lib.HexBlockSetTypes;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -9,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockHexTrapdoor extends TrapDoorBlock { public class BlockHexTrapdoor extends TrapDoorBlock {
public BlockHexTrapdoor(Properties $$0) { public BlockHexTrapdoor(Properties $$0) {
super($$0); super($$0, HexBlockSetTypes.EDIFIED_WOOD);
} }
@SoftImplement("forge") @SoftImplement("forge")

View file

@ -0,0 +1,26 @@
package at.petrak.hexcasting.common.lib;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public class HexBlockSetTypes {
public static void registerBlocks(Consumer<BlockSetType> r) {
for (var type : TYPES) {
r.accept(type);
}
}
private static final List<BlockSetType> TYPES = new ArrayList<>();
public static final BlockSetType EDIFIED_WOOD = register(
new BlockSetType("edified_wood")
);
private static BlockSetType register(BlockSetType type) {
TYPES.add(type);
return type;
}
}

View file

@ -14,7 +14,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class HexActionTagProvider extends TagsProvider<ActionRegistryEntry> { public class HexActionTagProvider extends TagsProvider<ActionRegistryEntry> {
public HexActionTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> provider) { public HexActionTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> provider) {
super(output, IXplatAbstractions.INSTANCE.getActionRegistry(), provider); super(output, IXplatAbstractions.INSTANCE.getActionRegistry().key(), provider);
} }
@Override @Override

View file

@ -48,6 +48,7 @@ import net.fabricmc.fabric.api.loot.v2.LootTableEvents
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry import net.fabricmc.fabric.api.registry.FlammableBlockRegistry
import net.minecraft.commands.synchronization.SingletonArgumentInfo import net.minecraft.commands.synchronization.SingletonArgumentInfo
import net.minecraft.core.Registry import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.InteractionResult import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
@ -119,26 +120,26 @@ object FabricHexInitializer : ModInitializer {
private fun initRegistries() { private fun initRegistries() {
fabricOnlyRegistration() fabricOnlyRegistration()
HexSounds.registerSounds(bind(Registry.SOUND_EVENT)) HexSounds.registerSounds(bind(BuiltInRegistries.SOUND_EVENT))
HexBlocks.registerBlocks(bind(Registry.BLOCK)) HexBlocks.registerBlocks(bind(BuiltInRegistries.BLOCK))
HexBlocks.registerBlockItems(bind(Registry.ITEM)) HexBlocks.registerBlockItems(bind(BuiltInRegistries.ITEM))
HexBlockEntities.registerTiles(bind(Registry.BLOCK_ENTITY_TYPE)) HexBlockEntities.registerTiles(bind(BuiltInRegistries.BLOCK_ENTITY_TYPE))
HexItems.registerItems(bind(Registry.ITEM)) HexItems.registerItems(bind(BuiltInRegistries.ITEM))
// Registry.register(IngredientDeserializer.REGISTRY, FabricUnsealedIngredient.ID, FabricUnsealedIngredient.Deserializer.INSTANCE) // Registry.register(IngredientDeserializer.REGISTRY, FabricUnsealedIngredient.ID, FabricUnsealedIngredient.Deserializer.INSTANCE)
Registry.register(IngredientDeserializer.REGISTRY, FabricModConditionalIngredient.ID, FabricModConditionalIngredient.Deserializer.INSTANCE) Registry.register(IngredientDeserializer.REGISTRY, FabricModConditionalIngredient.ID, FabricModConditionalIngredient.Deserializer.INSTANCE)
HexEntities.registerEntities(bind(Registry.ENTITY_TYPE)) HexEntities.registerEntities(bind(BuiltInRegistries.ENTITY_TYPE))
HexAttributes.register(bind(Registry.ATTRIBUTE)) HexAttributes.register(bind(BuiltInRegistries.ATTRIBUTE))
HexMobEffects.register(bind(Registry.MOB_EFFECT)) HexMobEffects.register(bind(BuiltInRegistries.MOB_EFFECT))
HexPotions.register(bind(Registry.POTION)) HexPotions.register(bind(BuiltInRegistries.POTION))
HexPotions.addRecipes() HexPotions.addRecipes()
HexRecipeStuffRegistry.registerSerializers(bind(Registry.RECIPE_SERIALIZER)) HexRecipeStuffRegistry.registerSerializers(bind(BuiltInRegistries.RECIPE_SERIALIZER))
HexRecipeStuffRegistry.registerTypes(bind(Registry.RECIPE_TYPE)) HexRecipeStuffRegistry.registerTypes(bind(BuiltInRegistries.RECIPE_TYPE))
HexParticles.registerParticles(bind(Registry.PARTICLE_TYPE)) HexParticles.registerParticles(bind(BuiltInRegistries.PARTICLE_TYPE))
HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) HexLootFunctions.registerSerializers(bind(BuiltInRegistries.LOOT_FUNCTION_TYPE))
HexIotaTypes.registerTypes(bind(IXplatAbstractions.INSTANCE.iotaTypeRegistry)) HexIotaTypes.registerTypes(bind(IXplatAbstractions.INSTANCE.iotaTypeRegistry))
HexActions.register(bind(IXplatAbstractions.INSTANCE.actionRegistry)) HexActions.register(bind(IXplatAbstractions.INSTANCE.actionRegistry))

View file

@ -44,6 +44,7 @@ import net.minecraft.world.entity.Mob;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -95,6 +96,9 @@ public class ForgeHexInitializer {
private static void initRegistry() { private static void initRegistry() {
bind(Registries.SOUND_EVENT, HexSounds::registerSounds); bind(Registries.SOUND_EVENT, HexSounds::registerSounds);
HexBlockSetTypes.registerBlocks(BlockSetType::register);
bind(Registries.BLOCK, HexBlocks::registerBlocks); bind(Registries.BLOCK, HexBlocks::registerBlocks);
bind(Registries.ITEM, HexBlocks::registerBlockItems); bind(Registries.ITEM, HexBlocks::registerBlockItems);
bind(Registries.BLOCK_ENTITY_TYPE, HexBlockEntities::registerTiles); bind(Registries.BLOCK_ENTITY_TYPE, HexBlockEntities::registerTiles);