Config logging improved. Config ordering. Added E-Furnace GUI rf/t and SOC tooltip. Fixed server world load config application bug. (issue #152).

This commit is contained in:
stfwi 2021-01-03 12:17:00 +01:00
parent 98529fd961
commit 61d0225afa
28 changed files with 372 additions and 120 deletions

View file

@ -5,4 +5,4 @@ version_minecraft=1.16.4
version_forge_minecraft=1.16.4-35.1.10
version_fml_mappings=20201028-1.16.3
version_jei=1.16.4:7.6.1.63
version_engineersdecor=1.1.6-b2
version_engineersdecor=1.1.6-b3

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.16.4": {
"1.1.6-b3": "[M] Config logging edited, E-Furnace GUI capacitor tooltip added, E-Furnace power consumption independent of config speed setting (issue #152 ty Staegrin).",
"1.1.6-b2": "[M] Alternative Clinker Brick recipe (swapped Bricks/Nether Bricks) added.\n[M] Furnace XP handling simplified (simply stores/releases XP for each smelting process).\n[M] Mod devices do not propagate strong Redstone power to adjacent blocks.\n[M] Minor \"librarizing\" changes under the hood.",
"1.1.6-b1": "[F] Fixed Metal Crafting Table Hopper access (issue #147, ty umerrr).\n[F] Fixed Dark Shingle Roof Chimney placement restriction (issue #149, thx WenXin20).\n[F] Door tags added for Wood Door and Metal Sliding Door (issue #150, thx WenXin20).\n[A] Electrical Furnace automatically chokes speed and power consumption when the internally stored power is below 20%.",
"1.1.5": "[R] Release build v1.1.5.\n[F] Fixed Crafting Table JEI storage slot count.\n[F] Fixed Factory Hopper removed item collection dupe bug (issue #146, thx FatheredPuma81).\n[F] Increased device GUI access ranges beyond the player block selection range.\n[A] Window placement handling improved.\n[M] Steel/Wood Pole and Double-T support placement improved (issue #139, thx Biviho).\n[M] Metal Sliding Door bottom/top shape when opened added.",
@ -23,6 +24,6 @@
},
"promos": {
"1.16.4-recommended": "1.1.5",
"1.16.4-latest": "1.1.6-b2"
"1.16.4-latest": "1.1.6-b3"
}
}

View file

@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.16.x.
## Version history
- v1.1.6-b3 [M] Config logging edited, E-Furnace GUI capacitor tooltip added, E-Furnace power consumption
independent of config speed setting (issue #152 ty Staegrin).
- v1.1.6-b2 [M] Alternative Clinker Brick recipe (swapped Bricks/Nether Bricks) added.
[M] Furnace XP handling simplified (simply stores/releases XP for each smelting process).
[M] Mod devices do not propagate strong Redstone power to adjacent blocks.

View file

@ -663,23 +663,27 @@ public class ModConfig
without_recipes_ = SERVER.without_recipes.get();
without_direct_slab_pickup = SERVER.without_direct_slab_pickup.get();
// -----------------------------------------------------------------------------------------------------------------
EdFurnace.FurnaceTileEntity.on_config(SERVER.furnace_smelting_speed_percent.get(), SERVER.furnace_fuel_efficiency_percent.get(), SERVER.furnace_boost_energy_consumption.get());
EdChair.on_config(SERVER.without_chair_sitting.get(), SERVER.without_mob_chair_sitting.get(), SERVER.chair_mob_sitting_probability_percent.get(), SERVER.chair_mob_standup_probability_percent.get());
EdLadderBlock.on_config(SERVER.without_ladder_speed_boost.get());
EdCraftingTable.on_config(SERVER.without_crafting_table_history.get(), false, SERVER.without_crafting_mouse_scrolling.get());
EdPipeValve.on_config(SERVER.pipevalve_max_flowrate.get(), SERVER.pipevalve_redstone_gain.get());
EdElectricalFurnace.ElectricalFurnaceTileEntity.on_config(SERVER.e_furnace_speed_percent.get(), SERVER.e_furnace_power_consumption.get(), SERVER.e_furnace_automatic_pulling.get());
EdSolarPanel.SolarPanelTileEntity.on_config(SERVER.small_solar_panel_peak_production.get());
EdBreaker.BreakerTileEntity.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.TreeCutterTileEntity.on_config(SERVER.tree_cutter_energy_consumption.get(), SERVER.tree_cutter_cutting_time_needed.get(), SERVER.tree_cutter_requires_power.get());
EdMilker.MilkerTileEntity.on_config(SERVER.milking_machine_energy_consumption.get(), SERVER.milking_machine_milking_delay.get());
EdSlabBlock.on_config(!SERVER.without_direct_slab_pickup.get());
EdSlabSliceBlock.on_config(!SERVER.without_direct_slab_pickup.get());
// currently no file config planned
EdLabeledCrate.on_config(false);
EdFluidFunnel.on_config(with_experimental_features_); // @todo: double check for abuse as pump first
EdDropper.on_config(true);
EdCraftingTable.on_config(SERVER.without_crafting_table_history.get(), false, SERVER.without_crafting_mouse_scrolling.get());
EdFluidBarrel.on_config(12000, 1000);
EdFluidFunnel.on_config(with_experimental_features_);
EdPipeValve.on_config(SERVER.pipevalve_max_flowrate.get(), SERVER.pipevalve_redstone_gain.get());
EdHopper.on_config();
EdDropper.on_config(true);
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());
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());
EdFreezer.on_config(92, 2);
EdMineralSmelter.on_config(92, 2);
EdWasteIncinerator.on_config(8);
// -----------------------------------------------------------------------------------------------------------------
{
// Check if the config is already synchronized or has to be synchronised.

View file

@ -952,8 +952,8 @@ public class ModContent
// -------------------------------------------------------------------------------------------------------------------
public static final EdTestBlock.TestBlock TEST_BLOCK = (EdTestBlock.TestBlock)(new EdTestBlock.TestBlock(
DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL).notSolid(),
DecorBlock.CFG_LOOK_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL),
Auxiliaries.getPixeledAABB(0,0,0, 16,16,16)
)).setRegistryName(new ResourceLocation(MODID, "test_block"));
@ -1076,7 +1076,7 @@ public class ModContent
};
private static final Block devBlocks[] = {
//TEST_BLOCK
TEST_BLOCK
};
//--------------------------------------------------------------------------------------------------------------------
@ -1258,7 +1258,6 @@ public class ModContent
CT_LABELED_CRATE.setRegistryName(MODID,"ct_labeled_crate");
}
// DON'T FORGET TO REGISTER THE GUI in registerContainerGuis(), no list/map format found yet for that.
private static final ContainerType<?> container_types[] = {
CT_TREATED_WOOD_CRAFTING_TABLE,
CT_LABELED_CRATE,

View file

@ -35,7 +35,6 @@ public class ModEngineersDecor
public static final String MODNAME = "Engineer's Decor";
public static final int VERSION_DATAFIXER = 0;
private static final Logger LOGGER = LogManager.getLogger();
private static boolean config_loaded = false;
public ModEngineersDecor()
{
@ -64,16 +63,6 @@ public class ModEngineersDecor
LOGGER.info("Registering recipe condition processor ...");
CraftingHelper.register(OptionalRecipeCondition.Serializer.INSTANCE);
wile.engineersdecor.libmc.detail.Networking.init(MODID);
if(config_loaded) {
try {
logger().info("Applying loaded config file.");
ModConfig.apply();
} catch(Throwable e) {
logger().error("Failed to apply config: " + e.getMessage());
}
} else {
logger().info("Cannot apply config, load event was not casted yet.");
}
}
private void onClientSetup(final FMLClientSetupEvent event)
@ -122,7 +111,7 @@ public class ModEngineersDecor
{}
public static void onConfigLoad(net.minecraftforge.fml.config.ModConfig.Loading configEvent)
{ config_loaded = true; }
{ ModConfig.apply(); }
public static void onConfigReload(net.minecraftforge.fml.config.ModConfig.Reloading configEvent)
{

View file

@ -52,6 +52,9 @@ import java.util.Random;
public class EdBreaker
{
public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required)
{ BreakerTileEntity.on_config(boost_energy_per_tick, breaking_time_per_hardness, min_breaking_time_ticks, power_required); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -161,11 +164,11 @@ public class EdBreaker
public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required)
{
boost_energy_consumption = TICK_INTERVAL * MathHelper.clamp(boost_energy_per_tick, 4, 4096);
energy_max = Math.max(boost_energy_consumption * 10, 10000);
energy_max = Math.max(boost_energy_consumption * 10, 100000);
breaking_reluctance = MathHelper.clamp(breaking_time_per_hardness, 5, 50);
min_breaking_time = MathHelper.clamp(min_breaking_time_ticks, 10, 100);
requires_power = power_required;
ModEngineersDecor.logger().info("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t");
ModEngineersDecor.logger().info("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t.");
}
public BreakerTileEntity()

View file

@ -13,7 +13,6 @@ import net.minecraft.util.math.vector.Vector3d;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -41,7 +40,7 @@ public class EdChair
sitting_enabled = (!without_sitting);
sitting_probability = (without_sitting||without_mob_sitting) ? 0.0 : MathHelper.clamp(sitting_probability_percent/100, 0, 0.9);
standup_probability = (without_sitting||without_mob_sitting) ? 1.0 : MathHelper.clamp(standup_probability_percent/100, 1e-6, 1e-2);
ModEngineersDecor.logger().info("Config chairs sit:" + sitting_enabled + ", mob-sit: " + (sitting_probability*100) + "%, stand up: " + (standup_probability)+"%");
ModEngineersDecor.logger().info("Config chairs: sit:" + sitting_enabled + ", mob-sit: " + (sitting_probability*100) + "%, standup: " + (standup_probability) + "%.");
}
//--------------------------------------------------------------------------------------------------------------------

View file

@ -76,7 +76,7 @@ public class EdDropper
public static void on_config(boolean with_item_insertion)
{
with_adjacent_item_insertion = with_item_insertion;
ModEngineersDecor.logger().info("Config dropper: item-insertion:" + with_adjacent_item_insertion);
ModEngineersDecor.logger().info("Config dropper: item-insertion:" + with_adjacent_item_insertion + ".");
}
//--------------------------------------------------------------------------------------------------------------------
@ -237,11 +237,6 @@ public class EdDropper
protected final InventoryRange storage_slot_range_ = new InventoryRange(main_inventory_, INPUT_SLOTS_FIRST, INPUT_SLOTS_SIZE);
protected final InventoryRange filter_slot_range_ = new InventoryRange(main_inventory_, CTRL_SLOTS_FIRST, CTRL_SLOTS_SIZE);
public static void on_config(int cooldown_ticks)
{
// ModEngineersDecor.logger.info("Config factory dropper:");
}
public DropperTileEntity()
{ this(ModContent.TET_FACTORY_DROPPER); }

View file

@ -64,6 +64,9 @@ import java.util.Random;
public class EdElectricalFurnace
{
public static void on_config(int speed_percent, int standard_energy_per_tick, boolean with_automatic_inventory_pulling)
{ ElectricalFurnaceTileEntity.on_config(speed_percent, standard_energy_per_tick, with_automatic_inventory_pulling); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -118,7 +121,7 @@ public class EdElectricalFurnace
public static class ElectricalFurnaceTileEntity extends EdFurnace.FurnaceTileEntity implements ITickableTileEntity, INameable, INamedContainerProvider
{
private static final int NUM_OF_FIELDS = 7;
private static final int NUM_OF_FIELDS = 8;
private static final int TICK_INTERVAL = 4;
private static final int FIFO_INTERVAL = 20;
private static final int HEAT_CAPACITY = 200;
@ -138,7 +141,7 @@ public class EdElectricalFurnace
private static final int FIFO_OUTPUT_1_SLOT_NO = 6;
public static final int DEFAULT_SPEED_PERCENT = 290;
public static final int DEFAULT_ENERGY_CONSUMPTION = 16;
public static final int DEFAULT_SCALED_ENERGY_CONSUMPTION = DEFAULT_ENERGY_CONSUMPTION * HEAT_INCREMENT * DEFAULT_SPEED_PERCENT / 100;
public static final int DEFAULT_SCALED_ENERGY_CONSUMPTION = DEFAULT_ENERGY_CONSUMPTION * TICK_INTERVAL;
// Config ----------------------------------------------------------------------------------
@ -150,17 +153,20 @@ public class EdElectricalFurnace
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, 4, 4096) * HEAT_INCREMENT * proc_speed_percent_ / 100;
proc_speed_percent_ = MathHelper.clamp(speed_percent, 10, 800);
energy_consumption_ = MathHelper.clamp(standard_energy_per_tick, 4, 4096) * TICK_INTERVAL;
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_);
ModEngineersDecor.logger().info("Config electrical furnace speed:" + proc_speed_percent_ + "%, heat-loss: 1K/t, heating consumption:" + (energy_consumption_/TICK_INTERVAL)+"rf/t.");
}
// ElectricalFurnaceTileEntity -----------------------------------------------------------------------------
private int speed_ = 1;
private boolean enabled_ = false;
protected int field_power_consumption_;
protected int power_consumption_accumulator_;
protected int power_consumption_timer_;
private final LazyOptional<IItemHandler> item_handler_;
public ElectricalFurnaceTileEntity()
@ -279,6 +285,7 @@ public class EdElectricalFurnace
case 4: return ElectricalFurnaceTileEntity.this.speed_;
case 5: return ElectricalFurnaceTileEntity.this.battery_.getMaxEnergyStored();
case 6: return ElectricalFurnaceTileEntity.this.field_is_burning_;
case 7: return ElectricalFurnaceTileEntity.this.field_power_consumption_;
default: return 0;
}
}
@ -293,6 +300,7 @@ public class EdElectricalFurnace
case 4: ElectricalFurnaceTileEntity.this.speed_ = value; break;
case 5: ElectricalFurnaceTileEntity.this.battery_.setMaxEnergyStored(value); break;
case 6: ElectricalFurnaceTileEntity.this.field_is_burning_ = value; break;
case 7: ElectricalFurnaceTileEntity.this.field_power_consumption_ = value; break;
}
}
};
@ -318,7 +326,8 @@ public class EdElectricalFurnace
final boolean was_burning = burning();
if(was_burning) burntime_left_ -= TICK_INTERVAL;
if(burntime_left_ < 0) burntime_left_ = 0;
if(world.isRemote) return;
if(world.isRemote()) return;
int battery_energy = battery_.getEnergyStored();
boolean update_blockstate = (was_burning != burning());
boolean dirty = update_blockstate;
boolean shift_in = false;
@ -348,7 +357,7 @@ public class EdElectricalFurnace
if(transferItems(SMELTING_INPUT_SLOT_NO, SMELTING_OUTPUT_SLOT_NO, 1)) dirty = true;
} else {
// smelt, automatically choke speed on low power storage
final int speed = (battery_.getSOC() >= 25)? (speed_) : (1);
final int speed = MathHelper.clamp((battery_.getSOC() >= 25) ? (speed_) : (1), 0, MAX_SPEED_SETTING);
if(!burning() && can_smelt) {
if(heat_up(speed)) { dirty = true; update_blockstate = true; }
}
@ -375,8 +384,16 @@ public class EdElectricalFurnace
sync_blockstate();
}
if(adjacent_inventory_shift(shift_in, shift_out)) dirty = true;
if(dirty) markDirty();
field_is_burning_ = burning() ? 1 : 0;
// power consumption
power_consumption_timer_ += TICK_INTERVAL;
power_consumption_accumulator_ += (battery_.getEnergyStored() - battery_energy);
if(power_consumption_timer_ >= 20) {
field_power_consumption_ = power_consumption_accumulator_/power_consumption_timer_;
power_consumption_accumulator_ = 0;
power_consumption_timer_ = 0;
}
if(dirty) markDirty();
}
// Furnace --------------------------------------------------------------------------------------
@ -474,11 +491,10 @@ public class EdElectricalFurnace
private boolean heat_up(int speed)
{
if(burntime_left_ >= (HEAT_CAPACITY-HEAT_INCREMENT)) return false;
if(!enabled_) return false;
int p = energy_consumption(speed);
if((p<=0) || (!battery_.draw(p))) return false;
burntime_left_ += HEAT_INCREMENT;
this.markDirty();
burntime_left_ = Math.min(burntime_left_+HEAT_INCREMENT, HEAT_CAPACITY);
return true; // returns TE dirty
}
@ -629,21 +645,24 @@ public class EdElectricalFurnace
public void init()
{
super.init();
{
final String prefix = ModContent.SMALL_ELECTRICAL_FURNACE.getTranslationKey() + ".tooltips.";
final int x0 = getGuiLeft(), y0 = getGuiTop();
final Slot aux = container.getSlot(ElectricalFurnaceTileEntity.SMELTING_AUX_SLOT_NO);
tooltip_.init(
new TipRange(x0+135, y0+50, 25, 25, new TranslationTextComponent(prefix + "speed")),
new TipRange(x0+aux.xPos, y0+aux.yPos, 16, 16, new TranslationTextComponent(prefix + "auxslot"))
);
}
final String prefix = ModContent.SMALL_ELECTRICAL_FURNACE.getTranslationKey() + ".tooltips.";
final int x0 = getGuiLeft(), y0 = getGuiTop();
final Slot aux = container.getSlot(ElectricalFurnaceTileEntity.SMELTING_AUX_SLOT_NO);
tooltip_.init(
new TipRange(x0+135, y0+50, 25, 25, new TranslationTextComponent(prefix + "speed")),
new TipRange(x0+aux.xPos, y0+aux.yPos, 16, 16, new TranslationTextComponent(prefix + "auxslot")),
new TipRange(x0+80, y0+55, 50, 14, ()->{
final int soc = getContainer().field(1) * 100 / Math.max(getContainer().field(5), 1);
final int consumption = getContainer().field(7);
return new TranslationTextComponent(prefix + "capacitors", soc, consumption);
})
);
}
@Override
public void render(MatrixStack mx, int mouseX, int mouseY, float partialTicks)
{
renderBackground/*renderBackground*/(mx);
renderBackground(mx);
super.render(mx, mouseX, mouseY, partialTicks);
if(!tooltip_.render(mx, this, mouseX, mouseY)) renderHoveredTooltip(mx, mouseX, mouseY);
}
@ -711,7 +730,7 @@ public class EdElectricalFurnace
private int energy_px(int maxwidth, int quantization)
{
int emax = getContainer().field(5);
int k = ((maxwidth * getContainer().field(1) * 9) / 8) /((emax>0?emax:1)+1);
int k = ((maxwidth * getContainer().field(1) * 9) / 8) / ((emax>0?emax:1)+1);
k = (k >= maxwidth-2) ? maxwidth : k;
if(quantization > 0) k = ((k+(quantization/2))/quantization) * quantization;
return k;

View file

@ -46,6 +46,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.libmc.blocks.StandardBlocks;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import wile.engineersdecor.libmc.detail.Fluidics;
@ -71,6 +72,7 @@ public class EdFluidBarrel
capacity_ = MathHelper.clamp(tank_capacity, 2000, 64000);
tile_fluid_handler_transfer_rate_ = MathHelper.clamp(tank_capacity, 50, 4096);
item_fluid_handler_transfer_rate_ = tile_fluid_handler_transfer_rate_;
ModEngineersDecor.logger().info("Config fluid barrel: capacity:" + capacity_ + "mb, transfer-rate:" + tile_fluid_handler_transfer_rate_ + "mb/t.");
}
//--------------------------------------------------------------------------------------------------------------------

View file

@ -54,7 +54,7 @@ public class EdFluidFunnel
public static void on_config(boolean with_tank_fluid_collection)
{
with_device_fluid_handler_collection = with_tank_fluid_collection;
ModEngineersDecor.logger().info("Config fluid funnel: tank-fluid-collection:"+with_device_fluid_handler_collection);
ModEngineersDecor.logger().info("Config fluid funnel: tank-fluid-collection:" + with_device_fluid_handler_collection + ".");
}
//--------------------------------------------------------------------------------------------------------------------
@ -226,8 +226,6 @@ public class EdFluidFunnel
// ICapabilityProvider / Output flow handler ----------------------------------------------------------
@Override
public <T> LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing)
{

View file

@ -47,6 +47,9 @@ import java.util.*;
public class EdFreezer
{
public static void on_config(int consumption, int cooldown_per_second)
{ FreezerTileEntity.on_config(consumption, cooldown_per_second); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------

View file

@ -70,6 +70,9 @@ import java.util.*;
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); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -232,7 +235,7 @@ public class EdFurnace
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);
ModEngineersDecor.logger().info("Config lab furnace speed:" + (proc_speed_*100) + "%, efficiency:" + (proc_fuel_efficiency_*100) + "%");
ModEngineersDecor.logger().info("Config lab furnace speed:" + (proc_speed_*100) + "%, efficiency:" + (proc_fuel_efficiency_*100) + "%, boost: " + (boost_energy_consumption/TICK_INTERVAL) + "rf/t.");
}
// DecorFurnaceTileEntity -----------------------------------------------------------------------------
@ -507,7 +510,7 @@ public class EdFurnace
if(burning() && canSmeltCurrentItem()) {
proc_time_elapsed_ += TICK_INTERVAL * proc_speed_;
if(heater_inserted_ && battery_.draw(boost_energy_consumption)) {
proc_time_elapsed_ += (TICK_INTERVAL * proc_speed_)*2;
proc_time_elapsed_ += (TICK_INTERVAL * proc_speed_) * 2;
}
if(proc_time_elapsed_ >= proc_time_needed_) {
proc_time_elapsed_ = 0;

View file

@ -64,10 +64,8 @@ import java.util.function.Supplier;
public class EdHopper
{
public static void on_config(int cooldown_ticks)
{
// ModEngineersDecor.logger.info("Config factory hopper:");
}
public static void on_config()
{}
//--------------------------------------------------------------------------------------------------------------------
// Block

View file

@ -61,6 +61,9 @@ import java.util.stream.Collectors;
public class EdMilker
{
public static void on_config(int energy_consumption_per_tick, int min_milking_delay_per_cow)
{ MilkerTileEntity.on_config(energy_consumption_per_tick, min_milking_delay_per_cow); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -186,7 +189,6 @@ public class EdMilker
private final Fluidics.Tank tank_;
private final LazyOptional<IFluidHandler> fluid_handler_;
public static void on_config(int energy_consumption_per_tick, int min_milking_delay_per_cow)
{
energy_consumption_ = MathHelper.clamp(energy_consumption_per_tick, 0, 1024);
@ -204,7 +206,7 @@ public class EdMilker
}
ModEngineersDecor.logger().info(
"Config milker: energy consumption:" + energy_consumption_ + "rf/t"
+ ((milk_fluid_==NO_MILK_FLUID)?"":" [milk fluid available]")
+ ((milk_fluid_==NO_MILK_FLUID)?"[no milk fluid registered]":" [milk fluid available]")
+ ((ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE==null)?"":" [bottledmilk mod available]")
);
}

View file

@ -55,6 +55,9 @@ import java.util.*;
public class EdMineralSmelter
{
public static void on_config(int consumption, int heatup_per_second)
{ MineralSmelterTileEntity.on_config(consumption, heatup_per_second); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -247,7 +250,7 @@ public class EdMineralSmelter
energy_consumption = MathHelper.clamp(consumption, 8, 4096);
heatup_rate = MathHelper.clamp(heatup_per_second, 1, 5);
cooldown_rate = MathHelper.clamp(heatup_per_second/2, 1, 5);
ModEngineersDecor.logger().info("Config mineal smelter energy consumption:" + energy_consumption + "rf/t, heat-up rate: " + heatup_rate + "%/s.");
ModEngineersDecor.logger().info("Config mineal smelter: energy consumption:" + energy_consumption + "rf/t, heat-up rate: " + heatup_rate + "%/s.");
}
public MineralSmelterTileEntity()

View file

@ -50,7 +50,7 @@ public class EdPipeValve
{
PipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000);
PipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000);
ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + PipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + PipeValveTileEntity.redstone_flow_slope_mb + "mb/sig");
ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + PipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + PipeValveTileEntity.redstone_flow_slope_mb + "mb/sig.");
}
//--------------------------------------------------------------------------------------------------------------------
@ -68,13 +68,6 @@ public class EdPipeValve
public final int valve_config;
public static void on_config(int container_size_decl, int redstone_slope)
{
PipeValveTileEntity.fluid_maxflow_mb = MathHelper.clamp(container_size_decl, 1, 10000);
PipeValveTileEntity.redstone_flow_slope_mb = MathHelper.clamp(redstone_slope, 1, 10000);
ModEngineersDecor.logger().info("Config pipe valve: maxflow:" + PipeValveTileEntity.fluid_maxflow_mb + "mb, redstone amp:" + PipeValveTileEntity.redstone_flow_slope_mb + "mb/sig");
}
public PipeValveBlock(long config, int valve_config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
{ super(config, builder, unrotatedAABB); this.valve_config = valve_config; }

View file

@ -67,6 +67,9 @@ import java.util.List;
public class EdPlacer
{
public static void on_config()
{}
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -204,11 +207,6 @@ public class EdPlacer
private int tick_timer_ = 0;
protected NonNullList<ItemStack> stacks_;
public static void on_config(int cooldown_ticks)
{
// ModEngineersDecor.logger.info("Config factory placer:");
}
public PlacerTileEntity()
{ this(ModContent.TET_FACTORY_PLACER); }

View file

@ -43,6 +43,9 @@ import java.util.List;
public class EdSolarPanel
{
public static void on_config(int peak_power_per_tick)
{ SolarPanelTileEntity.on_config(peak_power_per_tick); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -111,7 +114,7 @@ public class EdSolarPanel
peak_power_per_tick_ = MathHelper.clamp(peak_power_per_tick, 2, 8192);
feeding_threshold = Math.max(max_power_storage_/5, 1000);
balancing_threshold = Math.max(max_power_storage_/10, 1000);
ModEngineersDecor.logger().info("Config small solar panel: Peak production:" + peak_power_per_tick_ + "/tick");
ModEngineersDecor.logger().info("Config small solar panel: Peak production:" + peak_power_per_tick_ + "/t.");
}
//------------------------------------------------------------------------------------------------------------------

View file

@ -8,10 +8,14 @@
*/
package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -19,7 +23,6 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction;
@ -29,8 +32,21 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.registries.ForgeRegistries;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.libmc.detail.*;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -62,17 +78,17 @@ public class EdTestBlock
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, @Nullable Direction side)
{ return true; }
@Override
public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side)
{ return false; }
@Override
public boolean hasDynamicDropList()
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, TileEntity te, boolean explosion)
{
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(new ItemStack(this, 1));
return list;
}
{ return Collections.singletonList(new ItemStack(this)); }
@Override
@SuppressWarnings("deprecation")
@ -81,8 +97,7 @@ public class EdTestBlock
if(world.isRemote()) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof TestTileEntity)) return ActionResultType.FAIL;
((TestTileEntity)te).activated(player, hand, hit);
return ActionResultType.CONSUME;
return ((TestTileEntity)te).activated(player, hand, hit) ? ActionResultType.CONSUME : ActionResultType.PASS;
}
}
@ -92,41 +107,232 @@ public class EdTestBlock
public static class TestTileEntity extends TileEntity implements ITickableTileEntity
{
private int tick_interval_ = 10;
private int tick_timer_ = 0;
// ------------------------------------------------------------------------------------------
private final RfEnergy.Battery battery_;
private final LazyOptional<IEnergyStorage> energy_handler_;
private final Fluidics.Tank tank_;
private final LazyOptional<IFluidHandler> fluid_handler_;
private final Inventories.StorageInventory inventory_;
private final LazyOptional<IItemHandler> item_handler_;
private int tick_timer = 0;
private int rf_fed_avg = 0;
private int rf_fed_total = 0;
private int rf_fed_acc = 0;
private int rf_received_avg = 0;
private int rf_received_total = 0;
private int liq_filled_avg = 0;
private int liq_filled_total = 0;
private int liq_filled_acc = 0;
private int liq_received_avg = 0;
private int liq_received_total = 0;
private int items_inserted_total = 0;
private int items_received_total = 0;
private int rf_feed_setting = 4096;
private FluidStack liq_fill_stack = new FluidStack(Fluids.WATER, 128);
private ItemStack insertion_item = ItemStack.EMPTY;
private Direction block_facing = Direction.NORTH;
private boolean paused = false;
public TestTileEntity()
{ this(ModContent.TET_TEST_BLOCK); }
public TestTileEntity(TileEntityType<?> te_type)
{ super(te_type); }
// ------------------------------------------------------------------------------------------
public void activated(PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{}
// TileEntity ------------------------------------------------------------------------------
{
super(te_type);
battery_ = new RfEnergy.Battery((int)1e9, (int)1e9, 0, 0);
energy_handler_ = battery_.createEnergyHandler();
tank_ = new Fluidics.Tank((int)1e9);
fluid_handler_ = tank_.createFluidHandler();
inventory_ = new Inventories.StorageInventory(this, 1);
item_handler_ = Inventories.MappedItemHandler.createInsertionHandler(inventory_);
}
@Override
public void read(BlockState state, CompoundNBT nbt)
{ super.read(state, nbt); }
{
super.read(state, nbt);
tank_.load(nbt);
battery_.load(nbt);
rf_fed_avg = nbt.getInt("rf_fed_avg");
rf_fed_total = nbt.getInt("rf_fed_total");
rf_fed_acc = nbt.getInt("rf_fed_acc");
rf_received_avg = nbt.getInt("rf_received_avg");
rf_received_total = nbt.getInt("rf_received_total");
liq_filled_avg = nbt.getInt("liq_filled_avg");
liq_filled_total = nbt.getInt("liq_filled_total");
liq_filled_acc = nbt.getInt("liq_filled_acc");
liq_received_avg = nbt.getInt("liq_received_avg");
liq_received_total = nbt.getInt("liq_received_total");
rf_feed_setting = nbt.getInt("rf_feed_setting");
items_received_total = nbt.getInt("items_received_total");
items_inserted_total = nbt.getInt("items_inserted_total");
if(nbt.contains("liq_fill_stack")) liq_fill_stack = FluidStack.loadFluidStackFromNBT(nbt.getCompound("liq_fill_stack"));
if(nbt.contains("insertion_item")) insertion_item = ItemStack.read(nbt.getCompound("insertion_item"));
}
@Override
public CompoundNBT write(CompoundNBT nbt)
{ super.write(nbt); return nbt; }
{
super.write(nbt);
tank_.save(nbt);
battery_.save(nbt);
nbt.putInt("rf_fed_avg", rf_fed_avg);
nbt.putInt("rf_fed_total", rf_fed_total);
nbt.putInt("rf_fed_acc", rf_fed_acc);
nbt.putInt("rf_received_avg", rf_received_avg);
nbt.putInt("rf_received_total", rf_received_total);
nbt.putInt("liq_filled_avg", liq_filled_avg);
nbt.putInt("liq_filled_total", liq_filled_total);
nbt.putInt("liq_filled_acc", liq_filled_acc);
nbt.putInt("liq_received_avg", liq_received_avg);
nbt.putInt("liq_received_total", liq_received_total);
nbt.putInt("rf_feed_setting", rf_feed_setting);
nbt.putInt("items_received_total", items_received_total);
nbt.putInt("items_inserted_total", items_inserted_total);
if(!liq_fill_stack.isEmpty()) nbt.put("liq_fill_stack", liq_fill_stack.writeToNBT(new CompoundNBT()));
if(!insertion_item.isEmpty()) nbt.put("insertion_item", insertion_item.write(new CompoundNBT()));
return nbt;
}
private FluidStack getFillFluid(ItemStack stack)
{
// intentionally not item fluid handler, only specific items.
if(stack.getItem() == Items.WATER_BUCKET) return new FluidStack(Fluids.WATER, 1000);
if(stack.getItem() == Items.LAVA_BUCKET) return new FluidStack(Fluids.LAVA, 1000);
return FluidStack.EMPTY;
}
private ItemStack getRandomItemstack()
{
final int n = (int)Math.floor(Math.random() * ForgeRegistries.ITEMS.getValues().size());
ItemStack stack = new ItemStack(ForgeRegistries.ITEMS.getValues().stream().skip(n).findAny().orElse(Items.COBBLESTONE));
stack.setCount((int)Math.floor(Math.random() * stack.getMaxStackSize()));
return stack;
}
public boolean activated(PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
final ItemStack held = player.getHeldItem(hand);
if(held.isEmpty()) {
ArrayList<String> msgs = new ArrayList<>();
if(rf_fed_avg > 0) msgs.add("-" + rf_fed_avg + "rf/t");
if(rf_fed_total > 0) msgs.add("-" + rf_fed_total + "rf");
if(rf_received_avg > 0) msgs.add("+" + rf_received_avg + "rf/t");
if(rf_received_total > 0) msgs.add("+" + rf_received_total + "rf");
if(liq_filled_avg > 0) msgs.add("-" + liq_filled_avg + "mb/t");
if(liq_filled_total > 0) msgs.add("-" + liq_filled_total + "mb");
if(liq_received_avg > 0) msgs.add("+" + liq_received_avg + "mb/t");
if(liq_received_total > 0) msgs.add("+" + liq_received_total + "mb");
if(items_received_total > 0) msgs.add("+" + items_received_total + "items");
if(items_inserted_total > 0) msgs.add("-" + items_inserted_total + "items");
if(msgs.isEmpty()) msgs.add("Nothing transferred yet.");
Overlay.show(player, new StringTextComponent(String.join(" | ", msgs)), 1000);
return true;
} else if(paused) {
if(!getFillFluid(held).isEmpty()) {
FluidStack fs = getFillFluid(held);
if(liq_fill_stack.isEmpty() || !liq_fill_stack.isFluidEqual(fs)) {
fs.setAmount(128);
liq_fill_stack = fs;
} else {
int amount = liq_fill_stack.getAmount() * 2;
if(amount > 4096) amount = 16;
liq_fill_stack.setAmount(amount);
}
if(liq_fill_stack.isEmpty()) {
Overlay.show(player, new StringTextComponent("Fluid fill: none"), 1000);
} else {
Overlay.show(player, new StringTextComponent("Fluid fill: " + liq_fill_stack.getAmount() + "mb/t of " + liq_fill_stack.getFluid().getRegistryName()), 1000);
}
} else if(held.getItem() == Items.REDSTONE) {
rf_feed_setting = (rf_feed_setting<<1) & 0x00fffff0;
if(rf_feed_setting == 0) rf_feed_setting = 0x10;
Overlay.show(player, new StringTextComponent("RF feed rate: " + rf_feed_setting + "rf/t"), 1000);
} else {
BlockState adjacent_state = world.getBlockState(pos.offset(block_facing));
if(adjacent_state.getBlock()==Blocks.HOPPER || adjacent_state.getBlock()==ModContent.FACTORY_HOPPER) {
insertion_item = held.copy();
Overlay.show(player, new StringTextComponent("Insertion item: " + (insertion_item.getItem()==Items.LEVER ? "random" : insertion_item.toString()) + "/s"), 1000);
}
}
return true;
} else {
return false;
}
}
@Override
public void remove()
{ super.remove(); }
{
super.remove();
energy_handler_.invalidate();
fluid_handler_.invalidate();
item_handler_.invalidate();
}
@Override
public <T> LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing)
{
if((!paused) && (facing != block_facing)) {
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) return fluid_handler_.cast();
if(capability == CapabilityEnergy.ENERGY) return energy_handler_.cast();
if(capability ==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return item_handler_.cast();
}
return super.getCapability(capability, facing);
}
@Override
public void tick()
{
if((world.isRemote) || (--tick_timer_ > 0)) return;
tick_timer_ = tick_interval_;
if(world.isRemote()) return;
block_facing = getBlockState().get(TestBlock.FACING);
paused = world.isBlockPowered(getPos());
if(!paused) {
boolean dirty = false;
{
int p = RfEnergy.feed(getWorld(), getPos().offset(block_facing), block_facing.getOpposite(), rf_feed_setting);
rf_fed_acc += p;
dirty |= p>0;
}
if(!liq_fill_stack.isEmpty()) {
int f = Fluidics.fill(getWorld(), getPos().offset(block_facing), block_facing.getOpposite(), liq_fill_stack);
liq_filled_acc += f;
dirty |= f>0;
}
if(!inventory_.isEmpty()) {
int i = inventory_.getStackInSlot(0).getCount();
items_received_total += i;
inventory_.clear();
dirty |= i>0;
}
if((tick_timer == 1) && (!insertion_item.isEmpty())) {
BlockState adjacent_state = world.getBlockState(pos.offset(block_facing));
ItemStack stack = (insertion_item.getItem()==Items.LEVER) ? getRandomItemstack() : insertion_item.copy();
if(adjacent_state.getBlock()==Blocks.HOPPER || adjacent_state.getBlock()==ModContent.FACTORY_HOPPER) {
ItemStack remaining = Inventories.insert(getWorld(), getPos().offset(block_facing), block_facing.getOpposite(), stack, false);
int n = stack.getCount() - remaining.getCount();
items_inserted_total += n;
dirty |= n>0;
}
}
if(dirty) {
markDirty();
}
}
if(--tick_timer <= 0) {
tick_timer = 20;
rf_fed_avg = rf_fed_acc/20;
rf_fed_total += rf_fed_acc;
rf_fed_acc = 0;
rf_received_avg = battery_.getEnergyStored()/20;
rf_received_total += battery_.getEnergyStored();
battery_.clear();
liq_received_avg = tank_.getFluidAmount();
liq_received_total += tank_.getFluidAmount();
tank_.clear();
liq_filled_avg = (liq_fill_stack.isEmpty()) ? 0 : (liq_filled_acc/20);
liq_filled_total = (liq_fill_stack.isEmpty()) ? 0 : (liq_filled_total+liq_filled_acc);
liq_filled_acc = 0;
}
}
}

View file

@ -43,6 +43,9 @@ import java.util.Random;
public class EdTreeCutter
{
public static void on_config(int boost_energy_per_tick, int cutting_time_seconds, boolean power_required)
{ TreeCutterTileEntity.on_config(boost_energy_per_tick, cutting_time_seconds,power_required); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -129,7 +132,7 @@ public class EdTreeCutter
energy_max = Math.max(boost_energy_consumption * 10, 10000);
cutting_time_needed = 20 * MathHelper.clamp(cutting_time_seconds, 10, 240);
requires_power = power_required;
ModEngineersDecor.logger().info("Config tree cutter: Boost energy consumption:" + boost_energy_consumption + "rf/t" + (requires_power?" (power required for operation) ":"") + ", cutting time " + cutting_time_needed + "t." );
ModEngineersDecor.logger().info("Config tree cutter: energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t" + (requires_power?" (power required for operation) ":"") + ", cutting time:" + cutting_time_needed + "t." );
}
public TreeCutterTileEntity()

View file

@ -64,6 +64,9 @@ import java.util.Random;
public class EdWasteIncinerator
{
public static void on_config(int boost_energy_per_tick)
{ WasteIncineratorTileEntity.on_config(boost_energy_per_tick); }
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
@ -191,10 +194,10 @@ public class EdWasteIncinerator
private static int energy_consumption = DEFAULT_ENERGY_CONSUMPTION;
public static void on_config(int speed_percent, int fuel_efficiency_percent, int boost_energy_per_tick)
public static void on_config(int boost_energy_per_tick)
{
energy_consumption = MathHelper.clamp(boost_energy_per_tick, 4, 4096);
ModEngineersDecor.logger().info("Config waste incinerator boost energy consumption:" + energy_consumption);
ModEngineersDecor.logger().info("Config waste incinerator: boost energy consumption:" + energy_consumption + ".");
}
// WasteIncineratorTileEntity -----------------------------------------------------------------------------

View file

@ -9,12 +9,28 @@
package wile.engineersdecor.libmc.detail;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import javax.annotation.Nullable;
public class RfEnergy
{
public static int feed(World world, BlockPos pos, @Nullable Direction side, int rf_energy)
{
final TileEntity te = world.getTileEntity(pos);
if(te == null) return 0;
final IEnergyStorage es = te.getCapability(CapabilityEnergy.ENERGY, side).orElse(null);
if(es == null) return 0;
return es.receiveEnergy(rf_energy, false);
}
public static class Battery implements IEnergyStorage
{
protected int capacity_;

View file

@ -20,6 +20,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
@OnlyIn(Dist.CLIENT)
@ -39,9 +40,14 @@ public class TooltipDisplay
public static class TipRange
{
public final int x0,y0,x1,y1;
public final ITextComponent text;
public final Supplier<ITextComponent> text;
public TipRange(int x, int y, int w, int h, ITextComponent text)
{ this(x,y,w,h,()->text); }
public TipRange(int x, int y, int w, int h, Supplier<ITextComponent> text)
{ this.text=text; this.x0=x; this.y0=y; this.x1=x0+w-1; this.y1=y0+h-1; }
}
// ---------------------------------------------------------------------------------------------------
@ -87,10 +93,10 @@ public class TooltipDisplay
} else if(ranges.stream().noneMatch(
(tip)->{
if((x<tip.x0) || (x>tip.x1) || (y<tip.y0) || (y>tip.y1)) return false;
String text = tip.text.getString();
String text = tip.text.get().getString();
if(!text.isEmpty() && (!text.startsWith("block."))) {
try {
gui.renderTooltip(mx, tip.text, x, y); //gui.func_243308_b(mx, Collections.singletonList(tip.text), x, y);
gui.renderTooltip(mx, tip.text.get(), x, y);
} catch(Exception ex) {
had_render_exception = true;
Auxiliaries.logError("Tooltip rendering disabled due to exception: '" + ex.getMessage() + "'");

View file

@ -215,6 +215,7 @@
"block.engineersdecor.small_electrical_furnace": "Small Electrical Furnace",
"block.engineersdecor.small_electrical_furnace.help": "Small metal cased pass-through furnace.\n Can draw items from the input side,\n puts items into the inventory at\n the output side. Items can be\n inserted or drawn from all sides\n using hoppers. Implicitly bypasses\n items that cannot be smelted or\n cooked. Slightly more energy\n efficient and faster than a heated\n cobblestone furnace. Fifos and\n feeders transfer whole stacks.\n Feeders require a bit of power.\n Place a Hopper into an aux slot\n to automatically draw items from\n inventories on the input side.",
"block.engineersdecor.small_electrical_furnace.tooltips.auxslot": "Auxiliary slot\n§7Place a Hopper here to enable automatic feeding from the input side.",
"block.engineersdecor.small_electrical_furnace.tooltips.capacitors": "SOC %1$s%%, %2$srf/t",
"block.engineersdecor.small_electrical_furnace.tooltips.speed": "Smelting speed selection §7(OFF/I/II/III)",
"block.engineersdecor.small_fluid_funnel": "Small Fluid Collection Funnel",
"block.engineersdecor.small_fluid_funnel.help": "Collects fluids above it. Has an\n internal tank with three buckets\n capacity. Traces flowing fluids\n to nearby source blocks. The\n fluid can be obtained with fluid\n transfer systems or a bucket.\n Fills only tanks below (gravity\n transfer). Compatible with vanilla\n infinite-water-source creation.",

View file

@ -215,6 +215,7 @@
"block.engineersdecor.small_electrical_furnace": "Компактная конвейерная электрическая печь",
"block.engineersdecor.small_electrical_furnace.help": "Компактная конвейерная печь в металлическом корпусе. Автоматически принимает предметы со стороны ввода и складывает в инвентарь со стороны вывода. Предметы можно помещать/забирать со всех сторон с помощью воронок. Без проблем пропускает элементы, которые нельзя выплавить или приготовить. Чуть более энергоэффективная и быстрая, чем утеплённая булыжная печь. Транспортировка работает стеками. Механизм требует мало энергии.",
"block.engineersdecor.small_electrical_furnace.tooltips.auxslot": "Вспомогательный слот\n§8Поместите сюда воронку, чтобы включить автоматическую подачу со стороны входа.",
"block.engineersdecor.small_electrical_furnace.tooltips.capacitors": "SOC %1$s%%, %2$srf/t",
"block.engineersdecor.small_electrical_furnace.tooltips.speed": "Выбор скорости плавки §8(ВЫКЛ/I/II/III)",
"block.engineersdecor.small_fluid_funnel": "Малая воронка для сбора жидкости",
"block.engineersdecor.small_fluid_funnel.help": "Собирает жидкости над ним. Имеет внутренний бак на три ведра. Прослеживает текучие жидкости к соседним блокам источника. Жидкость может быть получена с помощью систем передачи жидкости или ведра. Заполняет только резервуары ниже (сила гравитации). Совместим с ванильным источником бесконечной воды.",

View file

@ -215,6 +215,7 @@
"block.engineersdecor.small_electrical_furnace": "小型电炉",
"block.engineersdecor.small_electrical_furnace.help": "§6小型金属封装穿过式熔炉。§r 自动从输入端获取物品并在输出端物品栏放置物品。 物品能从所有面使用漏斗插入或提取。无法熔炼或烹饪的物品会直接送到出口。 比加热的圆石炉有稍微高的能效比和更快。 先进先出和自动输出一次移动一组物品。自动输出需要一点能量。",
"block.engineersdecor.small_electrical_furnace.tooltips.auxslot": "Auxiliary slot\n§8Place a Hopper here to enable automatic feeding from the input side.",
"block.engineersdecor.small_electrical_furnace.tooltips.capacitors": "SOC %1$s%%, %2$srf/t",
"block.engineersdecor.small_electrical_furnace.tooltips.speed": "Smelting speed selection §8(OFF/I/II/III)",
"block.engineersdecor.small_fluid_funnel": "小型流体收集漏斗",
"block.engineersdecor.small_fluid_funnel.help": "§6收集上方的流体。§r有一个三桶大的内部储罐。会 追溯流体到附近的源方块。流体可被流体运输系统或桶 移出。只会装满下方的储罐(重力传输)。与原版 无限水兼容。",