generated from neoforged/MDK
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
269 changed files
with
4,004 additions
and
265 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.farcr.nomansland.core; | ||
|
||
import com.farcr.nomansland.core.registry.NMLBlockRegistry; | ||
import com.farcr.nomansland.core.registry.NMLItemRegistry; | ||
import com.mojang.logging.LogUtils; | ||
import net.neoforged.api.distmarker.Dist; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; | ||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import net.neoforged.neoforge.event.server.ServerStartingEvent; | ||
import org.slf4j.Logger; | ||
|
||
@Mod(NoMansLand.MODID) | ||
public class NoMansLand { | ||
public static final String MODID = "nomansland"; | ||
|
||
public static final Logger LOGGER = LogUtils.getLogger(); | ||
|
||
public NoMansLand(IEventBus modEventBus) { | ||
|
||
modEventBus.addListener(this::commonSetup); | ||
|
||
NMLBlockRegistry.BLOCKS.register(modEventBus); | ||
|
||
NMLItemRegistry.ITEMS.register(modEventBus); | ||
|
||
NeoForge.EVENT_BUS.register(this); | ||
|
||
} | ||
|
||
private void commonSetup(final FMLCommonSetupEvent event) { | ||
} | ||
|
||
@SubscribeEvent | ||
public void onServerStarting(ServerStartingEvent event) { | ||
} | ||
|
||
|
||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) | ||
public static class ClientModEvents { | ||
@SubscribeEvent | ||
public static void onClientSetup(FMLClientSetupEvent event) { | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/farcr/nomansland/core/registry/NMLBlockRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.farcr.nomansland.core.registry; | ||
|
||
import com.farcr.nomansland.core.NoMansLand; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.SlabBlock; | ||
import net.minecraft.world.level.block.StairBlock; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.neoforge.registries.DeferredBlock; | ||
import net.neoforged.neoforge.registries.DeferredItem; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class NMLBlockRegistry { | ||
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(NoMansLand.MODID); | ||
|
||
public static final DeferredBlock<Block> PINE_PLANKS = registerBlock("pine_planks",() -> new Block(Block.Properties.copy(Blocks.OAK_PLANKS))); | ||
public static final DeferredBlock<Block> PINE_STAIRS = registerBlock("pine_stairs",() -> new StairBlock(() -> NMLBlockRegistry.PINE_PLANKS.get() | ||
.defaultBlockState(),Block.Properties.copy(NMLBlockRegistry.PINE_PLANKS.get()))); | ||
public static final DeferredBlock<Block> PINE_SLAB = registerBlock("pine_slab",() -> new SlabBlock(Block.Properties.copy(NMLBlockRegistry.PINE_PLANKS.get()))); | ||
|
||
|
||
|
||
|
||
|
||
private static <T extends Block> DeferredBlock<T> registerBlock(String name, Supplier<T> block) { | ||
DeferredBlock<T> toReturn = BLOCKS.register(name, block); | ||
registerBlockItem(name, toReturn); | ||
return toReturn; | ||
} | ||
|
||
private static <T extends Block> DeferredItem<Item> registerBlockItem(String name, DeferredBlock<T> block) { | ||
return NMLItemRegistry.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); | ||
} | ||
|
||
public static void register(IEventBus eventBus) { | ||
BLOCKS.register(eventBus); | ||
NoMansLand.LOGGER.info("Registering NoMansLandBlocks for" + NoMansLand.MODID); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/farcr/nomansland/core/registry/NMLItemRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.farcr.nomansland.core.registry; | ||
|
||
import com.farcr.nomansland.core.NoMansLand; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
|
||
public class NMLItemRegistry { | ||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(NoMansLand.MODID); | ||
} |
Oops, something went wrong.