1.12: E-Furnace hopper detection/config fix.

This commit is contained in:
stfwi 2020-04-18 14:08:27 +02:00
parent 76384d1126
commit dea1363f8e
2 changed files with 25 additions and 16 deletions

View file

@ -9,6 +9,8 @@
package wile.engineersdecor.blocks;
import net.minecraft.init.Blocks;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor;
import net.minecraft.block.SoundType;
@ -333,12 +335,14 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
private static int transfer_energy_consumption_ = DEFAULT_SCALED_ENERGY_CONSUMPTION/8;
private static int proc_speed_percent_ = DEFAULT_SPEED_PERCENT;
private static double speed_setting_factor_[] = {0.0, 1.0, 1.5, 2.0};
private static boolean with_automatic_inventory_pulling_ = false;
public static void on_config(int speed_percent, int standard_energy_per_tick)
public static void on_config(int speed_percent, int standard_energy_per_tick, boolean with_automatic_inventory_pulling)
{
proc_speed_percent_ = MathHelper.clamp(speed_percent, 10, 500);
energy_consumption_ = MathHelper.clamp(standard_energy_per_tick, 10, 256) * HEAT_INCREMENT * proc_speed_percent_ / 100;
transfer_energy_consumption_ = MathHelper.clamp(energy_consumption_/8, 8, HEAT_INCREMENT);
with_automatic_inventory_pulling_ = with_automatic_inventory_pulling;
ModEngineersDecor.logger.info("Config electrical furnace speed:" + proc_speed_percent_ + ", power consumption:" + energy_consumption_);
}
@ -657,6 +661,9 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
// ITickable ------------------------------------------------------------------------------------
private boolean is_accepted_hopper(final ItemStack stack)
{ return (stack.getItem() == Item.getItemFromBlock(Blocks.HOPPER)) || (stack.getItem() == Item.getItemFromBlock(ModContent.FACTORY_HOPPER)); }
private boolean adjacent_inventory_shift(boolean inp, boolean out)
{
boolean dirty = false;
@ -675,6 +682,7 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
dirty = true;
}
}
if(with_automatic_inventory_pulling_ || is_accepted_hopper(stacks_.get(SMELTING_AUX_SLOT_NO))) {
if(inp && (stacks_.get(FIFO_INPUT_1_SLOT_NO).isEmpty())) {
TileEntity te = world.getTileEntity(pos.offset(inp_facing));
if((te!=null) && (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, out_facing))) {
@ -693,6 +701,7 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
}
}
}
}
return dirty;
}

View file

@ -617,7 +617,7 @@ public class ModConfig
BlockDecorLadder.on_config(optout.without_ladder_speed_boost);
BlockDecorCraftingTable.on_config(optout.without_crafting_table_history, false, tweaks.with_crafting_quickmove_buttons, tweaks.without_crafting_mouse_scrolling);
BlockDecorPipeValve.on_config(tweaks.pipevalve_max_flowrate, tweaks.pipevalve_redstone_slope);
BlockDecorFurnaceElectrical.BTileEntity.on_config(tweaks.e_furnace_speed_percent, tweaks.e_furnace_power_consumption);
BlockDecorFurnaceElectrical.BTileEntity.on_config(tweaks.e_furnace_speed_percent, tweaks.e_furnace_power_consumption, false);
BlockDecorSolarPanel.BTileEntity.on_config(tweaks.solar_panel_peak_power);
BlockDecorBreaker.BTileEntity.on_config(tweaks.block_breaker_power_consumption, tweaks.block_breaker_reluctance, tweaks.block_breaker_min_breaking_time, tweaks.block_breaker_requires_power);
BlockDecorTreeCutter.BTileEntity.on_config(tweaks.tree_cuttter_energy_consumption, tweaks.tree_cuttter_cutting_time_needed, tweaks.tree_cuttter_requires_power);