Player Feedback, Part II

This commit is contained in:
Zelophed 2021-02-11 17:47:55 +01:00
parent 3525ce49ce
commit b4c881a6c8
25 changed files with 282 additions and 162 deletions

View file

@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_
fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json
b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json
6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json
4c3e0500f9382d2e426e823fe876f57f4d7ee3b4 assets/create/blockstates/fluid_pipe.json
6106fc0a0f9d83da89c3e8af98e7c45232602c23 assets/create/blockstates/fluid_pipe.json
f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json
5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json
e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json
@ -335,7 +335,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
bdd56f32ce0a148b6e466a55ab2777f69fc08cfc assets/create/blockstates/radial_chassis.json
143d66a7262ccd29f36784d6b064d4a13ba374b6 assets/create/blockstates/radial_chassis.json
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json
@ -399,16 +399,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
df67c2c11fa22487d3a0fdc9b008056e593d14e3 assets/create/lang/en_ud.json
3ad443f44eb33fe8c3ac092d1532dcbd27e49c84 assets/create/lang/en_us.json
612a63d73f7f4b8e79dce3f53ddbe3345f0e74d8 assets/create/lang/unfinished/de_de.json
2e37dc718a8dea2af85daba7266c877ce80ff35b assets/create/lang/unfinished/fr_fr.json
f843761728c403276b7a47282f4fdd039b5b6854 assets/create/lang/unfinished/it_it.json
8b90c66fd5974c993e83bfa5733ca03187211d28 assets/create/lang/unfinished/ja_jp.json
59db0a3cff42707ecb828b975ef1fcba2a21a521 assets/create/lang/unfinished/ko_kr.json
b1900a6cce7216a4baa844affa169cfb32ff645c assets/create/lang/unfinished/nl_nl.json
d3f09a37b1f4ec5d53effc2b87efbccf2df2b7c7 assets/create/lang/unfinished/pt_br.json
16c92dab525ba20e85b65ee084f7b760432dcb73 assets/create/lang/unfinished/ru_ru.json
c8b5c2a3a65468950aa713a56bf1c930eef81305 assets/create/lang/unfinished/zh_cn.json
9fa2b840f81a9d61e25af4718a4948ee762ef0a8 assets/create/lang/en_us.json
ebe9ae0de05c542426e1fc9eeb865cad08f7c6a0 assets/create/lang/unfinished/de_de.json
f2525e7139a8e5aaac2fed2a562ad13a295f0e4e assets/create/lang/unfinished/fr_fr.json
30db009b45db33814b43f15d09775de2f9cad091 assets/create/lang/unfinished/it_it.json
25c2d05bfcdd0e64e889ca6ff36377d933f35e87 assets/create/lang/unfinished/ja_jp.json
7a4f40c3a6851714a450173f0c2f1e5689d96025 assets/create/lang/unfinished/ko_kr.json
c2b4070659ce9a0a44cbaa37beef3b0217d15c00 assets/create/lang/unfinished/nl_nl.json
9cfe6a2af979661bbdcc78edc28ab07b9a8f2f43 assets/create/lang/unfinished/pt_br.json
590368f1507e77d67c416299188b2e147e0a9616 assets/create/lang/unfinished/ru_ru.json
719105e25c79198ad76bd1782499545ce0f8a3ce assets/create/lang/unfinished/zh_cn.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -819,6 +819,12 @@
"create.gui.goggles.kinetic_stats": "Kinetic Stats:",
"create.gui.goggles.at_current_speed": "at current speed",
"create.gui.goggles.pole_length": "Pole Length:",
"create.gui.assembly.exception": "This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "Gauge Information:",
"create.gui.speedometer.title": "Rotation Speed",
"create.gui.stressometer.title": "Network Stress",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1211",
"_": "Missing Localizations: 1217",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "UNLOCALIZED: Kinetic Stats:",
"create.gui.goggles.at_current_speed": "UNLOCALIZED: at current speed",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "UNLOCALIZED: Gauge Information:",
"create.gui.speedometer.title": "UNLOCALIZED: Rotation Speed",
"create.gui.stressometer.title": "UNLOCALIZED: Network Stress",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 862",
"_": "Missing Localizations: 868",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "Statistiques cinétiques:",
"create.gui.goggles.at_current_speed": "À la vitesse actuelle",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "Informations sur la jauge:",
"create.gui.speedometer.title": "Vitesse de rotation",
"create.gui.stressometer.title": "Stress du réseau",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 846",
"_": "Missing Localizations: 852",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "Statistiche Cinetiche:",
"create.gui.goggles.at_current_speed": "Alla velocità Attuale",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "Informazioni sul Calibro:",
"create.gui.speedometer.title": "Velocità di Rotazione",
"create.gui.stressometer.title": "Stress della Rete",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 845",
"_": "Missing Localizations: 851",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "動力の統計:",
"create.gui.goggles.at_current_speed": "現在の速度",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "計器の情報:",
"create.gui.speedometer.title": "回転速度",
"create.gui.stressometer.title": "ネットワークの応力",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 52",
"_": "Missing Localizations: 58",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "가동 상태:",
"create.gui.goggles.at_current_speed": "현재 에너지량",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "게이지 정보:",
"create.gui.speedometer.title": "회전 속도",
"create.gui.stressometer.title": "네트워크 부하",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1152",
"_": "Missing Localizations: 1158",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "UNLOCALIZED: Kinetic Stats:",
"create.gui.goggles.at_current_speed": "UNLOCALIZED: at current speed",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "UNLOCALIZED: Gauge Information:",
"create.gui.speedometer.title": "UNLOCALIZED: Rotation Speed",
"create.gui.stressometer.title": "UNLOCALIZED: Network Stress",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1218",
"_": "Missing Localizations: 1224",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "UNLOCALIZED: Kinetic Stats:",
"create.gui.goggles.at_current_speed": "UNLOCALIZED: at current speed",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "UNLOCALIZED: Gauge Information:",
"create.gui.speedometer.title": "UNLOCALIZED: Rotation Speed",
"create.gui.stressometer.title": "UNLOCALIZED: Network Stress",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 2",
"_": "Missing Localizations: 8",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "Кинетическая статистика:",
"create.gui.goggles.at_current_speed": "На текущей скорости",
"create.gui.goggles.pole_length": "Длина поршня",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "Калибровочная информация:",
"create.gui.speedometer.title": "Скорость вращения",
"create.gui.stressometer.title": "Сетевой момент",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 5",
"_": "Missing Localizations: 11",
"_": "->------------------------] Game Elements [------------------------<-",
@ -820,6 +820,12 @@
"create.gui.goggles.kinetic_stats": "动力学状态:",
"create.gui.goggles.at_current_speed": "当前速度应力值",
"create.gui.goggles.pole_length": "UNLOCALIZED: Pole Length:",
"create.gui.assembly.exception": "UNLOCALIZED: This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "UNLOCALIZED: Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "UNLOCALIZED: The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "UNLOCALIZED: There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "UNLOCALIZED: There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "UNLOCALIZED: The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "仪表信息:",
"create.gui.speedometer.title": "旋转速度",
"create.gui.stressometer.title": "网络应力",

View file

@ -1,23 +1,52 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import com.simibubi.create.foundation.config.AllConfigs;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class AssemblyException extends RuntimeException {
public final ITextComponent message;
public class AssemblyException extends Exception {
public final ITextComponent component;
public AssemblyException(ITextComponent message) {
this.message = message;
public AssemblyException(ITextComponent component) {
this.component = component;
}
public AssemblyException(String langKey, Object... objects) {
this(new TranslationTextComponent("gui.goggles.contraptions." + langKey, objects));
this(new TranslationTextComponent("create.gui.assembly.exception." + langKey, objects));
}
public static AssemblyException unmovableBlock(BlockPos pos, BlockState state) {
return new AssemblyException("unmovableBlock", pos.getX(), pos.getY(), pos.getZ(),
return new AssemblyException("unmovableBlock",
pos.getX(),
pos.getY(),
pos.getZ(),
new TranslationTextComponent(state.getBlock().getTranslationKey()));
}
public static AssemblyException unloadedChunk(BlockPos pos) {
return new AssemblyException("chunkNotLoaded",
pos.getX(),
pos.getY(),
pos.getZ());
}
public static AssemblyException structureTooLarge() {
return new AssemblyException("structureTooLarge",
AllConfigs.SERVER.kinetics.maxBlocksMoved.get());
}
public static AssemblyException tooManyPistonPoles() {
return new AssemblyException("tooManyPistonPoles",
AllConfigs.SERVER.kinetics.maxPistonPoles.get());
}
public static AssemblyException noPistonPoles() {
return new AssemblyException("noPistonPoles");
}
public String getFormattedText() {
return component.getFormattedText();
}
}

View file

@ -1,28 +1,5 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isExtensionPole;
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Queue;
import java.util.Set;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllMovementBehaviours;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
@ -52,15 +29,7 @@ import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import net.minecraft.block.AbstractButtonBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.ChestBlock;
import net.minecraft.block.DoorBlock;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.block.PressurePlateBlock;
import net.minecraft.block.*;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluids;
@ -92,6 +61,16 @@ import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isExtensionPole;
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead;
public abstract class Contraption {
@ -150,7 +129,7 @@ public abstract class Contraption {
}
protected boolean addToInitialFrontier(World world, BlockPos pos, Direction forcedDirection,
Queue<BlockPos> frontier) {
Queue<BlockPos> frontier) throws AssemblyException {
return true;
}
@ -161,7 +140,7 @@ public abstract class Contraption {
return contraption;
}
public boolean searchMovedStructure(World world, BlockPos pos, @Nullable Direction forcedDirection) {
public boolean searchMovedStructure(World world, BlockPos pos, @Nullable Direction forcedDirection) throws AssemblyException {
initialPassengers.clear();
Queue<BlockPos> frontier = new LinkedList<>();
Set<BlockPos> visited = new HashSet<>();
@ -180,7 +159,7 @@ public abstract class Contraption {
if (!moveBlock(world, forcedDirection, frontier, visited))
return false;
}
throw new AssemblyException("structureTooLarge");
throw AssemblyException.structureTooLarge();
}
public void onEntityCreated(AbstractContraptionEntity entity) {
@ -249,7 +228,7 @@ public abstract class Contraption {
/** move the first block in frontier queue */
protected boolean moveBlock(World world, @Nullable Direction forcedDirection, Queue<BlockPos> frontier,
Set<BlockPos> visited) {
Set<BlockPos> visited) throws AssemblyException {
BlockPos pos = frontier.poll();
if (pos == null)
return false;
@ -258,7 +237,7 @@ public abstract class Contraption {
if (World.isOutsideBuildHeight(pos))
return true;
if (!world.isBlockPresent(pos))
throw new AssemblyException("chunkNotLoaded");
throw AssemblyException.unloadedChunk(pos);
if (isAnchoringBlockAt(pos))
return true;
BlockState state = world.getBlockState(pos);
@ -348,7 +327,7 @@ public abstract class Contraption {
if (blocks.size() <= AllConfigs.SERVER.kinetics.maxBlocksMoved.get())
return true;
else
throw new AssemblyException("structureTooLarge");
throw AssemblyException.structureTooLarge();
}
private void moveBearing(BlockPos pos, Queue<BlockPos> frontier, Set<BlockPos> visited, BlockState state) {
@ -402,7 +381,7 @@ public abstract class Contraption {
}
private boolean moveMechanicalPiston(World world, BlockPos pos, Queue<BlockPos> frontier, Set<BlockPos> visited,
BlockState state) {
BlockState state) throws AssemblyException {
int limit = AllConfigs.SERVER.kinetics.maxPistonPoles.get();
Direction direction = state.get(MechanicalPistonBlock.FACING);
if (state.get(MechanicalPistonBlock.STATE) == PistonState.EXTENDED) {
@ -424,7 +403,7 @@ public abstract class Contraption {
break;
}
if (limit <= -1)
throw new AssemblyException("tooManyPistonPoles");
throw AssemblyException.tooManyPistonPoles();
}
BlockPos searchPos = pos;
@ -443,7 +422,7 @@ public abstract class Contraption {
}
if (limit <= -1)
throw new AssemblyException("tooManyPistonPoles");
throw AssemblyException.tooManyPistonPoles();
return true;
}

View file

@ -0,0 +1,28 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.util.text.TextFormatting;
import java.util.Arrays;
import java.util.List;
public interface IDisplayAssemblyExceptions {
default boolean addExceptionToTooltip(List<String> tooltip) {
AssemblyException e = getLastAssemblyException();
if (e == null)
return false;
if (!tooltip.isEmpty())
tooltip.add("");
tooltip.add(IHaveGoggleInformation.spacing + TextFormatting.GOLD + Lang.translate("gui.assembly.exception"));
String text = e.getFormattedText();
Arrays.stream(text.split("\n")).forEach(l -> tooltip.add(IHaveGoggleInformation.spacing + TextFormatting.GRAY + l));
return true;
}
AssemblyException getLastAssemblyException();
}

View file

@ -1,13 +1,10 @@
package com.simibubi.create.content.contraptions.components.structureMovement.bearing;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions;
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkContraption.HandType;
import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.gui.AllIcons;
@ -17,7 +14,6 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOpt
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties;
@ -27,8 +23,11 @@ import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import org.apache.commons.lang3.tuple.Pair;
public class ClockworkBearingTileEntity extends KineticTileEntity implements IBearingTileEntity {
import java.util.List;
public class ClockworkBearingTileEntity extends KineticTileEntity implements IBearingTileEntity, IDisplayAssemblyExceptions {
protected ControlledContraptionEntity hourHand;
protected ControlledContraptionEntity minuteHand;
@ -39,7 +38,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
protected boolean running;
protected boolean assembleNextTick;
protected ITextComponent lastException;
protected AssemblyException lastException;
protected ScrollOptionBehaviour<ClockHands> operationMode;
@ -108,6 +107,11 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
applyRotations();
}
@Override
public AssemblyException getLastAssemblyException() {
return lastException;
}
protected void applyRotations() {
BlockState blockState = getBlockState();
Axis axis = Axis.X;
@ -207,7 +211,8 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
contraption = ClockworkContraption.assembleClockworkAt(world, pos, direction);
lastException = null;
} catch (AssemblyException e) {
lastException = e.message;
lastException = e;
sendData();
return;
}
if (contraption == null)
@ -294,7 +299,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
compound.putFloat("HourAngle", hourAngle);
compound.putFloat("MinuteAngle", minuteAngle);
if (lastException != null)
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException));
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException.component));
super.write(compound, clientPacket);
}
@ -307,7 +312,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
hourAngle = compound.getFloat("HourAngle");
minuteAngle = compound.getFloat("MinuteAngle");
if (compound.contains("LastException"))
lastException = ITextComponent.Serializer.fromJson(compound.getString("LastException"));
lastException = new AssemblyException(ITextComponent.Serializer.fromJson(compound.getString("LastException")));
else
lastException = null;
super.read(compound, clientPacket);
@ -408,12 +413,4 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
return pos;
}
@Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking);
if (lastException != null)
tooltip.add(lastException.getFormattedText());
return lastException != null || added;
}
}

View file

@ -1,21 +1,19 @@
package com.simibubi.create.content.contraptions.components.structureMovement.bearing;
import java.util.HashSet;
import java.util.Queue;
import java.util.Set;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import java.util.HashSet;
import java.util.Queue;
import java.util.Set;
public class ClockworkContraption extends Contraption {
@ -88,13 +86,13 @@ public class ClockworkContraption extends Contraption {
}
@Override
public boolean searchMovedStructure(World world, BlockPos pos, Direction direction) {
public boolean searchMovedStructure(World world, BlockPos pos, Direction direction) throws AssemblyException {
return super.searchMovedStructure(world, pos.offset(direction, offset + 1), null);
}
@Override
protected boolean moveBlock(World world, Direction direction, Queue<BlockPos> frontier,
Set<BlockPos> visited) {
Set<BlockPos> visited) throws AssemblyException {
if (ignoreBlocks.contains(frontier.peek())) {
frontier.poll();
return true;

View file

@ -1,13 +1,10 @@
package com.simibubi.create.content.contraptions.components.structureMovement.bearing;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
import java.util.List;
import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions;
import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
@ -15,7 +12,6 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOpt
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties;
@ -25,7 +21,11 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity implements IBearingTileEntity {
import java.util.List;
import static net.minecraft.state.properties.BlockStateProperties.FACING;
public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity implements IBearingTileEntity, IDisplayAssemblyExceptions {
protected ScrollOptionBehaviour<RotationMode> movementMode;
protected ControlledContraptionEntity movedContraption;
@ -33,7 +33,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
protected boolean running;
protected boolean assembleNextTick;
protected float clientAngleDiff;
protected ITextComponent lastException;
protected AssemblyException lastException;
public MechanicalBearingTileEntity(TileEntityType<? extends MechanicalBearingTileEntity> type) {
super(type);
@ -66,7 +66,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
compound.putBoolean("Running", running);
compound.putFloat("Angle", angle);
if (lastException != null)
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException));
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException.component));
super.write(compound, clientPacket);
}
@ -76,7 +76,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
running = compound.getBoolean("Running");
angle = compound.getFloat("Angle");
if (compound.contains("LastException"))
lastException = ITextComponent.Serializer.fromJson(compound.getString("LastException"));
lastException = new AssemblyException(ITextComponent.Serializer.fromJson(compound.getString("LastException")));
else
lastException = null;
super.read(compound, clientPacket);
@ -113,6 +113,11 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
return speed;
}
@Override
public AssemblyException getLastAssemblyException() {
return lastException;
}
protected boolean isWindmill() {
return false;
}
@ -130,11 +135,13 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
Direction direction = getBlockState().get(FACING);
BearingContraption contraption = new BearingContraption(isWindmill(), direction);
try {
lastException = null;
if (!contraption.assemble(world, pos))
return;
lastException = null;
} catch (AssemblyException e) {
lastException = e.message;
lastException = e;
sendData();
return;
}
@ -296,12 +303,4 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
TooltipHelper.addHint(tooltip, "hint.empty_bearing");
return true;
}
@Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking);
if (lastException != null)
tooltip.add(lastException.getFormattedText());
return lastException != null || added;
}
}

View file

@ -237,11 +237,18 @@ public class CartAssemblerBlock extends AbstractRailBlock
MountedContraption contraption = new MountedContraption(mode);
try {
assembler.ifPresent(te -> te.lastException = null);
if (!contraption.assemble(world, pos))
return;
assembler.ifPresent(te -> {
te.lastException = null;
te.sendData();
});
} catch (AssemblyException e) {
assembler.ifPresent(te -> te.lastException = e.message);
assembler.ifPresent(te -> {
te.lastException = e;
te.sendData();
});
return;
}

View file

@ -1,8 +1,7 @@
package com.simibubi.create.content.contraptions.components.structureMovement.mounted;
import java.util.List;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
@ -12,19 +11,21 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIco
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.RailShape;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
public class CartAssemblerTileEntity extends SmartTileEntity implements IHaveGoggleInformation {
import java.util.List;
public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplayAssemblyExceptions {
private static final int assemblyCooldown = 8;
protected ScrollOptionBehaviour<CartMovementMode> movementMode;
private int ticksSinceMinecartUpdate;
protected ITextComponent lastException; //TODO
protected AssemblyException lastException;
public CartAssemblerTileEntity(TileEntityType<? extends CartAssemblerTileEntity> type) {
super(type);
@ -47,6 +48,27 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IHaveGog
behaviours.add(movementMode);
}
@Override
public void write(CompoundNBT compound, boolean clientPacket) {
if (lastException != null)
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException.component));
super.write(compound, clientPacket);
}
@Override
protected void read(CompoundNBT compound, boolean clientPacket) {
if (compound.contains("LastException"))
lastException = new AssemblyException(ITextComponent.Serializer.fromJson(compound.getString("LastException")));
else
lastException = null;
super.read(compound, clientPacket);
}
@Override
public AssemblyException getLastAssemblyException() {
return lastException;
}
protected ValueBoxTransform getMovementModeSlot() {
return new CartAssemblerValueBoxTransform();
}
@ -106,11 +128,4 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IHaveGog
public boolean isMinecartUpdateValid() {
return ticksSinceMinecartUpdate >= assemblyCooldown;
}
@Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
if (lastException != null)
tooltip.add(lastException.getFormattedText());
return lastException != null;
}
}

View file

@ -1,18 +1,12 @@
package com.simibubi.create.content.contraptions.components.structureMovement.piston;
import java.util.List;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.IControlContraption;
import com.simibubi.create.content.contraptions.components.structureMovement.*;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos;
@ -20,7 +14,9 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
public abstract class LinearActuatorTileEntity extends KineticTileEntity implements IControlContraption {
import java.util.List;
public abstract class LinearActuatorTileEntity extends KineticTileEntity implements IControlContraption, IDisplayAssemblyExceptions {
public float offset;
public boolean running;
@ -29,7 +25,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
protected boolean forceMove;
protected ScrollOptionBehaviour<MovementMode> movementMode;
protected boolean waitingForSpeedChange;
protected ITextComponent lastException;
protected AssemblyException lastException;
// Custom position sync
protected float clientOffsetDiff;
@ -87,8 +83,9 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
assemble();
lastException = null;
} catch (AssemblyException e) {
lastException = e.message;
lastException = e;
}
sendData();
}
return;
}
@ -162,7 +159,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
compound.putBoolean("Waiting", waitingForSpeedChange);
compound.putFloat("Offset", offset);
if (lastException != null)
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException));
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException.component));
super.write(compound, clientPacket);
if (clientPacket && forceMove) {
@ -180,7 +177,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
waitingForSpeedChange = compound.getBoolean("Waiting");
offset = compound.getFloat("Offset");
if (compound.contains("LastException"))
lastException = ITextComponent.Serializer.fromJson(compound.getString("LastException"));
lastException = new AssemblyException(ITextComponent.Serializer.fromJson(compound.getString("LastException")));
else
lastException = null;
super.read(compound, clientPacket);
@ -197,6 +194,11 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
movedContraption = null;
}
@Override
public AssemblyException getLastAssemblyException() {
return lastException;
}
public abstract void disassemble();
protected abstract void assemble() throws AssemblyException;
@ -302,13 +304,4 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
public BlockPos getBlockPosition() {
return pos;
}
@Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking);
if (lastException != null)
tooltip.add(lastException.getFormattedText());
return lastException != null || added;
}
}

View file

@ -68,7 +68,7 @@ public class PistonContraption extends TranslatingContraption {
return true;
}
private boolean collectExtensions(World world, BlockPos pos, Direction direction) {
private boolean collectExtensions(World world, BlockPos pos, Direction direction) throws AssemblyException {
List<BlockInfo> poles = new ArrayList<>();
BlockPos actualStart = pos;
BlockState nextBlock = world.getBlockState(actualStart.offset(direction));
@ -91,7 +91,7 @@ public class PistonContraption extends TranslatingContraption {
nextBlock = world.getBlockState(actualStart.offset(direction));
if (extensionsInFront > MechanicalPistonBlock.maxAllowedPistonPoles())
throw new AssemblyException("tooManyPistonPoles");
throw AssemblyException.tooManyPistonPoles();
}
}
@ -114,7 +114,7 @@ public class PistonContraption extends TranslatingContraption {
nextBlock = world.getBlockState(end.offset(direction.getOpposite()));
if (extensionsInFront + extensionsInBack > MechanicalPistonBlock.maxAllowedPistonPoles())
throw new AssemblyException("tooManyPistonPoles");
throw AssemblyException.tooManyPistonPoles();
}
anchor = pos.offset(direction, initialExtensionProgress + 1);
@ -126,7 +126,7 @@ public class PistonContraption extends TranslatingContraption {
1, 1);
if (extensionLength == 0)
throw new AssemblyException("noPistonPoles");
throw AssemblyException.noPistonPoles();
bounds = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
@ -146,7 +146,7 @@ public class PistonContraption extends TranslatingContraption {
}
@Override
protected boolean addToInitialFrontier(World world, BlockPos pos, Direction direction, Queue<BlockPos> frontier) {
protected boolean addToInitialFrontier(World world, BlockPos pos, Direction direction, Queue<BlockPos> frontier) throws AssemblyException {
frontier.clear();
boolean sticky = isStickyPiston(world.getBlockState(pos.offset(orientation, -1)));
boolean retracting = direction != orientation;
@ -159,7 +159,7 @@ public class PistonContraption extends TranslatingContraption {
if (retracting && World.isOutsideBuildHeight(currentPos))
return true;
if (!world.isBlockPresent(currentPos))
throw new AssemblyException("chunkNotLoaded");
throw AssemblyException.unloadedChunk(currentPos);
BlockState state = world.getBlockState(currentPos);
if (!BlockMovementTraits.movementNecessary(state, world, currentPos))
return true;

View file

@ -9,7 +9,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.IWaterLoggable;
@ -192,7 +191,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
protected void read(CompoundNBT compound, boolean clientPacket) {
initialOffset = compound.getInt("InitialOffset");
if (compound.contains("LastException"))
lastException = ITextComponent.Serializer.fromJson(compound.getString("LastException"));
lastException = new AssemblyException(ITextComponent.Serializer.fromJson(compound.getString("LastException")));
else
lastException = null;
super.read(compound, clientPacket);
@ -202,7 +201,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
public void write(CompoundNBT compound, boolean clientPacket) {
compound.putInt("InitialOffset", initialOffset);
if (lastException != null)
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException));
compound.putString("LastException", ITextComponent.Serializer.toJson(lastException.component));
super.write(compound, clientPacket);
}

View file

@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock;
import com.simibubi.create.foundation.config.AllConfigs;
@ -92,6 +93,14 @@ public class GoggleOverlayRenderer {
tooltip.remove(tooltip.size() - 1);
}
if (te instanceof IDisplayAssemblyExceptions) {
boolean exceptionAdded = ((IDisplayAssemblyExceptions) te).addExceptionToTooltip(tooltip);
if (exceptionAdded) {
hasHoveringInformation = true;
hoverAddedInformation = true;
}
}
// break early if goggle or hover returned false when present
if ((hasGoggleInformation && !goggleAddedInformation) && (hasHoveringInformation && !hoverAddedInformation))
return;

View file

@ -9,13 +9,13 @@ import java.util.List;
public interface IHaveGoggleInformation {
DecimalFormat decimalFormat = new DecimalFormat("#.##");
public static String spacing = " ";
String spacing = " ";
/**
* this method will be called when looking at a TileEntity that implemented this interface
*
* @return {{@code true}} if the tooltip creation was successful and should be displayed,
* or {{@code false}} if the overlay should not be displayed
* @return {@code true} if the tooltip creation was successful and should be displayed,
* or {@code false} if the overlay should not be displayed
* */
default boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking){
return false;

View file

@ -172,6 +172,13 @@
"create.gui.goggles.at_current_speed": "at current speed",
"create.gui.goggles.pole_length": "Pole Length:",
"create.gui.assembly.exception": "This Contraption was unable to assemble:",
"create.gui.assembly.exception.unmovableBlock": "Unmovable Block (%4$s) at [%1$s %2$s %3$s]",
"create.gui.assembly.exception.chunkNotLoaded": "The Block at [%1$s %2$s %3$s] was not in a loaded chunk",
"create.gui.assembly.exception.structureTooLarge": "There are too many Blocks included in the contraption.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.tooManyPistonPoles": "There are too many extension Poles attached to this Piston.\nThe configured maximum is: %1$s",
"create.gui.assembly.exception.noPistonPoles": "The Piston is missing some extension Poles",
"create.gui.gauge.info_header": "Gauge Information:",
"create.gui.speedometer.title": "Rotation Speed",
"create.gui.stressometer.title": "Network Stress",