-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
548c9c6
commit 124ee73
Showing
31 changed files
with
296 additions
and
308 deletions.
There are no files selected for viewing
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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ pluginManagement { | |
} | ||
} | ||
|
||
rootProject.name = "Immersive-Wiring" | ||
rootProject.name = "Immersive-Energistics" |
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,115 @@ | ||
package dev.technici4n.immeng; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.minecraft.core.Direction; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.loot.LootTableProvider; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.level.block.entity.BlockEntityType; | ||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.neoforge.capabilities.BlockCapability; | ||
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; | ||
import net.neoforged.neoforge.data.event.GatherDataEvent; | ||
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; | ||
import net.neoforged.neoforge.registries.DeferredBlock; | ||
import net.neoforged.neoforge.registries.DeferredHolder; | ||
import net.neoforged.neoforge.registries.DeferredItem; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
|
||
import blusunrize.immersiveengineering.api.wires.WireApi; | ||
import blusunrize.immersiveengineering.common.blocks.BlockItemIE; | ||
import blusunrize.immersiveengineering.common.items.WireCoilItem; | ||
import dev.technici4n.immeng.data.ImmEngBlockLoot; | ||
import dev.technici4n.immeng.data.ImmEngBlockTags; | ||
import dev.technici4n.immeng.data.ImmEngRecipes; | ||
import dev.technici4n.immeng.data.ImmEngStatesProvider; | ||
|
||
import appeng.api.ids.AEConstants; | ||
import appeng.api.ids.AECreativeTabIds; | ||
import appeng.api.networking.IInWorldGridNodeHost; | ||
|
||
@Mod(ImmEng.ID) | ||
public class ImmEng { | ||
public static final String ID = "immeng"; | ||
|
||
public static ResourceLocation id(String path) { | ||
return new ResourceLocation(ID, path); | ||
} | ||
|
||
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(ID); | ||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(ID); | ||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITY_TYPES = DeferredRegister | ||
.create(Registries.BLOCK_ENTITY_TYPE, ID); | ||
|
||
@SuppressWarnings({ "Convert2MethodRef", "FunctionalExpressionCanBeFolded" }) | ||
public static final DeferredBlock<MEConnectorBlock<MEConnectorBlockEntity>> ME_CONNECTOR = BLOCKS | ||
.register("connector_me", () -> new MEConnectorBlock<>(() -> ImmEng.ME_CONNECTOR_BE.get())); | ||
@SuppressWarnings({ "Convert2MethodRef", "FunctionalExpressionCanBeFolded" }) | ||
public static final DeferredBlock<MEConnectorBlock<MEConnectorBlockEntity>> ME_RELAY = BLOCKS | ||
.register("connector_me_relay", () -> new MEConnectorBlock<>(() -> ImmEng.ME_RELAY_BE.get())); | ||
|
||
public static final DeferredItem<BlockItem> ME_CONNECTOR_ITEM = ITEMS.register("connector_me", | ||
() -> new BlockItemIE(ME_CONNECTOR.get())); | ||
public static final DeferredItem<BlockItem> ME_RELAY_ITEM = ITEMS.register("connector_me_relay", | ||
() -> new BlockItemIE(ME_RELAY.get())); | ||
|
||
public static final DeferredItem<WireCoilItem> ME_WIRE_COIL = ITEMS.register("wirecoil_me", | ||
() -> new WireCoilItem(MEWireType.NORMAL)); | ||
public static final DeferredItem<WireCoilItem> ME_WIRE_DENSE_COIL = ITEMS.register("wirecoil_me_dense", | ||
() -> new WireCoilItem(MEWireType.DENSE)); | ||
|
||
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<MEConnectorBlockEntity>> ME_CONNECTOR_BE = BLOCK_ENTITY_TYPES | ||
.register("connector_me", | ||
() -> BlockEntityType.Builder.of(MEConnectorBlockEntity::new, ME_CONNECTOR.get()).build(null)); | ||
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<MEConnectorBlockEntity>> ME_RELAY_BE = BLOCK_ENTITY_TYPES | ||
.register("connector_me_relay", | ||
() -> BlockEntityType.Builder.of(MEConnectorBlockEntity::new, ME_RELAY.get()).build(null)); | ||
|
||
public static final BlockCapability<IInWorldGridNodeHost, @Nullable Direction> IN_WORLD_GRID_NODE_HOST = BlockCapability | ||
.createSided(new ResourceLocation(AEConstants.MOD_ID, "inworld_gridnode_host"), IInWorldGridNodeHost.class); | ||
|
||
public ImmEng(IEventBus modEventBus) { | ||
BLOCKS.register(modEventBus); | ||
ITEMS.register(modEventBus); | ||
BLOCK_ENTITY_TYPES.register(modEventBus); | ||
|
||
WireApi.registerWireType(MEWireType.NORMAL); | ||
WireApi.registerWireType(MEWireType.DENSE); | ||
MELocalHandler.register(MELocalHandler.ID, MELocalHandler::new); | ||
|
||
modEventBus.addListener(ImmEng::initDatagen); | ||
|
||
modEventBus.addListener((RegisterCapabilitiesEvent event) -> { | ||
event.registerBlockEntity(IN_WORLD_GRID_NODE_HOST, ME_CONNECTOR_BE.get(), (be, side) -> be); | ||
}); | ||
|
||
modEventBus.addListener((BuildCreativeModeTabContentsEvent event) -> { | ||
if (event.getTabKey() == AECreativeTabIds.MAIN) { | ||
event.accept(ME_WIRE_COIL); | ||
event.accept(ME_WIRE_DENSE_COIL); | ||
event.accept(ME_CONNECTOR_ITEM); | ||
event.accept(ME_RELAY_ITEM); | ||
} | ||
}); | ||
} | ||
|
||
private static void initDatagen(GatherDataEvent event) { | ||
var gen = event.getGenerator(); | ||
|
||
gen.addProvider(event.includeClient(), | ||
new ImmEngStatesProvider(gen.getPackOutput(), event.getExistingFileHelper())); | ||
|
||
gen.addProvider(event.includeServer(), new LootTableProvider(gen.getPackOutput(), Set.of(), List.of( | ||
new LootTableProvider.SubProviderEntry(ImmEngBlockLoot::new, LootContextParamSets.BLOCK)))); | ||
gen.addProvider(event.includeServer(), new ImmEngRecipes(gen.getPackOutput())); | ||
gen.addProvider(event.includeServer(), | ||
new ImmEngBlockTags(gen.getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper())); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ewiring/modules/ae2/MEConnectorBlock.java → ...v/technici4n/immeng/MEConnectorBlock.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
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 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 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 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
30 changes: 30 additions & 0 deletions
30
src/main/java/dev/technici4n/immeng/data/ImmEngBlockLoot.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,30 @@ | ||
package dev.technici4n.immeng.data; | ||
|
||
import java.util.Set; | ||
|
||
import com.google.common.collect.Iterables; | ||
|
||
import net.minecraft.data.loot.BlockLootSubProvider; | ||
import net.minecraft.world.flag.FeatureFlags; | ||
import net.minecraft.world.level.block.Block; | ||
import net.neoforged.neoforge.registries.DeferredHolder; | ||
|
||
import dev.technici4n.immeng.ImmEng; | ||
|
||
public class ImmEngBlockLoot extends BlockLootSubProvider { | ||
public ImmEngBlockLoot() { | ||
super(Set.of(), FeatureFlags.VANILLA_SET); | ||
} | ||
|
||
@Override | ||
protected void generate() { | ||
for (var block : getKnownBlocks()) { | ||
dropSelf(block); | ||
} | ||
} | ||
|
||
@Override | ||
protected Iterable<Block> getKnownBlocks() { | ||
return Iterables.transform(ImmEng.BLOCKS.getEntries(), DeferredHolder::get); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/dev/technici4n/immeng/data/ImmEngBlockTags.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,23 @@ | ||
package dev.technici4n.immeng.data; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.tags.BlockTags; | ||
import net.neoforged.neoforge.common.data.BlockTagsProvider; | ||
import net.neoforged.neoforge.common.data.ExistingFileHelper; | ||
|
||
import dev.technici4n.immeng.ImmEng; | ||
|
||
public class ImmEngBlockTags extends BlockTagsProvider { | ||
public ImmEngBlockTags(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> registries, | ||
ExistingFileHelper existingFileHelper) { | ||
super(packOutput, registries, ImmEng.ID, existingFileHelper); | ||
} | ||
|
||
@Override | ||
protected void addTags(HolderLookup.Provider registries) { | ||
tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ImmEng.ME_CONNECTOR.get(), ImmEng.ME_RELAY.get()); | ||
} | ||
} |
Oops, something went wrong.