Ore Gen Inconsistencies

- Features now get registered on init, addresses #102
- Fixed motors starting with a scrollvalue of 0
- Fixed deployers not initializing properly
- Saws can now break leaves when moved
- Kinetic networks now actually incorporate pre-config-update capacity/impact of a component
This commit is contained in:
simibubi 2020-03-22 01:10:21 +01:00
parent 9497c1c1d4
commit 8ecf51445a
9 changed files with 31 additions and 24 deletions

View file

@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger;
import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.AllConfigs;
import com.simibubi.create.foundation.command.CreateCommand; import com.simibubi.create.foundation.command.CreateCommand;
import com.simibubi.create.foundation.command.ServerLagger; import com.simibubi.create.foundation.command.ServerLagger;
import com.simibubi.create.foundation.world.AllWorldFeatures;
import com.simibubi.create.modules.ModuleLoadedCondition; import com.simibubi.create.modules.ModuleLoadedCondition;
import com.simibubi.create.modules.contraptions.TorquePropagator; import com.simibubi.create.modules.contraptions.TorquePropagator;
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler; import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
@ -62,6 +63,7 @@ public class Create {
modEventBus.addListener(AllConfigs::onLoad); modEventBus.addListener(AllConfigs::onLoad);
modEventBus.addListener(AllConfigs::onReload); modEventBus.addListener(AllConfigs::onReload);
CreateClient.addListeners(modEventBus); CreateClient.addListeners(modEventBus);
AllWorldFeatures.reload();
} }
public static void init(final FMLCommonSetupEvent event) { public static void init(final FMLCommonSetupEvent event) {

View file

@ -20,6 +20,12 @@ public class CWorldGen extends ConfigBase {
super.onReload(); super.onReload();
} }
@Override
public void onLoad() {
AllWorldFeatures.reload();
super.onLoad();
}
@Override @Override
public String getName() { public String getName() {
return "world"; return "world";

View file

@ -135,9 +135,8 @@ public class ItemDescription {
add(linesOnShift, level); add(linesOnShift, level);
String genSpeed = generatorSpeed(block, rpmUnit); String genSpeed = generatorSpeed(block, rpmUnit);
if (!genSpeed.equals("")){ if (!genSpeed.equals("")) {
add(linesOnShift, ""); add(linesOnShift, GREEN + " " + genSpeed);
add(linesOnShift, GREEN + genSpeed);
} }
} }
@ -264,7 +263,7 @@ public class ItemDescription {
return linesOnShift; return linesOnShift;
} }
private String generatorSpeed(Block block, String unitRPM){ private String generatorSpeed(Block block, String unitRPM) {
String value = ""; String value = "";
if (block instanceof WaterWheelBlock) { if (block instanceof WaterWheelBlock) {

View file

@ -37,22 +37,22 @@ public class KineticNetwork {
if (members.containsKey(te)) if (members.containsKey(te))
return; return;
if (te.isSource()) { if (te.isSource()) {
float capacity = te.getAddedStressCapacity(); unloadedCapacity -= lastCapacity * getStressMultiplierForSpeed(te.getGeneratedSpeed());
unloadedCapacity -= capacity * getStressMultiplierForSpeed(te.getGeneratedSpeed()); float addedStressCapacity = te.getAddedStressCapacity();
if (unloadedCapacity < 0) sources.put(te, addedStressCapacity);
unloadedCapacity = 0;
sources.put(te, capacity);
} }
unloadedStress -= lastStress * getStressMultiplierForSpeed(te.getTheoreticalSpeed());
float stressApplied = te.getStressApplied(); float stressApplied = te.getStressApplied();
unloadedStress -= stressApplied * getStressMultiplierForSpeed(te.getTheoreticalSpeed());
if (unloadedStress < 0)
unloadedStress = 0;
members.put(te, stressApplied); members.put(te, stressApplied);
unloadedMembers--; unloadedMembers--;
if (unloadedMembers < 0) if (unloadedMembers < 0)
unloadedMembers = 0; unloadedMembers = 0;
if (unloadedCapacity < 0)
unloadedCapacity = 0;
if (unloadedStress < 0)
unloadedStress = 0;
} }
public void add(KineticTileEntity te) { public void add(KineticTileEntity te) {

View file

@ -102,7 +102,6 @@ public abstract class KineticBlock extends Block implements IRotate {
return; return;
if (worldIn.isRemote()) if (worldIn.isRemote())
return; return;
tileEntity.removeSource();
RotationPropagator.handleAdded(worldIn.getWorld(), pos, tileEntity); RotationPropagator.handleAdded(worldIn.getWorld(), pos, tileEntity);
} }

View file

@ -51,13 +51,12 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
@Override @Override
public void initialize() { public void initialize() {
if (!hasNetwork()) if (hasNetwork()) {
return;
KineticNetwork network = getOrCreateNetwork(); KineticNetwork network = getOrCreateNetwork();
if (!network.initialized) if (!network.initialized)
network.initFromTE(capacity, stress, networkSize); network.initFromTE(capacity, stress, networkSize);
network.addSilently(this, lastCapacityProvided, lastStressApplied); network.addSilently(this, lastCapacityProvided, lastStressApplied);
}
super.initialize(); super.initialize();
} }

View file

@ -31,7 +31,8 @@ public class SawMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override @Override
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) { public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
return super.canBreak(world, breakingPos, state) && state.isIn(BlockTags.LOGS); return super.canBreak(world, breakingPos, state)
&& (state.isIn(BlockTags.LOGS) || state.isIn(BlockTags.LEAVES));
} }
@Override @Override

View file

@ -32,6 +32,7 @@ public class MotorTileEntity extends GeneratingKineticTileEntity {
generatedSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, slot); generatedSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, slot);
generatedSpeed.between(-max, max); generatedSpeed.between(-max, max);
generatedSpeed.value = DEFAULT_SPEED; generatedSpeed.value = DEFAULT_SPEED;
generatedSpeed.scrollableValue = DEFAULT_SPEED;
generatedSpeed.withUnit(i -> Lang.translate("generic.unit.rpm")); generatedSpeed.withUnit(i -> Lang.translate("generic.unit.rpm"));
generatedSpeed.withCallback(i -> this.updateGeneratedRotation()); generatedSpeed.withCallback(i -> this.updateGeneratedRotation());
generatedSpeed.withStepFunction(MotorTileEntity::step); generatedSpeed.withStepFunction(MotorTileEntity::step);