Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0). Fixed Labeled Crate mouse scrolling (issue #169).
This commit is contained in:
parent
3f12390dd5
commit
3a10a87ac0
8 changed files with 47 additions and 16 deletions
|
@ -191,6 +191,7 @@ public class ModConfig
|
|||
public final ForgeConfigSpec.IntValue furnace_smelting_speed_percent;
|
||||
public final ForgeConfigSpec.IntValue furnace_fuel_efficiency_percent;
|
||||
public final ForgeConfigSpec.IntValue furnace_boost_energy_consumption;
|
||||
public final ForgeConfigSpec.ConfigValue<String> furnace_accepted_heaters;
|
||||
public final ForgeConfigSpec.IntValue e_furnace_speed_percent;
|
||||
public final ForgeConfigSpec.IntValue e_furnace_power_consumption;
|
||||
public final ForgeConfigSpec.IntValue small_solar_panel_peak_production;
|
||||
|
@ -424,6 +425,11 @@ public class ModConfig
|
|||
"this consumption (fixed threshold value). The value can be changed on-the-fly for tuning. " +
|
||||
"The default value corresponds to the IE heater consumption.")
|
||||
.defineInRange("furnace_boost_energy_consumption", 24, 2, 1024);
|
||||
furnace_accepted_heaters = builder
|
||||
.translation(MODID + ".config.furnace_accepted_heaters")
|
||||
.comment("Defines (as comma separated list of full registry names) which items are allowed as external " +
|
||||
"heaters in the Aux slot for powered speed boosting.")
|
||||
.define("furnace_accepted_heaters", "immersiveengineering:furnace_heater");
|
||||
chair_mob_sitting_probability_percent = builder
|
||||
.translation(MODID + ".config.chair_mob_sitting_probability_percent")
|
||||
.comment("Defines, in percent, how high the probability is that a mob sits on a chair " +
|
||||
|
@ -727,7 +733,7 @@ public class ModConfig
|
|||
EdPlacer.on_config();
|
||||
EdBreaker.on_config(SERVER.block_breaker_power_consumption.get(), SERVER.block_breaker_reluctance.get(), SERVER.block_breaker_min_breaking_time.get(), SERVER.block_breaker_requires_power.get());
|
||||
EdTreeCutter.on_config(SERVER.tree_cutter_energy_consumption.get(), SERVER.tree_cutter_cutting_time_needed.get(), SERVER.tree_cutter_requires_power.get());
|
||||
EdFurnace.on_config(SERVER.furnace_smelting_speed_percent.get(), SERVER.furnace_fuel_efficiency_percent.get(), SERVER.furnace_boost_energy_consumption.get());
|
||||
EdFurnace.on_config(SERVER.furnace_smelting_speed_percent.get(), SERVER.furnace_fuel_efficiency_percent.get(), SERVER.furnace_boost_energy_consumption.get(), SERVER.furnace_accepted_heaters.get());
|
||||
EdElectricalFurnace.on_config(SERVER.e_furnace_speed_percent.get(), SERVER.e_furnace_power_consumption.get(), SERVER.e_furnace_automatic_pulling.get());
|
||||
EdSolarPanel.on_config(SERVER.small_solar_panel_peak_production.get());
|
||||
EdMilker.on_config(SERVER.milking_machine_energy_consumption.get(), SERVER.milking_machine_milking_delay.get());
|
||||
|
|
|
@ -1083,8 +1083,9 @@ public class EdCraftingTable
|
|||
|
||||
protected void renderHoveredToolTip(MatrixStack mx, int mouseX, int mouseY)
|
||||
{
|
||||
if((!player.inventory.getItemStack().isEmpty()) || (getSlotUnderMouse() == null)) return;
|
||||
if(!player.inventory.getItemStack().isEmpty()) return;
|
||||
final Slot slot = getSlotUnderMouse();
|
||||
if(slot == null) return;
|
||||
if(!slot.getStack().isEmpty()) { renderTooltip(mx, slot.getStack(), mouseX, mouseY); return; }
|
||||
if(with_assist) {
|
||||
int hist_index = -1;
|
||||
|
|
|
@ -54,11 +54,12 @@ import net.minecraftforge.common.util.FakePlayer;
|
|||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import wile.engineersdecor.ModConfig;
|
||||
import wile.engineersdecor.ModContent;
|
||||
import wile.engineersdecor.ModEngineersDecor;
|
||||
import wile.engineersdecor.detail.ExternalObjects;
|
||||
import wile.engineersdecor.libmc.client.ContainerGui;
|
||||
import wile.engineersdecor.libmc.detail.Auxiliaries;
|
||||
import wile.engineersdecor.libmc.detail.Inventories;
|
||||
import wile.engineersdecor.libmc.detail.Inventories.StorageInventory;
|
||||
import wile.engineersdecor.libmc.detail.Inventories.MappedItemHandler;
|
||||
|
@ -67,12 +68,13 @@ import wile.engineersdecor.libmc.detail.RfEnergy;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class EdFurnace
|
||||
{
|
||||
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick)
|
||||
{ FurnaceTileEntity.on_config(speed_percent, fuel_efficiency_percent, boost_energy_per_tick); }
|
||||
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick, String accepted_heaters_csv)
|
||||
{ FurnaceTileEntity.on_config(speed_percent, fuel_efficiency_percent, boost_energy_per_tick, accepted_heaters_csv); }
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
// Block
|
||||
|
@ -230,13 +232,34 @@ public class EdFurnace
|
|||
private static double proc_fuel_efficiency_ = 1.0;
|
||||
private static double proc_speed_ = 1.2;
|
||||
private static int boost_energy_consumption = DEFAULT_BOOST_ENERGY * TICK_INTERVAL;
|
||||
private static Set<Item> accepted_heaters_ = new HashSet<>();
|
||||
|
||||
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick)
|
||||
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick, String accepted_heaters_csv)
|
||||
{
|
||||
proc_speed_ = ((double)MathHelper.clamp(speed_percent, 10, 500)) / 100;
|
||||
proc_fuel_efficiency_ = ((double) MathHelper.clamp(fuel_efficiency_percent, 10, 500)) / 100;
|
||||
boost_energy_consumption = TICK_INTERVAL * MathHelper.clamp(boost_energy_per_tick, 4, 4096);
|
||||
{
|
||||
List<String> heater_resource_locations = Arrays.stream(accepted_heaters_csv.toLowerCase().split("[\\s,;]+"))
|
||||
.map(s->s.trim())
|
||||
.collect(Collectors.toList());
|
||||
accepted_heaters_.clear();
|
||||
for(String rlstr: heater_resource_locations) {
|
||||
try {
|
||||
ResourceLocation rl = new ResourceLocation(rlstr);
|
||||
Item heater = ForgeRegistries.ITEMS.getValue(rl);
|
||||
if((heater==null) || (heater==Items.AIR)) {
|
||||
ModConfig.log("Furnace accepted heater config: Skipped '" + rl.toString() + "', item not found/mod not installed.");
|
||||
} else {
|
||||
accepted_heaters_.add(heater);
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
Auxiliaries.logError("Furnace accepted heater config invalid: '" + rlstr + "', not added.");
|
||||
}
|
||||
}
|
||||
}
|
||||
ModConfig.log("Config lab furnace speed:" + (proc_speed_*100) + "%, efficiency:" + (proc_fuel_efficiency_*100) + "%, boost: " + (boost_energy_consumption/TICK_INTERVAL) + "rf/t.");
|
||||
ModConfig.log("Config lab furnace accepted heaters: " + accepted_heaters_.stream().map(item->item.getRegistryName().toString()).collect(Collectors.joining(",")) + ".");
|
||||
}
|
||||
|
||||
// DecorFurnaceTileEntity -----------------------------------------------------------------------------
|
||||
|
@ -484,9 +507,9 @@ public class EdFurnace
|
|||
if(transferItems(FIFO_FUEL_1_SLOT_NO, FIFO_FUEL_0_SLOT_NO, 1)) dirty = true;
|
||||
if(transferItems(FIFO_INPUT_0_SLOT_NO, SMELTING_INPUT_SLOT_NO, 1)) dirty = true;
|
||||
if(transferItems(FIFO_INPUT_1_SLOT_NO, FIFO_INPUT_0_SLOT_NO, 1)) dirty = true;
|
||||
heater_inserted_ = (ExternalObjects.IE_EXTERNAL_HEATER==null) // without IE always allow electrical boost
|
||||
|| (inventory_.getStackInSlot(AUX_0_SLOT_NO).getItem()==ExternalObjects.IE_EXTERNAL_HEATER)
|
||||
|| (inventory_.getStackInSlot(AUX_1_SLOT_NO).getItem()==ExternalObjects.IE_EXTERNAL_HEATER);
|
||||
heater_inserted_ = accepted_heaters_.isEmpty() // without IE always allow electrical boost
|
||||
|| accepted_heaters_.contains(inventory_.getStackInSlot(AUX_0_SLOT_NO).getItem())
|
||||
|| accepted_heaters_.contains(inventory_.getStackInSlot(AUX_1_SLOT_NO).getItem());
|
||||
}
|
||||
ItemStack fuel = inventory_.getStackInSlot(SMELTING_FUEL_SLOT_NO);
|
||||
if(burning() || (!fuel.isEmpty()) && (!(inventory_.getStackInSlot(SMELTING_INPUT_SLOT_NO)).isEmpty())) {
|
||||
|
|
|
@ -630,7 +630,7 @@ public class EdLabeledCrate
|
|||
{
|
||||
if(!with_gui_mouse_handling) return super.mouseScrolled(mouseX, mouseY, wheel_inc);
|
||||
final Slot slot = getSlotUnderMouse();
|
||||
if(!slot.getHasStack()) return true;
|
||||
if((slot==null) || (!slot.getHasStack())) return true;
|
||||
final int count = slot.getStack().getCount();
|
||||
int limit = (Auxiliaries.isShiftDown() ? 2 : 1) * (Auxiliaries.isCtrlDown() ? 4 : 1);
|
||||
if(wheel_inc > 0.1) {
|
||||
|
|
|
@ -14,9 +14,6 @@ import net.minecraftforge.registries.ObjectHolder;
|
|||
public class ExternalObjects
|
||||
{
|
||||
|
||||
@ObjectHolder("immersiveengineering:furnace_heater")
|
||||
public static final Item IE_EXTERNAL_HEATER = null;
|
||||
|
||||
@ObjectHolder("bottledmilk:milk_bottle_drinkable")
|
||||
public static final Item BOTTLED_MILK_BOTTLE_DRINKLABLE = null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue