Miscellaneous fixes and improvements

- Fix ColorAttribute not showing color name
- Refactor some code related to SpeedLevel
- Improve goggles predicate API
- Make ToolboxInventory use Item#canFitInsideContainerItems
- Prevent toolbox items from being placed inside of shulker boxes
- Fix shadow steel always converting below y=0 instead of the min build
height
This commit is contained in:
PepperCode1 2022-03-29 21:49:23 -07:00
parent bf1b6382ee
commit c1ba7683a7
66 changed files with 240 additions and 204 deletions

View file

@ -11,7 +11,7 @@ body:
- type: textarea
attributes:
label: Reproduction Steps
description: Tell us about the steps to reproduce the bug
description: Tell us about the steps to reproduce the bug.
value: |
1.
2.
@ -28,13 +28,13 @@ body:
- type: textarea
attributes:
label: Screenshots and Videos
description: If applicable, add screenshots or videos to help explain your problem
description: If applicable, add screenshots or videos to help explain your problem.
validations:
required: false
- type: input
attributes:
label: Crash Report or Log
description: If applicable, please add a **link** to the crash report or log that was created when this issue occured. You can upload the crash report to a site like Pastebin or GitHub Gist. Please **do not** paste the whole crash report in this issue
description: If applicable, please add a **link** to the crash report or log that was created when this issue occured. You can upload the crash report to a site like Pastebin or GitHub Gist. Please **do not** paste the whole crash report in this issue.
validations:
required: false
- type: input
@ -121,7 +121,7 @@ body:
- type: textarea
attributes:
label: Other Mods
description: Please list any other mods that were running when the crash happened
description: Please list any other mods that were running when the crash happened.
validations:
required: false
- type: textarea
@ -132,4 +132,4 @@ body:
required: false
- type: markdown
attributes:
value: "Thank you for taking the time to make this bug report and to help improve Create"
value: "Thank you for taking the time to make this bug report and help improve Create!"

View file

@ -11,15 +11,15 @@ body:
- type: textarea
attributes:
label: Screenshots and Videos
description: If applicable, add screenshots or videos to help explain your suggestion
description: If applicable, add screenshots or videos to help explain your suggestion.
validations:
required: false
- type: textarea
attributes:
label: Additional Context
description: Add any extra context about the suggestion here
description: Add any extra context about the suggestion here.
validations:
required: false
- type: markdown
attributes:
value: "Thank you for taking the time to make this suggestion and to help improve Create"
value: "Thank you for taking the time to make this suggestion and help improve Create!"

View file

@ -531,21 +531,21 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
7880ce16e8b649e26d01cecee271648027f26651 assets/create/lang/en_ud.json
aca02d2ab91e288e65e07470a117ace325299130 assets/create/lang/en_us.json
64aa458040affc16c4412297cdb5ee13ad010660 assets/create/lang/unfinished/de_de.json
7f36bcf491d6890a563c8d03c281e300576f446d assets/create/lang/unfinished/es_cl.json
0c44dc2a7f3157c463a26900ec75b0278b372cc9 assets/create/lang/unfinished/es_es.json
ee7d298b7234ba25b373eb9d9f2a3ec52aeca233 assets/create/lang/unfinished/fr_fr.json
e642827b0c2530c490f6a4961cba9f6d91d3783c assets/create/lang/unfinished/it_it.json
e92011006f03ed066b51eb5d03011a982589ff37 assets/create/lang/unfinished/ja_jp.json
6441efd98496beff0dcfbd15fd1dd20f5e26eaaf assets/create/lang/unfinished/ko_kr.json
2313eaab1f7eabd4d6d481c139e3fe84ebb4a1eb assets/create/lang/unfinished/nl_nl.json
5a35cb79c97578730d20f766a59443afe484ad03 assets/create/lang/unfinished/pl_pl.json
1112631bcb7d1503dec6e605ef1c4828a1726551 assets/create/lang/unfinished/pt_br.json
36b1368644fb946a97044610932e2a11ddf508b3 assets/create/lang/unfinished/pt_pt.json
8ffe7f27cd6fce29116f9e0920c792376545aa2c assets/create/lang/unfinished/ru_ru.json
967dd607e8784ad7d8851c18f89e32661543a394 assets/create/lang/unfinished/zh_cn.json
5cd389eba3817fc4d5cbaa0ce15ccdb7fbe6c0bf assets/create/lang/unfinished/zh_tw.json
194fbc2c94d07a5fc1712c8b579973e92fafa5d8 assets/create/lang/en_us.json
a711143e849fdc488e43e8eb284248955bbf1ceb assets/create/lang/unfinished/de_de.json
f5218855767129457b3e10ae1d7c254b5af29f27 assets/create/lang/unfinished/es_cl.json
92882d65db2ee109a3e79d4156277f925f4a387c assets/create/lang/unfinished/es_es.json
02f3a6a3a281d59489cb0c02db249aaff7aaa433 assets/create/lang/unfinished/fr_fr.json
fd2eb2cc4987ae9ddadd6452fc853091b6a93982 assets/create/lang/unfinished/it_it.json
64d40f6fb9a873b8c107b82236f0b8fddc010c72 assets/create/lang/unfinished/ja_jp.json
7b680aca19dd1b015e72c1af91f388313eabcfac assets/create/lang/unfinished/ko_kr.json
bae90b8439e02d2f97f0eb65f2261e4e0d80aea5 assets/create/lang/unfinished/nl_nl.json
d640931ab5f23128910228880a4beccd45af3cce assets/create/lang/unfinished/pl_pl.json
f2ecb8fdd15cd042198d50e25b9dcafc9409423e assets/create/lang/unfinished/pt_br.json
0baffa79e99e78a81d9933c44aeefe6282e634ea assets/create/lang/unfinished/pt_pt.json
c77ae5ebbbd4ead7a641b9a2bf8b17073e73ecb9 assets/create/lang/unfinished/ru_ru.json
9acc0e92774c0e4b6207f08d3a85a81b1a7a0734 assets/create/lang/unfinished/zh_cn.json
60b348950274d79f267ae8e6283e5a23a6c65720 assets/create/lang/unfinished/zh_tw.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -1231,8 +1231,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Speed Requirement: %1$s",
"create.tooltip.speedRequirement.none": "None",
"create.tooltip.speedRequirement.slow": "Slow",
"create.tooltip.speedRequirement.medium": "Moderate",
"create.tooltip.speedRequirement.high": "Fast",
"create.tooltip.speedRequirement.fast": "Fast",
"create.tooltip.stressImpact": "Kinetic Stress Impact: %1$s",
"create.tooltip.stressImpact.low": "Low",
"create.tooltip.stressImpact.medium": "Moderate",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1324",
"_": "Missing Localizations: 1325",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Strg",
"create.tooltip.speedRequirement": "Geschwindigkeitsanforderung: %1$s",
"create.tooltip.speedRequirement.none": "Keine",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Moderat",
"create.tooltip.speedRequirement.high": "Schnell",
"create.tooltip.speedRequirement.fast": "Schnell",
"create.tooltip.stressImpact": "Kinetische Belastungsauswirkung: %1$s",
"create.tooltip.stressImpact.low": "Niedrig",
"create.tooltip.stressImpact.medium": "Moderat",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 335",
"_": "Missing Localizations: 336",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Requqrimiento de Velocidad: %1$s",
"create.tooltip.speedRequirement.none": "Ninguno",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Moderado",
"create.tooltip.speedRequirement.high": "Rápidp",
"create.tooltip.speedRequirement.fast": "Rápido",
"create.tooltip.stressImpact": "Impacto en el Estrés Cinético: %1$s",
"create.tooltip.stressImpact.low": "Bajo",
"create.tooltip.stressImpact.medium": "Moderado",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 6",
"_": "Missing Localizations: 7",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Requisitos de velocidad: %1$s",
"create.tooltip.speedRequirement.none": "Ninguno",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Moderado",
"create.tooltip.speedRequirement.high": "Rápido",
"create.tooltip.speedRequirement.fast": "Rápido",
"create.tooltip.stressImpact": "Impacto de estrés: %1$s",
"create.tooltip.stressImpact.low": "Bajo",
"create.tooltip.stressImpact.medium": "Moderado",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1586",
"_": "Missing Localizations: 1587",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Vitesse requise: %1$s",
"create.tooltip.speedRequirement.none": "Aucune",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Modérée",
"create.tooltip.speedRequirement.high": "Rapide",
"create.tooltip.speedRequirement.fast": "Rapide",
"create.tooltip.stressImpact": "Impact du stress: %1$s",
"create.tooltip.stressImpact.low": "Faible",
"create.tooltip.stressImpact.medium": "Modéré",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1275",
"_": "Missing Localizations: 1276",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Velocità richiesta: %1$s",
"create.tooltip.speedRequirement.none": "Nessuna",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Moderata",
"create.tooltip.speedRequirement.high": "Veloce",
"create.tooltip.speedRequirement.fast": "Veloce",
"create.tooltip.stressImpact": "Impatto sullo stress: %1$s",
"create.tooltip.stressImpact.low": "Basso",
"create.tooltip.stressImpact.medium": "Moderato",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1",
"_": "Missing Localizations: 2",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "必要な回転速度: %1$s",
"create.tooltip.speedRequirement.none": "無し",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "中速",
"create.tooltip.speedRequirement.high": "高速",
"create.tooltip.speedRequirement.fast": "高速",
"create.tooltip.stressImpact": "応力への影響: %1$s",
"create.tooltip.stressImpact.low": "低",
"create.tooltip.stressImpact.medium": "中",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1",
"_": "Missing Localizations: 2",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "요구 회전속도: %1$s",
"create.tooltip.speedRequirement.none": "없음",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "보통",
"create.tooltip.speedRequirement.high": "빠름",
"create.tooltip.speedRequirement.fast": "빠름",
"create.tooltip.stressImpact": "피로도 부하: %1$s",
"create.tooltip.stressImpact.low": "낮음",
"create.tooltip.stressImpact.medium": "보통",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1939",
"_": "Missing Localizations: 1940",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Snelheid eis: %1$s",
"create.tooltip.speedRequirement.none": "Geen",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Gemiddeld",
"create.tooltip.speedRequirement.high": "Snel",
"create.tooltip.speedRequirement.fast": "Snel",
"create.tooltip.stressImpact": "Stress Impact: %1$s",
"create.tooltip.stressImpact.low": "Laag",
"create.tooltip.stressImpact.medium": "Gemiddeld",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 374",
"_": "Missing Localizations: 375",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Wymagana prędkość: %1$s",
"create.tooltip.speedRequirement.none": "Brak",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Umiarkowana",
"create.tooltip.speedRequirement.high": "Wysoka",
"create.tooltip.speedRequirement.fast": "Wysoka",
"create.tooltip.stressImpact": "Wpływ na obciążenie: %1$s",
"create.tooltip.stressImpact.low": "Niski",
"create.tooltip.stressImpact.medium": "Umiarkowany",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1186",
"_": "Missing Localizations: 1187",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "UNLOCALIZED: Ctrl",
"create.tooltip.speedRequirement": "UNLOCALIZED: Speed Requirement: %1$s",
"create.tooltip.speedRequirement.none": "UNLOCALIZED: None",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "UNLOCALIZED: Moderate",
"create.tooltip.speedRequirement.high": "UNLOCALIZED: Fast",
"create.tooltip.speedRequirement.fast": "UNLOCALIZED: Fast",
"create.tooltip.stressImpact": "UNLOCALIZED: Kinetic Stress Impact: %1$s",
"create.tooltip.stressImpact.low": "UNLOCALIZED: Low",
"create.tooltip.stressImpact.medium": "UNLOCALIZED: Moderate",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1558",
"_": "Missing Localizations: 1559",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "UNLOCALIZED: Ctrl",
"create.tooltip.speedRequirement": "UNLOCALIZED: Speed Requirement: %1$s",
"create.tooltip.speedRequirement.none": "UNLOCALIZED: None",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "UNLOCALIZED: Moderate",
"create.tooltip.speedRequirement.high": "UNLOCALIZED: Fast",
"create.tooltip.speedRequirement.fast": "UNLOCALIZED: Fast",
"create.tooltip.stressImpact": "UNLOCALIZED: Kinetic Stress Impact: %1$s",
"create.tooltip.stressImpact.low": "UNLOCALIZED: Low",
"create.tooltip.stressImpact.medium": "UNLOCALIZED: Moderate",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 379",
"_": "Missing Localizations: 380",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "Требование к скорости: %1$s",
"create.tooltip.speedRequirement.none": "Нет",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "Умеренная",
"create.tooltip.speedRequirement.high": "Быстрая",
"create.tooltip.speedRequirement.fast": "Быстрая",
"create.tooltip.stressImpact": "Создаваемая нагрузка: %1$s",
"create.tooltip.stressImpact.low": "Низкая",
"create.tooltip.stressImpact.medium": "Средняя",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1",
"_": "Missing Localizations: 2",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "需求转速:%1$s",
"create.tooltip.speedRequirement.none": "无",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "适当",
"create.tooltip.speedRequirement.high": "快",
"create.tooltip.speedRequirement.fast": "快",
"create.tooltip.stressImpact": "应力影响:%1$s",
"create.tooltip.stressImpact.low": "低",
"create.tooltip.stressImpact.medium": "中",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 393",
"_": "Missing Localizations: 394",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1232,8 +1232,9 @@
"create.tooltip.keyCtrl": "Ctrl",
"create.tooltip.speedRequirement": "需求速度:%1$s",
"create.tooltip.speedRequirement.none": "無",
"create.tooltip.speedRequirement.slow": "UNLOCALIZED: Slow",
"create.tooltip.speedRequirement.medium": "適當",
"create.tooltip.speedRequirement.high": "快",
"create.tooltip.speedRequirement.fast": "快",
"create.tooltip.stressImpact": "動能消耗:%1$s",
"create.tooltip.stressImpact.low": "低",
"create.tooltip.stressImpact.medium": "中",

View file

@ -175,6 +175,7 @@ import com.simibubi.create.foundation.data.CreateRegistrate;
import com.simibubi.create.foundation.data.ModelGen;
import com.simibubi.create.foundation.data.SharedProperties;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.item.UncontainableBlockItem;
import com.simibubi.create.foundation.utility.ColorHandlers;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.DyeHelper;
@ -1503,7 +1504,7 @@ public class AllBlocks {
})
.onRegisterAfter(Item.class, v -> TooltipHelper.referTo(v, "block.create.toolbox"))
.tag(AllBlockTags.TOOLBOXES.tag)
.item()
.item(UncontainableBlockItem::new)
.model((c, p) -> p.withExistingParent(colourName + "_toolbox", p.modLoc("block/toolbox/item"))
.texture("0", p.modLoc("block/toolbox/" + colourName)))
.tag(AllItemTags.TOOLBOXES.tag)

View file

@ -2,7 +2,6 @@ package com.simibubi.create;
import com.simibubi.create.content.contraptions.components.actors.SeatEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntityRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntityRenderer;
@ -10,6 +9,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.gan
import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionEntityRenderer;
import com.simibubi.create.content.curiosities.tools.BlueprintEntity;
import com.simibubi.create.content.curiosities.tools.BlueprintRenderer;
import com.simibubi.create.content.curiosities.weapons.PotatoProjectileEntity;

View file

@ -19,32 +19,31 @@ import net.minecraft.world.level.block.state.BlockState;
public interface IRotate extends IWrenchable {
enum SpeedLevel {
NONE,
MEDIUM,
FAST;
NONE(ChatFormatting.DARK_GRAY, 0x000000, 0),
SLOW(ChatFormatting.GREEN, 0x22FF22, 10),
MEDIUM(ChatFormatting.AQUA, 0x0084FF, 20),
FAST(ChatFormatting.LIGHT_PURPLE, 0xFF55FF, 30);
private final ChatFormatting textColor;
private final int color;
private final int particleSpeed;
SpeedLevel(ChatFormatting textColor, int color, int particleSpeed) {
this.textColor = textColor;
this.color = color;
this.particleSpeed = particleSpeed;
}
public ChatFormatting getTextColor() {
return this == NONE ? ChatFormatting.GREEN
: this == MEDIUM ? ChatFormatting.AQUA : ChatFormatting.LIGHT_PURPLE;
return textColor;
}
public int getColor() {
return this == NONE ? 0x22FF22 : this == MEDIUM ? 0x0084FF : 0xFF55FF;
return color;
}
public int getParticleSpeed() {
return this == NONE ? 10 : this == MEDIUM ? 20 : 30;
}
public static SpeedLevel of(float speed) {
speed = Math.abs(speed);
if (speed >= AllConfigs.SERVER.kinetics.fastSpeed.get()) {
return FAST;
} else if (speed >= AllConfigs.SERVER.kinetics.mediumSpeed.get()) {
return MEDIUM;
}
return NONE;
return particleSpeed;
}
public float getSpeedValue() {
@ -53,22 +52,31 @@ public interface IRotate extends IWrenchable {
return AllConfigs.SERVER.kinetics.fastSpeed.get().floatValue();
case MEDIUM:
return AllConfigs.SERVER.kinetics.mediumSpeed.get().floatValue();
case SLOW:
return 1;
case NONE:
default:
return 0;
}
}
public static Component getFormattedSpeedText(float speed, boolean overstressed){
public static SpeedLevel of(float speed) {
speed = Math.abs(speed);
if (speed >= AllConfigs.SERVER.kinetics.fastSpeed.get())
return FAST;
if (speed >= AllConfigs.SERVER.kinetics.mediumSpeed.get())
return MEDIUM;
if (speed >= 1)
return SLOW;
return NONE;
}
public static Component getFormattedSpeedText(float speed, boolean overstressed) {
SpeedLevel speedLevel = of(speed);
MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, speedLevel.ordinal()));
if (speedLevel == SpeedLevel.MEDIUM)
level.append(Lang.translate("tooltip.speedRequirement.medium"));
if (speedLevel == SpeedLevel.FAST)
level.append(Lang.translate("tooltip.speedRequirement.high"));
level.append(Lang.translate("tooltip.speedRequirement." + Lang.asId(speedLevel.name())));
level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") ");
if (overstressed)
@ -82,40 +90,49 @@ public interface IRotate extends IWrenchable {
}
enum StressImpact {
LOW,
MEDIUM,
HIGH,
OVERSTRESSED;
LOW(ChatFormatting.YELLOW, ChatFormatting.GREEN),
MEDIUM(ChatFormatting.GOLD, ChatFormatting.YELLOW),
HIGH(ChatFormatting.RED, ChatFormatting.GOLD),
OVERSTRESSED(ChatFormatting.RED, ChatFormatting.RED);
private final ChatFormatting absoluteColor;
private final ChatFormatting relativeColor;
StressImpact(ChatFormatting absoluteColor, ChatFormatting relativeColor) {
this.absoluteColor = absoluteColor;
this.relativeColor = relativeColor;
}
public ChatFormatting getAbsoluteColor() {
return this == LOW ? ChatFormatting.YELLOW : this == MEDIUM ? ChatFormatting.GOLD : ChatFormatting.RED;
return absoluteColor;
}
public ChatFormatting getRelativeColor() {
return this == LOW ? ChatFormatting.GREEN : this == MEDIUM ? ChatFormatting.YELLOW : this == HIGH ? ChatFormatting.GOLD : ChatFormatting.RED;
return relativeColor;
}
public static StressImpact of(double stressPercent){
if (stressPercent > 1) return StressImpact.OVERSTRESSED;
else if (stressPercent > .75d) return StressImpact.HIGH;
else if (stressPercent > .5d) return StressImpact.MEDIUM;
else return StressImpact.LOW;
public static StressImpact of(double stressPercent) {
if (stressPercent > 1)
return StressImpact.OVERSTRESSED;
if (stressPercent > .75d)
return StressImpact.HIGH;
if (stressPercent > .5d)
return StressImpact.MEDIUM;
return StressImpact.LOW;
}
public static boolean isEnabled() {
return !AllConfigs.SERVER.kinetics.disableStress.get();
}
public static Component getFormattedStressText(double stressPercent){
public static Component getFormattedStressText(double stressPercent) {
StressImpact stressLevel = of(stressPercent);
ChatFormatting color = stressLevel.getRelativeColor();
MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, Math.min(stressLevel.ordinal(), 2)));
MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, Math.min(stressLevel.ordinal() + 1, 3)));
level.append(Lang.translate("tooltip.stressImpact." + Lang.asId(stressLevel.name())));
level.append(String.format(" (%s%%) ", (int) (stressPercent * 100)));
return level.withStyle(color);
return level.withStyle(stressLevel.getRelativeColor());
}
}
@ -124,7 +141,7 @@ public interface IRotate extends IWrenchable {
public Axis getRotationAxis(BlockState state);
public default SpeedLevel getMinimumRequiredSpeedLevel() {
return SpeedLevel.NONE;
return SpeedLevel.SLOW;
}
public default boolean hideStressImpact() {

View file

@ -357,13 +357,7 @@ public class KineticTileEntity extends SmartTileEntity
return true;
IRotate def = (IRotate) state.getBlock();
SpeedLevel minimumRequiredSpeedLevel = def.getMinimumRequiredSpeedLevel();
if (minimumRequiredSpeedLevel == null)
return true;
if (minimumRequiredSpeedLevel == SpeedLevel.MEDIUM)
return Math.abs(getSpeed()) >= AllConfigs.SERVER.kinetics.mediumSpeed.get();
if (minimumRequiredSpeedLevel == SpeedLevel.FAST)
return Math.abs(getSpeed()) >= AllConfigs.SERVER.kinetics.fastSpeed.get();
return true;
return Math.abs(getSpeed()) >= minimumRequiredSpeedLevel.getSpeedValue();
}
public static void switchToBlockState(Level world, BlockPos pos, BlockState state) {

View file

@ -155,18 +155,18 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn,
BlockHitResult hit) {
ItemStack heldItem = player.getItemInHand(handIn);
boolean isHand = heldItem.isEmpty() && handIn == InteractionHand.MAIN_HAND;
BlockEntity te = worldIn.getBlockEntity(pos);
if (!(te instanceof MechanicalCrafterTileEntity))
if (!(te instanceof MechanicalCrafterTileEntity crafter))
return InteractionResult.PASS;
MechanicalCrafterTileEntity crafter = (MechanicalCrafterTileEntity) te;
boolean wrenched = AllItems.WRENCH.isIn(heldItem);
ItemStack heldItem = player.getItemInHand(handIn);
if (AllBlocks.MECHANICAL_ARM.isIn(heldItem))
return InteractionResult.PASS;
boolean isHand = heldItem.isEmpty() && handIn == InteractionHand.MAIN_HAND;
boolean wrenched = AllItems.WRENCH.isIn(heldItem);
if (hit.getDirection() == state.getValue(HORIZONTAL_FACING)) {
if (crafter.phase != Phase.IDLE && !wrenched) {

View file

@ -49,6 +49,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.MagnetBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.RopeBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.render.EmptyLighter;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity;
import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock;

View file

@ -4,6 +4,7 @@ import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.MovingListener;
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.foundation.config.AllConfigs;
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements MovingListener {

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionEntityRenderer;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRendererProvider;

View file

@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
public class AnchoredLighter extends ContraptionLighter<Contraption> {

View file

@ -5,8 +5,8 @@ import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.foundation.config.AllConfigs;
import net.minecraft.core.BlockPos;

View file

@ -8,8 +8,8 @@ import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.core.BlockPos;

View file

@ -2,9 +2,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.NonStationaryLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View file

@ -2,10 +2,10 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ga
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.NonStationaryLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View file

@ -9,10 +9,10 @@ import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.NonStationaryLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity.CartMovementMode;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.VecHelper;

View file

@ -16,10 +16,10 @@ import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.VecHelper;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.components.structureMovement.piston;
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import net.minecraft.core.Vec3i;

View file

@ -1,9 +1,9 @@
package com.simibubi.create.content.contraptions.components.structureMovement.pulley;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;

View file

@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pu
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;

View file

@ -1,7 +1,8 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
package com.simibubi.create.content.contraptions.components.structureMovement.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.culling.Frustum;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
package com.simibubi.create.content.contraptions.components.structureMovement.render;
import com.jozufozu.flywheel.light.GPULightVolume;
import com.jozufozu.flywheel.light.LightListener;
@ -7,6 +7,7 @@ import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.ListenerStatus;
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import net.minecraft.world.level.LightLayer;

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.re
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
// so other contraptions don't crash before they have a lighter
public class EmptyLighter extends ContraptionLighter<Contraption> {

View file

@ -22,7 +22,6 @@ import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
import com.simibubi.create.foundation.render.CreateContexts;
import com.simibubi.create.foundation.utility.AnimationTickHolder;

View file

@ -1,10 +1,8 @@
package com.simibubi.create.content.contraptions.goggles;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
@ -33,7 +31,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
@ -46,7 +43,6 @@ public class GoggleOverlayRenderer {
public static final IIngameOverlay OVERLAY = GoggleOverlayRenderer::renderOverlay;
private static final List<Supplier<Boolean>> customGogglePredicates = new LinkedList<>();
private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines();
public static int hoverTicks = 0;
@ -73,7 +69,6 @@ public class GoggleOverlayRenderer {
Minecraft mc = Minecraft.getInstance();
ClientLevel world = mc.level;
BlockPos pos = result.getBlockPos();
ItemStack headSlot = mc.player.getItemBySlot(EquipmentSlot.HEAD);
BlockEntity te = world.getBlockEntity(pos);
if (lastHovered == null || lastHovered.equals(pos))
@ -82,9 +77,7 @@ public class GoggleOverlayRenderer {
hoverTicks = 0;
lastHovered = pos;
boolean wearingGoggles = AllItems.GOGGLES.isIn(headSlot);
for (Supplier<Boolean> supplier : customGogglePredicates)
wearingGoggles |= supplier.get();
boolean wearingGoggles = GogglesItem.isWearingGoggles(mc.player);
boolean hasGoggleInformation = te instanceof IHaveGoggleInformation;
boolean hasHoveringInformation = te instanceof IHaveHoveringInformation;
@ -200,12 +193,4 @@ public class GoggleOverlayRenderer {
poseStack.popPose();
}
/**
* Use this method to add custom entry points to the goggles overlay, e.g. custom
* armor, handheld alternatives, etc.
*/
public static void registerCustomGoggleCondition(Supplier<Boolean> condition) {
customGogglePredicates.add(condition);
}
}

View file

@ -1,5 +1,9 @@
package com.simibubi.create.content.contraptions.goggles;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import com.simibubi.create.AllItems;
import net.minecraft.world.InteractionHand;
@ -16,6 +20,11 @@ import net.minecraft.world.level.block.DispenserBlock;
public class GogglesItem extends Item {
private static final List<Predicate<Player>> IS_WEARING_PREDICATES = new ArrayList<>();
static {
addIsWearingPredicate(player -> AllItems.GOGGLES.isIn(player.getItemBySlot(EquipmentSlot.HEAD)));
}
public GogglesItem(Properties properties) {
super(properties);
DispenserBlock.registerBehavior(this, ArmorItem.DISPENSE_ITEM_BEHAVIOR);
@ -39,11 +48,21 @@ public class GogglesItem extends Item {
}
}
public static boolean canSeeParticles(Player player) {
for (ItemStack itemStack : player.getArmorSlots())
if (AllItems.GOGGLES.isIn(itemStack))
public static boolean isWearingGoggles(Player player) {
for (Predicate<Player> predicate : IS_WEARING_PREDICATES) {
if (predicate.test(player)) {
return true;
}
}
return false;
}
/**
* Use this method to add custom entry points to the goggles overlay, e.g. custom
* armor, handheld alternatives, etc.
*/
public static void addIsWearingPredicate(Predicate<Player> predicate) {
IS_WEARING_PREDICATES.add(predicate);
}
}

View file

@ -88,7 +88,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
double xSpeed, double ySpeed, double zSpeed) {
Minecraft mc = Minecraft.getInstance();
LocalPlayer player = mc.player;
boolean visible = worldIn != mc.level || player != null && GogglesItem.canSeeParticles(player);
boolean visible = worldIn != mc.level || player != null && GogglesItem.isWearingGoggles(player);
return new RotationIndicatorParticle(worldIn, x, y, z, data.color, data.radius1, data.radius2, data.speed,
data.getAxis(), data.lifeSpan, visible, this.spriteSet);
}

View file

@ -27,11 +27,10 @@ public class SpeedGaugeTileEntity extends GaugeTileEntity {
super.onSpeedChanged(prevSpeed);
float speed = Math.abs(getSpeed());
color = speed == 0 ? 0x333333
: Color.mixColors(SpeedLevel.of(speed)
color = Color.mixColors(SpeedLevel.of(speed)
.getColor(), 0xffffff, .25f);
if (speed == 69)
AllTriggers.triggerForNearbyPlayers(AllTriggers.SPEED_READ, level, worldPosition, 6, GogglesItem::canSeeParticles);
AllTriggers.triggerForNearbyPlayers(AllTriggers.SPEED_READ, level, worldPosition, 6, GogglesItem::isWearingGoggles);
dialTarget = getDialTarget(speed);
setChanged();

View file

@ -73,9 +73,7 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.stressometer.title").withStyle(ChatFormatting.GRAY)));
if (getTheoreticalSpeed() == 0)
tooltip.add(new TextComponent(spacing + ItemDescription.makeProgressBar(3, -1)).append(Lang.translate("gui.stressometer.no_rotation")).withStyle(ChatFormatting.DARK_GRAY));
// tooltip.add(new StringTextComponent(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1)
// + Lang.translate("gui.stressometer.no_rotation")));
tooltip.add(new TextComponent(spacing + ItemDescription.makeProgressBar(3, 0)).append(Lang.translate("gui.stressometer.no_rotation")).withStyle(ChatFormatting.DARK_GRAY));
else {
tooltip.add(componentSpacing.plainCopy().append(StressImpact.getFormattedStressText(stressFraction)));

View file

@ -73,15 +73,12 @@ public class ChromaticCompoundItem extends Item {
@Override
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) {
double y = entity.getY();
double yMotion = entity.getDeltaMovement().y;
Level world = entity.level;
CompoundTag data = entity.getPersistentData();
CompoundTag itemData = entity.getItem()
.getOrCreateTag();
Vec3 positionVec = entity.position();
CRecipes config = AllConfigs.SERVER.recipes;
if (world.isClientSide) {
int light = itemData.getInt("CollectingLight");
if (world.random.nextInt(config.lightSourceCountForRefinedRadiance.get() + 20) < light) {
@ -94,8 +91,13 @@ public class ChromaticCompoundItem extends Item {
return false;
}
double y = entity.getY();
double yMotion = entity.getDeltaMovement().y;
int minHeight = world.getMinBuildHeight();
CompoundTag data = entity.getPersistentData();
// Convert to Shadow steel if in void
if (y < 0 && y - yMotion < -10 && config.enableShadowSteelRecipe.get()) {
if (y < minHeight && y - yMotion < -10 + minHeight && config.enableShadowSteelRecipe.get()) {
ItemStack newStack = AllItems.SHADOW_STEEL.asStack();
newStack.setCount(stack.getCount());
data.putBoolean("JustCreated", true);

View file

@ -7,14 +7,11 @@ import java.util.function.Consumer;
import javax.annotation.Nonnull;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTags.AllItemTags;
import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.ShulkerBoxBlock;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
@ -91,13 +88,8 @@ public class ToolboxInventory extends ItemStackHandler {
@Override
public boolean isItemValid(int slot, ItemStack stack) {
if (AllItemTags.TOOLBOXES.matches(stack))
if (!stack.getItem().canFitInsideContainerItems())
return false;
if (stack.getItem() instanceof BlockItem) {
BlockItem blockItem = (BlockItem) stack.getItem();
if (blockItem.getBlock() instanceof ShulkerBoxBlock)
return false;
}
if (slot < 0 || slot >= getSlots())
return false;

View file

@ -10,9 +10,9 @@ import java.util.stream.Collectors;
import com.simibubi.create.content.logistics.item.filter.ItemAttribute;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.FireworkRocketItem;
import net.minecraft.world.item.FireworkStarItem;
@ -75,7 +75,7 @@ public class ColorAttribute implements ItemAttribute {
@Override
public Object[] getTranslationParameters() {
return new Object[]{new TranslatableComponent(color.getName()).getContents()};
return new Object[] { I18n.get("color.minecraft." + color.getName()) };
}
@Override

View file

@ -21,13 +21,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.base.IRotate;
import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel;
import com.simibubi.create.content.contraptions.base.IRotate.StressImpact;
import com.simibubi.create.content.contraptions.components.fan.EncasedFanBlock;
import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineBlock;
import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelBlock;
import com.simibubi.create.content.contraptions.goggles.GogglesItem;
import com.simibubi.create.foundation.block.BlockStressValues;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.config.CKinetics;
@ -39,7 +39,6 @@ import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.level.block.Block;
public class ItemDescription {
@ -90,7 +89,7 @@ public class ItemDescription {
CKinetics config = AllConfigs.SERVER.kinetics;
Component rpmUnit = Lang.translate("generic.unit.rpm");
boolean hasGoggles = AllItems.GOGGLES.isIn(Minecraft.getInstance().player.getItemBySlot(EquipmentSlot.HEAD));
boolean hasGoggles = GogglesItem.isWearingGoggles(Minecraft.getInstance().player);
SpeedLevel minimumRequiredSpeedLevel;
boolean showStressImpact;
@ -102,13 +101,12 @@ public class ItemDescription {
showStressImpact = !((IRotate) block).hideStressImpact();
}
boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE;
boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE && minimumRequiredSpeedLevel != SpeedLevel.SLOW;
boolean hasStressImpact =
StressImpact.isEnabled() && showStressImpact && BlockStressValues.getImpact(block) > 0;
boolean hasStressCapacity = StressImpact.isEnabled() && BlockStressValues.hasCapacity(block);
if (hasSpeedRequirement) {
List<Component> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
int index = minimumRequiredSpeedLevel.ordinal();
MutableComponent level =
new TextComponent(makeProgressBar(3, index)).withStyle(minimumRequiredSpeedLevel.getTextColor());
@ -118,7 +116,7 @@ public class ItemDescription {
.append(rpmUnit)
.append("+");
else
level.append(speedLevels.get(index));
level.append(Lang.translate("tooltip.speedRequirement." + Lang.asId(minimumRequiredSpeedLevel.name())));
list.add(Lang.translate("tooltip.speedRequirement")
.withStyle(GRAY));
@ -126,19 +124,18 @@ public class ItemDescription {
}
if (hasStressImpact) {
List<Component> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
double impact = BlockStressValues.getImpact(block);
StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH
: (impact >= config.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW);
int index = impactId.ordinal();
MutableComponent level =
new TextComponent(makeProgressBar(3, index)).withStyle(impactId.getAbsoluteColor());
new TextComponent(makeProgressBar(3, index + 1)).withStyle(impactId.getAbsoluteColor());
if (hasGoggles)
level.append(impact + "x ")
.append(rpmUnit);
else
level.append(stressLevels.get(index));
level.append(Lang.translate("tooltip.stressImpact." + Lang.asId(impactId.name())));
list.add(Lang.translate("tooltip.stressImpact")
.withStyle(GRAY));
@ -146,20 +143,18 @@ public class ItemDescription {
}
if (hasStressCapacity) {
List<Component> stressCapacityLevels =
Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", "high");
double capacity = BlockStressValues.getCapacity(block);
StressImpact impactId = capacity >= config.highCapacity.get() ? StressImpact.LOW
: (capacity >= config.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH);
int index = StressImpact.values().length - 2 - impactId.ordinal();
MutableComponent level =
new TextComponent(makeProgressBar(3, index)).withStyle(impactId.getAbsoluteColor());
new TextComponent(makeProgressBar(3, index + 1)).withStyle(impactId.getAbsoluteColor());
if (hasGoggles)
level.append(capacity + "x ")
.append(rpmUnit);
else
level.append(stressCapacityLevels.get(index));
level.append(Lang.translate("tooltip.capacityProvided." + Lang.asId(impactId.name())));
// if (!isEngine && ((IRotate) block).showCapacityWithAnnotation())
// level +=
@ -183,8 +178,8 @@ public class ItemDescription {
public static String makeProgressBar(int length, int filledLength) {
String bar = " ";
int emptySpaces = length - 1 - filledLength;
for (int i = 0; i <= filledLength; i++)
int emptySpaces = length - filledLength;
for (int i = 0; i < filledLength; i++)
bar += "\u2588";
for (int i = 0; i < emptySpaces; i++)
bar += "\u2592";

View file

@ -10,8 +10,8 @@ import java.util.function.Supplier;
import com.google.common.base.Strings;
import com.mojang.bridge.game.Language;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.AllSections;
import com.simibubi.create.content.contraptions.goggles.GogglesItem;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Couple;
@ -25,7 +25,6 @@ import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -235,10 +234,10 @@ public class TooltipHelper {
public static boolean hasTooltip(ItemStack stack, Player player) {
checkLocale();
boolean hasGlasses = AllItems.GOGGLES.isIn(player.getItemBySlot(EquipmentSlot.HEAD));
boolean hasGoggles = GogglesItem.isWearingGoggles(player);
if (hasGlasses != gogglesMode) {
gogglesMode = hasGlasses;
if (hasGoggles != gogglesMode) {
gogglesMode = hasGoggles;
cachedTooltips.clear();
}

View file

@ -0,0 +1,15 @@
package com.simibubi.create.foundation.item;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Block;
public class UncontainableBlockItem extends BlockItem {
public UncontainableBlockItem(Block block, Properties properties) {
super(block, properties);
}
@Override
public boolean canFitInsideContainerItems() {
return false;
}
}

View file

@ -13,7 +13,7 @@ import net.minecraft.world.level.Level;
public class EdgeInteractionBehaviour extends TileEntityBehaviour {
public static BehaviourType<EdgeInteractionBehaviour> TYPE = new BehaviourType<>();
public static final BehaviourType<EdgeInteractionBehaviour> TYPE = new BehaviourType<>();
ConnectionCallback connectionCallback;
ConnectivityPredicate connectivityPredicate;

View file

@ -42,11 +42,11 @@ public class EdgeInteractionHandler {
EdgeInteractionBehaviour behaviour = TileEntityBehaviour.get(world, pos, EdgeInteractionBehaviour.TYPE);
if (behaviour == null)
return;
if (behaviour.requiredItem.isPresent() && behaviour.requiredItem.get() != heldItem.getItem())
return;
BlockHitResult ray = RaycastHelper.rayTraceRange(world, player, 10);
if (ray == null)
return;
if (behaviour.requiredItem.orElse(heldItem.getItem()) != heldItem.getItem())
return;
Direction activatedDirection = getActivatedDirection(world, pos, ray.getDirection(), ray.getLocation(), behaviour);
if (activatedDirection == null)

View file

@ -1148,7 +1148,7 @@
"create.tooltip.speedRequirement": "Geschwindigkeitsanforderung: %1$s",
"create.tooltip.speedRequirement.none": "Keine",
"create.tooltip.speedRequirement.medium": "Moderat",
"create.tooltip.speedRequirement.high": "Schnell",
"create.tooltip.speedRequirement.fast": "Schnell",
"create.tooltip.stressImpact": "Kinetische Belastungsauswirkung: %1$s",
"create.tooltip.stressImpact.low": "Niedrig",
"create.tooltip.stressImpact.medium": "Moderat",

View file

@ -34,7 +34,7 @@
"create.recipe.fan_washing.fan": "Fan behind Flowing Water",
"create.recipe.fan_smoking": "Bulk Smoking",
"create.recipe.fan_smoking.fan": "Fan behind Fire",
"create.recipe.fan_haunting": "Bulk Haunting",
"create.recipe.fan_haunting": "Bulk Haunting",
"create.recipe.fan_haunting.fan": "Fan behind Soul Fire",
"create.recipe.fan_blasting": "Bulk Blasting",
"create.recipe.fan_blasting.fan": "Fan behind Lava",
@ -461,8 +461,9 @@
"create.tooltip.speedRequirement": "Speed Requirement: %1$s",
"create.tooltip.speedRequirement.none": "None",
"create.tooltip.speedRequirement.slow": "Slow",
"create.tooltip.speedRequirement.medium": "Moderate",
"create.tooltip.speedRequirement.high": "Fast",
"create.tooltip.speedRequirement.fast": "Fast",
"create.tooltip.stressImpact": "Kinetic Stress Impact: %1$s",
"create.tooltip.stressImpact.low": "Low",

View file

@ -1146,7 +1146,7 @@
"create.tooltip.speedRequirement": "Requqrimiento de Velocidad: %1$s",
"create.tooltip.speedRequirement.none": "Ninguno",
"create.tooltip.speedRequirement.medium": "Moderado",
"create.tooltip.speedRequirement.high": "Rápidp",
"create.tooltip.speedRequirement.fast": "Rápido",
"create.tooltip.stressImpact": "Impacto en el Estrés Cinético: %1$s",
"create.tooltip.stressImpact.low": "Bajo",
"create.tooltip.stressImpact.medium": "Moderado",

View file

@ -1228,7 +1228,7 @@
"create.tooltip.speedRequirement": "Requisitos de velocidad: %1$s",
"create.tooltip.speedRequirement.none": "Ninguno",
"create.tooltip.speedRequirement.medium": "Moderado",
"create.tooltip.speedRequirement.high": "Rápido",
"create.tooltip.speedRequirement.fast": "Rápido",
"create.tooltip.stressImpact": "Impacto de estrés: %1$s",
"create.tooltip.stressImpact.low": "Bajo",
"create.tooltip.stressImpact.medium": "Moderado",

View file

@ -623,7 +623,7 @@
"create.tooltip.speedRequirement": "Vitesse requise: %1$s",
"create.tooltip.speedRequirement.none": "Aucune",
"create.tooltip.speedRequirement.medium": "Modérée",
"create.tooltip.speedRequirement.high": "Rapide",
"create.tooltip.speedRequirement.fast": "Rapide",
"create.tooltip.stressImpact": "Impact du stress: %1$s",
"create.tooltip.stressImpact.low": "Faible",
"create.tooltip.stressImpact.medium": "Modéré",

View file

@ -1043,7 +1043,7 @@
"create.tooltip.speedRequirement": "Velocità richiesta: %1$s",
"create.tooltip.speedRequirement.none": "Nessuna",
"create.tooltip.speedRequirement.medium": "Moderata",
"create.tooltip.speedRequirement.high": "Veloce",
"create.tooltip.speedRequirement.fast": "Veloce",
"create.tooltip.stressImpact": "Impatto sullo stress: %1$s",
"create.tooltip.stressImpact.low": "Basso",
"create.tooltip.stressImpact.medium": "Moderato",

View file

@ -1232,7 +1232,7 @@
"create.tooltip.speedRequirement": "必要な回転速度: %1$s",
"create.tooltip.speedRequirement.none": "無し",
"create.tooltip.speedRequirement.medium": "中速",
"create.tooltip.speedRequirement.high": "高速",
"create.tooltip.speedRequirement.fast": "高速",
"create.tooltip.stressImpact": "応力への影響: %1$s",
"create.tooltip.stressImpact.low": "低",
"create.tooltip.stressImpact.medium": "中",

View file

@ -1230,7 +1230,7 @@
"create.tooltip.speedRequirement": "요구 회전속도: %1$s",
"create.tooltip.speedRequirement.none": "없음",
"create.tooltip.speedRequirement.medium": "보통",
"create.tooltip.speedRequirement.high": "빠름",
"create.tooltip.speedRequirement.fast": "빠름",
"create.tooltip.stressImpact": "피로도 부하: %1$s",
"create.tooltip.stressImpact.low": "낮음",
"create.tooltip.stressImpact.medium": "보통",

View file

@ -405,7 +405,7 @@
"create.tooltip.speedRequirement": "Snelheid eis: %1$s",
"create.tooltip.speedRequirement.none": "Geen",
"create.tooltip.speedRequirement.medium": "Gemiddeld",
"create.tooltip.speedRequirement.high": "Snel",
"create.tooltip.speedRequirement.fast": "Snel",
"create.tooltip.stressImpact": "Stress Impact: %1$s",
"create.tooltip.stressImpact.low": "Laag",

View file

@ -1116,7 +1116,7 @@
"create.tooltip.speedRequirement": "Wymagana prędkość: %1$s",
"create.tooltip.speedRequirement.none": "Brak",
"create.tooltip.speedRequirement.medium": "Umiarkowana",
"create.tooltip.speedRequirement.high": "Wysoka",
"create.tooltip.speedRequirement.fast": "Wysoka",
"create.tooltip.stressImpact": "Wpływ na obciążenie: %1$s",
"create.tooltip.stressImpact.low": "Niski",
"create.tooltip.stressImpact.medium": "Umiarkowany",

View file

@ -1118,7 +1118,7 @@
"create.tooltip.speedRequirement": "Требование к скорости: %1$s",
"create.tooltip.speedRequirement.none": "Нет",
"create.tooltip.speedRequirement.medium": "Умеренная",
"create.tooltip.speedRequirement.high": "Быстрая",
"create.tooltip.speedRequirement.fast": "Быстрая",
"create.tooltip.stressImpact": "Создаваемая нагрузка: %1$s",
"create.tooltip.stressImpact.low": "Низкая",
"create.tooltip.stressImpact.medium": "Средняя",

View file

@ -1232,7 +1232,7 @@
"create.tooltip.speedRequirement": "需求转速:%1$s",
"create.tooltip.speedRequirement.none": "无",
"create.tooltip.speedRequirement.medium": "适当",
"create.tooltip.speedRequirement.high": "快",
"create.tooltip.speedRequirement.fast": "快",
"create.tooltip.stressImpact": "应力影响:%1$s",
"create.tooltip.stressImpact.low": "低",
"create.tooltip.stressImpact.medium": "中",

View file

@ -1114,7 +1114,7 @@
"create.tooltip.speedRequirement": "需求速度:%1$s",
"create.tooltip.speedRequirement.none": "無",
"create.tooltip.speedRequirement.medium": "適當",
"create.tooltip.speedRequirement.high": "快",
"create.tooltip.speedRequirement.fast": "快",
"create.tooltip.stressImpact": "動能消耗:%1$s",
"create.tooltip.stressImpact.low": "低",
"create.tooltip.stressImpact.medium": "中",