Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.37 KB | None | 0 0
  1. package de.prwh.nanpa.common.core.blocks;
  2.  
  3. import java.util.Random;
  4.  
  5. import javax.annotation.Nullable;
  6.  
  7. import com.google.common.cache.LoadingCache;
  8.  
  9. import de.prwh.nanpa.common.core.NanpaContent;
  10. import de.prwh.nanpa.common.core.NanpaMain;
  11. import de.prwh.nanpa.common.dimension.TeleporterJungle;
  12. import net.minecraft.block.Block;
  13. import net.minecraft.block.BlockBreakable;
  14. import net.minecraft.block.BlockPortal;
  15. import net.minecraft.block.material.Material;
  16. import net.minecraft.block.properties.IProperty;
  17. import net.minecraft.block.properties.PropertyEnum;
  18. import net.minecraft.block.state.BlockStateContainer;
  19. import net.minecraft.block.state.BlockWorldState;
  20. import net.minecraft.block.state.IBlockState;
  21. import net.minecraft.block.state.pattern.BlockPattern;
  22. import net.minecraft.entity.Entity;
  23. import net.minecraft.entity.player.EntityPlayerMP;
  24. import net.minecraft.init.Blocks;
  25. import net.minecraft.init.SoundEvents;
  26. import net.minecraft.item.ItemStack;
  27. import net.minecraft.util.BlockRenderLayer;
  28. import net.minecraft.util.EnumFacing;
  29. import net.minecraft.util.EnumParticleTypes;
  30. import net.minecraft.util.Rotation;
  31. import net.minecraft.util.SoundCategory;
  32. import net.minecraft.util.math.AxisAlignedBB;
  33. import net.minecraft.util.math.BlockPos;
  34. import net.minecraft.world.IBlockAccess;
  35. import net.minecraft.world.World;
  36. import net.minecraftforge.fml.relauncher.Side;
  37. import net.minecraftforge.fml.relauncher.SideOnly;
  38.  
  39. public class BlockNPortal extends BlockPortal
  40. {
  41.     public static final PropertyEnum<EnumFacing.Axis> AXIS = PropertyEnum.<EnumFacing.Axis>create("axis", EnumFacing.Axis.class, new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Z});
  42.     protected static final AxisAlignedBB X_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D);
  43.     protected static final AxisAlignedBB Z_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D);
  44.     protected static final AxisAlignedBB Y_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D);
  45.  
  46.     public BlockNPortal()
  47.     {
  48.         super();
  49.         this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.X));
  50.         this.setTickRandomly(true);
  51.         this.setUnlocalizedName("portal_jungle");
  52.         this.setRegistryName("portal_jungle");
  53.     }
  54.  
  55.     public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
  56.     {
  57.         switch ((EnumFacing.Axis)state.getValue(AXIS))
  58.         {
  59.             case X:
  60.                 return X_AABB;
  61.             case Y:
  62.             default:
  63.                 return Y_AABB;
  64.             case Z:
  65.                 return Z_AABB;
  66.         }
  67.     }
  68.  
  69.     public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
  70.     {
  71.         super.updateTick(worldIn, pos, state, rand);
  72.  
  73. //        if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
  74. //        {
  75. //            int i = pos.getY();
  76. //            BlockPos blockpos;
  77. //
  78. //            for (blockpos = pos; !worldIn.getBlockState(blockpos).isFullyOpaque() && blockpos.getY() > 0; blockpos = blockpos.down())
  79. //            {
  80. //                ;
  81. //            }
  82. //
  83. //            if (i > 0 && !worldIn.getBlockState(blockpos.up()).isNormalCube())
  84. //            {
  85. //                Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, EntityList.getEntityStringFromClass(EntityPigZombie.class), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D);
  86. //
  87. //                if (entity != null)
  88. //                {
  89. //                    entity.timeUntilPortal = entity.getPortalCooldown();
  90. //                }
  91. //            }
  92. //        }
  93.     }
  94.  
  95.     @Nullable
  96.     public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
  97.     {
  98.         return NULL_AABB;
  99.     }
  100.  
  101.     public static int getMetaForAxis(EnumFacing.Axis axis)
  102.     {
  103.         return axis == EnumFacing.Axis.X ? 1 : (axis == EnumFacing.Axis.Z ? 2 : 0);
  104.     }
  105.  
  106.     public boolean isFullCube(IBlockState state)
  107.     {
  108.         return false;
  109.     }
  110.  
  111.     public boolean trySpawnPortal(World worldIn, BlockPos pos)
  112.     {
  113.         BlockNPortal.Size blockportal$size = new BlockNPortal.Size(worldIn, pos, EnumFacing.Axis.X);
  114.  
  115.         if (blockportal$size.isValid() && blockportal$size.portalBlockCount == 0)
  116.         {
  117.             blockportal$size.placePortalBlocks();
  118.             return true;
  119.         }
  120.         else
  121.         {
  122.             BlockNPortal.Size blockportal$size1 = new BlockNPortal.Size(worldIn, pos, EnumFacing.Axis.Z);
  123.  
  124.             if (blockportal$size1.isValid() && blockportal$size1.portalBlockCount == 0)
  125.             {
  126.                 blockportal$size1.placePortalBlocks();
  127.                 return true;
  128.             }
  129.             else
  130.             {
  131.                 return false;
  132.             }
  133.         }
  134.     }
  135.  
  136.     /**
  137.      * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
  138.      * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
  139.      * block, etc.
  140.      */
  141.     public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
  142.     {
  143.         EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);
  144.  
  145.         if (enumfacing$axis == EnumFacing.Axis.X)
  146.         {
  147.             BlockNPortal.Size blockportal$size = new BlockNPortal.Size(worldIn, pos, EnumFacing.Axis.X);
  148.  
  149.             if (!blockportal$size.isValid() || blockportal$size.portalBlockCount < blockportal$size.width * blockportal$size.height)
  150.             {
  151.                 worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
  152.             }
  153.         }
  154.         else if (enumfacing$axis == EnumFacing.Axis.Z)
  155.         {
  156.             BlockNPortal.Size blockportal$size1 = new BlockNPortal.Size(worldIn, pos, EnumFacing.Axis.Z);
  157.  
  158.             if (!blockportal$size1.isValid() || blockportal$size1.portalBlockCount < blockportal$size1.width * blockportal$size1.height)
  159.             {
  160.                 worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
  161.             }
  162.         }
  163.     }
  164.  
  165.     @SideOnly(Side.CLIENT)
  166.     public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
  167.     {
  168.         pos = pos.offset(side);
  169.         EnumFacing.Axis enumfacing$axis = null;
  170.  
  171.         if (blockState.getBlock() == this)
  172.         {
  173.             enumfacing$axis = (EnumFacing.Axis)blockState.getValue(AXIS);
  174.  
  175.             if (enumfacing$axis == null)
  176.             {
  177.                 return false;
  178.             }
  179.  
  180.             if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST)
  181.             {
  182.                 return false;
  183.             }
  184.  
  185.             if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH)
  186.             {
  187.                 return false;
  188.             }
  189.         }
  190.  
  191.         boolean flag = blockAccess.getBlockState(pos.west()).getBlock() == this && blockAccess.getBlockState(pos.west(2)).getBlock() != this;
  192.         boolean flag1 = blockAccess.getBlockState(pos.east()).getBlock() == this && blockAccess.getBlockState(pos.east(2)).getBlock() != this;
  193.         boolean flag2 = blockAccess.getBlockState(pos.north()).getBlock() == this && blockAccess.getBlockState(pos.north(2)).getBlock() != this;
  194.         boolean flag3 = blockAccess.getBlockState(pos.south()).getBlock() == this && blockAccess.getBlockState(pos.south(2)).getBlock() != this;
  195.         boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X;
  196.         boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z;
  197.         return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH));
  198.     }
  199.  
  200.     /**
  201.      * Returns the quantity of items to drop on block destruction.
  202.      */
  203.     public int quantityDropped(Random random)
  204.     {
  205.         return 0;
  206.     }
  207.  
  208.     /**
  209.      * Called When an Entity Collided with the Block
  210.      */
  211.     public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
  212.     {
  213.        
  214.         if(entityIn instanceof EntityPlayerMP) {
  215.             EntityPlayerMP player = (EntityPlayerMP) entityIn;
  216.  
  217.             if (player.timeUntilPortal > 0) {
  218.                 player.timeUntilPortal = player.getPortalCooldown();
  219.             } else {
  220.                 if(player.dimension != NanpaMain.dimensionId) {
  221.                     player.mcServer.getPlayerList().transferPlayerToDimension(player, NanpaMain.dimensionId, new TeleporterJungle(player.mcServer.worldServerForDimension(NanpaMain.dimensionId)));
  222.                     player.timeUntilPortal = 10;
  223.                 } else {
  224. //                  player.mcServer.getPlayerList().transferPlayerToDimension(player, 0, new TeleporterJungle(player.mcServer.worldServerForDimension(0)));
  225. //                  player.timeUntilPortal = 10;
  226.                 }
  227.             }
  228.            
  229.            
  230.            
  231.            
  232.            
  233.            
  234.         }
  235.        
  236.        
  237.        
  238. //        if (!entityIn.isRiding() && !entityIn.isBeingRidden() && entityIn.isNonBoss())
  239. //        {
  240. //            entityIn.setPortal(pos);
  241. //        }
  242.     }
  243.  
  244.     @Nullable
  245.     public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
  246.     {
  247.         return null;
  248.     }
  249.  
  250.     /**
  251.      * Convert the given metadata into a BlockState for this Block
  252.      */
  253.     public IBlockState getStateFromMeta(int meta)
  254.     {
  255.         return this.getDefaultState().withProperty(AXIS, (meta & 3) == 2 ? EnumFacing.Axis.Z : EnumFacing.Axis.X);
  256.     }
  257.  
  258.     @SideOnly(Side.CLIENT)
  259.     public BlockRenderLayer getBlockLayer()
  260.     {
  261.         return BlockRenderLayer.TRANSLUCENT;
  262.     }
  263.  
  264.     @SideOnly(Side.CLIENT)
  265.     public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
  266.     {
  267.         if (rand.nextInt(100) == 0)
  268.         {
  269.             worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, rand.nextFloat() * 0.4F + 0.8F, false);
  270.         }
  271.  
  272.         for (int i = 0; i < 4; ++i)
  273.         {
  274.             double d0 = (double)((float)pos.getX() + rand.nextFloat());
  275.             double d1 = (double)((float)pos.getY() + rand.nextFloat());
  276.             double d2 = (double)((float)pos.getZ() + rand.nextFloat());
  277.             double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
  278.             double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
  279.             double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
  280.             int j = rand.nextInt(2) * 2 - 1;
  281.  
  282.             if (worldIn.getBlockState(pos.west()).getBlock() != this && worldIn.getBlockState(pos.east()).getBlock() != this)
  283.             {
  284.                 d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j;
  285.                 d3 = (double)(rand.nextFloat() * 2.0F * (float)j);
  286.             }
  287.             else
  288.             {
  289.                 d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j;
  290.                 d5 = (double)(rand.nextFloat() * 2.0F * (float)j);
  291.             }
  292.  
  293.             worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
  294.         }
  295.     }
  296.  
  297.     /**
  298.      * Convert the BlockState into the correct metadata value
  299.      */
  300.     public int getMetaFromState(IBlockState state)
  301.     {
  302.         return getMetaForAxis((EnumFacing.Axis)state.getValue(AXIS));
  303.     }
  304.  
  305.     /**
  306.      * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
  307.      * blockstate.
  308.      */
  309.     public IBlockState withRotation(IBlockState state, Rotation rot)
  310.     {
  311.         switch (rot)
  312.         {
  313.             case COUNTERCLOCKWISE_90:
  314.             case CLOCKWISE_90:
  315.  
  316.                 switch ((EnumFacing.Axis)state.getValue(AXIS))
  317.                 {
  318.                     case X:
  319.                         return state.withProperty(AXIS, EnumFacing.Axis.Z);
  320.                     case Z:
  321.                         return state.withProperty(AXIS, EnumFacing.Axis.X);
  322.                     default:
  323.                         return state;
  324.                 }
  325.  
  326.             default:
  327.                 return state;
  328.         }
  329.     }
  330.  
  331.     protected BlockStateContainer createBlockState()
  332.     {
  333.         return new BlockStateContainer(this, new IProperty[] {AXIS});
  334.     }
  335.  
  336.     public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_)
  337.     {
  338.         EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
  339.         BlockNPortal.Size blockportal$size = new BlockNPortal.Size(worldIn, p_181089_2_, EnumFacing.Axis.X);
  340.         LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);
  341.  
  342.         if (!blockportal$size.isValid())
  343.         {
  344.             enumfacing$axis = EnumFacing.Axis.X;
  345.             blockportal$size = new BlockNPortal.Size(worldIn, p_181089_2_, EnumFacing.Axis.Z);
  346.         }
  347.  
  348.         if (!blockportal$size.isValid())
  349.         {
  350.             return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
  351.         }
  352.         else
  353.         {
  354.             int[] aint = new int[EnumFacing.AxisDirection.values().length];
  355.             EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
  356.             BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);
  357.  
  358.             for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
  359.             {
  360.                 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);
  361.  
  362.                 for (int i = 0; i < blockportal$size.getWidth(); ++i)
  363.                 {
  364.                     for (int j = 0; j < blockportal$size.getHeight(); ++j)
  365.                     {
  366.                         BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
  367.  
  368.                         if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR)
  369.                         {
  370.                             ++aint[enumfacing$axisdirection.ordinal()];
  371.                         }
  372.                     }
  373.                 }
  374.             }
  375.  
  376.             EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;
  377.  
  378.             for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
  379.             {
  380.                 if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
  381.                 {
  382.                     enumfacing$axisdirection1 = enumfacing$axisdirection2;
  383.                 }
  384.             }
  385.  
  386.             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);
  387.         }
  388.     }
  389.  
  390.     public static class Size
  391.         {
  392.             private final World world;
  393.             private final EnumFacing.Axis axis;
  394.             private final EnumFacing rightDir;
  395.             private final EnumFacing leftDir;
  396.             private int portalBlockCount;
  397.             private BlockPos bottomLeft;
  398.             private int height;
  399.             private int width;
  400.  
  401.             public Size(World worldIn, BlockPos p_i45694_2_, EnumFacing.Axis p_i45694_3_)
  402.             {
  403.                 this.world = worldIn;
  404.                 this.axis = p_i45694_3_;
  405.  
  406.                 if (p_i45694_3_ == EnumFacing.Axis.X)
  407.                 {
  408.                     this.leftDir = EnumFacing.EAST;
  409.                     this.rightDir = EnumFacing.WEST;
  410.                 }
  411.                 else
  412.                 {
  413.                     this.leftDir = EnumFacing.NORTH;
  414.                     this.rightDir = EnumFacing.SOUTH;
  415.                 }
  416.  
  417.                 for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.isEmptyBlock(worldIn.getBlockState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
  418.                 {
  419.                     ;
  420.                 }
  421.  
  422.                 int i = this.getDistanceUntilEdge(p_i45694_2_, this.leftDir) - 1;
  423.  
  424.                 if (i >= 0)
  425.                 {
  426.                     this.bottomLeft = p_i45694_2_.offset(this.leftDir, i);
  427.                     this.width = this.getDistanceUntilEdge(this.bottomLeft, this.rightDir);
  428.  
  429.                     if (this.width < 2 || this.width > 21)
  430.                     {
  431.                         this.bottomLeft = null;
  432.                         this.width = 0;
  433.                     }
  434.                 }
  435.  
  436.                 if (this.bottomLeft != null)
  437.                 {
  438.                     this.height = this.calculatePortalHeight();
  439.                 }
  440.             }
  441.  
  442.             protected int getDistanceUntilEdge(BlockPos p_180120_1_, EnumFacing p_180120_2_)
  443.             {
  444.                 int i;
  445.  
  446.                 for (i = 0; i < 22; ++i)
  447.                 {
  448.                     BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i);
  449.  
  450.                     if (!this.isEmptyBlock(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != Blocks.OBSIDIAN)
  451.                     {
  452.                         break;
  453.                     }
  454.                 }
  455.  
  456.                 Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock();
  457.                 return block == Blocks.OBSIDIAN ? i : 0;
  458.             }
  459.  
  460.             public int getHeight()
  461.             {
  462.                 return this.height;
  463.             }
  464.  
  465.             public int getWidth()
  466.             {
  467.                 return this.width;
  468.             }
  469.  
  470.             protected int calculatePortalHeight()
  471.             {
  472.                 label24:
  473.  
  474.                 for (this.height = 0; this.height < 21; ++this.height)
  475.                 {
  476.                     for (int i = 0; i < this.width; ++i)
  477.                     {
  478.                         BlockPos blockpos = this.bottomLeft.offset(this.rightDir, i).up(this.height);
  479.                         Block block = this.world.getBlockState(blockpos).getBlock();
  480.  
  481.                         if (!this.isEmptyBlock(block))
  482.                         {
  483.                             break label24;
  484.                         }
  485.  
  486.                         if (block == NanpaContent.block_portal)
  487.                         {
  488.                             ++this.portalBlockCount;
  489.                         }
  490.  
  491.                         if (i == 0)
  492.                         {
  493.                             block = this.world.getBlockState(blockpos.offset(this.leftDir)).getBlock();
  494.  
  495.                             if (block != Blocks.OBSIDIAN)
  496.                             {
  497.                                 break label24;
  498.                             }
  499.                         }
  500.                         else if (i == this.width - 1)
  501.                         {
  502.                             block = this.world.getBlockState(blockpos.offset(this.rightDir)).getBlock();
  503.  
  504.                             if (block != Blocks.OBSIDIAN)
  505.                             {
  506.                                 break label24;
  507.                             }
  508.                         }
  509.                     }
  510.                 }
  511.  
  512.                 for (int j = 0; j < this.width; ++j)
  513.                 {
  514.                     if (this.world.getBlockState(this.bottomLeft.offset(this.rightDir, j).up(this.height)).getBlock() != Blocks.OBSIDIAN)
  515.                     {
  516.                         this.height = 0;
  517.                         break;
  518.                     }
  519.                 }
  520.  
  521.                 if (this.height <= 21 && this.height >= 3)
  522.                 {
  523.                     return this.height;
  524.                 }
  525.                 else
  526.                 {
  527.                     this.bottomLeft = null;
  528.                     this.width = 0;
  529.                     this.height = 0;
  530.                     return 0;
  531.                 }
  532.             }
  533.  
  534.             protected boolean isEmptyBlock(Block blockIn)
  535.             {
  536.                 return blockIn.getMaterial(blockIn.getDefaultState()) == Material.AIR || blockIn == Blocks.FIRE || blockIn == Blocks.PORTAL;
  537.             }
  538.  
  539.             public boolean isValid()
  540.             {
  541.                 return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
  542.             }
  543.  
  544.             public void placePortalBlocks()
  545.             {
  546.                 for (int i = 0; i < this.width; ++i)
  547.                 {
  548.                     BlockPos blockpos = this.bottomLeft.offset(this.rightDir, i);
  549.  
  550.                     for (int j = 0; j < this.height; ++j)
  551.                     {
  552.                         this.world.setBlockState(blockpos.up(j), Blocks.PORTAL.getDefaultState().withProperty(BlockNPortal.AXIS, this.axis), 2);
  553.                     }
  554.                 }
  555.             }
  556.         }
  557. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement