本文整理汇总了Java中net.minecraft.block.state.pattern.BlockPattern.createLoadingCache方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPattern.createLoadingCache方法的具体用法?Java BlockPattern.createLoadingCache怎么用?Java BlockPattern.createLoadingCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.state.pattern.BlockPattern
的用法示例。
在下文中一共展示了BlockPattern.createLoadingCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPatternHelper
import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_)
{
EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, p_181089_2_, EnumFacing.Axis.X);
LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);
if (!blockportal$size.isValid())
{
enumfacing$axis = EnumFacing.Axis.X;
blockportal$size = new BlockPortal.Size(worldIn, p_181089_2_, EnumFacing.Axis.Z);
}
if (!blockportal$size.isValid())
{
return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
}
else
{
int[] aint = new int[EnumFacing.AxisDirection.values().length];
EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);
for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
{
BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
for (int i = 0; i < blockportal$size.getWidth(); ++i)
{
for (int j = 0; j < blockportal$size.getHeight(); ++j)
{
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR)
{
++aint[enumfacing$axisdirection.ordinal()];
}
}
}
}
EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
{
if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
{
enumfacing$axisdirection1 = enumfacing$axisdirection2;
}
}
return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
}
}
示例2: createPatternHelper
import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
@Override
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_)
{
EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
AetherPortalSize blockportal$size = new AetherPortalSize(worldIn, p_181089_2_, EnumFacing.Axis.X);
LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);
if (!blockportal$size.isValid())
{
enumfacing$axis = EnumFacing.Axis.X;
blockportal$size = new AetherPortalSize(worldIn, p_181089_2_, EnumFacing.Axis.Z);
}
if (!blockportal$size.isValid())
{
return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
}
else
{
int[] aint = new int[EnumFacing.AxisDirection.values().length];
EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);
for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
{
BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
for (int i = 0; i < blockportal$size.getWidth(); ++i)
{
for (int j = 0; j < blockportal$size.getHeight(); ++j)
{
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR)
{
++aint[enumfacing$axisdirection.ordinal()];
}
}
}
}
EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
{
if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
{
enumfacing$axisdirection1 = enumfacing$axisdirection2;
}
}
return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
}
}
示例3: createPatternHelper
import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_) {
EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
BlockAbstractPortal.Size blockportal$size = getSizer(worldIn, p_181089_2_, EnumFacing.Axis.X);
LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);
if (!blockportal$size.isValid()) {
enumfacing$axis = EnumFacing.Axis.X;
blockportal$size = getSizer(worldIn, p_181089_2_, EnumFacing.Axis.Z);
}
if (!blockportal$size.isValid()) {
return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
} else {
int[] aint = new int[EnumFacing.AxisDirection.values().length];
EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);
for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values()) {
BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(
enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos
: blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1),
EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache,
blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
for (int i = 0; i < blockportal$size.getWidth(); ++i) {
for (int j = 0; j < blockportal$size.getHeight(); ++j) {
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR) {
++aint[enumfacing$axisdirection.ordinal()];
}
}
}
}
EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values()) {
if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()]) {
enumfacing$axisdirection1 = enumfacing$axisdirection2;
}
}
return new BlockPattern.PatternHelper(
enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos
: blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1),
EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache,
blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
}
}
示例4: createPatternHelper
import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
@Override
public PatternHelper createPatternHelper(World world, BlockPos pos) {
EnumFacing.Axis axis = EnumFacing.Axis.Z;
Size psize = new Size(world, pos, EnumFacing.Axis.X);
LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(world, true);
if (!psize.isSizeValid())
{
axis = EnumFacing.Axis.X;
psize = new Size(world, pos, EnumFacing.Axis.Z);
}
if (!psize.isSizeValid())
{
return new PatternHelper(pos, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
}
else
{
int[] aint = new int[EnumFacing.AxisDirection.values().length];
EnumFacing enumfacing = psize.face1.rotateYCCW();
BlockPos blockpos = psize.pos.up(psize.getSizeY() - 1);
for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
{
PatternHelper phelp = new PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos :
blockpos.offset(psize.face1, psize.getSizeX() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection, axis),
EnumFacing.UP, loadingcache, psize.getSizeX(), psize.getSizeY(), 1);
for (int i = 0; i < psize.getSizeX(); ++i)
{
for (int j = 0; j < psize.getSizeY(); ++j)
{
BlockWorldState bws = phelp.translateOffset(i, j, 1);
if (bws.getBlockState() != null && bws.getBlockState().getBlock().getMaterial(bws.getBlockState()) != Material.AIR)
{
++aint[enumfacing$axisdirection.ordinal()];
}
}
}
}
EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
{
if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
{
enumfacing$axisdirection1 = enumfacing$axisdirection2;
}
}
return new PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos :
blockpos.offset(psize.face1, psize.getSizeX() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, axis),
EnumFacing.UP, loadingcache, psize.getSizeX(), psize.getSizeY(), 1);
}
}