• Posts

    • So i'm trying to get a structure to spawn in my mod using an NBT structure i created but its not actually spawning. So i was able to register the structure and i'm pretty confident its in there in code but for some reason i cant use a structure block to spawn it. What would i need to do to get this working. Here is my git with the files and the NBT files from my GIT Any idea's on where i can go or what i can try would be helpful! https://github.com/drizzs/GrassWorld-1.14/blob/1.14.4-rewrite/src/main/java/com/drizzs/grassworld/features/GrassIslandPiece.java https://github.com/drizzs/GrassWorld-1.14/blob/1.14.4-rewrite/src/main/java/com/drizzs/grassworld/features/GrassIslandStructure.java https://github.com/drizzs/GrassWorld-1.14/blob/1.14.4-rewrite/src/main/java/com/drizzs/grassworld/features/GrassIslandVariant.java https://github.com/drizzs/GrassWorld-1.14/tree/1.14.4-rewrite/src/main/resources/data/grassworld/structures only the dirtisland variant is being used. i'm assuming its not loading my template possibly https://github.com/drizzs/GrassWorld-1.14/blob/1.14.4-rewrite/src/main/java/com/drizzs/grassworld/registries/GrassFeatures.java this is how i register it and such
    • Is it possible to write JSON loot table where I specify loots based on used item?
    • So what? You know how to write a for loop, right? This is basic programming.
    • 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  
  • Topics

  • Who's Online (See full list)