Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ tasks {
compileOnlyApi("org.jetbrains:annotations:24.1.0")
annotationProcessor("org.jetbrains:annotations:24.1.0")

compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")

localImplementation(deobf("curse.maven:journeymap-32274:5172461"))
localImplementation(deobf("mezz.jei:jei_1.12.2:4.16.1.302"))
localImplementation(deobf("curse.maven:top-245211:2667280"))
Expand Down
36 changes: 36 additions & 0 deletions docs/conduit-api-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# How to create a custom conduit?

The original author of this article is **Henry Loenwind** (from EnderIO dev team),
we improved this article and split it from Javadocs.

Sorry, the conduit API is too involved to be put into the API jar.

Ok, it would be possible to do, but it would be much work and addons that implement conduits have no reason not to
compile against Ender IO proper, anyway.

So, to get started:
- Write an interface defining your conduit that extends `Conduit`.
- Write one or more classes implementing that.
- Add an `ConduitNetwork` if you want.
- Add an `ConduitRenderer`.
- Write your item class.
- Use the `ConduitBuilder` to define your conduit (Note: You can leave out the offsets to get assigned the first free offset).
- Register the definition with the `ConduitRegistry`.
- Register your renderer with the `ConduitBundleRenderManager` (that's in the conduits module at the moment...)

Oh, and if your conduit doesn't use Capabilities but needs an interface implemented on the `TileEntity`: Your problem.

Really, I'm tired of having a ConduitBundle TileEntity that has countless {@link Optional}-ed interfaces on it. Just
switch over to a Capability-based API---it isn't that hard.

Notes:

The Offset system will hopefully go away soon and be replaced with a dynamic conduit positioning. This will be a
breaking change for the rendering and
collision system, but it will become simpler, not harder. If you use the default renderer (like all built-in conduits
but the 2 lower-tier liquid conduits
do), you'll probably won't have to do much at all.
<p>
Please subscribe to the EnderIO github issue tracker and handle tickets about your conduits there. Because if your
conduits cause too many tickets there I may be tempted to blacklist them.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.morphismmc.eioadditions.common.teleport;

import crazypants.enderio.api.teleport.ITravelSource;
import crazypants.enderio.base.sound.IModSound;
import crazypants.enderio.base.sound.ModSound;
import crazypants.enderio.base.sound.SoundRegistry;
import com.morphismmc.eioadditions.AdditionsConstants;
import com.morphismmc.eioadditions.common.config.AdditionsTeleportConfig;
Expand All @@ -25,15 +25,15 @@ public int getMaxDistanceTravelled() {
};

private final ResourceLocation registryName;
public final IModSound sound;
public final ModSound sound;

AdditionsTravelSource(IModSound sound) {
AdditionsTravelSource(ModSound sound) {
this.registryName = new ResourceLocation(AdditionsConstants.MOD_ID, name().toLowerCase());
this.sound = sound;
}

@Override
public IModSound getSound() {
public ModSound getSound() {
return sound;
}

Expand Down
9 changes: 0 additions & 9 deletions src/main/java/crazypants/enderio/api/ILocalizable.java

This file was deleted.

10 changes: 10 additions & 0 deletions src/main/java/crazypants/enderio/api/Localizable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package crazypants.enderio.api;

import org.jetbrains.annotations.NotNull;

public interface Localizable {

@NotNull
String getUnlocalizedName();

}
52 changes: 0 additions & 52 deletions src/main/java/crazypants/enderio/api/conduits/Readme.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@API(apiVersion = EnderIOAPIProps.VERSION, owner = "enderio", provides = "enderioapi|conduits")
@API(apiVersion = EnderIOAPIProps.VERSION,
owner = "enderio",
provides = "enderioapi|conduits")
package crazypants.enderio.api.conduits;

import net.minecraftforge.fml.common.API;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import javax.annotation.Nonnull;

import crazypants.enderio.api.ILocalizable;
import crazypants.enderio.api.Localizable;

public enum FarmNotification implements ILocalizable {
public enum FarmNotification implements Localizable {

OUTPUT_FULL("outputFull"),
NO_SEEDS("noSeeds", true),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package crazypants.enderio.api.teleport;

import crazypants.enderio.base.sound.IModSound;
import crazypants.enderio.base.sound.ModSound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistryEntry;
import org.jetbrains.annotations.NotNull;
Expand All @@ -13,7 +13,7 @@
*/
public interface ITravelSource extends IForgeRegistryEntry<ITravelSource> {

IModSound getSound();
ModSound getSound();

default boolean getConserveMomentum() {
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/crazypants/enderio/api/teleport/TravelSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import crazypants.enderio.base.EnderIO;
import crazypants.enderio.base.config.config.TeleportConfig;
import crazypants.enderio.base.sound.IModSound;
import crazypants.enderio.base.sound.ModSound;
import crazypants.enderio.base.sound.SoundRegistry;
import net.minecraft.util.ResourceLocation;

Expand Down Expand Up @@ -61,7 +61,7 @@ public static int getMaxDistanceSq() {
}

private final ResourceLocation registryName;
public final IModSound sound;
public final ModSound sound;

// region GTLite Patch
@Deprecated
Expand All @@ -70,15 +70,15 @@ public static int getMaxDistanceSq() {
private final DoubleSupplier powerCost;

@Deprecated
TravelSource(IModSound sound, IntSupplier maxDistance, DoubleSupplier powerCost) {
TravelSource(ModSound sound, IntSupplier maxDistance, DoubleSupplier powerCost) {
this.registryName = new ResourceLocation(EnderIO.DOMAIN, name().toLowerCase());
this.sound = sound;
this.maxDistance = maxDistance;
this.powerCost = powerCost;
}
// endregion

TravelSource(IModSound sound) {
TravelSource(ModSound sound) {
this(sound, () -> 0, () -> 0);
}

Expand All @@ -88,7 +88,7 @@ public ResourceLocation getRegistryName() {
}

@Override
public IModSound getSound() {
public ModSound getSound() {
return sound;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Interface for items which support the overlay and conduit view modes
*/
public interface IConduitControl extends IHideFacades {
public interface ConduitControllable extends IHideFacades {

/**
* Controls whether the overlay is shown and the player can change the display mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import com.google.common.collect.Multimap;

import crazypants.enderio.api.ILocalizable;
import crazypants.enderio.api.Localizable;
import crazypants.enderio.base.handler.darksteel.PacketDarkSteelSFX;

/**
Expand All @@ -40,7 +40,7 @@
* @author Henry Loenwind
*
*/
public interface IDarkSteelUpgrade extends IForgeRegistryEntry<IDarkSteelUpgrade>, ILocalizable {
public interface IDarkSteelUpgrade extends IForgeRegistryEntry<IDarkSteelUpgrade>, Localizable {

/**
* @return The unlocalized name to display in the tooltip.
Expand Down
38 changes: 27 additions & 11 deletions src/main/java/crazypants/enderio/base/EnderIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
import net.minecraftforge.server.permission.DefaultPermissionHandler;
import net.minecraftforge.server.permission.PermissionAPI;

import org.apache.commons.lang3.tuple.Triple;

import com.enderio.core.common.Lang;
import com.enderio.core.common.mixin.SimpleMixinLoader;
import com.enderio.core.common.util.NNList;
Expand All @@ -48,7 +46,6 @@
import crazypants.enderio.base.config.config.DiagnosticsConfig;
import crazypants.enderio.base.config.config.PersonalConfig;
import crazypants.enderio.base.config.config.TeleportConfig;
import crazypants.enderio.base.config.recipes.RecipeFactory;
import crazypants.enderio.base.config.recipes.RecipeLoader;
import crazypants.enderio.base.diagnostics.EnderIOCrashCallable;
import crazypants.enderio.base.diagnostics.ProfilerAntiReactor;
Expand All @@ -69,21 +66,29 @@
import crazypants.enderio.base.recipe.vat.VatRecipeManager;
import crazypants.enderio.base.scheduler.Celeb;
import crazypants.enderio.base.scheduler.Scheduler;
import org.jetbrains.annotations.NotNull;

@Mod(modid = EnderIO.MODID,
name = EnderIO.MOD_NAME,
version = EnderIO.VERSION,
dependencies = EnderIO.DEPENDENCIES,
version = EnderIO.MOD_VERSION,
dependencies = EnderIO.MOD_DEPENDENCIES,
guiFactory = "crazypants.enderio.base.config.GUIFactory")
public class EnderIO implements IEnderIOAddon {

public static final @Nonnull String MODID = "enderio";
public static final @Nonnull String DOMAIN = "enderio";
public static final @Nonnull String MOD_NAME = "Ender IO";
public static final @Nonnull String VERSION = EIOTags.VERSION;
// region Mod Info

@NotNull
public static final String MODID = EIOTags.MOD_ID;
@NotNull
public static final String DOMAIN = EIOTags.MOD_ID;
@NotNull
public static final String MOD_NAME = EIOTags.MOD_NAME;
@NotNull
public static final String MOD_VERSION = EIOTags.VERSION;
@NotNull
public static final String MOD_DEPENDENCIES = "after:endercore;after:hwyla;after:jei";

private static final @Nonnull String DEFAULT_DEPENDENCIES = "after:endercore;after:hwyla;after:jei";
public static final @Nonnull String DEPENDENCIES = DEFAULT_DEPENDENCIES;
// endregion

@Instance(MODID)
public static EnderIO instance;
Expand Down Expand Up @@ -326,6 +331,17 @@ public NNList<String> getExampleFiles() {
"unhide_base");
}

/**
* Get the {@link ResourceLocation} with its {@code path} at the mod namespace.
*
* @param path The path in the mod domain.
* @return Returns the {@link ResourceLocation} of the mod.
*/
@NotNull
public static ResourceLocation id(@NotNull String path) {
return new ResourceLocation(DOMAIN, path);
}

static void initCrashData() {
// this is an ugly hack to make sure all anon subclasses of CrashReportCategory that are needed for a crash
// report are actually loaded
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/crazypants/enderio/base/EnderIODummy.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@Mod(modid = EnderIODummy.MODID,
name = EnderIODummy.MOD_NAME,
version = EnderIO.VERSION,
version = EnderIO.MOD_VERSION,
dependencies = "after:" + EnderIO.MODID)
public class EnderIODummy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
import net.minecraft.nbt.NBTTagCompound;

import crazypants.enderio.base.filter.FilterRegistry;
import crazypants.enderio.base.filter.IFilter;
import crazypants.enderio.base.filter.Filter;
import info.loenwind.autosave.Registry;
import info.loenwind.autosave.exceptions.NoHandlerFoundException;
import info.loenwind.autosave.handlers.IHandler;
import info.loenwind.autosave.util.NBTAction;

public class HandleIFilter implements IHandler<IFilter> {
public class HandleIFilter implements IHandler<Filter> {

@Override
public @Nonnull Class<?> getRootType() {
return IFilter.class;
return Filter.class;
}

@Override
public boolean store(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt,
@Nonnull Type type, @Nonnull String name, @Nonnull IFilter object)
@Nonnull Type type, @Nonnull String name, @Nonnull Filter object)
throws IllegalArgumentException,
IllegalAccessException,
InstantiationException,
Expand All @@ -37,9 +37,9 @@ public boolean store(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase,

@Override
@Nullable
public IFilter read(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt,
@Nonnull Type type, @Nonnull String name,
@Nullable IFilter object) throws IllegalArgumentException, IllegalAccessException,
public Filter read(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt,
@Nonnull Type type, @Nonnull String name,
@Nullable Filter object) throws IllegalArgumentException, IllegalAccessException,
InstantiationException, NoHandlerFoundException {
if (object == null && !nbt.hasKey(name)) {
// Note: This will be called with no nbt when a fresh itemstack is placed---output should be null!
Expand Down
Loading