Refactored crafting patterns (#4458)

* Deduplicate crafting patterns internals

This should save a bit memory for duplicate patterns as well as speed up
loading new patterns on reloading chunks.

* Encode recipe id in pattern
* Use the recipe id directly for looking it up
* Slightly refactored how patterns encode whether they are crafting patterns or not.
* Renamed PatternHelper.
* Added APIs to encode patterns. (#4463)
* Removed ICraftingPatternItem.
* Renamed isCrafting to isCraftable

Co-authored-by: shartte <shartte@users.noreply.github.com>
This commit is contained in:
yueh
2020-07-12 16:21:30 +02:00
committed by GitHub
parent 06735f5c39
commit 9bb23bcac8
19 changed files with 551 additions and 243 deletions
+13 -13
View File
@@ -10,12 +10,14 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
/**
* To be implemented on blocks that "hide" another block inside, so connected textures can still be accomplished.
* To be implemented on blocks that "hide" another block inside, so connected
* textures can still be accomplished.
*/
public interface IFacade {
/**
* @deprecated Use {@link #getFacade(IBlockReader, BlockPos, Direction, BlockPos)}
* @deprecated Use
* {@link #getFacade(IBlockReader, BlockPos, Direction, BlockPos)}
*/
@Nonnull
@Deprecated
@@ -24,20 +26,18 @@ public interface IFacade {
/**
* Gets the blockstate this facade appears as.
*
* @param world
* {@link World}
* @param pos
* The Blocks position
* @param side
* The side being rendered, NOT the side being connected from.
* <p>
* This value can be null if no side is specified. Please handle this appropriately.
* @param connection
* The position of the block being connected to.
* @param world {@link World}
* @param pos The Blocks position
* @param side The side being rendered, NOT the side being connected from.
* <p>
* This value can be null if no side is specified. Please
* handle this appropriately.
* @param connection The position of the block being connected to.
* @return The blockstate which your block appears as.
*/
@Nonnull
default BlockState getFacade(@Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nullable Direction side, @Nonnull BlockPos connection) {
default BlockState getFacade(@Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nullable Direction side,
@Nonnull BlockPos connection) {
return getFacade(world, pos, side);
}