use of com.microsoft.Malmo.Schemas.BlockSpecWithDescription in project malmo by Microsoft.
the class AgentQuitFromTouchingBlockTypeImplementation method doIWantToQuit.
@Override
public boolean doIWantToQuit(MissionInit missionInit) {
if (this.wantToQuit)
return true;
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
List<BlockPos> touchingBlocks = PositionHelper.getTouchingBlocks(player);
for (BlockPos pos : touchingBlocks) {
IBlockState bs = player.worldObj.getBlockState(pos);
// Does this block match our trigger specs?
String blockname = bs.getBlock().getUnlocalizedName().toLowerCase();
if (!this.blockTypeNames.contains(blockname))
continue;
// The type matches one of our block types, so now we need to perform additional checks.
for (BlockSpecWithDescription blockspec : this.params.getBlock()) {
if (findMatch(blockspec, bs)) {
this.quitCode = blockspec.getDescription();
// Yes, we want to quit!
return true;
}
}
}
// Nothing matched, we can quit happily.
return false;
}
Aggregations