This commit is contained in:
attackeight 2024-04-16 00:39:46 +00:00 committed by GitHub
commit ff3340237b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 812 additions and 34 deletions

View file

@ -582,8 +582,8 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
5616dda664dd106d576848124fc0fc1de18d0fd3 assets/create/blockstates/yellow_valve_handle.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
390244ea1a4e56fb33c66490a033bd0b4870d0b8 assets/create/lang/en_ud.json
9d2ef7ec16aec62ac33b2c0debb6b368d0fdf7f8 assets/create/lang/en_us.json
1a1d2043da072a75d5e4dff42ef7434ed07cf2c3 assets/create/lang/en_ud.json
5592d94106823c42d666791c54947004172888f8 assets/create/lang/en_us.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
@ -5012,7 +5012,7 @@ e6aa8895186358e9d069f5a99909132be49f3bf1 data/create/recipes/diorite_from_stone_
a90268d38f976327ff5e1b87ff1d72ca2d1ebad6 data/create/recipes/dripstone_block_from_stone_types_dripstone_stonecutting.json
27d9bf05a610447e90314e658dbbcd191f378fc9 data/create/recipes/dripstone_pillar_from_stone_types_dripstone_stonecutting.json
d81ceba2946286d374801e698a4ca2116395cbad data/create/recipes/emptying/builders_tea.json
318ab703224ff1d6f7200675e1e0a4c138b28456 data/create/recipes/emptying/compat/alexsmobs/lava_bottle.json
d62f4682fe6cc61df5a1c0231a2004a4ee78a329 data/create/recipes/emptying/compat/alexsmobs/lava_bottle.json
c26d003e921720308c05ad7b9f3cb57de94a10a8 data/create/recipes/emptying/compat/farmersdelight/milk_bottle.json
60c0edfb5b759e4f13427b631861f503f8552923 data/create/recipes/emptying/compat/neapolitan/milk_bottle.json
20b7c7c62fa2e33199e08188dd8836844a6d9cfd data/create/recipes/emptying/honey_bottle.json

View file

@ -948,12 +948,31 @@
"create.display_source.computer_display_source": "\u0279\u01DD\u0287nd\u026Fo\u0186 \u026Fo\u0279\u2132",
"create.display_source.count_items": "s\u026F\u01DD\u0287I bu\u0131\u0265\u0254\u0287\u0250\u026F \u025Fo \u0287uno\u026F\u2C6F",
"create.display_source.current_floor": "uo\u0131\u0287\u0250\u0254o\uA780 \u0279o\u0287\u0250\u028C\u01DD\u05DF\u018E",
"create.display_source.elevator_pulley.bottom_distance_int": "s\u029E\u0254o\u05DF\u15FA \u026Fo\u0287\u0287o\u15FA",
"create.display_source.elevator_pulley.bottom_distance_percent": "\u0287u\u01DD\u0254\u0279\u01DD\u0500 \u026Fo\u0287\u0287o\u15FA",
"create.display_source.elevator_pulley.bottom_distance_progress_bar": "\u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500 \u026Fo\u0287\u0287o\u15FA",
"create.display_source.elevator_pulley.current_floor": "\u0279oo\u05DF\u2132 \u0287u\u01DD\u0279\u0279n\u0186",
"create.display_source.elevator_pulley.current_floor_description": "uo\u0131\u0287d\u0131\u0279\u0254s\u01DD\u15E1 \u0279oo\u05DF\u2132 \u0287u\u01DD\u0279\u0279n\u0186",
"create.display_source.elevator_pulley.display": "o\u025FuI p\u01DD\u028E\u0250\u05DFds\u0131\u15E1",
"create.display_source.elevator_pulley.floor_count": "\u0287uno\u0186 \u0279oo\u05DF\u2132",
"create.display_source.elevator_pulley.top_distance_int": "s\u029E\u0254o\u05DF\u15FA do\u27D8",
"create.display_source.elevator_pulley.top_distance_percent": "\u0287u\u01DD\u0254\u0279\u01DD\u0500 do\u27D8",
"create.display_source.elevator_pulley.top_distance_progress_bar": "\u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500 do\u27D8",
"create.display_source.elevator_pulley_source": "\u028E\u01DD\u05DF\u05DFn\u0500 \u0279o\u0287\u0250\u028C\u01DD\u05DF\u018E",
"create.display_source.entity_name": "\u01DD\u026F\u0250N \u028E\u0287\u0131\u0287u\u018E",
"create.display_source.fill_level": "\u05DF\u01DD\u028C\u01DD\uA780 \u05DF\u05DF\u0131\u2132 \u0279\u01DDu\u0131\u0250\u0287uo\u0186",
"create.display_source.fill_level.display": "\u0287\u0250\u026F\u0279o\u2132 \u028E\u0250\u05DFds\u0131\u15E1",
"create.display_source.fill_level.percent": "\u0287u\u01DD\u0254\u0279\u01DD\u0500",
"create.display_source.fill_level.progress_bar": "\u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500",
"create.display_source.fluid_amount": "sp\u0131n\u05DF\u2132 bu\u0131\u0265\u0254\u0287\u0250\u026F \u025Fo \u0287uno\u026F\u2C6F",
"create.display_source.hose_pulley.display": "o\u025FuI p\u01DD\u028E\u0250\u05DFds\u0131\u15E1",
"create.display_source.hose_pulley.fluid": "p\u0131n\u05DF\u2132",
"create.display_source.hose_pulley.fluid_count": "\u0287uno\u0186 p\u0131n\u05DF\u2132",
"create.display_source.hose_pulley.percent_empty": "\u028E\u0287d\u026F\u018E o\u0287 \u0287u\u01DD\u0254\u0279\u01DD\u0500",
"create.display_source.hose_pulley.percent_infinite": "\u01DD\u0287\u0131u\u0131\u025FuI o\u0287 \u0287u\u01DD\u0254\u0279\u01DD\u0500",
"create.display_source.hose_pulley.progress_bar_empty": "\u028E\u0287d\u026F\u018E o\u0287 \u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500",
"create.display_source.hose_pulley.progress_bar_infinite": "\u01DD\u0287\u0131u\u0131\u025FuI o\u0287 \u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500",
"create.display_source.hose_pulley_source": "\u028E\u01DD\u05DF\u05DFn\u0500 \u01DDsoH",
"create.display_source.item_throughput": "\u0287nd\u0265bno\u0279\u0265\u27D8 \u026F\u01DD\u0287I",
"create.display_source.item_throughput.interval": "\u05DF\u0250\u028C\u0279\u01DD\u0287uI",
"create.display_source.item_throughput.interval.hour": "\u0279noH \u0279\u01DDd",
@ -973,6 +992,13 @@
"create.display_source.list_fluids": "sp\u0131n\u05DF\u2132 bu\u0131\u0265\u0254\u0287\u0250\u026F \u0287s\u0131\uA780",
"create.display_source.list_items": "s\u026F\u01DD\u0287I bu\u0131\u0265\u0254\u0287\u0250\u026F \u0287s\u0131\uA780",
"create.display_source.max_enchant_level": "\u0287so\u0186 bu\u0131\u0287u\u0250\u0265\u0254u\u018E x\u0250W",
"create.display_source.mechanical_bearing_source": "bu\u0131\u0279\u0250\u01DD\u15FA \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW",
"create.display_source.mechanical_piston.blocks": "s\u029E\u0254o\u05DF\u15FA",
"create.display_source.mechanical_piston.blocks_max": "s\u029E\u0254o\u05DF\u15FA x\u0250W",
"create.display_source.mechanical_piston.display": "o\u025FuI p\u01DD\u028E\u0250\u05DFds\u0131\u15E1",
"create.display_source.mechanical_piston.percent": "\u0287u\u01DD\u0254\u0279\u01DD\u0500",
"create.display_source.mechanical_piston.progress_bar": "\u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500",
"create.display_source.mechanical_piston_source": "uo\u0287s\u0131\u0500 \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW",
"create.display_source.nixie_tube": "s\u01DDqn\u27D8 \u01DD\u0131x\u0131N \u028Edo\u0186",
"create.display_source.observed_train_name": "\u01DD\u026F\u0250N u\u0131\u0250\u0279\u27D8 p\u01DD\u0287\u0254\u01DD\u0287\u01DD\u15E1",
"create.display_source.player_deaths": "s\u0265\u0287\u0250\u01DD\u15E1 \u0279\u01DD\u028E\u0250\u05DF\u0500",
@ -980,6 +1006,12 @@
"create.display_source.redstone_power.display": "\u0287\u0250\u026F\u0279o\u2132 \u028E\u0250\u05DFds\u0131\u15E1",
"create.display_source.redstone_power.number": "\u0279\u01DDq\u026FnN",
"create.display_source.redstone_power.progress_bar": "\u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500",
"create.display_source.rope_pulley.blocks": "s\u029E\u0254o\u05DF\u15FA",
"create.display_source.rope_pulley.blocks_max": "s\u029E\u0254o\u05DF\u15FA x\u0250W",
"create.display_source.rope_pulley.display": "o\u025FuI p\u01DD\u028E\u0250\u05DFds\u0131\u15E1",
"create.display_source.rope_pulley.percent": "\u0287u\u01DD\u0254\u0279\u01DD\u0500",
"create.display_source.rope_pulley.progress_bar": "\u0279\u0250\u15FA ss\u01DD\u0279bo\u0279\u0500",
"create.display_source.rope_pulley_source": "\u028E\u01DD\u05DF\u05DFn\u0500 \u01DDdo\u1D1A",
"create.display_source.scoreboard": "p\u0279\u0250oq\u01DD\u0279o\u0254S",
"create.display_source.scoreboard.objective": "\u15E1I \u01DD\u028C\u0131\u0287\u0254\u01DD\u0638qO",
"create.display_source.scoreboard.objective.deaths": "s\u0265\u0287\u0250\u01DD\u15E1 \u0279\u01DD\u028E\u0250\u05DF\u0500",

View file

@ -948,12 +948,31 @@
"create.display_source.computer_display_source": "From Computer",
"create.display_source.count_items": "Amount of matching Items",
"create.display_source.current_floor": "Elevator Location",
"create.display_source.elevator_pulley.bottom_distance_int": "Bottom Blocks",
"create.display_source.elevator_pulley.bottom_distance_percent": "Bottom Percent",
"create.display_source.elevator_pulley.bottom_distance_progress_bar": "Bottom Progress Bar",
"create.display_source.elevator_pulley.current_floor": "Current Floor",
"create.display_source.elevator_pulley.current_floor_description": "Current Floor Description",
"create.display_source.elevator_pulley.display": "Displayed Info",
"create.display_source.elevator_pulley.floor_count": "Floor Count",
"create.display_source.elevator_pulley.top_distance_int": "Top Blocks",
"create.display_source.elevator_pulley.top_distance_percent": "Top Percent",
"create.display_source.elevator_pulley.top_distance_progress_bar": "Top Progress Bar",
"create.display_source.elevator_pulley_source": "Elevator Pulley",
"create.display_source.entity_name": "Entity Name",
"create.display_source.fill_level": "Container Fill Level",
"create.display_source.fill_level.display": "Display Format",
"create.display_source.fill_level.percent": "Percent",
"create.display_source.fill_level.progress_bar": "Progress Bar",
"create.display_source.fluid_amount": "Amount of matching Fluids",
"create.display_source.hose_pulley.display": "Displayed Info",
"create.display_source.hose_pulley.fluid": "Fluid",
"create.display_source.hose_pulley.fluid_count": "Fluid Count",
"create.display_source.hose_pulley.percent_empty": "Percent to Empty",
"create.display_source.hose_pulley.percent_infinite": "Percent to Infinite",
"create.display_source.hose_pulley.progress_bar_empty": "Progress Bar to Empty",
"create.display_source.hose_pulley.progress_bar_infinite": "Progress Bar to Infinite",
"create.display_source.hose_pulley_source": "Hose Pulley",
"create.display_source.item_throughput": "Item Throughput",
"create.display_source.item_throughput.interval": "Interval",
"create.display_source.item_throughput.interval.hour": "per Hour",
@ -973,6 +992,13 @@
"create.display_source.list_fluids": "List matching Fluids",
"create.display_source.list_items": "List matching Items",
"create.display_source.max_enchant_level": "Max Enchanting Cost",
"create.display_source.mechanical_bearing_source": "Mechanical Bearing",
"create.display_source.mechanical_piston.blocks": "Blocks",
"create.display_source.mechanical_piston.blocks_max": "Max Blocks",
"create.display_source.mechanical_piston.display": "Displayed Info",
"create.display_source.mechanical_piston.percent": "Percent",
"create.display_source.mechanical_piston.progress_bar": "Progress Bar",
"create.display_source.mechanical_piston_source": "Mechanical Piston",
"create.display_source.nixie_tube": "Copy Nixie Tubes",
"create.display_source.observed_train_name": "Detected Train Name",
"create.display_source.player_deaths": "Player Deaths",
@ -980,6 +1006,12 @@
"create.display_source.redstone_power.display": "Display Format",
"create.display_source.redstone_power.number": "Number",
"create.display_source.redstone_power.progress_bar": "Progress Bar",
"create.display_source.rope_pulley.blocks": "Blocks",
"create.display_source.rope_pulley.blocks_max": "Max Blocks",
"create.display_source.rope_pulley.display": "Displayed Info",
"create.display_source.rope_pulley.percent": "Percent",
"create.display_source.rope_pulley.progress_bar": "Progress Bar",
"create.display_source.rope_pulley_source": "Rope Pulley",
"create.display_source.scoreboard": "Scoreboard",
"create.display_source.scoreboard.objective": "Objective ID",
"create.display_source.scoreboard.objective.deaths": "Player Deaths",

View file

@ -16,7 +16,7 @@
],
"conditions": [
{
"modid": "atmospheric",
"modid": "alexsmobs",
"type": "forge:mod_loaded"
}
]

View file

@ -185,6 +185,12 @@ import com.simibubi.create.content.redstone.diodes.PulseExtenderBlockEntity;
import com.simibubi.create.content.redstone.diodes.PulseRepeaterBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkRenderer;
import com.simibubi.create.content.redstone.displayLink.source.ElevatorPulleyDisplaySource;
import com.simibubi.create.content.redstone.displayLink.source.GantryShaftDisplaySource;
import com.simibubi.create.content.redstone.displayLink.source.HosePulleyDisplaySource;
import com.simibubi.create.content.redstone.displayLink.source.MechanicalBearingDisplaySource;
import com.simibubi.create.content.redstone.displayLink.source.MechanicalPistonDisplaySource;
import com.simibubi.create.content.redstone.displayLink.source.PulleyDisplaySource;
import com.simibubi.create.content.redstone.displayLink.source.NixieTubeDisplaySource;
import com.simibubi.create.content.redstone.displayLink.target.NixieTubeDisplayTarget;
import com.simibubi.create.content.redstone.link.RedstoneLinkBlockEntity;
@ -322,7 +328,7 @@ public class AllBlockEntityTypes {
.validBlocks(AllBlocks.HAND_CRANK)
.renderer(() -> HandCrankRenderer::new)
.register();
public static final BlockEntityEntry<ValveHandleBlockEntity> VALVE_HANDLE = REGISTRATE
.blockEntity("valve_handle", ValveHandleBlockEntity::new)
.instance(() -> HandCrankInstance::new)
@ -343,6 +349,7 @@ public class AllBlockEntityTypes {
.instance(() -> SingleRotatingInstance::new, false)
.validBlocks(AllBlocks.GANTRY_SHAFT)
.renderer(() -> KineticBlockEntityRenderer::new)
.onRegister(assignDataBehaviourBE(new GantryShaftDisplaySource()))
.register();
public static final BlockEntityEntry<GantryCarriageBlockEntity> GANTRY_PINION = REGISTRATE
@ -405,6 +412,7 @@ public class AllBlockEntityTypes {
.instance(() -> HosePulleyInstance::new)
.validBlocks(AllBlocks.HOSE_PULLEY)
.renderer(() -> HosePulleyRenderer::new)
.onRegister(assignDataBehaviourBE(new HosePulleyDisplaySource()))
.register();
public static final BlockEntityEntry<SpoutBlockEntity> SPOUT = REGISTRATE
@ -469,6 +477,7 @@ public class AllBlockEntityTypes {
.instance(() -> ShaftInstance::new, false)
.validBlocks(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON)
.renderer(() -> MechanicalPistonRenderer::new)
.onRegister(assignDataBehaviourBE(new MechanicalPistonDisplaySource()))
.register();
public static final BlockEntityEntry<WindmillBearingBlockEntity> WINDMILL_BEARING = REGISTRATE
@ -483,6 +492,7 @@ public class AllBlockEntityTypes {
.instance(() -> BearingInstance::new)
.validBlocks(AllBlocks.MECHANICAL_BEARING)
.renderer(() -> BearingRenderer::new)
.onRegister(assignDataBehaviourBE(new MechanicalBearingDisplaySource()))
.register();
public static final BlockEntityEntry<ClockworkBearingBlockEntity> CLOCKWORK_BEARING = REGISTRATE
@ -497,6 +507,7 @@ public class AllBlockEntityTypes {
.instance(() -> RopePulleyInstance::new, false)
.validBlocks(AllBlocks.ROPE_PULLEY)
.renderer(() -> PulleyRenderer::new)
.onRegister(assignDataBehaviourBE(new PulleyDisplaySource()))
.register();
public static final BlockEntityEntry<ElevatorPulleyBlockEntity> ELEVATOR_PULLEY =
@ -504,6 +515,7 @@ public class AllBlockEntityTypes {
// .instance(() -> ElevatorPulleyInstance::new, false)
.validBlocks(AllBlocks.ELEVATOR_PULLEY)
.renderer(() -> ElevatorPulleyRenderer::new)
.onRegister(assignDataBehaviourBE(new ElevatorPulleyDisplaySource()))
.register();
public static final BlockEntityEntry<ElevatorContactBlockEntity> ELEVATOR_CONTACT =
@ -708,7 +720,7 @@ public class AllBlockEntityTypes {
.validBlocks(AllBlocks.ANALOG_LEVER)
.renderer(() -> AnalogLeverRenderer::new)
.register();
public static final BlockEntityEntry<PlacardBlockEntity> PLACARD = REGISTRATE
.blockEntity("placard", PlacardBlockEntity::new)
.validBlocks(AllBlocks.PLACARD)
@ -835,7 +847,7 @@ public class AllBlockEntityTypes {
.validBlocksDeferred(TrackMaterial::allBlocks)
.renderer(() -> TrackRenderer::new)
.register();
public static final BlockEntityEntry<FakeTrackBlockEntity> FAKE_TRACK = REGISTRATE
.blockEntity("fake_track", FakeTrackBlockEntity::new)
.validBlocks(AllBlocks.FAKE_TRACK)
@ -883,7 +895,7 @@ public class AllBlockEntityTypes {
.renderer(() -> TrackObserverRenderer::new)
.validBlocks(AllBlocks.TRACK_OBSERVER)
.register();
public static final BlockEntityEntry<ClipboardBlockEntity> CLIPBOARD = REGISTRATE
.blockEntity("clipboard", ClipboardBlockEntity::new)
.validBlocks(AllBlocks.CLIPBOARD)

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.bearing;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.AssemblyException;
@ -326,6 +327,7 @@ public class MechanicalBearingBlockEntity extends GeneratingKineticBlockEntity
public boolean isRunning() {
return running;
}
public float getAngle() { return angle; }
@Override
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {

View file

@ -37,6 +37,7 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
protected boolean waitingForSpeedChange;
protected AssemblyException lastException;
protected double sequencedOffsetLimit;
protected int extensionLength;
// Custom position sync
protected float clientOffsetDiff;
@ -58,7 +59,7 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
behaviours.add(movementMode);
registerAwardables(behaviours, AllAdvancements.CONTRAPTION_ACTORS);
}
@Override
protected boolean syncSequenceContext() {
return true;
@ -74,7 +75,7 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
if (isPassive())
return;
if (level.isClientSide)
clientOffsetDiff *= .75f;
@ -134,7 +135,7 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
resetContraptionToOffset();
sendData();
}
if (contraptionPresent) {
if (moveAndCollideContraption()) {
movedContraption.setContraptionMotion(Vec3.ZERO);
@ -167,7 +168,7 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
protected boolean isPassive() {
return false;
}
@Override
public void lazyTick() {
super.lazyTick();
@ -189,10 +190,10 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
public void onSpeedChanged(float prevSpeed) {
super.onSpeedChanged(prevSpeed);
sequencedOffsetLimit = -1;
if (isPassive())
return;
assembleNextTick = true;
waitingForSpeedChange = false;
@ -267,7 +268,7 @@ public abstract class LinearActuatorBlockEntity extends KineticBlockEntity
protected abstract void assemble() throws AssemblyException;
protected abstract int getExtensionRange();
public abstract int getExtensionRange();
protected abstract int getInitialOffset();

View file

@ -87,7 +87,7 @@ public class MechanicalPistonBlockEntity extends LinearActuatorBlockEntity {
level.addFreshEntity(movedContraption);
AllSoundEvents.CONTRAPTION_ASSEMBLE.playOnServer(level, worldPosition);
if (contraption.containsBlockBreakers())
award(AllAdvancements.CONTRAPTION_ACTORS);
}
@ -138,7 +138,7 @@ public class MechanicalPistonBlockEntity extends LinearActuatorBlockEntity {
}
@Override
protected int getExtensionRange() {
public int getExtensionRange() {
return extensionLength;
}

View file

@ -7,6 +7,7 @@ import java.util.List;
import javax.annotation.Nullable;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBogeyStyles;
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.AssemblyException;
import com.simibubi.create.content.contraptions.BlockMovementChecks;
@ -23,17 +24,24 @@ import com.simibubi.create.infrastructure.config.AllConfigs;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.Tags;
import static com.simibubi.create.Create.LOGGER;
public class PulleyBlockEntity extends LinearActuatorBlockEntity implements ThresholdSwitchObservable {
@ -43,6 +51,7 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
protected BlockPos mirrorParent;
protected List<BlockPos> mirrorChildren;
public WeakReference<AbstractContraptionEntity> sharedMirrorContraption;
public int lastContraptionPos = -1;
public PulleyBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
@ -169,6 +178,7 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
clientOffsetDiff = 0;
running = true;
lastContraptionPos = -1;
sendData();
}
@ -189,6 +199,8 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
if (movedContraption != null)
resetContraptionToOffset();
lastContraptionPos = (int)movedContraption.getY();
if (!level.isClientSide) {
if (shouldCreateRopes()) {
if (offset > 0) {
@ -339,8 +351,37 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
notifyUpdate();
}
private final List<Block> airblocks = List.of(Blocks.AIR, Blocks.WATER, Blocks.LAVA, AllBlocks.ROPE.get(), AllBlocks.PULLEY_MAGNET.get());
public float blocksToGround() {
int y = getBlockPos().getY();
y --;
int blocksBelow = 0;
while (true) {
Block blockatY = level.getBlockState(getBlockPos().atY(y)).getBlock();
if (airblocks.contains(blockatY) || y == lastContraptionPos) {
y--;
blocksBelow ++;
} else {
break;
}
}
return blocksBelow;
}
public float getOffset() {
if (lastContraptionPos != -1 ) {
return worldPosition.getY() - lastContraptionPos;
} else if (getAttachedContraption() != null) {
return (float)worldPosition.getY() - (float)getAttachedContraption().getY();
} else {
return offset;
}
}
@Override
protected int getExtensionRange() {
public int getExtensionRange() {
return Math.max(0, Math.min(AllConfigs.server().kinetics.maxRopeLength.get(),
(worldPosition.getY() - 1) - level.getMinBuildHeight()));
}

View file

@ -31,10 +31,10 @@ public class HosePulleyBlockEntity extends KineticBlockEntity {
private SmartFluidTank internalTank;
private LazyOptional<IFluidHandler> capability;
private FluidDrainingBehaviour drainer;
private FluidFillingBehaviour filler;
private HosePulleyFluidHandler handler;
private boolean infinite;
public FluidDrainingBehaviour drainer;
public FluidFillingBehaviour filler;
public HosePulleyFluidHandler handler;
public boolean infinite;
public HosePulleyBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
super(typeIn, pos, state);
@ -191,4 +191,8 @@ public class HosePulleyBlockEntity extends KineticBlockEntity {
return this.capability.cast();
return super.getCapability(cap, side);
}
public SmartFluidTank getInternalTank() {
return internalTank;
}
}

View file

@ -38,6 +38,9 @@ public class HosePulleyFluidHandler implements IFluidHandler {
}
}
drainer.resetBlocksFilled();
drainer.inUse = false;
filler.inUse = true;
if (action.simulate())
return diff <= 0 ? resource.getAmount() : internalTank.fill(remaining, action);
if (diff <= 0) {
@ -76,6 +79,9 @@ public class HosePulleyFluidHandler implements IFluidHandler {
return internalTank.drain(maxDrain, action);
filler.counterpartActed();
filler.resetBlocksFilled();
filler.inUse = false;
drainer.inUse = true;
FluidStack leftover = returned.copy();
int available = 1000 + internalTank.getFluidAmount();
int drained;

View file

@ -47,6 +47,9 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
Set<BlockPos> validationVisited;
Set<BlockPos> newValidationSet;
int blocksFilled = -1;
public boolean inUse = true;
public FluidDrainingBehaviour(SmartBlockEntity be) {
super(be);
validationVisited = new HashSet<>();
@ -278,6 +281,9 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
visited.clear();
}
if (inUse)
blocksFilled = visited.size();
int maxBlocks = maxBlocks();
if (visited.size() > maxBlocks && canDrainInfinitely(fluid) && !queue.isEmpty()) {
infinite = true;
@ -324,6 +330,9 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
return;
}
if (inUse)
blocksFilled = validationVisited.size();
validationSet = newValidationSet;
newValidationSet = new HashSet<>();
validationVisited.clear();
@ -357,4 +366,11 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
: new FluidStack(fluid, 1000);
}
public int getBlocksFilled() {
return blocksFilled;
}
public void resetBlocksFilled() {
blocksFilled = -1;
}
}

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
import com.simibubi.create.content.schematics.requirement.ItemRequirement;
import com.simibubi.create.foundation.advancement.AllAdvancements;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BehaviourType;
@ -49,6 +50,9 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour {
List<BlockPosEntry> infinityCheckFrontier;
Set<BlockPos> infinityCheckVisited;
int blocksFilled = -1;
public boolean inUse = true;
public FluidFillingBehaviour(SmartBlockEntity be) {
super(be);
queue = new ObjectHeapPriorityQueue<>((p, p2) -> -comparePositions(p, p2));
@ -96,6 +100,8 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour {
if (!infinityCheckFrontier.isEmpty())
return;
if (inUse)
blocksFilled = infinityCheckVisited.size();
if (infinite) {
reset();
return;
@ -316,4 +322,11 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour {
return TYPE;
}
public int getBlocksFilled() {
return blocksFilled;
}
public void resetBlocksFilled() {
blocksFilled = -1;
}
}

View file

@ -13,6 +13,9 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import static com.simibubi.create.content.kinetics.base.DirectionalKineticBlock.FACING;
import static com.simibubi.create.content.kinetics.gantry.GantryShaftBlock.PART;
public class GantryShaftBlockEntity extends KineticBlockEntity {
public GantryShaftBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
@ -23,7 +26,7 @@ public class GantryShaftBlockEntity extends KineticBlockEntity {
protected boolean syncSequenceContext() {
return true;
}
public void checkAttachedCarriageBlocks() {
if (!canAssembleOn())
return;
@ -112,4 +115,121 @@ public class GantryShaftBlockEntity extends KineticBlockEntity {
return false;
}
public int attachedShafts() {
if (level.getBlockState(worldPosition).getBlock() instanceof GantryShaftBlock) {
BlockState state = level.getBlockState(worldPosition);
Direction facing = state.getValue(GantryShaftBlock.FACING);
GantryShaftBlock.Part part = state.getValue(PART);
int toReturn = 1;
int yOffset = 1;
if (part.equals(GantryShaftBlock.Part.START)) {
while (true) {
BlockState targetBlockState = level.getBlockState(worldPosition.relative(facing, yOffset));
if (targetBlockState.getBlock() instanceof GantryShaftBlock) {
if (targetBlockState.getValue(FACING).equals(facing)) {
toReturn++;
yOffset++;
} else {
break;
}
} else {
break;
}
}
} else if (part.equals(GantryShaftBlock.Part.END)) {
yOffset = -1;
while (true) {
BlockState targetBlockState = level.getBlockState(worldPosition.relative(facing, yOffset));
if (targetBlockState.getBlock() instanceof GantryShaftBlock) {
if (targetBlockState.getValue(FACING).equals(facing)) {
toReturn++;
yOffset--;
} else {
break;
}
} else {
break;
}
}
} else if (part.equals(GantryShaftBlock.Part.MIDDLE)) {
while (true) {
BlockState targetBlockState = level.getBlockState(worldPosition.relative(facing, yOffset));
if (targetBlockState.getBlock() instanceof GantryShaftBlock) {
if (targetBlockState.getValue(FACING).equals(facing)) {
toReturn++;
yOffset++;
} else {
break;
}
} else {
break;
}
}
yOffset = -1;
while (true) {
BlockState targetBlockState = level.getBlockState(worldPosition.relative(facing, yOffset));
if (targetBlockState.getBlock() instanceof GantryShaftBlock) {
if (targetBlockState.getValue(FACING).equals(facing)) {
toReturn++;
yOffset--;
} else {
break;
}
} else {
break;
}
}
}
return toReturn;
}
return -1;
}
public int findGantryOffset() {
if (getBlockState().getBlock() instanceof GantryShaftBlock) {
if (level.getBlockEntity(getBlockPos()) instanceof GantryShaftBlockEntity gsbe) {
int start = gsbe.startPos();
BlockPos startPos = switch (getBlockState().getValue(FACING).getAxis()) {
case X -> new BlockPos(start, getBlockPos().getY(), getBlockPos().getZ());
case Y -> new BlockPos(getBlockPos().getX(), start, getBlockPos().getZ());
case Z -> new BlockPos(getBlockPos().getX(), getBlockPos().getY(), start);
};
int offset = 0;
while (true) {
BlockPos targetBlockPos = startPos.relative(getBlockState().getValue(FACING), offset);
if (!(level.getBlockEntity(targetBlockPos) instanceof GantryShaftBlockEntity))
break;
offset ++;
for (Direction d: Direction.values()) {
if (level.getBlockEntity(targetBlockPos.relative(d)) instanceof GantryCarriageBlockEntity) {
return offset;
}
}
}
}
}
return -1;
}
public int startPos() {
if (getBlockState().getBlock() instanceof GantryShaftBlock) {
BlockState state = getBlockState();
Direction facing = state.getValue(GantryShaftBlock.FACING);
GantryShaftBlock.Part part = state.getValue(PART);
if (part.equals(GantryShaftBlock.Part.START) || part.equals(GantryShaftBlock.Part.SINGLE)) {
return getBlockPos().get(facing.getAxis());
} else if (part.equals(GantryShaftBlock.Part.END) || part.equals(GantryShaftBlock.Part.MIDDLE)) {
int offset = -1;
while (true) {
BlockState targetBlockState = level.getBlockState(worldPosition.relative(facing, offset));
if (targetBlockState.getValue(PART).equals(GantryShaftBlock.Part.START)) {
return worldPosition.relative(facing, offset).get(facing.getAxis());
} else {
offset--;
}
}
}
}
return -1;
}
}

View file

@ -0,0 +1,149 @@
package com.simibubi.create.content.redstone.displayLink.source;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.Contraption;
import com.simibubi.create.content.contraptions.elevator.ElevatorContraption;
import com.simibubi.create.content.contraptions.elevator.ElevatorPulleyBlockEntity;
import com.simibubi.create.content.contraptions.piston.LinearActuatorBlockEntity;
import com.simibubi.create.content.contraptions.pulley.PulleyBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.IntAttached;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.system.CallbackI;
import java.util.Objects;
public class ElevatorPulleyDisplaySource extends PercentOrProgressBarDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof ElevatorPulleyBlockEntity epbe))
return null;
if (epbe.movedContraption == null)
return new TextComponent("");
Contraption movedContraption = epbe.movedContraption.getContraption();
if (!(movedContraption instanceof ElevatorContraption ec))
return null;
int mode = context.sourceConfig().getInt("Mode");
return switch (mode) {
case 0 -> new TextComponent(String.valueOf(floorCount(ec)));
case 1 -> new TextComponent(String.valueOf(targetFloor(epbe, ec)));
case 2 -> new TextComponent(String.valueOf(targetFloorDescription(epbe, ec)));
case 3 -> new TextComponent(String.valueOf(distanceToTop(epbe, ec)));
case 6 -> new TextComponent(String.valueOf(distanceToBottom(epbe, ec)));
default -> super.provideLine(context, stats);
};
}
private float shaftHeight(ElevatorPulleyBlockEntity epbe,ElevatorContraption ec) {
return (float)topFloorY(epbe, ec) - bottomFloorY(epbe, ec);
}
private float distanceToTop(ElevatorPulleyBlockEntity epbe, ElevatorContraption ec) {
int contraptionY = epbe.getBlockPosition().getY() - (int)epbe.offset;
contraptionY --;
return (float)Math.abs(topFloorY(epbe, ec) - contraptionY);
}
private float distanceToBottom(ElevatorPulleyBlockEntity epbe, ElevatorContraption ec) {
int contraptionY = epbe.getBlockPosition().getY() - (int)epbe.offset;
contraptionY --;
return (float)Math.abs(contraptionY - bottomFloorY(epbe, ec));
}
private float topFloorY(ElevatorPulleyBlockEntity epbe, ElevatorContraption ec) {
int topFloorY = epbe.getLevel().getMinBuildHeight();
for (IntAttached<Couple<String>> floor : ec.namesList) {
topFloorY = Math.max(floor.getFirst(), topFloorY);
}
return topFloorY;
}
private float bottomFloorY(ElevatorPulleyBlockEntity epbe, ElevatorContraption ec) {
int bottomFloorY = epbe.getLevel().getMaxBuildHeight();
for (IntAttached<Couple<String>> floor : ec.namesList) {
bottomFloorY = Math.min(floor.getFirst(), bottomFloorY);
}
return (float)bottomFloorY;
}
private int floorCount(ElevatorContraption ec) {
return ec.namesList.size();
}
private String targetFloor(ElevatorPulleyBlockEntity epbe, ElevatorContraption ec) {
IntAttached<Couple<String>> targetFloor = null;
for (IntAttached<Couple<String>> floor : ec.namesList) {
if (Objects.equals(floor.getFirst(), ec.getCurrentTargetY(epbe.getLevel()))) {
targetFloor = floor;
}
}
return targetFloor != null ? targetFloor.getValue().getFirst() : "";
}
private String targetFloorDescription(ElevatorPulleyBlockEntity epbe, ElevatorContraption ec) {
IntAttached<Couple<String>> targetFloor = null;
for (IntAttached<Couple<String>> floor : ec.namesList) {
if (Objects.equals(floor.getFirst(), ec.getCurrentTargetY(epbe.getLevel()))) {
targetFloor = floor;
}
}
return targetFloor != null ? targetFloor.getValue().getSecond() : "";
}
@Nullable
@Override
protected Float getProgress(DisplayLinkContext context) {
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof ElevatorPulleyBlockEntity epbe))
return null;
Contraption movedContraption = epbe.movedContraption.getContraption();
if (!(movedContraption instanceof ElevatorContraption ec))
return null;
int mode = context.sourceConfig().getInt("Mode");
return switch (mode) {
case 4,5 -> distanceToBottom(epbe, ec)/shaftHeight(epbe, ec);
case 7,8 -> distanceToTop(epbe, ec)/shaftHeight(epbe, ec);
default -> 0f;
};
}
@Override
protected boolean progressBarActive(DisplayLinkContext context) {
int mode = context.sourceConfig().getInt("Mode");
return mode == 5 || mode == 8;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine)
return;
builder.addSelectionScrollInput(0, 138,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.elevator_pulley",
"floor_count", "current_floor", "current_floor_description", "top_distance_int", "top_distance_percent", "top_distance_progress_bar",
"bottom_distance_int", "bottom_distance_percent", "bottom_distance_progress_bar"))
.titled(Lang.translateDirect("display_source.elevator_pulley.display")),
"Mode");
}
@Override
protected boolean allowsLabeling(DisplayLinkContext context) {
return true;
}
}

View file

@ -0,0 +1,64 @@
package com.simibubi.create.content.redstone.displayLink.source;
import org.jetbrains.annotations.Nullable;
import com.simibubi.create.content.kinetics.gantry.GantryShaftBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class GantryShaftDisplaySource extends PercentOrProgressBarDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
int mode = context.sourceConfig().getInt("Mode");
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof GantryShaftBlockEntity gsbe))
return null;
gsbe.checkAttachedCarriageBlocks();
return switch (mode) {
case 2 -> new TextComponent(String.valueOf(gsbe.findGantryOffset()));
case 3 -> new TextComponent(String.valueOf(gsbe.attachedShafts()));
default -> super.provideLine(context, stats);
};
}
@Nullable
@Override
protected Float getProgress(DisplayLinkContext context) {
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof GantryShaftBlockEntity gsbe))
return null;
return (float)gsbe.findGantryOffset()/(float)gsbe.attachedShafts();
}
@Override
protected boolean progressBarActive(DisplayLinkContext context) {
return context.sourceConfig().getInt("Mode") == 1;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine)
return;
builder.addSelectionScrollInput(0, 137,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.gantry_shaft",
"percent", "progress_bar", "blocks", "blocks_max"))
.titled(Lang.translateDirect("display_source.gantry_shaft.display")),
"Mode");
}
@Override
protected boolean allowsLabeling(DisplayLinkContext context) {
return true;
}
}

View file

@ -0,0 +1,95 @@
package com.simibubi.create.content.redstone.displayLink.source;
import com.simibubi.create.content.contraptions.piston.MechanicalPistonBlockEntity;
import com.simibubi.create.content.fluids.hosePulley.HosePulleyBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.infrastructure.config.AllConfigs;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.Nullable;
public class HosePulleyDisplaySource extends PercentOrProgressBarDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
int mode = context.sourceConfig().getInt("Mode");
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof HosePulleyBlockEntity hpbe))
return null;
return switch (mode) {
case 0 -> new TextComponent(I18n.get(hpbe.getInternalTank().getFluid().getTranslationKey()));
case 1 -> new TextComponent(String.valueOf(blocksFilled(hpbe)));
default -> super.provideLine(context, stats);
};
}
private int blocksFilled(HosePulleyBlockEntity hpbe) {
int filler = hpbe.filler.getBlocksFilled();
int drainer = hpbe.drainer.getBlocksFilled();
if (hpbe.infinite)
return maxBlocks();
if ((filler == -1 && drainer == -1) || hpbe.getInternalTank().getFluid().getFluid().isSame(Fluids.EMPTY))
return 0;
if (filler == -1) {
return drainer;
} else if (drainer == -1) {
return filler;
} else {
return 0;
}
}
private int maxBlocks() {
return AllConfigs.server().fluids.hosePulleyBlockThreshold.get();
}
@Nullable
@Override
protected Float getProgress(DisplayLinkContext context) {
BlockEntity be = context.getSourceBlockEntity();
int mode = context.sourceConfig().getInt("Mode");
if (!(be instanceof HosePulleyBlockEntity hpbe))
return null;
if (mode == 2 || mode == 3)
return (float)blocksFilled(hpbe)/(float)maxBlocks();
if (mode == 4 || mode == 5)
return Math.abs(1 - ((float)blocksFilled(hpbe)/(float)maxBlocks()));
return 0f;
}
@Override
protected boolean progressBarActive(DisplayLinkContext context) {
int mode = context.sourceConfig().getInt("Mode");
return mode == 3 || mode == 5;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine)
return;
builder.addSelectionScrollInput(0, 137,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.hose_pulley", "fluid",
"fluid_count", "percent_infinite", "progress_bar_infinite", "percent_empty", "progress_bar_empty"))
.titled(Lang.translateDirect("display_source.hose_pulley.display")),
"Mode");
}
@Override
protected boolean allowsLabeling(DisplayLinkContext context) {
return true;
}
}

View file

@ -0,0 +1,29 @@
package com.simibubi.create.content.redstone.displayLink.source;
import com.simibubi.create.content.contraptions.bearing.MechanicalBearingBlockEntity;
import com.simibubi.create.content.contraptions.elevator.ElevatorPulleyBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
public class MechanicalBearingDisplaySource extends SingleLineDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof MechanicalBearingBlockEntity epbe))
return null;
return new TextComponent(String.valueOf(epbe.getAngle()));
}
@Override
protected boolean allowsLabeling(DisplayLinkContext context) {
return true;
}
}

View file

@ -0,0 +1,67 @@
package com.simibubi.create.content.redstone.displayLink.source;
import com.simibubi.create.content.contraptions.elevator.ElevatorPulleyBlockEntity;
import com.simibubi.create.content.contraptions.piston.LinearActuatorBlockEntity;
import com.simibubi.create.content.contraptions.piston.MechanicalPistonBlockEntity;
import com.simibubi.create.content.contraptions.pulley.PulleyBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.Nullable;
public class MechanicalPistonDisplaySource extends PercentOrProgressBarDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
int mode = context.sourceConfig().getInt("Mode");
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof MechanicalPistonBlockEntity mpbe))
return null;
return switch (mode) {
case 2 -> new TextComponent(String.valueOf(mpbe.offset));
case 3 -> new TextComponent(String.valueOf(mpbe.getExtensionRange()));
default -> super.provideLine(context, stats);
};
}
@Nullable
@Override
protected Float getProgress(DisplayLinkContext context) {
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof MechanicalPistonBlockEntity mpbe))
return null;
return mpbe.offset/(float)mpbe.getExtensionRange();
}
@Override
protected boolean progressBarActive(DisplayLinkContext context) {
return context.sourceConfig().getInt("Mode") == 1;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine)
return;
builder.addSelectionScrollInput(0, 137,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.mechanical_piston", "percent", "progress_bar", "blocks", "blocks_max"))
.titled(Lang.translateDirect("display_source.mechanical_piston.display")),
"Mode");
}
@Override
protected boolean allowsLabeling(DisplayLinkContext context) {
return true;
}
}

View file

@ -0,0 +1,63 @@
package com.simibubi.create.content.redstone.displayLink.source;
import net.minecraft.network.chat.TextComponent;
import org.jetbrains.annotations.Nullable;
import com.simibubi.create.content.contraptions.pulley.PulleyBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PulleyDisplaySource extends PercentOrProgressBarDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
int mode = context.sourceConfig().getInt("Mode");
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof PulleyBlockEntity pbe))
return null;
return switch (mode) {
case 2 -> new TextComponent(String.valueOf(pbe.offset));
case 3 -> new TextComponent(String.valueOf(pbe.blocksToGround()));
default -> super.provideLine(context, stats);
};
}
@Nullable
@Override
protected Float getProgress(DisplayLinkContext context) {
BlockEntity be = context.getSourceBlockEntity();
if (!(be instanceof PulleyBlockEntity labe))
return null;
return labe.getOffset()/labe.blocksToGround();
}
@Override
protected boolean progressBarActive(DisplayLinkContext context) {
return context.sourceConfig().getInt("Mode") == 1;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine)
return;
builder.addSelectionScrollInput(0, 138,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.rope_pulley", "percent", "progress_bar", "blocks", "blocks_max"))
.titled(Lang.translateDirect("display_source.rope_pulley.display")),
"Mode");
}
@Override
protected boolean allowsLabeling(DisplayLinkContext context) {
return true;
}
}

View file

@ -179,7 +179,7 @@
"create.terrainzapper.leftClickToSet": "Left-Click a Block to set Material",
"create.large_water_wheel.not_enough_space": "Clear Blocks for Placement",
"create.minecart_coupling.two_couplings_max": "Minecarts cannot have more than two couplings each",
"create.minecart_coupling.unloaded": "Parts of your train seem to be in unloaded chunks",
"create.minecart_coupling.no_loops": "Couplings cannot form a loop",
@ -219,7 +219,7 @@
"create.logistics.fluid_filter": "Fluid Filter",
"create.logistics.firstFrequency": "Frequency #1",
"create.logistics.secondFrequency": "Frequency #2",
"create.logistics.filter.click_to_set": "Click with item to set",
"create.logistics.filter.click_to_replace": "Click with item to replace",
"create.logistics.filter.hold_to_set_amount": "Click and hold for amount",
@ -230,26 +230,26 @@
"create.logistics.filter.up_to": "Up to",
"create.logistics.filter.exactly": "Exactly",
"create.logistics.filter.requires_item_in_inventory": "Requires %1$s item in Inventory",
"create.logistics.creative_crate.supply": "Infinite Supply",
"create.logistics.train_observer.cargo_filter": "Cargo Filter",
"create.kinetics.creative_motor.rotation_speed": "Generated Speed in RPM",
"create.kinetics.speed_controller.rotation_speed": "Targeted Speed in RPM",
"create.kinetics.valve_handle.rotated_angle": "Rotation when used",
"create.logistics.redstone_interval": "Redstone Interval",
"create.contraptions.contoller.target": "Targeted Component",
"create.contraptions.mechanical_roller.pave_material": "Paving Material",
"create.contraptions.chassis.radius": "Radius when Sticky",
"create.contraptions.chassis.range": "Range of Sticky Sides",
"create.contraptions.chassis.distance": "Distance",
"create.gui.value_settings.hold_to_edit": "Click and hold to edit",
"create.gui.value_settings.release_to_confirm": "Release %1$s to Confirm",
"create.gui.goggles.generator_stats": "Generator Stats:",
"create.gui.goggles.kinetic_stats": "Kinetic Stats:",
"create.gui.goggles.at_current_speed": "at current speed",
@ -309,7 +309,7 @@
"create.gui.sequenced_gearshift.speed.back_fast": "Double speed, Reversed",
"create.gui.clipboard.erase_checked": "Erase checked items",
"create.clipboard.actions": "Clipboard Actions",
"create.clipboard.to_copy": "%1$s to Copy settings",
"create.clipboard.to_paste": "%1$s to Paste settings",
@ -872,7 +872,7 @@
"create.contraption.controls.actor_toggle.on": "On",
"create.contraption.controls.actor_toggle.off": "Off",
"create.contraption.controls.floor_unreachable": "Unreachable",
"create.contraption.door_control": "Onboard Door Control",
"create.contraption.door_control.all": "Open All Doors",
"create.contraption.door_control.all.short": "Open All",
@ -967,6 +967,38 @@
"create.display_source.boiler.not_enough_space": "Not enough space ",
"create.display_source.boiler.for_boiler_status": "for Boiler Status",
"create.display_source.computer_display_source": "From Computer",
"create.display_source.elevator_pulley_source": "Elevator Pulley",
"create.display_source.elevator_pulley.display": "Displayed Info",
"create.display_source.elevator_pulley.floor_count": "Floor Count",
"create.display_source.elevator_pulley.current_floor": "Current Floor",
"create.display_source.elevator_pulley.current_floor_description": "Current Floor Description",
"create.display_source.elevator_pulley.top_distance_int": "Top Blocks",
"create.display_source.elevator_pulley.top_distance_percent": "Top Percent",
"create.display_source.elevator_pulley.top_distance_progress_bar": "Top Progress Bar",
"create.display_source.elevator_pulley.bottom_distance_int": "Bottom Blocks",
"create.display_source.elevator_pulley.bottom_distance_percent": "Bottom Percent",
"create.display_source.elevator_pulley.bottom_distance_progress_bar": "Bottom Progress Bar",
"create.display_source.mechanical_bearing_source": "Mechanical Bearing",
"create.display_source.mechanical_piston_source": "Mechanical Piston",
"create.display_source.mechanical_piston.display": "Displayed Info",
"create.display_source.mechanical_piston.percent": "Percent",
"create.display_source.mechanical_piston.progress_bar": "Progress Bar",
"create.display_source.mechanical_piston.blocks": "Blocks",
"create.display_source.mechanical_piston.blocks_max": "Max Blocks",
"create.display_source.rope_pulley_source": "Rope Pulley",
"create.display_source.rope_pulley.display": "Displayed Info",
"create.display_source.rope_pulley.percent": "Percent",
"create.display_source.rope_pulley.progress_bar": "Progress Bar",
"create.display_source.rope_pulley.blocks": "Blocks",
"create.display_source.rope_pulley.blocks_max": "Max Blocks",
"create.display_source.hose_pulley_source": "Hose Pulley",
"create.display_source.hose_pulley.display": "Displayed Info",
"create.display_source.hose_pulley.fluid": "Fluid",
"create.display_source.hose_pulley.fluid_count": "Fluid Count",
"create.display_source.hose_pulley.percent_infinite": "Percent to Infinite",
"create.display_source.hose_pulley.progress_bar_infinite": "Progress Bar to Infinite",
"create.display_source.hose_pulley.percent_empty": "Percent to Empty",
"create.display_source.hose_pulley.progress_bar_empty": "Progress Bar to Empty",
"create.display_target.line": "Line %1$s",
"create.display_target.page": "Page %1$s",