Skip to content

Commit

Permalink
Rebrand to Immersive Energistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n committed Mar 25, 2024
1 parent 548c9c6 commit 124ee73
Show file tree
Hide file tree
Showing 31 changed files with 296 additions and 308 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: immersive-wiring
name: immersive-energistics
path: build/libs/
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ jobs:
- name: Generate data
run: ./gradlew runData --max-workers 1
env:
IW_VERSION: ${{ github.event.release.tag_name }}
MOD_VERSION: ${{ github.event.release.tag_name }}
- name: Build
run: ./gradlew build --max-workers 1
env:
IW_VERSION: ${{ github.event.release.tag_name }}
MOD_VERSION: ${{ github.event.release.tag_name }}
- name: Upload Release Artifact
uses: softprops/action-gh-release@v1
with:
files: build/libs/Immersive-Wiring-${{ github.event.release.tag_name }}.jar
files: build/libs/Immersive-Energistics-${{ github.event.release.tag_name }}.jar
tag_name: ${{ github.event.release.tag_name }}
- name: Upload to external sites
run: ./gradlew curseforge modrinth --max-workers 1
env:
IW_VERSION: ${{ github.event.release.tag_name }}
MOD_VERSION: ${{ github.event.release.tag_name }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
MODRINTH: ${{ secrets.MODRINTH }}
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "me.ramidzkh"
version = System.getenv("IW_VERSION") ?: "0.0.0"
version = System.getenv("MOD_VERSION") ?: "0.0.0"

repositories {
maven {
Expand Down Expand Up @@ -120,7 +120,7 @@ runs {
}

data {
programArguments.addAll "--mod", "immersivewiring", "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources/").getAbsolutePath()
programArguments.addAll "--mod", "immeng", "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources/").getAbsolutePath()
}
}

Expand Down Expand Up @@ -175,9 +175,9 @@ System.getenv("CURSEFORGE")?.with { String key ->
apiKey = key

project {
id = "574300" // TODO
id = "992377"
changelogType = "markdown"
changelog = "View changelog at [the release page](https://github.com/AppliedEnergistics/Applied-Mekanistics/releases/tag/${version})"
changelog = "View changelog at [the release page](https://github.com/AppliedEnergistics/Immersive-Energistics/releases/tag/${version})"

if (version.contains("alpha")) {
releaseType = "alpha"
Expand Down Expand Up @@ -206,8 +206,8 @@ System.getenv("CURSEFORGE")?.with { String key ->
// Modrinth
modrinth {
token.set(System.getenv("MODRINTH"))
projectId.set("applied-mekanistics") // TODO
changelog.set("View changelog at [the release page](https://github.com/AppliedEnergistics/Applied-Mekanistics/releases/tag/${version})")
projectId.set("immersive-energistics")
changelog.set("View changelog at [the release page](https://github.com/AppliedEnergistics/Immersive-Energistics/releases/tag/${version})")
versionNumber.set(project.version)

if (version.contains("alpha")) {
Expand Down
Binary file added images/setup1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/setup1_network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pluginManagement {
}
}

rootProject.name = "Immersive-Wiring"
rootProject.name = "Immersive-Energistics"
115 changes: 115 additions & 0 deletions src/main/java/dev/technici4n/immeng/ImmEng.java
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()));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.technici4n.immersivewiring.modules.ae2;
package dev.technici4n.immeng;

import java.util.function.Supplier;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.technici4n.immersivewiring.modules.ae2;
package dev.technici4n.immeng;

import java.util.Collection;
import java.util.HashSet;
Expand Down Expand Up @@ -67,13 +67,13 @@ IManagedGridNode createWireNode() {
}

public MEConnectorBlockEntity(BlockPos pos, BlockState state) {
super(state.is(AEModule.ME_RELAY) ? AEModule.ME_RELAY_BE.get() : AEModule.ME_CONNECTOR_BE.get(), pos, state);
this.relay = state.is(AEModule.ME_RELAY);
super(state.is(ImmEng.ME_RELAY) ? ImmEng.ME_RELAY_BE.get() : ImmEng.ME_CONNECTOR_BE.get(), pos, state);
this.relay = state.is(ImmEng.ME_RELAY);

if (this.relay) {
gridNode.setVisualRepresentation(AEModule.ME_RELAY_ITEM);
gridNode.setVisualRepresentation(ImmEng.ME_RELAY_ITEM);
} else {
gridNode.setVisualRepresentation(AEModule.ME_CONNECTOR_ITEM);
gridNode.setVisualRepresentation(ImmEng.ME_CONNECTOR_ITEM);
gridNode.setInWorldNode(true);
}

Expand Down Expand Up @@ -181,10 +181,10 @@ void loadConnectionOnA(Connection connection, LocalWireNetwork localNet) {
// Update flags and active item based on wire
if (connection.type == MEWireType.DENSE) {
wireNode.setFlags(GridFlags.DENSE_CAPACITY);
wireNode.setVisualRepresentation(AEModule.ME_WIRE_DENSE_COIL);
wireNode.setVisualRepresentation(ImmEng.ME_WIRE_DENSE_COIL);
} else {
wireNode.setFlags(GridFlags.PREFERRED);
wireNode.setVisualRepresentation(AEModule.ME_WIRE_COIL);
wireNode.setVisualRepresentation(ImmEng.ME_WIRE_COIL);
}
wireNode.create(getLevelNonnull(), null);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.technici4n.immersivewiring.modules.ae2;
package dev.technici4n.immeng;

import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -9,10 +9,9 @@
import blusunrize.immersiveengineering.api.wires.IImmersiveConnectable;
import blusunrize.immersiveengineering.api.wires.LocalWireNetwork;
import blusunrize.immersiveengineering.api.wires.localhandlers.LocalNetworkHandler;
import dev.technici4n.immersivewiring.ImmersiveWiring;

public class MELocalHandler extends LocalNetworkHandler {
public static final ResourceLocation ID = ImmersiveWiring.id("me");
public static final ResourceLocation ID = ImmEng.id("me");

protected MELocalHandler(LocalWireNetwork net, GlobalWireNetwork global) {
super(net, global);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.technici4n.immersivewiring.modules.ae2;
package dev.technici4n.immeng;

import org.jetbrains.annotations.NotNull;

Expand All @@ -17,10 +17,6 @@ public MEWireType(boolean dense) {
this.dense = dense;
}

public boolean isDense() {
return dense;
}

@Override
public String getUniqueName() {
return dense ? "me_dense" : "me";
Expand All @@ -43,7 +39,7 @@ public int getMaxLength() {

@Override
public ItemStack getWireCoil(Connection connection) {
return dense ? AEModule.ME_WIRE_DENSE_COIL.toStack() : AEModule.ME_WIRE_COIL.toStack();
return dense ? ImmEng.ME_WIRE_DENSE_COIL.toStack() : ImmEng.ME_WIRE_COIL.toStack();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.technici4n.immersivewiring.data;
package dev.technici4n.immeng.data;

import java.util.List;
import java.util.function.Consumer;
Expand All @@ -16,19 +16,11 @@
import net.neoforged.neoforge.common.data.ExistingFileHelper;

import blusunrize.immersiveengineering.api.IEProperties;
import dev.technici4n.immersivewiring.ImmersiveWiring;
import dev.technici4n.immeng.ImmEng;

public abstract class IWBlockStatesProvider extends BlockStateProvider {
private final String module;

public IWBlockStatesProvider(PackOutput output, ExistingFileHelper exFileHelper, String module) {
super(output, ImmersiveWiring.ID, exFileHelper);
this.module = module;
}

@Override
public final String getName() {
return super.getName() + " (" + module + ")";
public abstract class ExtendedBlockStatesProvider extends BlockStateProvider {
public ExtendedBlockStatesProvider(PackOutput output, ExistingFileHelper exFileHelper) {
super(output, ImmEng.ID, exFileHelper);
}

// Mostly copy-pasted from IE
Expand All @@ -41,11 +33,6 @@ protected void createAllRotatedBlock(Supplier<? extends Block> block,
createRotatedBlock(block, model, IEProperties.FACING_ALL, additionalProps, 90, 0);
}

protected void createRotatedBlock(Supplier<? extends Block> block, ModelFile model, Property<Direction> facing,
List<Property<?>> additionalProps, int offsetRotX, int offsetRotY) {
createRotatedBlock(block, $ -> model, facing, additionalProps, offsetRotX, offsetRotY);
}

protected void createRotatedBlock(Supplier<? extends Block> block,
Function<VariantBlockStateBuilder.PartialBlockstate, ModelFile> model, Property<Direction> facing,
List<Property<?>> additionalProps, int offsetRotX, int offsetRotY) {
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/dev/technici4n/immeng/data/ImmEngBlockLoot.java
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 src/main/java/dev/technici4n/immeng/data/ImmEngBlockTags.java
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());
}
}
Loading

0 comments on commit 124ee73

Please sign in to comment.