From b4cdcb97291b7cccaeb3665ed90f48e3326dbb90 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 21 Mar 2020 18:32:53 +0100 Subject: [PATCH 1/3] Bug Fixes - Fixed compat crash when tooltips are loaded early - Buffed all sources - Render buffers are now cleared when loading a world. Might help with shader issues - Fixed eager loading of biomes in ore features - Kinetic blocks now always clear their source when placed (needs testing) - Kinetic blocks now remember their applied stress to a network before a config change - Chassis range is now displayed with an overlay instead of outlines - Crushing wheels are now more lenient about having different speeds - Crushing wheels no longer pull players in peaceful mode - Mixers no longer ignore items inserted during processing - Powered Latch now reacts to weak power on the sides - Fixed flexcrates not updating their inventory properly when extended --- build.gradle | 4 +- .../com/simibubi/create/ClientEvents.java | 2 + src/main/java/com/simibubi/create/Events.java | 6 +- .../com/simibubi/create/config/CStress.java | 2 +- .../create/config/StressConfigDefaults.java | 16 ++- .../behaviour/simple/DeferralBehaviour.java | 52 +++++++ .../create/foundation/world/OreFeature.java | 20 +-- .../modules/contraptions/KineticNetwork.java | 50 ++++++- .../contraptions/TorquePropagator.java | 2 +- .../contraptions/base/KineticBlock.java | 1 + .../contraptions/base/KineticTileEntity.java | 28 +++- .../contraptions/ChassisRangeDisplay.java | 134 +++++++++--------- .../crusher/CrushingWheelBlock.java | 3 +- .../crusher/CrushingWheelControllerBlock.java | 6 +- .../mixer/MechanicalMixerTileEntity.java | 9 +- .../press/MechanicalPressTileEntity.java | 17 ++- .../waterwheel/WaterWheelTileEntity.java | 1 - .../processing/BasinOperatingTileEntity.java | 57 +++++--- .../processing/BasinTileEntity.java | 12 +- .../logistics/block/diodes/LatchBlock.java | 12 +- .../block/inventories/FlexcrateBlock.java | 1 + src/main/resources/META-INF/mods.toml | 4 +- wiki/Rotational Force in Create.txt | 52 ------- 23 files changed, 291 insertions(+), 200 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/behaviour/simple/DeferralBehaviour.java delete mode 100644 wiki/Rotational Force in Create.txt diff --git a/build.gradle b/build.gradle index e37909416..ceece4dc1 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = 'mc1.14.4_v0.2' +version = 'mc1.14.4_v0.2.1' group = 'com.simibubi.create' archivesBaseName = 'create' @@ -71,7 +71,7 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' + minecraft 'net.minecraftforge:forge:1.14.4-28.2.3' // compile against the JEI API but do not include it at runtime compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.26:api") diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index c17309f55..d6c7cdd55 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -127,6 +127,8 @@ public class ClientEvents { public static void addToItemTooltip(ItemTooltipEvent event) { if (!AllConfigs.CLIENT.tooltips.get()) return; + if (Minecraft.getInstance().player == null) + return; ItemStack stack = event.getItemStack(); String translationKey = stack.getItem().getTranslationKey(stack); diff --git a/src/main/java/com/simibubi/create/Events.java b/src/main/java/com/simibubi/create/Events.java index e58c67ee4..8ba99e87e 100644 --- a/src/main/java/com/simibubi/create/Events.java +++ b/src/main/java/com/simibubi/create/Events.java @@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.Tags; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.ServerTickEvent; @@ -22,6 +23,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBloc import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.eventbus.api.Event.Result; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; @@ -46,7 +48,8 @@ public class Events { IWorld world = event.getWorld(); Create.redstoneLinkNetworkHandler.onLoadWorld(world); Create.torquePropagator.onLoadWorld(world); -// Create.logisticalNetworkHandler.onLoadWorld(world); + if (event.getWorld().isRemote()) + DistExecutor.runWhenOn(Dist.CLIENT, () -> CreateClient.bufferCache::invalidate); } @SubscribeEvent @@ -54,7 +57,6 @@ public class Events { IWorld world = event.getWorld(); Create.redstoneLinkNetworkHandler.onUnloadWorld(world); Create.torquePropagator.onUnloadWorld(world); -// Create.logisticalNetworkHandler.onUnloadWorld(world); } @SubscribeEvent diff --git a/src/main/java/com/simibubi/create/config/CStress.java b/src/main/java/com/simibubi/create/config/CStress.java index d42a7cc10..31171aba9 100644 --- a/src/main/java/com/simibubi/create/config/CStress.java +++ b/src/main/java/com/simibubi/create/config/CStress.java @@ -49,7 +49,7 @@ public class CStress extends ConfigBase { @Override public String getName() { - return "stressValues"; + return "stressValues.v" + StressConfigDefaults.forcedUpdateVersion; } private static class Comments { diff --git a/src/main/java/com/simibubi/create/config/StressConfigDefaults.java b/src/main/java/com/simibubi/create/config/StressConfigDefaults.java index 23ebbd34d..84fa82524 100644 --- a/src/main/java/com/simibubi/create/config/StressConfigDefaults.java +++ b/src/main/java/com/simibubi/create/config/StressConfigDefaults.java @@ -3,21 +3,27 @@ package com.simibubi.create.config; import com.simibubi.create.AllBlocks; public class StressConfigDefaults { + + /** + * Increment this number if all stress entries should be updated in this update. + * Worlds from the previous version will overwrite potentially changed values with the new defaults. + */ + public static final int forcedUpdateVersion = 1; public static double getDefaultStressCapacity(AllBlocks block) { switch (block) { case CREATIVE_MOTOR: - return 1024; + return 2048; case FURNACE_ENGINE: - return 512; + return 1024; case MECHANICAL_BEARING: - return 256; + return 512; case ENCASED_FAN: case HAND_CRANK: - return 16; + return 32; case WATER_WHEEL: - return 4; + return 8; default: return -1; } diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/simple/DeferralBehaviour.java b/src/main/java/com/simibubi/create/foundation/behaviour/simple/DeferralBehaviour.java new file mode 100644 index 000000000..23d845c7d --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/behaviour/simple/DeferralBehaviour.java @@ -0,0 +1,52 @@ +package com.simibubi.create.foundation.behaviour.simple; + +import java.util.function.Supplier; + +import com.simibubi.create.foundation.behaviour.base.IBehaviourType; +import com.simibubi.create.foundation.behaviour.base.SmartTileEntity; +import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; + +import net.minecraft.nbt.CompoundNBT; + +public class DeferralBehaviour extends TileEntityBehaviour { + + public static IBehaviourType TYPE = new IBehaviourType() { + }; + + private boolean needsUpdate; + private Supplier callback; + + public DeferralBehaviour(SmartTileEntity te, Supplier callback) { + super(te); + this.callback = callback; + } + + @Override + public void writeNBT(CompoundNBT nbt) { + nbt.putBoolean("NeedsUpdate", needsUpdate); + super.writeNBT(nbt); + } + + @Override + public void readNBT(CompoundNBT nbt) { + needsUpdate = nbt.getBoolean("NeedsUpdate"); + super.readNBT(nbt); + } + + @Override + public void tick() { + super.tick(); + if (needsUpdate && callback.get()) + needsUpdate = false; + } + + public void scheduleUpdate() { + needsUpdate = true; + } + + @Override + public IBehaviourType getType() { + return TYPE; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/world/OreFeature.java b/src/main/java/com/simibubi/create/foundation/world/OreFeature.java index a4ecaa7ed..74c06e339 100644 --- a/src/main/java/com/simibubi/create/foundation/world/OreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/world/OreFeature.java @@ -1,8 +1,5 @@ package com.simibubi.create.foundation.world; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; import java.util.Optional; import org.apache.commons.lang3.tuple.Pair; @@ -20,7 +17,6 @@ import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraft.world.gen.placement.IPlacementConfig; import net.minecraft.world.gen.placement.Placement; import net.minecraftforge.common.ForgeConfigSpec.Builder; -import net.minecraftforge.registries.ForgeRegistries; public abstract class OreFeature extends ConfigBase implements IFeature { @@ -32,7 +28,7 @@ public abstract class OreFeature extends ConfigBase protected ConfigInt maxHeight; private Block block; - private List biomeWhitelist; + private Biome.Category biomeWhitelist; public OreFeature(Block block, int clusterSize) { this.block = block; @@ -50,16 +46,8 @@ public abstract class OreFeature extends ConfigBase return this; } - public OreFeature inBiomes(Biome... biomes) { - biomeWhitelist = Arrays.asList(biomes); - return this; - } - public OreFeature inBiomes(Biome.Category category) { - biomeWhitelist = new LinkedList<>(); - for (Biome biome : ForgeRegistries.BIOMES) - if (biome.getCategory() == category) - biomeWhitelist.add(biome); + biomeWhitelist = category; return this; } @@ -70,9 +58,9 @@ public abstract class OreFeature extends ConfigBase @Override public Optional> createFeature(Biome biome) { - if (biomeWhitelist != null && !biomeWhitelist.contains(biome)) + if (biomeWhitelist != null && biome.getCategory() == biomeWhitelist) return Optional.empty(); - if (!canGenerate()) + if (!canGenerate()) return Optional.empty(); Pair, T> placement = getPlacement(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java index 9d9b85679..5b550da65 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.contraptions; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; @@ -16,31 +17,42 @@ public class KineticNetwork { private float currentStress; private float unloadedCapacity; private float unloadedStress; + private int unloadedMembers; public KineticNetwork() { sources = new HashMap<>(); members = new HashMap<>(); } - public void initFromTE(float maxStress, float currentStress) { + public void initFromTE(float maxStress, float currentStress, int members) { unloadedCapacity = maxStress; unloadedStress = currentStress; + unloadedMembers = members; initialized = true; updateStress(); updateCapacity(); } - public void addSilently(KineticTileEntity te) { + public void addSilently(KineticTileEntity te, float lastCapacity, float lastStress) { 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); } + float stressApplied = te.getStressApplied(); unloadedStress -= stressApplied * getStressMultiplierForSpeed(te.getTheoreticalSpeed()); + if (unloadedStress < 0) + unloadedStress = 0; members.put(te, stressApplied); + + unloadedMembers--; + if (unloadedMembers < 0) + unloadedMembers = 0; } public void add(KineticTileEntity te) { @@ -112,22 +124,46 @@ public class KineticNetwork { public float calculateCapacity() { float presentCapacity = 0; - for (KineticTileEntity te : sources.keySet()) - presentCapacity += sources.get(te) * getStressMultiplierForSpeed(te.getGeneratedSpeed()); + for (Iterator iterator = sources.keySet().iterator(); iterator.hasNext();) { + KineticTileEntity te = iterator.next(); + if (te.getWorld().getTileEntity(te.getPos()) != te) { + iterator.remove(); + continue; + } + presentCapacity += getActualCapacityOf(te); + } float newMaxStress = presentCapacity + unloadedCapacity; return newMaxStress; } public float calculateStress() { float presentStress = 0; - for (KineticTileEntity te : members.keySet()) - presentStress += members.get(te) * getStressMultiplierForSpeed(te.getTheoreticalSpeed()); + for (Iterator iterator = members.keySet().iterator(); iterator.hasNext();) { + KineticTileEntity te = iterator.next(); + if (te.getWorld().getTileEntity(te.getPos()) != te) { + iterator.remove(); + continue; + } + presentStress += getActualStressOf(te); + } float newStress = presentStress + unloadedStress; return newStress; } - private float getStressMultiplierForSpeed(float speed) { + public float getActualCapacityOf(KineticTileEntity te) { + return sources.get(te) * getStressMultiplierForSpeed(te.getGeneratedSpeed()); + } + + public float getActualStressOf(KineticTileEntity te) { + return members.get(te) * getStressMultiplierForSpeed(te.getTheoreticalSpeed()); + } + + private static float getStressMultiplierForSpeed(float speed) { return Math.abs(speed); } + public int getSize() { + return unloadedMembers + members.size(); + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/TorquePropagator.java b/src/main/java/com/simibubi/create/modules/contraptions/TorquePropagator.java index 3e83ab772..54f61a940 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/TorquePropagator.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/TorquePropagator.java @@ -22,7 +22,7 @@ public class TorquePropagator { Create.logger.debug("Removed Kinetic Network Space for " + world.getDimension().getType().getRegistryName()); } - public KineticNetwork getNetworkFor(KineticTileEntity te) { + public KineticNetwork getOrCreateNetworkFor(KineticTileEntity te) { Long id = te.network; KineticNetwork network; Map map = networks.get(te.getWorld()); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java index 215172baa..6bea19b3f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java @@ -102,6 +102,7 @@ public abstract class KineticBlock extends Block implements IRotate { return; if (worldIn.isRemote()) return; + tileEntity.removeSource(); RotationPropagator.handleAdded(worldIn.getWorld(), pos, tileEntity); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index d34961dad..ae6cceebf 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -39,7 +39,10 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick protected boolean overStressed; private int flickerTally; + private int networkSize; private int validationCountdown; + private float lastStressApplied; + private float lastCapacityProvided; public KineticTileEntity(TileEntityType typeIn) { super(typeIn); @@ -48,14 +51,15 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick @Override public void initialize() { - super.initialize(); if (!hasNetwork()) return; KineticNetwork network = getOrCreateNetwork(); if (!network.initialized) - network.initFromTE(capacity, stress); - network.addSilently(this); + network.initFromTE(capacity, stress, networkSize); + network.addSilently(this, lastCapacityProvided, lastStressApplied); + + super.initialize(); } @Override @@ -166,9 +170,18 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick if (hasNetwork()) { CompoundNBT networkTag = new CompoundNBT(); - networkTag.putLong("Id", network); + networkTag.putLong("Id", this.network); networkTag.putFloat("Stress", stress); networkTag.putFloat("Capacity", capacity); + networkTag.putInt("Size", getOrCreateNetwork().getSize()); + + float stressApplied = getStressApplied(); + float addedStressCapacity = getAddedStressCapacity(); + if (stressApplied != 0) + networkTag.putFloat("AddedStress", stressApplied); + if (addedStressCapacity != 0) + networkTag.putFloat("AddedCapacity", addedStressCapacity); + compound.put("Network", networkTag); } @@ -184,6 +197,8 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick overStressed = false; stress = 0; capacity = 0; + lastStressApplied = 0; + lastCapacityProvided = 0; if (compound.contains("Source")) source = NBTUtil.readBlockPos(compound.getCompound("Source")); @@ -193,6 +208,9 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick network = networkTag.getLong("Id"); stress = networkTag.getFloat("Stress"); capacity = networkTag.getFloat("Capacity"); + networkSize = networkTag.getInt("Size"); + lastStressApplied = networkTag.getFloat("AddedStress"); + lastCapacityProvided = networkTag.getFloat("AddedCapacity"); overStressed = capacity < stress && StressImpact.isEnabled(); } @@ -275,7 +293,7 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick } public KineticNetwork getOrCreateNetwork() { - return Create.torquePropagator.getNetworkFor(this); + return Create.torquePropagator.getOrCreateNetworkFor(this); } public boolean hasNetwork() { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ChassisRangeDisplay.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ChassisRangeDisplay.java index cdc074ba5..964e1fd06 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ChassisRangeDisplay.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ChassisRangeDisplay.java @@ -1,58 +1,52 @@ package com.simibubi.create.modules.contraptions.components.contraptions; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import com.mojang.blaze3d.platform.GlStateManager; -import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllKeys; import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.modules.contraptions.components.contraptions.chassis.ChassisTileEntity; -import com.simibubi.create.modules.contraptions.components.contraptions.chassis.LinearChassisBlock; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.World; public class ChassisRangeDisplay { - private static final VoxelShape BLOCK_OUTLINE = Block.makeCuboidShape(-.5f, -.5f, -.5f, 16.5f, 16.5f, 16.5f); private static final int DISPLAY_TIME = 200; private static GroupEntry lastHoveredGroup = null; private static class Entry { - VoxelShape shape; + Set includedPositions; ChassisTileEntity te; int timer; public Entry(ChassisTileEntity te) { this.te = te; - this.shape = createSelection(te); + includedPositions = createSelection(te); timer = DISPLAY_TIME; } - protected VoxelShape createSelection(ChassisTileEntity chassis) { - List positions = chassis.getIncludedBlockPositions(null, true); - VoxelShape shape = VoxelShapes.empty(); - if (positions == null) - return shape; - for (BlockPos blockPos : positions) - shape = - VoxelShapes.or(shape, BLOCK_OUTLINE.withOffset(blockPos.getX(), blockPos.getY(), blockPos.getZ())); - return shape; + protected Set createSelection(ChassisTileEntity chassis) { + Set positions = new HashSet<>(); + List includedBlockPositions = chassis.getIncludedBlockPositions(null, true); + if (includedBlockPositions == null) + return Collections.emptySet(); + positions.addAll(includedBlockPositions); + return positions; } } @@ -66,21 +60,14 @@ public class ChassisRangeDisplay { } @Override - protected VoxelShape createSelection(ChassisTileEntity chassis) { - VoxelShape shape = VoxelShapes.empty(); + protected Set createSelection(ChassisTileEntity chassis) { + Set list = new HashSet<>(); includedTEs = te.collectChassisGroup(); if (includedTEs == null) - return shape; - - // outlining algo is not very scalable -> display only single chassis if group gets too large - if (LinearChassisBlock.isChassis(chassis.getBlockState()) && includedTEs.size() > 32) - includedTEs = Arrays.asList(chassis); - if (AllBlocks.ROTATION_CHASSIS.typeOf(chassis.getBlockState()) && includedTEs.size() > 8) - includedTEs = Arrays.asList(chassis); - + return list; for (ChassisTileEntity chassisTileEntity : includedTEs) - shape = VoxelShapes.or(shape, super.createSelection(chassisTileEntity)); - return shape; + list.addAll(super.createSelection(chassisTileEntity)); + return list; } } @@ -106,35 +93,40 @@ public class ChassisRangeDisplay { } } - if (hasWrench) { - RayTraceResult over = Minecraft.getInstance().objectMouseOver; - if (!(over instanceof BlockRayTraceResult)) + if (!hasWrench) + return; + + RayTraceResult over = Minecraft.getInstance().objectMouseOver; + if (!(over instanceof BlockRayTraceResult)) + return; + BlockRayTraceResult ray = (BlockRayTraceResult) over; + BlockPos pos = ray.getPos(); + TileEntity tileEntity = world.getTileEntity(pos); + if (tileEntity == null || tileEntity.isRemoved()) + return; + if (!(tileEntity instanceof ChassisTileEntity)) + return; + + boolean ctrl = AllKeys.ctrlDown(); + ChassisTileEntity chassisTileEntity = (ChassisTileEntity) tileEntity; + + if (ctrl) { + GroupEntry existingGroupForPos = getExistingGroupForPos(pos); + if (existingGroupForPos != null) { + for (ChassisTileEntity included : existingGroupForPos.includedTEs) + entries.remove(included.getPos()); + existingGroupForPos.timer = DISPLAY_TIME; return; - BlockRayTraceResult ray = (BlockRayTraceResult) over; - BlockPos pos = ray.getPos(); - TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity == null || tileEntity.isRemoved()) - return; - if (tileEntity instanceof ChassisTileEntity) { - ChassisTileEntity chassisTileEntity = (ChassisTileEntity) tileEntity; - if (AllKeys.ctrlDown()) { - GroupEntry existingGroupForPos = getExistingGroupForPos(pos); - if (existingGroupForPos != null) { - for (ChassisTileEntity included : existingGroupForPos.includedTEs) - entries.remove(included.getPos()); - existingGroupForPos.timer = DISPLAY_TIME; - return; - } - } - if (!entries.containsKey(pos) || AllKeys.ctrlDown()) - display(chassisTileEntity); - else { - deselect(); - if (!AllKeys.ctrlDown()) - entries.get(pos).timer = DISPLAY_TIME; - } } } + + if (!entries.containsKey(pos) || ctrl) + display(chassisTileEntity); + else { + deselect(); + if (!ctrl) + entries.get(pos).timer = DISPLAY_TIME; + } } private static void deselect() { @@ -184,23 +176,31 @@ public class ChassisRangeDisplay { GlStateManager.lineWidth(2); TessellatorHelper.prepareForDrawing(); GlStateManager.disableTexture(); + GlStateManager.enableAlphaTest(); - for (Entry entry : entries.values()) { - float timer = entry.timer - partialTicks; - float alpha = timer > 20 ? 1 : timer / 20f; - WorldRenderer.drawShape(entry.shape, 0, 0, 0, 1, .7f, 0, alpha); - } - for (Entry entry : groupEntries) { - float timer = entry.timer - partialTicks; - float alpha = timer > 20 ? 1 : timer / 20f; - WorldRenderer.drawShape(entry.shape, 0, 0, 0, 1, .7f, 0, alpha); - } + for (Entry entry : entries.values()) + renderPositions(entry, partialTicks); + for (Entry groupEntry : groupEntries) + renderPositions(groupEntry, partialTicks); GlStateManager.enableTexture(); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); TessellatorHelper.cleanUpAfterDrawing(); GlStateManager.lineWidth(1); } + public static void renderPositions(Entry entry, float partialTicks) { + TessellatorHelper.begin(); + BlockPos size = new BlockPos(1, 1, 1); + float timer = entry.timer - partialTicks; + float alpha = timer > 20 ? .5f : timer / 40f; + GlStateManager.color4f(1, .7f, 0, alpha); + Set includedPositions = entry.includedPositions; + for (BlockPos pos : includedPositions) + TessellatorHelper.cube(Tessellator.getInstance().getBuffer(), pos, size, 1 / 1024f, true, false); + TessellatorHelper.draw(); + } + private static GroupEntry getExistingGroupForPos(BlockPos pos) { for (GroupEntry groupEntry : groupEntries) for (ChassisTileEntity chassis : groupEntry.includedTEs) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelBlock.java index 41f7c4557..33218cfc3 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelBlock.java @@ -77,7 +77,8 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock { controllerShouldExist = true; KineticTileEntity te = (KineticTileEntity) world.getTileEntity(pos); KineticTileEntity otherTe = (KineticTileEntity) world.getTileEntity(otherWheelPos); - if (te != null && otherTe != null && -te.getSpeed() == otherTe.getSpeed() && te.getSpeed() != 0) { + if (te != null && otherTe != null && (te.getSpeed() > 0) != (otherTe.getSpeed() > 0) + && te.getSpeed() != 0) { float signum = Math.signum(te.getSpeed()) * (state.get(AXIS) == Axis.X ? -1 : 1); controllerShouldBeValid = facing.getAxisDirection().getOffset() != signum; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerBlock.java index 41b396317..e5543980d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerBlock.java @@ -28,6 +28,7 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.Difficulty; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; @@ -88,7 +89,10 @@ public class CrushingWheelControllerBlock extends Block implements IHaveNoBlockI ((ItemEntity) entityIn).setPickupDelay(10); if (te.isOccupied()) return; - if ((entityIn instanceof PlayerEntity) && ((PlayerEntity) entityIn).isCreative()) + boolean isPlayer = entityIn instanceof PlayerEntity; + if (isPlayer && ((PlayerEntity) entityIn).isCreative()) + return; + if (isPlayer && entityIn.world.getDifficulty() == Difficulty.PEACEFUL) return; te.startCrushing(entityIn); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntity.java index b873da005..c580f4f88 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntity.java @@ -58,7 +58,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { }; minIngredients = new ScrollValueBehaviour(Lang.translate("mechanical_mixer.min_ingredients"), this, slot); minIngredients.between(1, 9); - minIngredients.withCallback(i -> checkBasin = true); + minIngredients.withCallback(i -> basinChecker.scheduleUpdate()); minIngredients.requiresWrench(); behaviours.add(minIngredients); } @@ -217,7 +217,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { @Override public void startProcessingBasin() { - if (running) + if (running && runningTicks <= 20) return; super.startProcessingBasin(); running = true; @@ -244,4 +244,9 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { return shapelessOrMixingRecipesKey; } + @Override + protected boolean isRunning() { + return running; + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntity.java index fd3c75b67..e7e48ee0f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntity.java @@ -190,8 +190,10 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { } if (!world.isRemote) { - world.playSound(null, getPos(), AllSoundEvents.MECHANICAL_PRESS_ITEM_BREAK.get(), SoundCategory.BLOCKS, .5f, 1f); - world.playSound(null, getPos(), AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.get(), SoundCategory.BLOCKS, .125f, 1f); + world.playSound(null, getPos(), AllSoundEvents.MECHANICAL_PRESS_ITEM_BREAK.get(), SoundCategory.BLOCKS, + .5f, 1f); + world.playSound(null, getPos(), AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.get(), SoundCategory.BLOCKS, + .125f, 1f); } } @@ -257,8 +259,8 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { public Optional getRecipe(ItemStack item) { pressingInv.setInventorySlotContents(0, item); - Optional recipe = world.getRecipeManager().getRecipe(AllRecipes.PRESSING.getType(), pressingInv, - world); + Optional recipe = + world.getRecipeManager().getRecipe(AllRecipes.PRESSING.getType(), pressingInv, world); return recipe; } @@ -305,7 +307,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { @Override public void startProcessingBasin() { - if (running) + if (running && runningTicks <= 30) return; super.startProcessingBasin(); start(Mode.BASIN); @@ -320,4 +322,9 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { sendData(); } + @Override + protected boolean isRunning() { + return running; + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelTileEntity.java index ffe000e97..30f01ccc5 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelTileEntity.java @@ -39,7 +39,6 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity { @Override public CompoundNBT write(CompoundNBT compound) { - CompoundNBT flows = new CompoundNBT(); for (Direction d : Direction.values()) flows.putFloat(d.getName(), this.flows.get(d)); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java index 3e7307b7c..e27841081 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; +import com.simibubi.create.foundation.behaviour.simple.DeferralBehaviour; import com.simibubi.create.foundation.utility.recipe.RecipeFinder; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.processing.BasinTileEntity.BasinInventory; @@ -16,6 +18,7 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -24,7 +27,7 @@ import net.minecraftforge.items.ItemHandlerHelper; public abstract class BasinOperatingTileEntity extends KineticTileEntity { - public boolean checkBasin; + public DeferralBehaviour basinChecker; public boolean basinRemoved; protected IRecipe lastRecipe; protected LazyOptional basinInv = LazyOptional.empty(); @@ -32,7 +35,13 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { public BasinOperatingTileEntity(TileEntityType typeIn) { super(typeIn); - checkBasin = true; + } + + @Override + public void addBehaviours(List behaviours) { + super.addBehaviours(behaviours); + basinChecker = new DeferralBehaviour(this, this::updateBasin); + behaviours.add(basinChecker); } @Override @@ -40,7 +49,7 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { super.onSpeedChanged(prevSpeed); if (getSpeed() == 0) basinRemoved = true; - checkBasin = true; + basinChecker.scheduleUpdate(); } public void gatherInputs() { @@ -57,8 +66,6 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { @Override public void tick() { - super.tick(); - if (basinRemoved) { basinRemoved = false; basinRemoved(); @@ -66,40 +73,41 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { return; } + super.tick(); + } + + protected boolean updateBasin() { if (!isSpeedRequirementFulfilled()) - return; + return true; if (getSpeed() == 0) - return; - if (!isCheckingBasin()) - return; - if (!checkBasin) - return; - checkBasin = false; + return true; + if (isRunning()) + return false; + TileEntity basinTE = world.getTileEntity(pos.down(2)); if (basinTE == null || !(basinTE instanceof BasinTileEntity)) - return; + return true; if (!basinInv.isPresent()) basinInv = basinTE.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); if (!basinInv.isPresent()) - return; + return true; if (world.isRemote) - return; + return true; gatherInputs(); List> recipes = getMatchingRecipes(); if (recipes.isEmpty()) - return; + return true; lastRecipe = recipes.get(0); startProcessingBasin(); sendData(); - } - - protected boolean isCheckingBasin() { return true; } + protected abstract boolean isRunning(); + public void startProcessingBasin() { } @@ -122,7 +130,9 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { List catalysts = new ArrayList<>(); int buckets = 0; - Ingredients: for (Ingredient ingredient : lastRecipe.getIngredients()) { + NonNullList ingredients = lastRecipe.getIngredients(); + Ingredients: for (int i = 0; i < ingredients.size(); i++) { + Ingredient ingredient = ingredients.get(i); for (int slot = 0; slot < inputs.getSlots(); slot++) { if (!ingredient.test(inputs.extractItem(slot, 1, true))) continue; @@ -131,8 +141,7 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { buckets++; if ((lastRecipe instanceof ProcessingRecipe)) { - ProcessingRecipe pr = (ProcessingRecipe) lastRecipe; - if (pr.getRollableIngredients().get(slot).remains()) + if (((ProcessingRecipe) lastRecipe).getRollableIngredients().get(i).remains()) catalysts.add(extracted.copy()); } continue Ingredients; @@ -152,6 +161,10 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { continueWithPreviousRecipe(); sendData(); } + + TileEntity basinTE = world.getTileEntity(pos.down(2)); + if (basinTE instanceof BasinTileEntity) + ((BasinTileEntity) basinTE).contentsChanged = false; } protected List> getMatchingRecipes() { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntity.java index 3936d6f3d..217caedea 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntity.java @@ -19,7 +19,7 @@ import net.minecraftforge.items.wrapper.RecipeWrapper; public class BasinTileEntity extends SyncedTileEntity implements ITickableTileEntity { - protected boolean updateProcessing; + public boolean contentsChanged; protected ItemStackHandler outputInventory = new ItemStackHandler(9) { protected void onContentsChanged(int slot) { @@ -36,7 +36,7 @@ public class BasinTileEntity extends SyncedTileEntity implements ITickableTileEn protected ItemStackHandler inputInventory = new ItemStackHandler(9) { protected void onContentsChanged(int slot) { - updateProcessing = true; + contentsChanged = true; sendData(); markDirty(); }; @@ -91,7 +91,7 @@ public class BasinTileEntity extends SyncedTileEntity implements ITickableTileEn public BasinTileEntity() { super(AllTileEntities.BASIN.type); - updateProcessing = true; + contentsChanged = true; recipeInventory = new BasinInputInventory(); } @@ -134,15 +134,15 @@ public class BasinTileEntity extends SyncedTileEntity implements ITickableTileEn @Override public void tick() { - if (!updateProcessing) + if (!contentsChanged) return; - updateProcessing = false; + contentsChanged = false; TileEntity te = world.getTileEntity(pos.up(2)); if (te == null) return; if (te instanceof BasinOperatingTileEntity) - ((BasinOperatingTileEntity) te).checkBasin = true; + ((BasinOperatingTileEntity) te).basinChecker.scheduleUpdate(); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java index b66cba448..a1dbe7134 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java @@ -30,7 +30,11 @@ public class LatchBlock extends ToggleLatchBlock { boolean back = state.get(POWERED); boolean shouldBack = this.shouldBePowered(worldIn, pos, state); boolean side = state.get(POWERED_SIDE); - boolean shouldSide = getPowerOnSides(worldIn, pos, state) > 0; + + Direction direction = state.get(HORIZONTAL_FACING); + Direction left = direction.rotateY(); + Direction right = direction.rotateYCCW(); + boolean shouldSide = worldIn.isBlockPowered(pos.offset(left)) || worldIn.isBlockPowered(pos.offset(right)); TickPriority tickpriority = TickPriority.HIGH; if (this.isFacingTowardsRepeater(worldIn, pos, state)) @@ -49,7 +53,11 @@ public class LatchBlock extends ToggleLatchBlock { boolean back = state.get(POWERED); boolean shouldBack = this.shouldBePowered(worldIn, pos, state); boolean side = state.get(POWERED_SIDE); - boolean shouldSide = getPowerOnSides(worldIn, pos, state) > 0; + + Direction direction = state.get(HORIZONTAL_FACING); + Direction left = direction.rotateY(); + Direction right = direction.rotateYCCW(); + boolean shouldSide = worldIn.isBlockPowered(pos.offset(left)) || worldIn.isBlockPowered(pos.offset(right)); BlockState stateIn = state; if (back != shouldBack) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java index c6c1be96c..690dbabef 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java @@ -84,6 +84,7 @@ public class FlexcrateBlock extends ProperDirectionalBlock { other.inventory.setStackInSlot(slot, ItemStack.EMPTY); } te.allowedAmount = other.allowedAmount; + other.invHandler.invalidate(); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index bd61ebbdd..7119bac61 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -4,7 +4,7 @@ loaderVersion="[28,)" [[mods]] modId="create" -version="0.2" +version="mc1.14-0.2.1" displayName="Create" #updateJSONURL="" authors="simibubi" @@ -14,7 +14,7 @@ Technology that empowers the player.''' [[dependencies.create]] modId="forge" mandatory=true - versionRange="[28.1.0,)" + versionRange="[28.1.20,)" ordering="NONE" side="BOTH" diff --git a/wiki/Rotational Force in Create.txt b/wiki/Rotational Force in Create.txt deleted file mode 100644 index 1fafb47df..000000000 --- a/wiki/Rotational Force in Create.txt +++ /dev/null @@ -1,52 +0,0 @@ -Some of the most prominent machines and components require **Rotational Force** to operate. Sometimes the provided rotation speed and direction reflects their behaviour, and some components may have a more significant _cost_ than others. - -1. Generate & Convey -2. Changing Gear -3. Stress & Capacity - -## Generate & Convey -Using appropiate generators(link), you can start setting things in motion. These kinetic components will apply the speed they generate at to attached shafts, cogs, etc. Any component can be connected to any other, so long as their integrated shafts/cogs are linked together. - -(waterwheel powering something) (mechanical crafters powering each other) - -**Multiple generators** can be connected together in order achieve a greater Capacity score for the attached kinetic network. When attaching new generators to running components, it is important that the added generator rotates in the **same direction** as the component it is attached to. When connecting two kinetic blocks with **incompatible direction** of rotation, you'll notice that the blocks just break. However, trouble-shooting this will be quite straight-forward - all you need to do is to include a means of reversing the rotation between the generator and the rest: - -Relaying rotational power between two components is one of the most important tasks when creating with Create. There are a variety of options and multiple possible solutions for each situation. These are the components that allow you to move, spread and modify rotational behaviour most effectively: - -(mesh of these components showing off their behaviour) - -- **Shafts**, cheapest option for relaying in a straight line. -- **Cogwheels**, move sideways while keeping the same rotation axis; reverse the direction -- **Belts**, move sideways while while keeping the same rotation axis; cannot be vertical; do not reverse direction -- **Gearboxes**, relay between two different rotation axes in a compact fashion; reverse connections on the same axis -- **Encased Belts**, relay sideways and between different rotation axes; do not reverse direction - -Best is play around with each component and familiarizing yourself with its abilities. It is important to know the options when having to deal with complex connection tasks in a potentially less forgiving environment. - -## Changing Gear - -Some kinetic blocks have the ability to **speed up** or **slow down** connected components. Attach a large to a regular cogwheel diagonally: powering one of them at their shaft will result in the other rotating twice or half the speed respectively. -With this and other more compact blocks, you will have full control over the speed provided to your contraptions. This is especially important for machines that require a **minimum level of speed** to operate (e.g. the Mechanical Mixer). -Connecting faster components to other slower components **directly** will cause the faster network to overpower the rest, alinging the speed of everything that is now part of it. (That is, if the direction lines up) - -(image of something ridiculous) - -With this mechanic you can take things to the extreme and either rotate machines at the configurated maximum speed (256rpm by default) or slow them down to a fraction. But you may notice that speeding up brings a cost with it... - -## Stress & Capacity - -_In Create 0.2+, a bit of balance had been brought to rotational power: something to resemble torque in a highly simplified fashion._ - -Rotational generators have limited capacity for what they power. "Stress Impact" and "Stress Capacity" are the two opposing values in a kinetic network: **generators add capacity, machines and components add impact**. If the capacity is exhausted, all connected parts will simply stop moving, until capacity is increased or stress is relieved again. -**Stress Impact is tied to rotation speed**. Increasing the speed increases a components stress impact or capacity proportionally. - -(image of fans and water wheel) - -Consider the following example: -Assume one Water Wheel can provide just enough power in order to power four fans at the same speed. -* Doubling the speed of the fans using cogwheels will make the fans blow stronger, but the network will cease to function until the count of fans is halved, or the count of water wheels is doubled. -* Similarly, you would be able to power eight fans running at half the speed of the water wheel. - -By default, components used **only for relaying** rotational power, such as shafts and cogwheels, have **no stress impact** at all. This makes predicting the amount of generators required for your contraptions much simpler and prevents punishment for aesthetic detours between machines and generators. - -Optimizing stress impact and comparing net capacity of sources at base speed can become quite scientific. For those who are interested in seeing some actual numbers and more exhaustive information, it is recommended to look into crafting a pair of Goggles and a Stress Gauge. \ No newline at end of file From 9497c1c1d4f1d9afc08a709cc720be4385e5a68c Mon Sep 17 00:00:00 2001 From: Zelophed Date: Sat, 21 Mar 2020 19:49:46 +0100 Subject: [PATCH 2/3] added some tags and changed a couple tooltips - added limestone, weathered limestone, gabbro, dolomite and scoria (as well as their polished variants) to #forge:stone - added #forge:storage_blocks/copper to #forge:storage_blocks - added copper block to #forge:storage_blocks/copper - added config value for the furnace generators speed - added the generation speed of water wheel, encased fan and furnace generator to their tooltips - goggles now show the power of a analog lever when worn --- .../com/simibubi/create/config/CKinetics.java | 2 + .../foundation/item/ItemDescription.java | 58 ++++++++++++------- .../redstone/AnalogLeverTileEntity.java | 3 + .../gauge/GaugeInformationRenderer.java | 14 +++-- .../resources/assets/create/lang/en_us.json | 5 +- .../data/forge/tags/blocks/stone.json | 16 +++++ .../forge/tags/blocks/storage_blocks.json | 6 ++ .../tags/blocks/storage_blocks/copper.json | 6 ++ .../data/forge/tags/items/stone.json | 16 +++++ .../data/forge/tags/items/storage_blocks.json | 6 ++ .../tags/items/storage_blocks/copper.json | 6 ++ 11 files changed, 111 insertions(+), 27 deletions(-) create mode 100644 src/main/resources/data/forge/tags/blocks/stone.json create mode 100644 src/main/resources/data/forge/tags/blocks/storage_blocks.json create mode 100644 src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json create mode 100644 src/main/resources/data/forge/tags/items/stone.json create mode 100644 src/main/resources/data/forge/tags/items/storage_blocks.json create mode 100644 src/main/resources/data/forge/tags/items/storage_blocks/copper.json diff --git a/src/main/java/com/simibubi/create/config/CKinetics.java b/src/main/java/com/simibubi/create/config/CKinetics.java index 073eb5991..1a8b992b2 100644 --- a/src/main/java/com/simibubi/create/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/config/CKinetics.java @@ -7,6 +7,7 @@ public class CKinetics extends ConfigBase { public ConfigInt crushingDamage = i(4, 0, "crushingDamage", Comments.crushingDamage); public ConfigInt maxMotorSpeed = i(256, 64, "maxMotorSpeed", Comments.rpm, Comments.maxMotorSpeed); public ConfigInt waterWheelSpeed = i(5, 1, "waterWheelSpeed", Comments.rpm, Comments.waterWheelSpeed); + public ConfigInt furnaceEngineSpeed = i(16, 1, "furnaceEngineSpeed", Comments.rpm, Comments.furnaceEngineSpeed); public ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed); public ConfigEnum ignoreDeployerAttacks = e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks); @@ -69,6 +70,7 @@ public class CKinetics extends ConfigBase { static String stress = "Fine tune the kinetic stats of individual components"; static String ignoreDeployerAttacks = "Select what mobs should ignore Deployers when attacked by them."; static String waterWheelSpeed = "Rotation speed gained by a water wheel for each side with running water. (halved if not against blades)"; + static String furnaceEngineSpeed = "Base rotation speed for the furnace engine generator"; static String disableStress = "Disable the Stress mechanic altogether."; static String kineticValidationFrequency = "Game ticks between Kinetic Blocks checking whether their source is still valid."; } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index f58337de5..63d47a7dc 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -1,26 +1,5 @@ package com.simibubi.create.foundation.item; -import static com.simibubi.create.foundation.item.TooltipHelper.cutString; -import static net.minecraft.util.text.TextFormatting.AQUA; -import static net.minecraft.util.text.TextFormatting.BLUE; -import static net.minecraft.util.text.TextFormatting.DARK_GRAY; -import static net.minecraft.util.text.TextFormatting.DARK_GREEN; -import static net.minecraft.util.text.TextFormatting.DARK_PURPLE; -import static net.minecraft.util.text.TextFormatting.DARK_RED; -import static net.minecraft.util.text.TextFormatting.GOLD; -import static net.minecraft.util.text.TextFormatting.GRAY; -import static net.minecraft.util.text.TextFormatting.GREEN; -import static net.minecraft.util.text.TextFormatting.LIGHT_PURPLE; -import static net.minecraft.util.text.TextFormatting.RED; -import static net.minecraft.util.text.TextFormatting.STRIKETHROUGH; -import static net.minecraft.util.text.TextFormatting.WHITE; -import static net.minecraft.util.text.TextFormatting.YELLOW; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - import com.simibubi.create.AllItems; import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.CKinetics; @@ -28,8 +7,10 @@ import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact; +import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock; import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; - +import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock; +import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -40,6 +21,14 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static com.simibubi.create.foundation.item.TooltipHelper.cutString; +import static net.minecraft.util.text.TextFormatting.*; + public class ItemDescription { public static final ItemDescription MISSING = new ItemDescription(null); @@ -144,6 +133,12 @@ public class ItemDescription { add(linesOnShift, GRAY + Lang.translate("tooltip.capacityProvided")); add(linesOnShift, level); + + String genSpeed = generatorSpeed(block, rpmUnit); + if (!genSpeed.equals("")){ + add(linesOnShift, ""); + add(linesOnShift, GREEN + genSpeed); + } } if (hasSpeedRequirement || hasStressImpact || hasStressCapacity) @@ -269,4 +264,23 @@ public class ItemDescription { return linesOnShift; } + private String generatorSpeed(Block block, String unitRPM){ + String value = ""; + + if (block instanceof WaterWheelBlock) { + int baseSpeed = AllConfigs.SERVER.kinetics.waterWheelSpeed.get(); + value = baseSpeed + "-" + (baseSpeed * 3); + } + + else if (block instanceof EncasedFanBlock) + value = AllConfigs.SERVER.kinetics.generatingFanSpeed.get().toString(); + + else if (block instanceof FurnaceEngineBlock) { + int baseSpeed = AllConfigs.SERVER.kinetics.furnaceEngineSpeed.get(); + value = baseSpeed + "-" + (baseSpeed * 2); + } + + return !value.equals("") ? Lang.translate("tooltip.generationSpeed", value, unitRPM) : ""; + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java index f4b3790c2..63b0bd5c2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java @@ -69,4 +69,7 @@ public class AnalogLeverTileEntity extends SmartTileEntity { sendData(); } + public int getState() { + return state; + } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java index aeaa8c39d..3bbaf5bb5 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java @@ -20,6 +20,7 @@ import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; +import com.simibubi.create.modules.contraptions.redstone.AnalogLeverTileEntity; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -42,6 +43,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; public class GaugeInformationRenderer { private static DecimalFormat decimalFormat = new DecimalFormat("#.##"); + private static String spacing = " "; @SubscribeEvent public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) { @@ -64,7 +66,7 @@ public class GaugeInformationRenderer { if (!AllItems.GOGGLES.typeOf(goggles) && !notFastEnough) return; - if (mc.player.isSneaking()) + if (mc.player.isSneaking() && !(te instanceof AnalogLeverTileEntity)) return; List tooltip = new ArrayList<>(); @@ -79,6 +81,8 @@ public class GaugeInformationRenderer { addGeneratorTooltip(state, tooltip, (GeneratingKineticTileEntity) te); if (te instanceof KineticTileEntity) addStressTooltip(state, tooltip, (KineticTileEntity) te); + if (te instanceof AnalogLeverTileEntity) + addLeverTooltip(state, tooltip, (AnalogLeverTileEntity) te); } if (tooltip.isEmpty()) @@ -117,7 +121,6 @@ public class GaugeInformationRenderer { } private static void addStressTooltip(BlockState state, List tooltip, KineticTileEntity te) { - String spacing = " "; float stressApplied = te.getStressApplied(); if (stressApplied == 0 || !StressImpact.isEnabled()) return; @@ -139,7 +142,6 @@ public class GaugeInformationRenderer { } private static void addGeneratorTooltip(BlockState state, List tooltip, GeneratingKineticTileEntity te) { - String spacing = " "; float addedStressCapacity = te.getAddedStressCapacity(); if (addedStressCapacity == 0 || !StressImpact.isEnabled()) return; @@ -182,7 +184,6 @@ public class GaugeInformationRenderer { String _atCurrentSpeed = Lang.translate("gui.goggles.at_current_speed"); String _baseValue = Lang.translate("gui.goggles.base_value"); - String spacing = " "; tooltip.add(spacing + _infoHeader); if (AllBlocks.STRESS_GAUGE.typeOf(state)) { @@ -261,6 +262,11 @@ public class GaugeInformationRenderer { } } + private static void addLeverTooltip(BlockState state, List tooltip, AnalogLeverTileEntity te) { + int leverState = te.getState(); + tooltip.add(spacing + Lang.translate("tooltip.analogStrength", leverState)); + } + private static String format(double d) { return decimalFormat.format(d); } diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index d3e4c9652..7a881dd14 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -310,7 +310,7 @@ "create.generic.unit.ticks": "Ticks", "create.generic.unit.seconds": "Seconds", "create.generic.unit.minutes": "Minutes", - "create.generic.unit.rpm": "rpm", + "create.generic.unit.rpm": "RPM", "create.generic.unit.stress": "su", "create.generic.unit.degrees": "°", @@ -607,6 +607,9 @@ "create.tooltip.capacityProvided.medium": "Medium", "create.tooltip.capacityProvided.high": "Large", "create.tooltip.capacityProvided.asGenerator": "(As Generator)", + "create.tooltip.generationSpeed" : "Generates at %1$s %2$s", + + "create.tooltip.analogStrength": "Analog Strength: %1$s/15", "create.tooltip.wip": "WIP", "create.tooltip.workInProgress": "Work in progress!", diff --git a/src/main/resources/data/forge/tags/blocks/stone.json b/src/main/resources/data/forge/tags/blocks/stone.json new file mode 100644 index 000000000..a891eebb6 --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/stone.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "create:limestone", + "create:polished_limestone", + "create:weathered_limestone", + "create:polished_weathered_limestone", + "create:gabbro", + "create:polished_gabbro", + "create:dolomite", + "create:polished_dolomite", + "create:scoria", + "create:polished_scoria" + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks.json b/src/main/resources/data/forge/tags/blocks/storage_blocks.json new file mode 100644 index 000000000..fe1a1db93 --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#forge:storage_blocks/copper" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json b/src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json new file mode 100644 index 000000000..0b5561d1f --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:copper_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/stone.json b/src/main/resources/data/forge/tags/items/stone.json new file mode 100644 index 000000000..a891eebb6 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/stone.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "create:limestone", + "create:polished_limestone", + "create:weathered_limestone", + "create:polished_weathered_limestone", + "create:gabbro", + "create:polished_gabbro", + "create:dolomite", + "create:polished_dolomite", + "create:scoria", + "create:polished_scoria" + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks.json b/src/main/resources/data/forge/tags/items/storage_blocks.json new file mode 100644 index 000000000..fe1a1db93 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#forge:storage_blocks/copper" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks/copper.json b/src/main/resources/data/forge/tags/items/storage_blocks/copper.json new file mode 100644 index 000000000..0b5561d1f --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks/copper.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:copper_block" + ] +} \ No newline at end of file From 8ecf51445a0605b8a14464af0e74dd3416a6ede6 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 22 Mar 2020 01:10:21 +0100 Subject: [PATCH 3/3] 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 --- src/main/java/com/simibubi/create/Create.java | 2 ++ .../com/simibubi/create/config/CWorldGen.java | 6 ++++++ .../create/foundation/item/ItemDescription.java | 7 +++---- .../foundation/world/AllWorldFeatures.java | 6 +++--- .../modules/contraptions/KineticNetwork.java | 16 ++++++++-------- .../modules/contraptions/base/KineticBlock.java | 1 - .../contraptions/base/KineticTileEntity.java | 13 ++++++------- .../components/actors/SawMovementBehaviour.java | 3 ++- .../components/motor/MotorTileEntity.java | 1 + 9 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 5fe815d27..5f2b2a1c1 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -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) { diff --git a/src/main/java/com/simibubi/create/config/CWorldGen.java b/src/main/java/com/simibubi/create/config/CWorldGen.java index 7464e6859..b945ba94c 100644 --- a/src/main/java/com/simibubi/create/config/CWorldGen.java +++ b/src/main/java/com/simibubi/create/config/CWorldGen.java @@ -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"; diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index 63d47a7dc..7422a3933 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -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) { diff --git a/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java b/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java index f278e19b4..382100e5d 100644 --- a/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java +++ b/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java @@ -44,13 +44,13 @@ public enum AllWorldFeatures { for (AllWorldFeatures entry : AllWorldFeatures.values()) { for (Biome biome : ForgeRegistries.BIOMES) { - if (entry.featureInstances.containsKey(biome)) + if (entry.featureInstances.containsKey(biome)) biome.getFeatures(entry.feature.getGenerationStage()).remove(entry.featureInstances.remove(biome)); Optional> createFeature = entry.feature.createFeature(biome); - if (!createFeature.isPresent()) + if (!createFeature.isPresent()) continue; - + entry.featureInstances.put(biome, createFeature.get()); biome.addFeature(entry.feature.getGenerationStage(), createFeature.get()); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java index 5b550da65..a0ae23f18 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java @@ -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) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java index 6bea19b3f..215172baa 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java @@ -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); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index ae6cceebf..688a16419 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -51,13 +51,12 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick @Override public void initialize() { - if (!hasNetwork()) - return; - - KineticNetwork network = getOrCreateNetwork(); - if (!network.initialized) - network.initFromTE(capacity, stress, networkSize); - network.addSilently(this, lastCapacityProvided, lastStressApplied); + if (hasNetwork()) { + KineticNetwork network = getOrCreateNetwork(); + if (!network.initialized) + network.initFromTE(capacity, stress, networkSize); + network.addSilently(this, lastCapacityProvided, lastStressApplied); + } super.initialize(); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/SawMovementBehaviour.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/SawMovementBehaviour.java index bd03396b3..00071f5ea 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/SawMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/SawMovementBehaviour.java @@ -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 diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorTileEntity.java index c342777c1..06ee179ee 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorTileEntity.java @@ -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);