Fixed Tree Cutter/Block Breaker not accepting small energy transfers (issue #82).

This commit is contained in:
stfwi 2020-01-31 18:17:15 +01:00
parent 216c1259e2
commit 66b2390ca5
19 changed files with 95 additions and 87 deletions

View file

@ -5,4 +5,4 @@ version_minecraft=1.14.4
version_forge_minecraft=1.14.4-28.1.116
version_fml_mappings=20190719-1.14.3
version_jei=1.14.4:6.0.0.10
version_engineersdecor=1.0.18-b4
version_engineersdecor=1.0.19-b1

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.14.4": {
"1.0.19-b1": "[F] Fixed Tree Cutter / Block Breaker not accepting small energy transfers (thx WindFox, issue #82).",
"1.0.18-b4": "[M] Lang update ru_ru (PR#77, thanks Smollet777).\n[F] Fixed Milking machine cow path issue, added milking delay cow tracking.\n[F] Slab / Slab Slice placement adapted to vanilla standard.",
"1.0.18-b3": "[A] Added Treated Wood Crafting table tweaks (ctrl-shift moves all same stacks from the inventory, mouse wheel over crafting slot increases/decreases crafting grid stacks).\n[F] EN Lang file fixed (issue #76, thx Riverstar907).\n[F] Fixed Tree Cutter not respecting power-required config (thx federsavo, issue #77).\n[F] Fixed Small Solar Panel not exposing energy capability (thx MatthiasMann, issue #78).",
"1.0.18-b2": "[F] Fixed JEI integration warning if nothing is opt'ed out (thx @SDUBZ for reporting).\n[M] Lang ru_ru updated (Smollet777).",
@ -44,6 +45,6 @@
},
"promos": {
"1.14.4-recommended": "",
"1.14.4-latest": "1.0.18-b4"
"1.14.4-latest": "1.0.19-b1"
}
}

View file

@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.14.4.
## Version history
- v1.0.19-b1 [F] Fixed Tree Cutter / Block Breaker not accepting small energy transfers (thx WindFox, issue #82).
- v1.0.18-b4 [M] Lang update ru_ru (PR#77, thanks Smollet777).
[F] Fixed Milking machine cow path issue, added milking delay cow tracking.
[F] Slab / Slab Slice placement adapted to vanilla standard.

View file

@ -126,7 +126,7 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
private int tick_timer_;
private int active_timer_;
private int proc_time_elapsed_;
private int boost_energy_;
private int energy_;
public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required)
{
@ -161,11 +161,11 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
@Override
public int getMaxEnergyStored()
{ return boost_energy_consumption; }
{ return boost_energy_consumption*2; }
@Override
public int getEnergyStored()
{ return boost_energy_; }
{ return energy_; }
@Override
public int extractEnergy(int maxExtract, boolean simulate)
@ -173,10 +173,10 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
@Override
public int receiveEnergy(int maxReceive, boolean simulate)
{ // only speedup support, no buffering, not in nbt -> no markdirty
if((boost_energy_ >= boost_energy_consumption) || (maxReceive < boost_energy_consumption)) return 0;
if(!simulate) boost_energy_ = boost_energy_consumption;
return boost_energy_consumption;
{
maxReceive = MathHelper.clamp(maxReceive, 0, Math.max((boost_energy_consumption*2) - energy_, 0));
if(!simulate) energy_ += maxReceive;
return maxReceive;
}
// Capability export ----------------------------------------------------------------------------
@ -262,9 +262,9 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
tick_timer_ = IDLE_TICK_INTERVAL;
return;
}
int time_needed = (int)(target_state.getBlockHardness(world, pos) * breaking_reluctance) + min_breaking_time;
if(boost_energy_ >= boost_energy_consumption) {
boost_energy_ = 0;
int time_needed = MathHelper.clamp((int)(target_state.getBlockHardness(world, pos) * breaking_reluctance) + min_breaking_time, min_breaking_time, MAX_BREAKING_TIME);
if(energy_ >= boost_energy_consumption) {
energy_ -= boost_energy_consumption;
proc_time_elapsed_ += TICK_INTERVAL * (1+BOOST_FACTOR);
time_needed += min_breaking_time * (3*BOOST_FACTOR/5);
active_timer_ = 2;
@ -275,12 +275,9 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
--active_timer_;
}
boolean active = (active_timer_ > 0);
if(boost_energy_ >= boost_energy_consumption) {
boost_energy_ = 0;
proc_time_elapsed_ += TICK_INTERVAL * BOOST_FACTOR;
time_needed += min_breaking_time * (3*BOOST_FACTOR/5);
if(requires_power && !active) {
proc_time_elapsed_ = Math.max(0, proc_time_elapsed_ - 2*TICK_INTERVAL);
}
time_needed = MathHelper.clamp(time_needed, min_breaking_time, MAX_BREAKING_TIME);
if(proc_time_elapsed_ >= time_needed) {
proc_time_elapsed_ = 0;
breakBlock(target_state, target_pos, world);

View file

@ -95,7 +95,7 @@ public class BlockDecorTreeCutter extends BlockDecorDirectedHorizontal
private int tick_timer_;
private int active_timer_;
private int proc_time_elapsed_;
private int boost_energy_;
private int energy_;
public static void on_config(int boost_energy_per_tick, int cutting_time_seconds, boolean power_required)
{
@ -125,11 +125,11 @@ public class BlockDecorTreeCutter extends BlockDecorDirectedHorizontal
@Override
public int getMaxEnergyStored()
{ return boost_energy_consumption; }
{ return boost_energy_consumption*2; }
@Override
public int getEnergyStored()
{ return boost_energy_; }
{ return energy_; }
@Override
public int extractEnergy(int maxExtract, boolean simulate)
@ -137,10 +137,10 @@ public class BlockDecorTreeCutter extends BlockDecorDirectedHorizontal
@Override
public int receiveEnergy(int maxReceive, boolean simulate)
{ // only speedup support, no buffering, not in nbt -> no markdirty
if((boost_energy_ >= boost_energy_consumption) || (maxReceive < boost_energy_consumption)) return 0;
if(!simulate) boost_energy_ = boost_energy_consumption;
return boost_energy_consumption;
{
maxReceive = MathHelper.clamp(maxReceive, 0, Math.max((boost_energy_consumption*2) - energy_, 0));
if(!simulate) energy_ += maxReceive;
return maxReceive;
}
// Capability export ----------------------------------------------------------------------------
@ -182,8 +182,8 @@ public class BlockDecorTreeCutter extends BlockDecorDirectedHorizontal
return;
}
proc_time_elapsed_ += TICK_INTERVAL;
if(boost_energy_ >= boost_energy_consumption) {
boost_energy_ = 0;
if(energy_ >= boost_energy_consumption) {
energy_ -= boost_energy_consumption;
proc_time_elapsed_ += TICK_INTERVAL*BOOST_FACTOR;
active_timer_ = 2;
} else if(!requires_power) {