0
사용자가 항목을 클릭 할 때 블록을 배치하는 방법은 무엇입니까?Forge Mod Loader로 블록 배치?
내가 할 수있는 유일한 방법은 이지만 매개 변수는 javadocs에서 잘못 설명되어 있습니다.
사용자가 항목을 클릭 할 때 블록을 배치하는 방법은 무엇입니까?Forge Mod Loader로 블록 배치?
내가 할 수있는 유일한 방법은 이지만 매개 변수는 javadocs에서 잘못 설명되어 있습니다.
ItemBlock
클래스를 살펴 보셨습니까? onItemUse()
을 placeBlockAt()
기능 또는 기능과 함께 사용 하시겠습니까?
/**
* Called to actually place the block, after the location is determined
* and all permission checks have been made.
*
* @param stack The item stack that was used to place the block. This can be changed inside the method.
* @param player The player who is placing the block. Can be null if the block is not being placed by a player.
* @param side The side the player (or machine) right-clicked on.
*/
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
{
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3))
{
return false;
}
if (world.getBlock(x, y, z) == field_150939_a)
{
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
}
return true;
}