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.foundation.command.CreateCommand;
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.contraptions.TorquePropagator;
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
@ -62,6 +63,7 @@ public class Create {
modEventBus.addListener(AllConfigs::onLoad);
modEventBus.addListener(AllConfigs::onReload);
CreateClient.addListeners(modEventBus);
AllWorldFeatures.reload();
}
public static void init(final FMLCommonSetupEvent event) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -31,7 +31,8 @@ public class SawMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override
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

View file

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