From 8c46d409a3d91acd2e514d09d5ebb794973e0ba9 Mon Sep 17 00:00:00 2001 From: oshi4 Date: Mon, 6 Jan 2020 16:12:47 +0300 Subject: [PATCH] Arcana portal fix Currently building similar to End portal --- .../blocks/arcana/BlockArcanaPortalFrame.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/divinerpg/objects/blocks/arcana/BlockArcanaPortalFrame.java b/src/main/java/divinerpg/objects/blocks/arcana/BlockArcanaPortalFrame.java index 1368c37efd..feafd81680 100644 --- a/src/main/java/divinerpg/objects/blocks/arcana/BlockArcanaPortalFrame.java +++ b/src/main/java/divinerpg/objects/blocks/arcana/BlockArcanaPortalFrame.java @@ -1,17 +1,10 @@ package divinerpg.objects.blocks.arcana; -import java.util.List; -import java.util.Random; - -import javax.annotation.Nullable; - import com.google.common.base.Predicates; - import divinerpg.enums.EnumBlockType; import divinerpg.objects.blocks.BlockMod; import divinerpg.registry.ModBlocks; import net.minecraft.block.Block; -import net.minecraft.block.BlockEndPortalFrame; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockFaceShape; @@ -24,20 +17,18 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; -import net.minecraft.util.SoundCategory; +import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import javax.annotation.Nullable; +import java.util.List; +import java.util.Random; + public class BlockArcanaPortalFrame extends BlockMod { public static final PropertyDirection FACING = BlockHorizontal.FACING; protected static final AxisAlignedBB AABB_BLOCK = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.8125D, 1.0D); @@ -118,7 +109,21 @@ public static BlockPattern getOrCreatePortalShape() { if (portalShape == null) { - portalShape = FactoryBlockPattern.start().aisle("?vvv?", ">???<", ">???<", ">???<", "?^^^?").where('?', BlockWorldState.hasState(BlockStateMatcher.ANY)).where('^', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame).where(FACING, Predicates.equalTo(EnumFacing.WEST)))).where('>', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame).where(FACING, Predicates.equalTo(EnumFacing.WEST)))).where('v', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame).where(FACING, Predicates.equalTo(EnumFacing.WEST)))).where('<', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame).where(FACING, Predicates.equalTo(EnumFacing.WEST)))).build(); + portalShape = FactoryBlockPattern.start() + .aisle("?vvv?", + ">???<", + ">???<", + ">???<", + "?^^^?") + .where('?', BlockWorldState.hasState(BlockStateMatcher.ANY)) + .where('^', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame) + .where(FACING, Predicates.equalTo(EnumFacing.SOUTH)))) + .where('>', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame) + .where(FACING, Predicates.equalTo(EnumFacing.WEST)))) + .where('v', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame) + .where(FACING, Predicates.equalTo(EnumFacing.NORTH)))) + .where('<', BlockWorldState.hasState(BlockStateMatcher.forBlock(ModBlocks.arcanaPortalFrame) + .where(FACING, Predicates.equalTo(EnumFacing.EAST)))).build(); } return portalShape; @@ -147,7 +152,6 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); BlockPattern.PatternHelper blockpattern$patternhelper = this.getOrCreatePortalShape().match(worldIn, pos); - //TODO - Stop portal forming outside the frame if (blockpattern$patternhelper != null) { BlockPos blockpos = blockpattern$patternhelper.getFrontTopLeft().add(-3, 0, -3);