use of net.minecraft.block.ConcretePowderBlock in project minecolonies by Minecolonies.
the class EntityAIConcreteMixer method craft.
@Override
protected IAIState craft() {
if (currentRecipeStorage == null) {
return START_WORKING;
}
if (currentRequest == null && job.getCurrentTask() != null) {
return GET_RECIPE;
}
if (walkTo == null && walkToBuilding()) {
return getState();
}
currentRequest = job.getCurrentTask();
if (currentRequest != null && (currentRequest.getState() == RequestState.CANCELLED || currentRequest.getState() == RequestState.FAILED)) {
currentRequest = null;
incrementActionsDone(getActionRewardForCraftingSuccess());
currentRecipeStorage = null;
return START_WORKING;
}
final ItemStack concrete = currentRecipeStorage.getPrimaryOutput();
if (concrete.getItem() instanceof BlockItem && ((BlockItem) concrete.getItem()).getBlock() instanceof ConcretePowderBlock) {
return super.craft();
}
final IAIState mixState = mixConcrete();
if (mixState == getState()) {
currentRequest.addDelivery(new ItemStack(concrete.getItem(), 1));
job.setCraftCounter(job.getCraftCounter() + 1);
if (job.getCraftCounter() >= job.getMaxCraftingCount()) {
incrementActionsDone(getActionRewardForCraftingSuccess());
currentRecipeStorage = null;
resetValues();
if (inventoryNeedsDump()) {
if (job.getMaxCraftingCount() == 0 && job.getCraftCounter() == 0 && currentRequest != null) {
job.finishRequest(true);
worker.getCitizenExperienceHandler().addExperience(currentRequest.getRequest().getCount() / 2.0);
}
}
}
}
return mixState;
}
use of net.minecraft.block.ConcretePowderBlock in project minecolonies by ldtteam.
the class EntityAIConcreteMixer method craft.
@Override
protected IAIState craft() {
if (currentRecipeStorage == null) {
return START_WORKING;
}
if (currentRequest == null && job.getCurrentTask() != null) {
return GET_RECIPE;
}
if (walkTo == null && walkToBuilding()) {
return getState();
}
currentRequest = job.getCurrentTask();
if (currentRequest != null && (currentRequest.getState() == RequestState.CANCELLED || currentRequest.getState() == RequestState.FAILED)) {
currentRequest = null;
incrementActionsDone(getActionRewardForCraftingSuccess());
currentRecipeStorage = null;
return START_WORKING;
}
final ItemStack concrete = currentRecipeStorage.getPrimaryOutput();
if (concrete.getItem() instanceof BlockItem && ((BlockItem) concrete.getItem()).getBlock() instanceof ConcretePowderBlock) {
return super.craft();
}
final IAIState mixState = mixConcrete();
if (mixState == getState()) {
currentRequest.addDelivery(new ItemStack(concrete.getItem(), 1));
job.setCraftCounter(job.getCraftCounter() + 1);
if (job.getCraftCounter() >= job.getMaxCraftingCount()) {
incrementActionsDone(getActionRewardForCraftingSuccess());
currentRecipeStorage = null;
resetValues();
if (inventoryNeedsDump()) {
if (job.getMaxCraftingCount() == 0 && job.getCraftCounter() == 0 && currentRequest != null) {
job.finishRequest(true);
worker.getCitizenExperienceHandler().addExperience(currentRequest.getRequest().getCount() / 2.0);
}
}
}
}
return mixState;
}
Aggregations