/**
* Creates a Factory Contraptions
*
* @param anchor Anchor to attempt creation
* @return Created Contraption if successful
*/
@Override
public Response createContraption(BlockLocation location) {
//Check if interaction block is correct
if (structureGadget.validBlock(location.getBlock())) {
return new Response(false, "Incorrect block for a Factory");
}
Anchor anchor = structureGadget.exists(location);
if (anchor == null) {
return new Response(false, "Incorrect structure for factory");
}
Inventory inventory = ((InventoryHolder) location.getBlock().getState()).getInventory();
if (matchGadget.matches(inventory) && matchGadget.consume(inventory)) {
Generator newGenerator = new Generator(this, anchor);
contraptionManager.registerContraption(newGenerator);
SoundType.CREATION.play(anchor.getLocation());
return new Response(true, "Created a " + newGenerator.getName() + " factory!", newGenerator);
}
return new Response(false, "Incorrect items for a Factory");
}
GeneratorProperties.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:Contraptions
作者:
评论列表
文章目录