mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-12 16:37:38 +00:00
remove deprecated endpoints
will publish a pre-tag and create integration PRs shortly
This commit is contained in:
1 parent
3f8beb3c68
commit
74dc712460
3 files changed
-82
No files matched your search
@@ -1,13 +1,11 @@
|
||||
package com.gtnewhorizons.postea.api;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.gtnewhorizons.postea.utility.BlockConversionInfo;
|
||||
@@ -25,40 +23,6 @@ public abstract class BlockReplacementManager {
|
||||
|
||||
// region custom transformer registration
|
||||
|
||||
/**
|
||||
* Adds a custom transformer for a given id.
|
||||
*
|
||||
* @deprecated Use {@link #addTransformationHandler(String, Function)}
|
||||
*
|
||||
* @apiNote When the transformer function passed to this function returns a null, value Postea will assume that
|
||||
* the transformer has failed to identify and run the handler on any other handler function registered
|
||||
* to the given ID.
|
||||
* <br>
|
||||
* If you need to perform a simple transformations consider using the following methods instead:
|
||||
* <ul>
|
||||
* <li>block -> block (with same meta): {@link #addSimpleReplacement(String, Block)}</li>
|
||||
* <li>block -> block with specific meta: {@link #addSimpleReplacement(String, Block, int)}</li>
|
||||
* <li>block with meta -> block (with same meta): {@link #addSimpleReplacement(String, int, Block)}</li>
|
||||
* <li>block with meta -> block with specific meta:
|
||||
* {@link #addSimpleReplacement(String, int, Block, int)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @implNote For performance reasons, Postea assumes that the BlockConversionInfo that was passed to the handler
|
||||
* hasn't been modified if you return a null value. This isn't enforced though since returning a null
|
||||
* value after doing some modifications has a couple niche uses. eg: having separate handlers for
|
||||
* different migrations of a single thing that can be sunset at different times down the line.
|
||||
*
|
||||
* @param originalId The id of the block to transform.
|
||||
* @param transformer The transformer to apply.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unused")
|
||||
public static void addBlockReplacement(String originalId,
|
||||
BiFunction<BlockConversionInfo, World, BlockConversionInfo> transformer) {
|
||||
if (transformer == null) throw new IllegalArgumentException("transformer is null");
|
||||
addTransformationHandler(originalId, info -> transformer.apply(info, info.world) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom transformer for a given id.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.gtnewhorizons.postea.api;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -28,40 +27,6 @@ public abstract class ItemStackReplacementManager {
|
||||
|
||||
// region custom transformer registration
|
||||
|
||||
/**
|
||||
* Adds a custom transformer for a given id.
|
||||
*
|
||||
* @deprecated Use {@link #addTransformationHandler(String, BiFunction)} instead.
|
||||
*
|
||||
* @apiNote When the transformer function passed to this function returns a null, value Postea will assume that
|
||||
* the transformer has failed to identify and run the handler on any other handler function registered
|
||||
* to the given ID.
|
||||
* <p>
|
||||
* If you need to perform a simple transformations consider using the following methods instead:
|
||||
* <ul>
|
||||
* <li>item -> item (with same meta): {@link #addSimpleReplacement(String, Item)}</li>
|
||||
* <li>item -> item with specific meta: {@link #addSimpleReplacement(String, Item, int)}</li>
|
||||
* <li>item with meta -> item (with same meta): {@link #addSimpleReplacement(String, int, Item)}</li>
|
||||
* <li>item with meta -> item with specific meta:
|
||||
* {@link #addSimpleReplacement(String, int, Item, int)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @implNote For performance reasons, Postea assumes that the tag that was passed to the handler hasn't been
|
||||
* modified
|
||||
* if you return a null value. This isn't enforced though since returning a null value after doing some
|
||||
* modifications has a couple niche uses. eg: having separate handlers for different migrations of a
|
||||
* single thing that can be sunset at different times down the line.
|
||||
*
|
||||
* @param originalId The id of the item to transform.
|
||||
* @param transformer The transformer to apply.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unused")
|
||||
public static void addItemReplacement(String originalId, Function<NBTTagCompound, NBTTagCompound> transformer) {
|
||||
if (transformer == null) throw new IllegalArgumentException("transformer is null");
|
||||
addTransformationHandler(originalId, (_originalId, tag) -> transformer.apply(tag) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom transformer for a given id.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gtnewhorizons.postea.api;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -19,16 +18,6 @@ import com.gtnewhorizons.postea.utility.TransformerRegistry;
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class TileEntityReplacementManager {
|
||||
|
||||
/**
|
||||
* @deprecated Superseded by {@link #tileEntityTransformer(String, TriFunction)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void tileEntityTransformer(String tileEntityId,
|
||||
BiFunction<NBTTagCompound, World, BlockInfo> transformerFunction) {
|
||||
if (transformerFunction == null) throw new NullPointerException("transformer is null");
|
||||
tileEntityTransformer(tileEntityId, (tag, world, chunk) -> transformerFunction.apply(tag, world));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback function to transform a tile entity before it's loaded.
|
||||
* Callback returns a {@link BlockInfo} which the tile entity will be transformed into.
|
||||
|
||||
Reference in new issue
Block a user