Skip to content

Commit

Permalink
update NeoForge
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Feb 2, 2024
1 parent 52c2355 commit a7cdab7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 158 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.debug=false

minecraft_version=1.20.4
minecraft_version_range=[1.20.4,1.21)
neo_version=20.4.77-beta
neo_version_range=[20.4.77-beta,)
neo_version=20.4.147-beta
neo_version_range=[20.4.147-beta,)
loader_version_range=[1,)

mod_id=bibliocraft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public final class EventHandler {
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = Bibliocraft.MOD_ID)
public static final class ModBus {
@SubscribeEvent
public static void constructMod(FMLConstructModEvent event) {
private static void constructMod(FMLConstructModEvent event) {
event.enqueueWork(() -> {
BibliocraftWoodType.postRegister();
BCRegistries.init(Objects.requireNonNull(ModList.get().getModContainerById(Bibliocraft.MOD_ID).orElseThrow().getEventBus()));
});
}

@SubscribeEvent
public static void entityAttributeCreation(EntityAttributeCreationEvent event) {
private static void entityAttributeCreation(EntityAttributeCreationEvent event) {
event.put(BCEntities.FANCY_ARMOR_STAND.get(), LivingEntity.createLivingAttributes().build());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.github.minecraftschurlimods.bibliocraft.apiimpl;

import net.minecraft.MethodsReturnNonnullByDefault;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,38 @@
import com.github.minecraftschurlimods.bibliocraft.init.BCItems;
import com.github.minecraftschurlimods.bibliocraft.init.BCMenus;
import com.github.minecraftschurlimods.bibliocraft.util.BCUtil;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.entity.ArmorStandRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.DyeColor;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.event.ModelEvent;
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;

import java.util.Objects;

public final class ClientHandler {
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = Bibliocraft.MOD_ID)
public static final class ModBus {
@SubscribeEvent
static void clientSetup(FMLClientSetupEvent event) {
event.enqueueWork(() -> {
MenuScreens.register(BCMenus.BOOKCASE.get(), BCMenuScreens.Bookcase::new);
MenuScreens.register(BCMenus.FANCY_ARMOR_STAND.get(), BCMenuScreens.FancyArmorStand::new);
MenuScreens.register(BCMenus.LABEL.get(), BCMenuScreens.Label::new);
MenuScreens.register(BCMenus.POTION_SHELF.get(), BCMenuScreens.PotionShelf::new);
MenuScreens.register(BCMenus.SHELF.get(), BCMenuScreens.Shelf::new);
MenuScreens.register(BCMenus.TOOL_RACK.get(), BCMenuScreens.ToolRack::new);
});
private static void registerMenuScreens(RegisterMenuScreensEvent event) {
event.register(BCMenus.BOOKCASE.get(), BCMenuScreens.Bookcase::new);
event.register(BCMenus.FANCY_ARMOR_STAND.get(), BCMenuScreens.FancyArmorStand::new);
event.register(BCMenus.LABEL.get(), BCMenuScreens.Label::new);
event.register(BCMenus.POTION_SHELF.get(), BCMenuScreens.PotionShelf::new);
event.register(BCMenus.SHELF.get(), BCMenuScreens.Shelf::new);
event.register(BCMenus.TOOL_RACK.get(), BCMenuScreens.ToolRack::new);
}

@SubscribeEvent
static void registerGeometryLoaders(ModelEvent.RegisterGeometryLoaders event) {
private static void registerGeometryLoaders(ModelEvent.RegisterGeometryLoaders event) {
event.register(new ResourceLocation(Bibliocraft.MOD_ID, "bookcase"), BookcaseGeometryLoader.INSTANCE);
}

@SubscribeEvent
static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {
private static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {
event.registerEntityRenderer(BCEntities.FANCY_ARMOR_STAND.get(), ArmorStandRenderer::new);
event.registerEntityRenderer(BCEntities.SEAT.get(), EmptyEntityRenderer::new);
event.registerBlockEntityRenderer(BCBlockEntities.DISPLAY_CASE.get(), DisplayCaseBER::new);
Expand All @@ -64,12 +61,12 @@ static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {
}

@SubscribeEvent
static void registerColorHandlersBlock(RegisterColorHandlersEvent.Block event) {
private static void registerColorHandlersBlock(RegisterColorHandlersEvent.Block event) {
event.register((state, level, pos, tintIndex) -> tintIndex == 0 && Objects.requireNonNull(level).getBlockEntity(Objects.requireNonNull(pos)) instanceof SwordPedestalBlockEntity spbe ? spbe.getColor() : -1, BCBlocks.SWORD_PEDESTAL.get());
}

@SubscribeEvent
static void registerColorHandlersItem(RegisterColorHandlersEvent.Item event) {
private static void registerColorHandlersItem(RegisterColorHandlersEvent.Item event) {
event.register((stack, tintIndex) -> tintIndex == 0 ? BCUtil.getNBTColor(stack, DyeColor.GREEN.getTextColor()) : -1, BCItems.SWORD_PEDESTAL.get());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = Bibliocraft.MOD_ID)
public final class BCDatagen {
@SubscribeEvent
static void gatherData(GatherDataEvent event) {
private static void gatherData(GatherDataEvent event) {
DataGenerator generator = event.getGenerator();
PackOutput output = generator.getPackOutput();
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
Expand All @@ -34,7 +34,7 @@ static void gatherData(GatherDataEvent event) {
generator.addProvider(event.includeClient(), new BCItemModelProvider(output, existingFileHelper));

generator.addProvider(event.includeServer(), new BCLootTableProvider(output));
generator.addProvider(event.includeServer(), new BCRecipeProvider(output, lookupProvider));
generator.addProvider(event.includeServer(), new BCRecipeProvider(output));
BCBlockTagsProvider blockTags = generator.addProvider(event.includeServer(), new BCBlockTagsProvider(output, lookupProvider, existingFileHelper));
generator.addProvider(event.includeServer(), new BCItemTagsProvider(output, lookupProvider, blockTags.contentsGetter(), existingFileHelper));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import com.github.minecraftschurlimods.bibliocraft.Bibliocraft;
import com.github.minecraftschurlimods.bibliocraft.api.BibliocraftDatagenAPI;
import com.github.minecraftschurlimods.bibliocraft.init.BCItems;
import com.github.minecraftschurlimods.bibliocraft.util.ShapedNBTRecipeBuilder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.DyeColor;
Expand All @@ -22,8 +22,8 @@
import java.util.concurrent.CompletableFuture;

public final class BCRecipeProvider extends RecipeProvider {
public BCRecipeProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(output, lookupProvider);
public BCRecipeProvider(PackOutput output) {
super(output);
}

@Override
Expand All @@ -32,7 +32,7 @@ protected void buildRecipes(RecipeOutput output) {
for (DyeColor color : DyeColor.values()) {
ItemStack result = new ItemStack(BCItems.SWORD_PEDESTAL.get());
DyeableLeatherItem.dyeArmor(result, List.of(DyeItem.byColor(color)));
ShapedNBTRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, result)
ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, result)
.pattern(" S ")
.pattern("SWS")
.define('S', Items.SMOOTH_STONE_SLAB)
Expand Down

This file was deleted.

0 comments on commit a7cdab7

Please sign in to comment.