Placeable Groups
Creating a Placeable Group
//Create Placeable Group Data that can be applied to an itemstack
DEUSound deuSound = yourMethodToGetADEUSound();
boolean isPlaceSound = true; //false would be a break sound
PlaceableGroupData data = new PlaceableGroupData("mygrouptag")
.setPermission("myplacepermission")
.setRespectPlayerFacing(true)
.setRespectBlockFace(true)
.setDropItemOnBreak(true)
.setPlacerBreaksOnly(true)
.addSound(deuSound, isPlaceSound);
//Apply the data to an itemstack of a block type.
//When the block is placed the group will be spawned with the corresponding properties
data.apply(itemStack);Getting/Changing Placeable Group Data
//Get whether an item has Placeable Group Data
boolean hasData = PlaceableGroupManager.hasData(itemStack);
//Set the group tag of the group to spawn
PlaceableGroupManager.setGroup(itemStack, groupTag);
//Set the permission required to place the block and spawn the group
PlaceableGroupManager.setPlacePermission(itemStack, "myplacepermission");
//Set whether the group should spawn with respect with player facing
PlaceableGroupManager.setRespectPlayerFacing(itemStack, true);
//Set whether the group should spawn with respect to its placed block face
PlaceableGroupManager.setRespectBlockFace(itemStack, true);
//Set whether only the placer of the block can destroy it
PlaceableGroupManager.setPlacerBreaksOnly(itemStack, true);
DEUSound deuSound = yourMethodToGetADEUSound();
boolean isPlaceSound = true; //false would be a break sound
PlaceableGroupManager.addSound(itemStack, deuSound, isPlaceSound);Unassign a Placeable Group
Last updated
