Skip to content

Commit

Permalink
fix cooking devices
Browse files Browse the repository at this point in the history
- change: 調理器具ブロックの処理速度を上げた
  • Loading branch information
defeatedcrow committed Dec 14, 2017
1 parent d5fddd5 commit 491fe93
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 108 deletions.
20 changes: 19 additions & 1 deletion java/defeatedcrow/hac/food/block/TilePotteryPot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import java.util.Iterator;
import java.util.List;

import defeatedcrow.hac.api.climate.ClimateAPI;
import defeatedcrow.hac.api.climate.DCHeatTier;
import defeatedcrow.hac.api.climate.IClimate;
import defeatedcrow.hac.api.recipe.RecipeAPI;
import defeatedcrow.hac.core.util.DCUtil;
import defeatedcrow.hac.food.gui.ContainerFluidProcessor;
Expand Down Expand Up @@ -54,6 +56,12 @@ protected void onServerUpdate() {

@Override
public int getProcessTime() {
if (current != null) {
if (current.getHeat() == DCHeatTier.OVEN)
return 100;
else if (current.getHeat().getTier() > DCHeatTier.OVEN.getTier())
return 40;
}
return 200;
}

Expand All @@ -65,8 +73,13 @@ public boolean canRecipeProcess() {
List<ItemStack> ins = new ArrayList<ItemStack>(this.getInputs());
FluidStack outf = outputT.getFluid();
List<ItemStack> outs = new ArrayList<ItemStack>(this.getOutputs());
if (currentRecipe == null) {
if (currentRecipe == null && current != null) {
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(current, ins, inf);
if (currentRecipe == null && current.getHeat().getTier() > 0) {
IClimate clm2 = ClimateAPI.register.getClimateFromParam(current.getHeat().addTier(1),
current.getHumidity(), current.getAirflow());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(clm2, ins, inf);
}
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 3);
} else {
if (currentRecipe.matchClimate(current) && currentRecipe.matches(ins, inf)) {
Expand All @@ -88,6 +101,11 @@ public boolean canStartProcess() {
FluidStack outf = outputT.getFluid();
List<ItemStack> outs = new ArrayList<ItemStack>(this.getOutputs());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(current, ins, inf);
if (currentRecipe == null && current.getHeat().getTier() > 0) {
IClimate clm2 = ClimateAPI.register.getClimateFromParam(current.getHeat().addTier(1), current.getHumidity(),
current.getAirflow());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(clm2, ins, inf);
}
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 3);
}

Expand Down
21 changes: 20 additions & 1 deletion java/defeatedcrow/hac/food/block/TileSteelPot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import java.util.Iterator;
import java.util.List;

import defeatedcrow.hac.api.climate.ClimateAPI;
import defeatedcrow.hac.api.climate.DCHeatTier;
import defeatedcrow.hac.api.climate.IClimate;
import defeatedcrow.hac.api.recipe.RecipeAPI;
import defeatedcrow.hac.core.util.DCUtil;
import defeatedcrow.hac.food.gui.ContainerFluidProcessor;
Expand Down Expand Up @@ -53,6 +56,12 @@ protected void onServerUpdate() {

@Override
public int getProcessTime() {
if (current != null) {
if (current.getHeat() == DCHeatTier.KILN)
return 8;
else if (current.getHeat().getTier() > DCHeatTier.KILN.getTier())
return 4;
}
return 20;
}

Expand All @@ -64,8 +73,13 @@ public boolean canRecipeProcess() {
List<ItemStack> ins = new ArrayList<ItemStack>(this.getInputs());
FluidStack outf = outputT.getFluid();
List<ItemStack> outs = new ArrayList<ItemStack>(this.getOutputs());
if (currentRecipe == null) {
if (currentRecipe == null && current != null) {
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(current, ins, inf);
if (currentRecipe == null && current.getHeat().getTier() > 0) {
IClimate clm2 = ClimateAPI.register.getClimateFromParam(current.getHeat().addTier(1),
current.getHumidity(), current.getAirflow());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(clm2, ins, inf);
}
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 3);
} else {
if (currentRecipe.matchClimate(current) && currentRecipe.matches(ins, inf)) {
Expand All @@ -86,6 +100,11 @@ public boolean canStartProcess() {
FluidStack outf = outputT.getFluid();
List<ItemStack> outs = new ArrayList<ItemStack>(this.getOutputs());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(current, ins, inf);
if (currentRecipe == null && current.getHeat().getTier() > 0) {
IClimate clm2 = ClimateAPI.register.getClimateFromParam(current.getHeat().addTier(1), current.getHumidity(),
current.getAirflow());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(clm2, ins, inf);
}
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 3);
}

Expand Down
22 changes: 20 additions & 2 deletions java/defeatedcrow/hac/food/block/TileTeaPot.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.List;

import defeatedcrow.hac.api.climate.ClimateAPI;
import defeatedcrow.hac.api.climate.DCHeatTier;
import defeatedcrow.hac.api.climate.IClimate;
import defeatedcrow.hac.api.recipe.RecipeAPI;
import defeatedcrow.hac.core.fluid.DCTank;
import defeatedcrow.hac.core.fluid.FluidIDRegisterDC;
Expand Down Expand Up @@ -40,6 +42,12 @@ public class TileTeaPot extends TileFluidProcessorBase {

@Override
public int getProcessTime() {
if (current != null) {
if (current.getHeat() == DCHeatTier.KILN)
return 8;
else if (current.getHeat().getTier() > DCHeatTier.KILN.getTier())
return 4;
}
return 20;
}

Expand Down Expand Up @@ -203,9 +211,14 @@ public boolean canRecipeProcess() {
List<ItemStack> ins = new ArrayList<ItemStack>(this.getInputs());
FluidStack outf = outputT.getFluid();
List<ItemStack> outs = new ArrayList<ItemStack>(this.getOutputs());
if (currentRecipe == null) {
if (currentRecipe == null && current != null) {
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(current, ins, inf);
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 0);
if (currentRecipe == null && current.getHeat().getTier() > 0) {
IClimate clm2 = ClimateAPI.register.getClimateFromParam(current.getHeat().addTier(1),
current.getHumidity(), current.getAirflow());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(clm2, ins, inf);
}
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 3);
} else {
if (currentRecipe.matchClimate(current) && currentRecipe.matches(ins, inf)) {
int outAmo = currentRecipe.getOutputFluid() == null ? 0 : currentRecipe.getOutputFluid().amount;
Expand All @@ -225,6 +238,11 @@ public boolean canStartProcess() {
FluidStack outf = outputT.getFluid();
List<ItemStack> outs = new ArrayList<ItemStack>(this.getOutputs());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(current, ins, inf);
if (currentRecipe == null && current.getHeat().getTier() > 0) {
IClimate clm2 = ClimateAPI.register.getClimateFromParam(current.getHeat().addTier(1), current.getHumidity(),
current.getAirflow());
currentRecipe = RecipeAPI.registerFluidRecipes.getRecipe(clm2, ins, inf);
}
return currentRecipe != null && currentRecipe.matchOutput(outs, outf, 0);
}

Expand Down

0 comments on commit 491fe93

Please sign in to comment.