Package fr.rodofire.ewc.util
Class BlockPlaceUtil
java.lang.Object
fr.rodofire.ewc.util.BlockPlaceUtil
Useful class to verify and place the block in the world.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.level.block.state.BlockStategetBlockWith2DNoise(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 2d noise this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetBlockWith2DNoise(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 2d noise this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetBlockWith3DNoise(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 3d noise this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetBlockWith3DNoise(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 3d noise this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetBlockWithOrder(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, int i) return the BlockState wanted based on order this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetBlockWithOrder(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, int i) return the BlockState wanted based on order this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetRandomBlock(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetRandomBlock(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.util.RandomSource random) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetRandomBlock(net.minecraft.world.level.block.state.BlockState[] blocksToPlace) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world genstatic net.minecraft.world.level.block.state.BlockStategetRandomBlock(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, net.minecraft.util.RandomSource random) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world genstatic booleanplace(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, BlockDataKey data, @Nullable StructurePlacementRuleManager ruler, int flag) static voidplaceBlock(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Places a block at a given position in the world.static voidplaceBlockWith2DNoise(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) assign the 2d noise value to 'a' then call the method to get the block depending on the noisestatic voidplaceBlockWith3DNoise(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) assign the 3d noise value to 'a' then call the method to get the block depending on the noisestatic voidplaceBlockWithNbt(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag compound) Places a block at a given position in the world with NBT data.static voidplaceBlockWithOrder(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, int i) Place the block corresponding to the index 'i'.static voidplaceRandomBlock(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos) method to place random blocks based on a given liststatic voidplaceRandomBlock(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) method to place random blocks based on a given liststatic booleanplaceVerifiedBlock(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Verifies and places a block at a given position in the world if verification passes.static booleanplaceVerifiedBlock(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Verifies and places a block at a given position in the world if verification passes.static booleanplaceVerifiedBlockWithNbt(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag compound) Verifies and places a block with NBT data at a given position in the world if verification passes.static booleanset2dNoiseBlockWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) verify if it can put the block before placing itstatic booleanset3dNoiseBlockWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) verify if it can put the block before placing itstatic booleansetBlockWithOrderWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, int i) verify if it can put the block before placing itstatic booleansetRandomBlockWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos) verify if it can put the block before placing itstatic booleanverifyBlock(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos) method to verify that the block is not an unbreakable block or not and to verify if the block can be put or not.static booleanverifyBlock(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos, Map<net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState> blockStateMap) Verifies if a block can be placed at a given position in the world.static booleanverifyBlock(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos) method to verify that the block is not an unbreakable block or not and to verify if the block can be put or not.
-
Constructor Details
-
BlockPlaceUtil
public BlockPlaceUtil()
-
-
Method Details
-
place
public static boolean place(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, BlockDataKey data, @Nullable @Nullable StructurePlacementRuleManager ruler, int flag) -
verifyBlock
public static boolean verifyBlock(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos) method to verify that the block is not an unbreakable block or not and to verify if the block can be put or not.- Parameters:
world- the world where theBlockwill be placedpos- the position of the block- Returns:
- true if it can be posed, false if not
-
verifyBlock
public static boolean verifyBlock(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos) method to verify that the block is not an unbreakable block or not and to verify if the block can be put or not.- Parameters:
world- the world where theBlockwill be placedforce- force the posblocksToForce- list of blocks that can still be forcedpos- the position of the block- Returns:
- true if it can be posed, false if not
-
verifyBlock
public static boolean verifyBlock(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos, Map<net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState> blockStateMap) Verifies if a block can be placed at a given position in the world.- Parameters:
world- The world in which to verify the block.force- If the placement should be forced.blocksToForce- The blocks to force place.pos- The position of the block.blockStateMap- The map of block states.- Returns:
- true if the block can be placed, false otherwise.
-
placeBlock
public static void placeBlock(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Places a block at a given position in the world.- Parameters:
world- The world in which to place the block.pos- The position of the block.state- The state of the block.
-
placeVerifiedBlock
public static boolean placeVerifiedBlock(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Verifies and places a block at a given position in the world if verification passes.- Parameters:
world- The world in which to place the block.force- If the placement should be forced.blocksToForce- The blocks to force place.pos- The position of the block.state- The state of the block.- Returns:
- true if the block was placed, false otherwise.
-
placeVerifiedBlock
public static boolean placeVerifiedBlock(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Verifies and places a block at a given position in the world if verification passes.- Parameters:
world- The world in which to place the block.pos- The position of the block.state- The state of the block.- Returns:
- true if the block was placed, false otherwise.
-
placeBlockWithNbt
public static void placeBlockWithNbt(net.minecraft.world.level.WorldGenLevel world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag compound) Places a block at a given position in the world with NBT data.- Parameters:
world- The world in which to place the block.pos- The position of the block.state- The state of the block.compound- The NBT data to apply.
-
placeVerifiedBlockWithNbt
public static boolean placeVerifiedBlockWithNbt(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag compound) Verifies and places a block with NBT data at a given position in the world if verification passes.- Parameters:
world- The world in which to place the block.force- If the placement should be forced.blocksToForce- The blocks to force place.pos- The position of the block.state- The state of the block.compound- The NBT data to apply.- Returns:
- true if the block was placed, false otherwise.
-
setBlockWithOrderWithVerification
public static boolean setBlockWithOrderWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, int i) verify if it can put the block before placing it- Parameters:
world- the world where theBlockwill be placedforce- force the posblocksToForce- list of blocks that can still be forcedblockToPlace- list of blocks to placepos- the position of the blocki- the index of the stage we're at- Returns:
- boolean (true if the block was placed, else false)
-
setRandomBlockWithVerification
public static boolean setRandomBlockWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos) verify if it can put the block before placing it- Parameters:
world- the world where theBlockwill be placedforce- force the posblocksToForce- list of blocks that can still be forcedblockToPlace- list of blocks to placepos- the position of the block- Returns:
- boolean (true if the block was placed, else false)
-
set2dNoiseBlockWithVerification
public static boolean set2dNoiseBlockWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) verify if it can put the block before placing it- Parameters:
world- the world where theBlockwill be placedforce- force the posblocksToForce- list of blocks that can still be forcedblockToPlace- list of blocks to placepos- the position of the blocknoise- the 2d noise that will determine if the block can be placed- Returns:
- boolean (true if the block was placed, else false)
-
set3dNoiseBlockWithVerification
public static boolean set3dNoiseBlockWithVerification(net.minecraft.world.level.WorldGenLevel world, boolean force, Set<net.minecraft.world.level.block.Block> blocksToForce, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) verify if it can put the block before placing it- Parameters:
world- the world where theBlockwill be placedforce- force the posblocksToForce- list of blocks that can still be forcedblockToPlace- list of blocks to placepos- the position of the blocknoise- the 2d noise that will determine if the block can be placed- Returns:
- boolean (true if the block was placed, else false)
-
placeRandomBlock
public static void placeRandomBlock(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos) method to place random blocks based on a given list- Parameters:
world- the world where theBlockwill be placedblockToPlace- list of blocks to placepos- the position of the block
-
placeRandomBlock
public static void placeRandomBlock(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blockToPlace, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random) method to place random blocks based on a given list- Parameters:
world- the world where theBlockwill be placedblockToPlace- list of blocks to placepos- the position of the block
-
placeBlockWithOrder
public static void placeBlockWithOrder(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, int i) Place the block corresponding to the index 'i'. Generally, after that, the index 'i' will be incremented by one every time this method is called. But you can change it to place two same blocks then incrementing -
placeBlockWith2DNoise
public static void placeBlockWith2DNoise(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) assign the 2d noise value to 'a' then call the method to get the block depending on the noise- Parameters:
world- the world of the blockblocksToPlace- the blockStates list that would be chosen frompos- the pos of the block to testnoise- the noise
-
placeBlockWith3DNoise
public static void placeBlockWith3DNoise(net.minecraft.world.level.WorldGenLevel world, List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) assign the 3d noise value to 'a' then call the method to get the block depending on the noise -
getRandomBlock
public static net.minecraft.world.level.block.state.BlockState getRandomBlock(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the block states list that would be chosen from- Returns:
- the block related to the noise
-
getRandomBlock
public static net.minecraft.world.level.block.state.BlockState getRandomBlock(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.util.RandomSource random) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the block states list that would be chosen from- Returns:
- the block related to the noise
-
getBlockWithOrder
public static net.minecraft.world.level.block.state.BlockState getBlockWithOrder(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, int i) return the BlockState wanted based on order this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the blockStates list that would be chosen fromi- the index to choose from- Returns:
- the block related to the noise
-
getBlockWith2DNoise
public static net.minecraft.world.level.block.state.BlockState getBlockWith2DNoise(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 2d noise this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the blockStates list that would be chosen frompos- the pos of the block to testnoise- the noise- Returns:
- the block related to the noise
-
getBlockWith3DNoise
public static net.minecraft.world.level.block.state.BlockState getBlockWith3DNoise(List<net.minecraft.world.level.block.state.BlockState> blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 3d noise this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the blockStates list that would be chosen frompos- the pos of the block to testnoise- the noise- Returns:
- the block related to the noise
-
getRandomBlock
public static net.minecraft.world.level.block.state.BlockState getRandomBlock(net.minecraft.world.level.block.state.BlockState[] blocksToPlace) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the block states list that would be chosen from- Returns:
- the block related to the noise
-
getRandomBlock
public static net.minecraft.world.level.block.state.BlockState getRandomBlock(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, net.minecraft.util.RandomSource random) return the BlockState wanted based on randomness this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the block states list that would be chosen from- Returns:
- the block related to the noise
-
getBlockWithOrder
public static net.minecraft.world.level.block.state.BlockState getBlockWithOrder(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, int i) return the BlockState wanted based on order this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the blockStates list that would be chosen fromi- the index to choose from- Returns:
- the block related to the noise
-
getBlockWith2DNoise
public static net.minecraft.world.level.block.state.BlockState getBlockWith2DNoise(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 2d noise this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the blockStates list that would be chosen frompos- the pos of the block to testnoise- the noise- Returns:
- the block related to the noise
-
getBlockWith3DNoise
public static net.minecraft.world.level.block.state.BlockState getBlockWith3DNoise(net.minecraft.world.level.block.state.BlockState[] blocksToPlace, net.minecraft.core.BlockPos pos, FastNoiseLite noise) return the BlockState wanted based on 3d noise this method doesn't place the block It is notable used during the shape gen during world gen- Parameters:
blocksToPlace- the blockStates list that would be chosen frompos- the pos of the block to testnoise- the noise- Returns:
- the block related to the noise
-