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

@ -4,4 +4,4 @@ org.gradle.jvmargs=-Xmx8G
version_minecraft=1.12.2
version_forge=14.23.5.2768
version_jei=4.10.0.198
version_engineersdecor=1.0.18
version_engineersdecor=1.0.19-b1

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": {
"1.0.19-b1": "[F] Fixed Tree Cutter / Block Breaker not accepting small energy transfers (thx WindFox, issue #82).",
"1.0.18": "[R] Release based on v1.0.18-b2. Release-to-release changes: * Tree cutter config fixes. * Treated Wood Crafting Table mouse tweaks. * Lang updates.\n[M] Lang update ru_ru (PR#77, thanks Smollet777).",
"1.0.18-b2": "[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).",
"1.0.18-b1": "[M] Lang ru_ru updated (Smollet777).",
@ -77,6 +78,6 @@
},
"promos": {
"1.12.2-recommended": "1.0.18",
"1.12.2-latest": "1.0.18"
"1.12.2-latest": "1.0.19-b1"
}
}

View file

@ -10,6 +10,8 @@ Mod sources for Minecraft version 1.12.2.
----
## Version history
- v1.0.19-b1 [F] Fixed Tree Cutter / Block Breaker not accepting small energy transfers (thx WindFox, issue #82).
-------------------------------------------------------------------
- v1.0.18 [R] Release based on v1.0.18-b2. Release-to-release changes:
* Tree cutter config fixes.

View file

@ -116,7 +116,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)
{
@ -151,11 +151,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)
@ -164,9 +164,9 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
@Override
public int receiveEnergy(int maxReceive, boolean simulate)
{
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 ----------------------------------------------------------------------------
@ -253,9 +253,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;
@ -266,7 +266,9 @@ public class BlockDecorBreaker extends BlockDecorDirectedHorizontal
--active_timer_;
}
boolean active = (active_timer_ > 0);
time_needed = MathHelper.clamp(time_needed, min_breaking_time, MAX_BREAKING_TIME);
if(requires_power && !active) {
proc_time_elapsed_ = Math.max(0, proc_time_elapsed_ - 2*TICK_INTERVAL);
}
if(proc_time_elapsed_ >= time_needed) {
proc_time_elapsed_ = 0;
breakBlock(target_state, target_pos, world);

View file

@ -344,7 +344,6 @@ public class BlockDecorFluidFunnel extends BlockDecor
if(trail.isEmpty()) break; // reset search
if(num_adjacent==0) pos = trail.pop();
}
//println("FAIL=" + steps + " - " + (pos.subtract(collection_pos))); String s = new String(); for(BlockPos p:checked) s += "\n" + p; System.out.println(s);
if(intensive_search_counter_ > 2) world.setBlockToAir(pos);
last_pick_pos_ = collection_pos;
search_offsets_ = null; // try other search order

View file

@ -104,7 +104,7 @@ public class BlockDecorTreeCutter extends BlockDecorDirectedHorizontal
private int tick_timer_;
private int active_timer_;
private int proc_time_elapsed_; // small, not saved in nbt.
private int boost_energy_; // small, not saved in nbt.
private int energy_; // small, not saved in nbt.
public static void on_config(int boost_energy_per_tick, int cutting_time_seconds, boolean power_required)
{
@ -135,11 +135,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)
@ -147,10 +147,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 ----------------------------------------------------------------------------
@ -197,8 +197,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) {