Skip to content

Commit

Permalink
added some tags and changed a couple tooltips
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
zelophed committed Mar 21, 2020
1 parent b4cdcb9 commit 9497c1c
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 27 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/simibubi/create/config/CKinetics.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<DeployerAggroSetting> ignoreDeployerAttacks =
e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks);
Expand Down Expand Up @@ -69,6 +70,7 @@ private static class Comments {
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.";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
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;
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;
Expand All @@ -40,6 +21,14 @@
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);
Expand Down Expand Up @@ -144,6 +133,12 @@ public ItemDescription withKineticStats(Block block) {

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)
Expand Down Expand Up @@ -269,4 +264,23 @@ public List<ITextComponent> getLinesOnShift() {
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) : "";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@ public void changeState(boolean back) {
sendData();
}

public int getState() {
return state;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand All @@ -42,6 +43,7 @@
public class GaugeInformationRenderer {

private static DecimalFormat decimalFormat = new DecimalFormat("#.##");
private static String spacing = " ";

@SubscribeEvent
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
Expand All @@ -64,7 +66,7 @@ public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEv

if (!AllItems.GOGGLES.typeOf(goggles) && !notFastEnough)
return;
if (mc.player.isSneaking())
if (mc.player.isSneaking() && !(te instanceof AnalogLeverTileEntity))
return;

List<String> tooltip = new ArrayList<>();
Expand All @@ -79,6 +81,8 @@ public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEv
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())
Expand Down Expand Up @@ -117,7 +121,6 @@ private static void addSpeedRequirementMessage(BlockState state, List<String> to
}

private static void addStressTooltip(BlockState state, List<String> tooltip, KineticTileEntity te) {
String spacing = " ";
float stressApplied = te.getStressApplied();
if (stressApplied == 0 || !StressImpact.isEnabled())
return;
Expand All @@ -139,7 +142,6 @@ private static void addStressTooltip(BlockState state, List<String> tooltip, Kin
}

private static void addGeneratorTooltip(BlockState state, List<String> tooltip, GeneratingKineticTileEntity te) {
String spacing = " ";
float addedStressCapacity = te.getAddedStressCapacity();
if (addedStressCapacity == 0 || !StressImpact.isEnabled())
return;
Expand Down Expand Up @@ -182,7 +184,6 @@ private static void addGaugeTooltip(BlockState state, List<String> tooltip, Tile
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)) {
Expand Down Expand Up @@ -261,6 +262,11 @@ private static void addGaugeTooltip(BlockState state, List<String> tooltip, Tile
}
}

private static void addLeverTooltip(BlockState state, List<String> 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);
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/assets/create/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "°",

Expand Down Expand Up @@ -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!",
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/data/forge/tags/blocks/stone.json
Original file line number Diff line number Diff line change
@@ -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"

]
}
6 changes: 6 additions & 0 deletions src/main/resources/data/forge/tags/blocks/storage_blocks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#forge:storage_blocks/copper"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:copper_block"
]
}
16 changes: 16 additions & 0 deletions src/main/resources/data/forge/tags/items/stone.json
Original file line number Diff line number Diff line change
@@ -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"

]
}
6 changes: 6 additions & 0 deletions src/main/resources/data/forge/tags/items/storage_blocks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#forge:storage_blocks/copper"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:copper_block"
]
}

0 comments on commit 9497c1c

Please sign in to comment.