• Posts

    • but what if the items they have are spread over multiple slots? what if they have 5 oak boards in one slot, and the other 5 in another slot?
    • Hi   I have extended the vanilla BubbleColumn.java in order to add some special behaviours such as allowing blocks with a tag and can be waterlogged to retain the bubble column structure when intersecting. Blocks with this tag while waterlogged does not block bubble columns. Bubble Column is a block with the property DRAG. If true (Magma Block) it drags the player down to the bottom and false (Soul Sand) does the opposite and pushes the player to the surface.   BubbleColumn.java public class BlockBubbleColumn extends BubbleColumnBlock { public static final ResourceLocation transparentID = new ResourceLocation(Reference.MODID,"bubble_column_transparent_blocks"); public BlockBubbleColumn(String name, Block.Properties properties) { super(properties); setRegistryName(name); } @Override public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos.down()).getBlock(); return canTransfer(block,worldIn.getBlockState(pos.down())) || block == IntercraftBlocks.VANILLA_BUBBLE_COLUMN || block == Blocks.SOUL_SAND || block == Blocks.MAGMA_BLOCK; } @Override public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { BlockState blockState = worldIn.getBlockState(pos.down()); boolean drag; if (canTransfer(blockState.getBlock(),blockState)) { BlockPos p = getNextValidDragPosDown(worldIn,pos.down()); if (p == null) return; else drag = getDrag(worldIn,p); System.out.println(String.format("Block under it has drag %s",drag)); } else drag = getDrag(worldIn,pos.down()); System.out.println(String.format("Drag is %s",drag)); placeBubbleColumn(worldIn, pos.up(), drag); //placeBubbleColumn(worldIn, pos.up(), getDrag(worldIn, pos.down())); } @Override public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { BlockState blockState = worldIn.getBlockState(pos.up()); if (canTransfer(blockState.getBlock(),blockState)) { BlockPos p = getNextValidDragPosUp(worldIn,pos); if (p != null) placeBubbleColumn(worldIn, p, getDrag(worldIn, pos)); } else placeBubbleColumn(worldIn, pos.up(), getDrag(worldIn,pos)); //placeBubbleColumn(worldIn, pos.up(), getDrag(worldIn, pos)); } private static BlockPos getNextValidDragPosUp(IBlockReader reader, BlockPos pos) { BlockPos p; int y = 1; while (reader.getHeight()>pos.getY()+y) { p = pos.up(y); Block block = reader.getBlockState(p).getBlock(); if ( block == IntercraftBlocks.VANILLA_BUBBLE_COLUMN ) { System.out.println(block.getRegistryName().getPath()); System.out.println(p.toString()); return p; } y++; } return null; } private static BlockPos getNextValidDragPosDown(IBlockReader reader, BlockPos pos) { BlockPos p; int y = 1; while (0<pos.getY()-y) { p = pos.down(y); Block block = reader.getBlockState(p).getBlock(); if ( block == IntercraftBlocks.VANILLA_BUBBLE_COLUMN || block == Blocks.SOUL_SAND || block == Blocks.MAGMA_BLOCK ) { System.out.println(block.getRegistryName().getPath()); System.out.println(p.toString()); return p; } y++; } return null; } private static boolean getDrag(IBlockReader blockReader, BlockPos pos) { BlockState blockstate = blockReader.getBlockState(pos); Block block = blockstate.getBlock(); if (block == IntercraftBlocks.VANILLA_BUBBLE_COLUMN || block == Blocks.BUBBLE_COLUMN) { return blockstate.get(DRAG); } else { return block != Blocks.SOUL_SAND; } } private static boolean canTransfer(Block block, BlockState state) { return (BlockTags.getCollection().getOrCreate(transparentID).contains(block) && getWaterLogged(state)); } private static boolean getWaterLogged(BlockState state) { return state.has(WATERLOGGED) ? state.get(WATERLOGGED) : false; } }   The idea is to allow this to work with a lot of blocks without having to add extra properties to them, so my plan was to instead of reading the block below, look if it is Bubble Column, Soul Sand or Magma Block and otherwise look for the closest valid column block to continue the pillar.   I have narrowed it down to three functions that control this; isValidPosition, onBlockAdded and tick. The problem right now is probably a logic error, but I can't figure it out. From the values I print out it first succeeds in setting the correct value, but the rest does not read the previous block's data and then the first blocks' data is changed to the incorrect value. This example I'm expecting them all to be false, but this is what it prints out and then in-game they all are true: [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:getNextValidDragPosDown:121]: bubble_column [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:getNextValidDragPosDown:122]: BlockPos{x=-5, y=96, z=148} [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:onBlockAdded:55]: Block under it has drag false [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:onBlockAdded:62]: Drag is false [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:onBlockAdded:62]: Drag is true [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:onBlockAdded:62]: Drag is true [19:50:18] [Server thread/INFO] [STDOUT/]: [net.intercraft.intercraftcore.block.BlockBubbleColumn:onBlockAdded:62]: Drag is true  
    • By accessing Minecraft#player you are either reaching across logical sides or it will never work because you are on the client already. You must do this on the server.
    • could you let me know if im implimenting this properly? public void placeItemsInDispenser() { this.mc.player.inventory.currentItem = this.shulkerSlot; ItemStack shulker = this.mc.player.getHeldItem(EnumHand.MAIN_HAND); inventory.insertItem(this.debugSlot.getValue(), shulker, false); } I tried a range of values for slotID and it doesnt seem to transfer over
  • Topics

  • Who's Online (See full list)