mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-27 12:24:41 +01:00
Merge branch 'mc1.18/dev' into mc1.19/dev
This commit is contained in:
commit
1c30b235dd
149 changed files with 4756 additions and 2680 deletions
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -49,6 +49,7 @@ body:
|
||||||
label: Mod Version
|
label: Mod Version
|
||||||
description: The version of the mod you were using when the bug occured
|
description: The version of the mod you were using when the bug occured
|
||||||
options:
|
options:
|
||||||
|
- "0.5.1b"
|
||||||
- "0.5.1a"
|
- "0.5.1a"
|
||||||
- "0.5.0i"
|
- "0.5.0i"
|
||||||
- "0.5.0h"
|
- "0.5.0h"
|
||||||
|
|
|
@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
|
||||||
org.gradle.daemon = false
|
org.gradle.daemon = false
|
||||||
|
|
||||||
# mod version info
|
# mod version info
|
||||||
mod_version = 0.5.1.a
|
mod_version = 0.5.1.b
|
||||||
artifact_minecraft_version = 1.19.2
|
artifact_minecraft_version = 1.19.2
|
||||||
|
|
||||||
minecraft_version = 1.19.2
|
minecraft_version = 1.19.2
|
||||||
|
|
|
@ -890,6 +890,9 @@
|
||||||
"itemGroup.create.base": "Create",
|
"itemGroup.create.base": "Create",
|
||||||
"itemGroup.create.palettes": "Create's Building Blocks",
|
"itemGroup.create.palettes": "Create's Building Blocks",
|
||||||
|
|
||||||
|
"block.create.mangrove_window": "Mangrove Window",
|
||||||
|
"block.create.mangrove_window_pane": "Mangrove Window Pane",
|
||||||
|
|
||||||
"death.attack.create.crush": "%1$s was processed by Crushing Wheels",
|
"death.attack.create.crush": "%1$s was processed by Crushing Wheels",
|
||||||
"death.attack.create.crush.player": "%1$s was thrown into Crushing Wheels by %2$s",
|
"death.attack.create.crush.player": "%1$s was thrown into Crushing Wheels by %2$s",
|
||||||
"death.attack.create.fan_fire": "%1$s got smoked by an Encased Fan",
|
"death.attack.create.fan_fire": "%1$s got smoked by an Encased Fan",
|
||||||
|
@ -2527,7 +2530,7 @@
|
||||||
|
|
||||||
"create.ponder.encased_fluid_pipe.header": "Encasing Fluid Pipes",
|
"create.ponder.encased_fluid_pipe.header": "Encasing Fluid Pipes",
|
||||||
"create.ponder.encased_fluid_pipe.text_1": "Copper Casing can be used to decorate Fluid Pipes",
|
"create.ponder.encased_fluid_pipe.text_1": "Copper Casing can be used to decorate Fluid Pipes",
|
||||||
"create.ponder.encased_fluid_pipe.text_2": "Aside from being conceiled, Encased Pipes are locked into their connectivity state",
|
"create.ponder.encased_fluid_pipe.text_2": "Aside from being concealed, Encased Pipes are locked into their connectivity state",
|
||||||
"create.ponder.encased_fluid_pipe.text_3": "It will no longer react to any neighbouring blocks being added or removed",
|
"create.ponder.encased_fluid_pipe.text_3": "It will no longer react to any neighbouring blocks being added or removed",
|
||||||
|
|
||||||
"create.ponder.fan_direction.header": "Air flow of Encased Fans",
|
"create.ponder.fan_direction.header": "Air flow of Encased Fans",
|
||||||
|
@ -2995,7 +2998,7 @@
|
||||||
"create.ponder.smart_chute.text_4": "Redstone power will prevent Smart Chutes from acting.",
|
"create.ponder.smart_chute.text_4": "Redstone power will prevent Smart Chutes from acting.",
|
||||||
|
|
||||||
"create.ponder.smart_observer.header": "Advanced detection with Smart Observers",
|
"create.ponder.smart_observer.header": "Advanced detection with Smart Observers",
|
||||||
"create.ponder.smart_observer.text_1": "Smart Observers can be used detect a variety of events",
|
"create.ponder.smart_observer.text_1": "Smart Observers can be used to detect a variety of events",
|
||||||
"create.ponder.smart_observer.text_2": "It can detect items or fluids inside of generic containers",
|
"create.ponder.smart_observer.text_2": "It can detect items or fluids inside of generic containers",
|
||||||
"create.ponder.smart_observer.text_3": "The filter slot can be used to look for specific contents only",
|
"create.ponder.smart_observer.text_3": "The filter slot can be used to look for specific contents only",
|
||||||
"create.ponder.smart_observer.text_4": "It also activates when the block itself matches the filter",
|
"create.ponder.smart_observer.text_4": "It also activates when the block itself matches the filter",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_cap",
|
"parent": "create:block/bars/cap",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/andesite_bars",
|
"bars": "create:block/bars/andesite_bars",
|
||||||
"edge": "create:block/bars/andesite_bars_edge",
|
"edge": "create:block/bars/andesite_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_cap_alt",
|
"parent": "create:block/bars/cap_alt",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/andesite_bars",
|
"bars": "create:block/bars/andesite_bars",
|
||||||
"edge": "create:block/bars/andesite_bars_edge",
|
"edge": "create:block/bars/andesite_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_post",
|
"parent": "create:block/bars/post",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/andesite_bars",
|
"bars": "create:block/bars/andesite_bars",
|
||||||
"edge": "create:block/bars/andesite_bars_edge",
|
"edge": "create:block/bars/andesite_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_post_ends",
|
"parent": "create:block/bars/post_ends",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/andesite_bars",
|
"bars": "create:block/bars/andesite_bars",
|
||||||
"edge": "create:block/bars/andesite_bars_edge",
|
"edge": "create:block/bars/andesite_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_side",
|
"parent": "create:block/bars/side",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/andesite_bars",
|
"bars": "create:block/bars/andesite_bars",
|
||||||
"edge": "create:block/bars/andesite_bars_edge",
|
"edge": "create:block/bars/andesite_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_side_alt",
|
"parent": "create:block/bars/side_alt",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/andesite_bars",
|
"bars": "create:block/bars/andesite_bars",
|
||||||
"edge": "create:block/bars/andesite_bars_edge",
|
"edge": "create:block/bars/andesite_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_cap",
|
"parent": "create:block/bars/cap",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/brass_bars",
|
"bars": "create:block/bars/brass_bars",
|
||||||
"edge": "create:block/bars/brass_bars_edge",
|
"edge": "create:block/bars/brass_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_cap_alt",
|
"parent": "create:block/bars/cap_alt",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/brass_bars",
|
"bars": "create:block/bars/brass_bars",
|
||||||
"edge": "create:block/bars/brass_bars_edge",
|
"edge": "create:block/bars/brass_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_post",
|
"parent": "create:block/bars/post",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/brass_bars",
|
"bars": "create:block/bars/brass_bars",
|
||||||
"edge": "create:block/bars/brass_bars_edge",
|
"edge": "create:block/bars/brass_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_post_ends",
|
"parent": "create:block/bars/post_ends",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/brass_bars",
|
"bars": "create:block/bars/brass_bars",
|
||||||
"edge": "create:block/bars/brass_bars_edge",
|
"edge": "create:block/bars/brass_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_side",
|
"parent": "create:block/bars/side",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/brass_bars",
|
"bars": "create:block/bars/brass_bars",
|
||||||
"edge": "create:block/bars/brass_bars_edge",
|
"edge": "create:block/bars/brass_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_side_alt",
|
"parent": "create:block/bars/side_alt",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/brass_bars",
|
"bars": "create:block/bars/brass_bars",
|
||||||
"edge": "create:block/bars/brass_bars_edge",
|
"edge": "create:block/bars/brass_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_cap",
|
"parent": "create:block/bars/cap",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/copper_bars",
|
"bars": "create:block/bars/copper_bars",
|
||||||
"edge": "create:block/bars/copper_bars_edge",
|
"edge": "create:block/bars/copper_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_cap_alt",
|
"parent": "create:block/bars/cap_alt",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/copper_bars",
|
"bars": "create:block/bars/copper_bars",
|
||||||
"edge": "create:block/bars/copper_bars_edge",
|
"edge": "create:block/bars/copper_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_post",
|
"parent": "create:block/bars/post",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/copper_bars",
|
"bars": "create:block/bars/copper_bars",
|
||||||
"edge": "create:block/bars/copper_bars_edge",
|
"edge": "create:block/bars/copper_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_post_ends",
|
"parent": "create:block/bars/post_ends",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/copper_bars",
|
"bars": "create:block/bars/copper_bars",
|
||||||
"edge": "create:block/bars/copper_bars_edge",
|
"edge": "create:block/bars/copper_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_side",
|
"parent": "create:block/bars/side",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/copper_bars",
|
"bars": "create:block/bars/copper_bars",
|
||||||
"edge": "create:block/bars/copper_bars_edge",
|
"edge": "create:block/bars/copper_bars_edge",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/iron_bars_side_alt",
|
"parent": "create:block/bars/side_alt",
|
||||||
"textures": {
|
"textures": {
|
||||||
"bars": "create:block/bars/copper_bars",
|
"bars": "create:block/bars/copper_bars",
|
||||||
"edge": "create:block/bars/copper_bars_edge",
|
"edge": "create:block/bars/copper_bars_edge",
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
"create:pulse_repeater",
|
"create:pulse_repeater",
|
||||||
"create:pulse_extender",
|
"create:pulse_extender",
|
||||||
"create:clipboard",
|
"create:clipboard",
|
||||||
"create:copycat_step",
|
|
||||||
"create:copycat_panel",
|
|
||||||
"#minecraft:banners",
|
"#minecraft:banners",
|
||||||
"#minecraft:signs"
|
"#minecraft:signs"
|
||||||
]
|
]
|
||||||
|
|
|
@ -160,6 +160,9 @@
|
||||||
"create:andesite_ladder",
|
"create:andesite_ladder",
|
||||||
"create:brass_ladder",
|
"create:brass_ladder",
|
||||||
"create:copper_ladder",
|
"create:copper_ladder",
|
||||||
|
"create:andesite_bars",
|
||||||
|
"create:brass_bars",
|
||||||
|
"create:copper_bars",
|
||||||
"create:andesite_scaffolding",
|
"create:andesite_scaffolding",
|
||||||
"create:brass_scaffolding",
|
"create:brass_scaffolding",
|
||||||
"create:copper_scaffolding",
|
"create:copper_scaffolding",
|
||||||
|
|
|
@ -787,6 +787,7 @@ public class AllBlocks {
|
||||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||||
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
|
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
|
||||||
.properties(p -> p.noOcclusion())
|
.properties(p -> p.noOcclusion())
|
||||||
|
.properties(p -> p.isRedstoneConductor((level, pos, state) -> false))
|
||||||
.transform(pickaxeOnly())
|
.transform(pickaxeOnly())
|
||||||
.blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p)))
|
.blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||||
.item()
|
.item()
|
||||||
|
|
|
@ -55,7 +55,8 @@ public class AllBogeyStyles {
|
||||||
public static void register() {}
|
public static void register() {}
|
||||||
|
|
||||||
public static class BogeyStyleBuilder {
|
public static class BogeyStyleBuilder {
|
||||||
protected final Map<BogeySizes.BogeySize, Supplier<BogeyStyle.SizeData>> sizes = new HashMap<>();
|
protected final Map<BogeySizes.BogeySize, Supplier<BogeyStyle.SizeRenderData>> sizeRenderers = new HashMap<>();
|
||||||
|
protected final Map<BogeySizes.BogeySize, ResourceLocation> sizes = new HashMap<>();
|
||||||
protected final ResourceLocation name;
|
protected final ResourceLocation name;
|
||||||
protected final ResourceLocation cycleGroup;
|
protected final ResourceLocation cycleGroup;
|
||||||
|
|
||||||
|
@ -94,8 +95,9 @@ public class AllBogeyStyles {
|
||||||
|
|
||||||
public BogeyStyleBuilder size(BogeySizes.BogeySize size, Supplier<Supplier<? extends BogeyRenderer>> renderer,
|
public BogeyStyleBuilder size(BogeySizes.BogeySize size, Supplier<Supplier<? extends BogeyRenderer>> renderer,
|
||||||
ResourceLocation location) {
|
ResourceLocation location) {
|
||||||
|
this.sizes.put(size, location);
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
this.sizes.put(size, () -> new BogeyStyle.SizeData(location, renderer.get(), renderer.get()
|
this.sizeRenderers.put(size, () -> new BogeyStyle.SizeRenderData(renderer.get(), renderer.get()
|
||||||
.get()));
|
.get()));
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
|
@ -120,7 +122,7 @@ public class AllBogeyStyles {
|
||||||
|
|
||||||
public BogeyStyle build() {
|
public BogeyStyle build() {
|
||||||
BogeyStyle entry = new BogeyStyle(name, cycleGroup, displayName, soundType, contactParticle, smokeParticle,
|
BogeyStyle entry = new BogeyStyle(name, cycleGroup, displayName, soundType, contactParticle, smokeParticle,
|
||||||
defaultData, sizes, commonRenderer);
|
defaultData, sizes, sizeRenderers, commonRenderer);
|
||||||
BOGEY_STYLES.put(name, entry);
|
BOGEY_STYLES.put(name, entry);
|
||||||
CYCLE_GROUPS.computeIfAbsent(cycleGroup, l -> new HashMap<>())
|
CYCLE_GROUPS.computeIfAbsent(cycleGroup, l -> new HashMap<>())
|
||||||
.put(name, entry);
|
.put(name, entry);
|
||||||
|
|
|
@ -25,8 +25,8 @@ import com.simibubi.create.content.kinetics.press.PressingRecipe;
|
||||||
import com.simibubi.create.content.kinetics.saw.CuttingRecipe;
|
import com.simibubi.create.content.kinetics.saw.CuttingRecipe;
|
||||||
import com.simibubi.create.content.processing.basin.BasinRecipe;
|
import com.simibubi.create.content.processing.basin.BasinRecipe;
|
||||||
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory;
|
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory;
|
||||||
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipeSerializer;
|
|
||||||
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
|
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
|
||||||
|
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipeSerializer;
|
||||||
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class Create {
|
||||||
|
|
||||||
public static final String ID = "create";
|
public static final String ID = "create";
|
||||||
public static final String NAME = "Create";
|
public static final String NAME = "Create";
|
||||||
public static final String VERSION = "0.5.1a";
|
public static final String VERSION = "0.5.1b";
|
||||||
|
|
||||||
public static final Logger LOGGER = LogUtils.getLogger();
|
public static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ public class AttachedComputerPacket extends BlockEntityDataPacket<SyncedBlockEnt
|
||||||
|
|
||||||
private final boolean hasAttachedComputer;
|
private final boolean hasAttachedComputer;
|
||||||
|
|
||||||
public AttachedComputerPacket(BlockPos tilePos, boolean hasAttachedComputer) {
|
public AttachedComputerPacket(BlockPos blockEntityPos, boolean hasAttachedComputer) {
|
||||||
super(tilePos);
|
super(blockEntityPos);
|
||||||
this.hasAttachedComputer = hasAttachedComputer;
|
this.hasAttachedComputer = hasAttachedComputer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ public class AttachedComputerPacket extends BlockEntityDataPacket<SyncedBlockEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePacket(SyncedBlockEntity tile) {
|
protected void handlePacket(SyncedBlockEntity blockEntity) {
|
||||||
if (tile instanceof SmartBlockEntity smartTile) {
|
if (blockEntity instanceof SmartBlockEntity sbe) {
|
||||||
smartTile.getBehaviour(AbstractComputerBehaviour.TYPE)
|
sbe.getBehaviour(AbstractComputerBehaviour.TYPE)
|
||||||
.setHasAttachedComputer(hasAttachedComputer);
|
.setHasAttachedComputer(hasAttachedComputer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,18 +37,18 @@ public class ComputerBehaviour extends AbstractComputerBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) {
|
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) {
|
||||||
if (te instanceof SpeedControllerBlockEntity scte)
|
if (te instanceof SpeedControllerBlockEntity scbe)
|
||||||
return () -> new SpeedControllerPeripheral(scte, scte.targetSpeed);
|
return () -> new SpeedControllerPeripheral(scbe, scbe.targetSpeed);
|
||||||
if (te instanceof DisplayLinkBlockEntity dlte)
|
if (te instanceof DisplayLinkBlockEntity dlbe)
|
||||||
return () -> new DisplayLinkPeripheral(dlte);
|
return () -> new DisplayLinkPeripheral(dlbe);
|
||||||
if (te instanceof SequencedGearshiftBlockEntity sgte)
|
if (te instanceof SequencedGearshiftBlockEntity sgbe)
|
||||||
return () -> new SequencedGearshiftPeripheral(sgte);
|
return () -> new SequencedGearshiftPeripheral(sgbe);
|
||||||
if (te instanceof SpeedGaugeBlockEntity sgte)
|
if (te instanceof SpeedGaugeBlockEntity sgbe)
|
||||||
return () -> new SpeedGaugePeripheral(sgte);
|
return () -> new SpeedGaugePeripheral(sgbe);
|
||||||
if (te instanceof StressGaugeBlockEntity sgte)
|
if (te instanceof StressGaugeBlockEntity sgbe)
|
||||||
return () -> new StressGaugePeripheral(sgte);
|
return () -> new StressGaugePeripheral(sgbe);
|
||||||
if (te instanceof StationBlockEntity ste)
|
if (te instanceof StationBlockEntity sbe)
|
||||||
return () -> new StationPeripheral(ste);
|
return () -> new StationPeripheral(sbe);
|
||||||
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"No peripheral available for " + ForgeRegistries.BLOCK_ENTITY_TYPES.getKey(te.getType()));
|
"No peripheral available for " + ForgeRegistries.BLOCK_ENTITY_TYPES.getKey(te.getType()));
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
|
||||||
private final AtomicInteger cursorX = new AtomicInteger();
|
private final AtomicInteger cursorX = new AtomicInteger();
|
||||||
private final AtomicInteger cursorY = new AtomicInteger();
|
private final AtomicInteger cursorY = new AtomicInteger();
|
||||||
|
|
||||||
public DisplayLinkPeripheral(DisplayLinkBlockEntity tile) {
|
public DisplayLinkPeripheral(DisplayLinkBlockEntity blockEntity) {
|
||||||
super(tile);
|
super(blockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
|
@ -36,7 +36,7 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final Object[] getSize() {
|
public final Object[] getSize() {
|
||||||
DisplayTargetStats stats = tile.activeTarget.provideStats(new DisplayLinkContext(tile.getLevel(), tile));
|
DisplayTargetStats stats = blockEntity.activeTarget.provideStats(new DisplayLinkContext(blockEntity.getLevel(), blockEntity));
|
||||||
return new Object[]{stats.maxRows(), stats.maxColumns()};
|
return new Object[]{stats.maxRows(), stats.maxColumns()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final void write(String text) {
|
public final void write(String text) {
|
||||||
ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
|
ListTag tag = blockEntity.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
|
||||||
|
|
||||||
int x = cursorX.get();
|
int x = cursorX.get();
|
||||||
int y = cursorY.get();
|
int y = cursorY.get();
|
||||||
|
@ -68,8 +68,8 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
|
||||||
|
|
||||||
tag.set(y, StringTag.valueOf(builder.toString()));
|
tag.set(y, StringTag.valueOf(builder.toString()));
|
||||||
|
|
||||||
synchronized (tile) {
|
synchronized (blockEntity) {
|
||||||
tile.getSourceConfig().put(TAG_KEY, tag);
|
blockEntity.getSourceConfig().put(TAG_KEY, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
cursorX.set(x + text.length());
|
cursorX.set(x + text.length());
|
||||||
|
@ -77,26 +77,26 @@ public class DisplayLinkPeripheral extends SyncedPeripheral<DisplayLinkBlockEnti
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final void clearLine() {
|
public final void clearLine() {
|
||||||
ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
|
ListTag tag = blockEntity.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
|
||||||
|
|
||||||
if (tag.size() > cursorY.get())
|
if (tag.size() > cursorY.get())
|
||||||
tag.set(cursorY.get(), StringTag.valueOf(""));
|
tag.set(cursorY.get(), StringTag.valueOf(""));
|
||||||
|
|
||||||
synchronized (tile) {
|
synchronized (blockEntity) {
|
||||||
tile.getSourceConfig().put(TAG_KEY, tag);
|
blockEntity.getSourceConfig().put(TAG_KEY, tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final void clear() {
|
public final void clear() {
|
||||||
synchronized (tile) {
|
synchronized (blockEntity) {
|
||||||
tile.getSourceConfig().put(TAG_KEY, new ListTag());
|
blockEntity.getSourceConfig().put(TAG_KEY, new ListTag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final void update() {
|
public final void update() {
|
||||||
tile.tickSource();
|
blockEntity.tickSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -13,8 +13,8 @@ import dan200.computercraft.api.lua.LuaFunction;
|
||||||
|
|
||||||
public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftBlockEntity> {
|
public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGearshiftBlockEntity> {
|
||||||
|
|
||||||
public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity tile) {
|
public SequencedGearshiftPeripheral(SequencedGearshiftBlockEntity blockEntity) {
|
||||||
super(tile);
|
super(blockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
|
@ -29,20 +29,20 @@ public class SequencedGearshiftPeripheral extends SyncedPeripheral<SequencedGear
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final boolean isRunning() {
|
public final boolean isRunning() {
|
||||||
return !this.tile.isIdle();
|
return !this.blockEntity.isIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runInstruction(IArguments arguments, SequencerInstructions instructionType) throws LuaException {
|
private void runInstruction(IArguments arguments, SequencerInstructions instructionType) throws LuaException {
|
||||||
int speedModifier = arguments.count() > 1 ? arguments.getInt(1) : 1;
|
int speedModifier = arguments.count() > 1 ? arguments.getInt(1) : 1;
|
||||||
this.tile.getInstructions().clear();
|
this.blockEntity.getInstructions().clear();
|
||||||
|
|
||||||
this.tile.getInstructions().add(new Instruction(
|
this.blockEntity.getInstructions().add(new Instruction(
|
||||||
instructionType,
|
instructionType,
|
||||||
InstructionSpeedModifiers.getByModifier(speedModifier),
|
InstructionSpeedModifiers.getByModifier(speedModifier),
|
||||||
Math.abs(arguments.getInt(0))));
|
Math.abs(arguments.getInt(0))));
|
||||||
this.tile.getInstructions().add(new Instruction(SequencerInstructions.END));
|
this.blockEntity.getInstructions().add(new Instruction(SequencerInstructions.END));
|
||||||
|
|
||||||
this.tile.run(0);
|
this.blockEntity.run(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -11,8 +11,8 @@ public class SpeedControllerPeripheral extends SyncedPeripheral<SpeedControllerB
|
||||||
|
|
||||||
private final ScrollValueBehaviour targetSpeed;
|
private final ScrollValueBehaviour targetSpeed;
|
||||||
|
|
||||||
public SpeedControllerPeripheral(SpeedControllerBlockEntity tile, ScrollValueBehaviour targetSpeed) {
|
public SpeedControllerPeripheral(SpeedControllerBlockEntity blockEntity, ScrollValueBehaviour targetSpeed) {
|
||||||
super(tile);
|
super(blockEntity);
|
||||||
this.targetSpeed = targetSpeed;
|
this.targetSpeed = targetSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@ import dan200.computercraft.api.lua.LuaFunction;
|
||||||
|
|
||||||
public class SpeedGaugePeripheral extends SyncedPeripheral<SpeedGaugeBlockEntity> {
|
public class SpeedGaugePeripheral extends SyncedPeripheral<SpeedGaugeBlockEntity> {
|
||||||
|
|
||||||
public SpeedGaugePeripheral(SpeedGaugeBlockEntity tile) {
|
public SpeedGaugePeripheral(SpeedGaugeBlockEntity blockEntity) {
|
||||||
super(tile);
|
super(blockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final float getSpeed() {
|
public final float getSpeed() {
|
||||||
return this.tile.getSpeed();
|
return this.blockEntity.getSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -32,54 +32,54 @@ import net.minecraftforge.network.PacketDistributor;
|
||||||
|
|
||||||
public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
||||||
|
|
||||||
public StationPeripheral(StationBlockEntity tile) {
|
public StationPeripheral(StationBlockEntity blockEntity) {
|
||||||
super(tile);
|
super(blockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final void assemble() throws LuaException {
|
public final void assemble() throws LuaException {
|
||||||
if (!tile.isAssembling())
|
if (!blockEntity.isAssembling())
|
||||||
throw new LuaException("station must be in assembly mode");
|
throw new LuaException("station must be in assembly mode");
|
||||||
|
|
||||||
tile.assemble(null);
|
blockEntity.assemble(null);
|
||||||
|
|
||||||
if (tile.getStation() == null || tile.getStation().getPresentTrain() == null)
|
if (blockEntity.getStation() == null || blockEntity.getStation().getPresentTrain() == null)
|
||||||
throw new LuaException("failed to assemble train");
|
throw new LuaException("failed to assemble train");
|
||||||
|
|
||||||
if (!tile.exitAssemblyMode())
|
if (!blockEntity.exitAssemblyMode())
|
||||||
throw new LuaException("failed to exit assembly mode");
|
throw new LuaException("failed to exit assembly mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final void disassemble() throws LuaException {
|
public final void disassemble() throws LuaException {
|
||||||
if (tile.isAssembling())
|
if (blockEntity.isAssembling())
|
||||||
throw new LuaException("station must not be in assembly mode");
|
throw new LuaException("station must not be in assembly mode");
|
||||||
|
|
||||||
getTrainOrThrow();
|
getTrainOrThrow();
|
||||||
|
|
||||||
if (!tile.enterAssemblyMode(null))
|
if (!blockEntity.enterAssemblyMode(null))
|
||||||
throw new LuaException("could not disassemble train");
|
throw new LuaException("could not disassemble train");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final void setAssemblyMode(boolean assemblyMode) throws LuaException {
|
public final void setAssemblyMode(boolean assemblyMode) throws LuaException {
|
||||||
if (assemblyMode) {
|
if (assemblyMode) {
|
||||||
if (!tile.enterAssemblyMode(null))
|
if (!blockEntity.enterAssemblyMode(null))
|
||||||
throw new LuaException("failed to enter assembly mode");
|
throw new LuaException("failed to enter assembly mode");
|
||||||
} else {
|
} else {
|
||||||
if (!tile.exitAssemblyMode())
|
if (!blockEntity.exitAssemblyMode())
|
||||||
throw new LuaException("failed to exit assembly mode");
|
throw new LuaException("failed to exit assembly mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final boolean isInAssemblyMode() {
|
public final boolean isInAssemblyMode() {
|
||||||
return tile.isAssembling();
|
return blockEntity.isAssembling();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final String getStationName() throws LuaException {
|
public final String getStationName() throws LuaException {
|
||||||
GlobalStation station = tile.getStation();
|
GlobalStation station = blockEntity.getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
throw new LuaException("station is not connected to a track");
|
throw new LuaException("station is not connected to a track");
|
||||||
|
|
||||||
|
@ -88,13 +88,13 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
||||||
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final void setStationName(String name) throws LuaException {
|
public final void setStationName(String name) throws LuaException {
|
||||||
if (!tile.updateName(name))
|
if (!blockEntity.updateName(name))
|
||||||
throw new LuaException("could not set station name");
|
throw new LuaException("could not set station name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final boolean isTrainPresent() throws LuaException {
|
public final boolean isTrainPresent() throws LuaException {
|
||||||
GlobalStation station = tile.getStation();
|
GlobalStation station = blockEntity.getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
throw new LuaException("station is not connected to a track");
|
throw new LuaException("station is not connected to a track");
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final boolean isTrainImminent() throws LuaException {
|
public final boolean isTrainImminent() throws LuaException {
|
||||||
GlobalStation station = tile.getStation();
|
GlobalStation station = blockEntity.getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
throw new LuaException("station is not connected to a track");
|
throw new LuaException("station is not connected to a track");
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final boolean isTrainEnroute() throws LuaException {
|
public final boolean isTrainEnroute() throws LuaException {
|
||||||
GlobalStation station = tile.getStation();
|
GlobalStation station = blockEntity.getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
throw new LuaException("station is not connected to a track");
|
throw new LuaException("station is not connected to a track");
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull Train getTrainOrThrow() throws LuaException {
|
private @NotNull Train getTrainOrThrow() throws LuaException {
|
||||||
GlobalStation station = tile.getStation();
|
GlobalStation station = blockEntity.getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
throw new LuaException("station is not connected to a track");
|
throw new LuaException("station is not connected to a track");
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,18 @@ import dan200.computercraft.api.lua.LuaFunction;
|
||||||
|
|
||||||
public class StressGaugePeripheral extends SyncedPeripheral<StressGaugeBlockEntity> {
|
public class StressGaugePeripheral extends SyncedPeripheral<StressGaugeBlockEntity> {
|
||||||
|
|
||||||
public StressGaugePeripheral(StressGaugeBlockEntity tile) {
|
public StressGaugePeripheral(StressGaugeBlockEntity blockEntity) {
|
||||||
super(tile);
|
super(blockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final float getStress() {
|
public final float getStress() {
|
||||||
return this.tile.getNetworkStress();
|
return this.blockEntity.getNetworkStress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
public final float getStressCapacity() {
|
public final float getStressCapacity() {
|
||||||
return this.tile.getNetworkCapacity();
|
return this.blockEntity.getNetworkCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -16,30 +16,30 @@ import net.minecraftforge.network.PacketDistributor;
|
||||||
|
|
||||||
public abstract class SyncedPeripheral<T extends SmartBlockEntity> implements IPeripheral {
|
public abstract class SyncedPeripheral<T extends SmartBlockEntity> implements IPeripheral {
|
||||||
|
|
||||||
protected final T tile;
|
protected final T blockEntity;
|
||||||
private final AtomicInteger computers = new AtomicInteger();
|
private final AtomicInteger computers = new AtomicInteger();
|
||||||
|
|
||||||
public SyncedPeripheral(T tile) {
|
public SyncedPeripheral(T blockEntity) {
|
||||||
this.tile = tile;
|
this.blockEntity = blockEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attach(@NotNull IComputerAccess computer) {
|
public void attach(@NotNull IComputerAccess computer) {
|
||||||
computers.incrementAndGet();
|
computers.incrementAndGet();
|
||||||
updateTile();
|
updateBlockEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detach(@NotNull IComputerAccess computer) {
|
public void detach(@NotNull IComputerAccess computer) {
|
||||||
computers.decrementAndGet();
|
computers.decrementAndGet();
|
||||||
updateTile();
|
updateBlockEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTile() {
|
private void updateBlockEntity() {
|
||||||
boolean hasAttachedComputer = computers.get() > 0;
|
boolean hasAttachedComputer = computers.get() > 0;
|
||||||
|
|
||||||
tile.getBehaviour(ComputerBehaviour.TYPE).setHasAttachedComputer(hasAttachedComputer);
|
blockEntity.getBehaviour(ComputerBehaviour.TYPE).setHasAttachedComputer(hasAttachedComputer);
|
||||||
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new AttachedComputerPacket(tile.getBlockPos(), hasAttachedComputer));
|
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new AttachedComputerPacket(blockEntity.getBlockPos(), hasAttachedComputer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -323,8 +323,8 @@ public abstract class Contraption {
|
||||||
if (AllBlocks.BELT.has(state))
|
if (AllBlocks.BELT.has(state))
|
||||||
moveBelt(pos, frontier, visited, state);
|
moveBelt(pos, frontier, visited, state);
|
||||||
|
|
||||||
if (AllBlocks.WINDMILL_BEARING.has(state) && world.getBlockEntity(pos)instanceof WindmillBearingBlockEntity wbte)
|
if (AllBlocks.WINDMILL_BEARING.has(state) && world.getBlockEntity(pos)instanceof WindmillBearingBlockEntity wbbe)
|
||||||
wbte.disassembleForMovement();
|
wbbe.disassembleForMovement();
|
||||||
|
|
||||||
if (AllBlocks.GANTRY_CARRIAGE.has(state))
|
if (AllBlocks.GANTRY_CARRIAGE.has(state))
|
||||||
moveGantryPinion(world, pos, frontier, visited, state);
|
moveGantryPinion(world, pos, frontier, visited, state);
|
||||||
|
@ -894,8 +894,8 @@ public abstract class Contraption {
|
||||||
return;
|
return;
|
||||||
be.setLevel(world);
|
be.setLevel(world);
|
||||||
modelData.put(info.pos, be.getModelData());
|
modelData.put(info.pos, be.getModelData());
|
||||||
if (be instanceof KineticBlockEntity kte)
|
if (be instanceof KineticBlockEntity kbe)
|
||||||
kte.setSpeed(0);
|
kbe.setSpeed(0);
|
||||||
be.getBlockState();
|
be.getBlockState();
|
||||||
|
|
||||||
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state);
|
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state);
|
||||||
|
|
|
@ -72,6 +72,8 @@ public class MountedStorage {
|
||||||
// There doesn't appear to be much of a standard for tagging chests/barrels
|
// There doesn't appear to be much of a standard for tagging chests/barrels
|
||||||
String blockId = ForgeRegistries.BLOCKS.getKey(blockState.getBlock())
|
String blockId = ForgeRegistries.BLOCKS.getKey(blockState.getBlock())
|
||||||
.getPath();
|
.getPath();
|
||||||
|
if (blockId.contains("ender"))
|
||||||
|
return false;
|
||||||
return blockId.endsWith("_chest") || blockId.endsWith("_barrel");
|
return blockId.endsWith("_chest") || blockId.endsWith("_barrel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
|
||||||
if (contraption instanceof ElevatorContraption ec)
|
if (contraption instanceof ElevatorContraption ec)
|
||||||
return elevatorInteraction(localPos, contraptionEntity, ec, ctx);
|
return elevatorInteraction(localPos, contraptionEntity, ec, ctx);
|
||||||
if (contraptionEntity.level.isClientSide()) {
|
if (contraptionEntity.level.isClientSide()) {
|
||||||
if (contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte)
|
if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
|
||||||
cte.pressButton();
|
cbe.pressButton();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
AllPackets.getChannel().sendToServer(new ElevatorTargetFloorPacket(contraptionEntity, efs.currentTargetY));
|
AllPackets.getChannel().sendToServer(new ElevatorTargetFloorPacket(contraptionEntity, efs.currentTargetY));
|
||||||
if (contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte)
|
if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
|
||||||
cte.pressButton();
|
cbe.pressButton();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,8 @@ public class ContraptionControlsRenderer extends SmartBlockEntityRenderer<Contra
|
||||||
msr.rotate(Direction.WEST, AngleHelper.rad(67.5f));
|
msr.rotate(Direction.WEST, AngleHelper.rad(67.5f));
|
||||||
|
|
||||||
float buttondepth = -.25f;
|
float buttondepth = -.25f;
|
||||||
if (ctx.contraption.presentBlockEntities.get(ctx.localPos)instanceof ContraptionControlsBlockEntity cte)
|
if (ctx.contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe)
|
||||||
buttondepth += -1 / 24f * cte.button.getValue(AnimationTickHolder.getPartialTicks(renderWorld));
|
buttondepth += -1 / 24f * cbe.button.getValue(AnimationTickHolder.getPartialTicks(renderWorld));
|
||||||
|
|
||||||
if (!text.isBlank() && playerDistance < 100) {
|
if (!text.isBlank() && playerDistance < 100) {
|
||||||
int actualWidth = fontRenderer.width(text);
|
int actualWidth = fontRenderer.width(text);
|
||||||
|
|
|
@ -35,8 +35,9 @@ public class TrackPaverV2 {
|
||||||
Vec3 direction = VecHelper.clampComponentWise(diff, 1);
|
Vec3 direction = VecHelper.clampComponentWise(diff, 1);
|
||||||
int extent = (int) Math.round((to - from) / direction.length());
|
int extent = (int) Math.round((to - from) / direction.length());
|
||||||
double length = edge.getLength();
|
double length = edge.getLength();
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(edge.getPosition(graph, Mth.clamp(from, 1 / 16f, length - 1 / 16f) / length)
|
BlockPos pos = new BlockPos(edge.getPosition(graph, Mth.clamp(from, 1 / 16f, length - 1 / 16f) / length)
|
||||||
.subtract(0, 0.5, 0));
|
.subtract(0, diff.y != 0 ? 1 : 0.5, 0));
|
||||||
|
|
||||||
paveStraight(task, pos, direction, extent);
|
paveStraight(task, pos, direction, extent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class BearingContraption extends Contraption {
|
||||||
|
|
||||||
private BlockState getSailBlock(Pair<StructureBlockInfo, BlockEntity> capture) {
|
private BlockState getSailBlock(Pair<StructureBlockInfo, BlockEntity> capture) {
|
||||||
BlockState state = capture.getKey().state;
|
BlockState state = capture.getKey().state;
|
||||||
if (AllBlocks.COPYCAT_PANEL.has(state) && capture.getRight()instanceof CopycatBlockEntity cte)
|
if (AllBlocks.COPYCAT_PANEL.has(state) && capture.getRight() instanceof CopycatBlockEntity cbe)
|
||||||
return cte.getMaterial();
|
return cbe.getMaterial();
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,16 @@ public class ElevatorColumn {
|
||||||
public void markDirty() {
|
public void markDirty() {
|
||||||
for (BlockPos pos : getContacts()) {
|
for (BlockPos pos : getContacts()) {
|
||||||
BlockEntity blockEntity = level.getBlockEntity(pos);
|
BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||||
if (blockEntity instanceof ElevatorContactBlockEntity ecte)
|
if (blockEntity instanceof ElevatorContactBlockEntity ecbe)
|
||||||
ecte.setChanged();
|
ecbe.setChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void floorReached(LevelAccessor level, String name) {
|
public void floorReached(LevelAccessor level, String name) {
|
||||||
getContacts().stream()
|
getContacts().stream()
|
||||||
.forEach(p -> {
|
.forEach(p -> {
|
||||||
if (level.getBlockEntity(p)instanceof ElevatorContactBlockEntity ecte)
|
if (level.getBlockEntity(p) instanceof ElevatorContactBlockEntity ecbe)
|
||||||
ecte.updateDisplayedFloor(name);
|
ecbe.updateDisplayedFloor(name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ public class ElevatorColumn {
|
||||||
public List<IntAttached<Couple<String>>> compileNamesList() {
|
public List<IntAttached<Couple<String>>> compileNamesList() {
|
||||||
return getContacts().stream()
|
return getContacts().stream()
|
||||||
.map(p -> {
|
.map(p -> {
|
||||||
if (level.getBlockEntity(p)instanceof ElevatorContactBlockEntity ecte)
|
if (level.getBlockEntity(p) instanceof ElevatorContactBlockEntity ecbe)
|
||||||
return IntAttached.with(p.getY(), ecte.getNames());
|
return IntAttached.with(p.getY(), ecbe.getNames());
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
|
@ -126,13 +126,13 @@ public class ElevatorColumn {
|
||||||
Integer y = contacts.get(i);
|
Integer y = contacts.get(i);
|
||||||
|
|
||||||
BlockPos pos = contactAt(y);
|
BlockPos pos = contactAt(y);
|
||||||
if (!(level.getBlockEntity(pos)instanceof ElevatorContactBlockEntity ecte))
|
if (!(level.getBlockEntity(pos) instanceof ElevatorContactBlockEntity ecbe))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Integer currentLevel = null;
|
Integer currentLevel = null;
|
||||||
|
|
||||||
if (!ecte.shortName.isBlank()) {
|
if (!ecbe.shortName.isBlank()) {
|
||||||
Integer tryValueOf = tryValueOf(ecte.shortName);
|
Integer tryValueOf = tryValueOf(ecbe.shortName);
|
||||||
if (tryValueOf != null)
|
if (tryValueOf != null)
|
||||||
currentLevel = tryValueOf;
|
currentLevel = tryValueOf;
|
||||||
if (currentLevel == null)
|
if (currentLevel == null)
|
||||||
|
@ -146,13 +146,13 @@ public class ElevatorColumn {
|
||||||
|
|
||||||
for (int peekI = i + 1; peekI < contacts.size(); peekI++) {
|
for (int peekI = i + 1; peekI < contacts.size(); peekI++) {
|
||||||
BlockPos peekPos = contactAt(contacts.get(peekI));
|
BlockPos peekPos = contactAt(contacts.get(peekI));
|
||||||
if (!(level.getBlockEntity(peekPos)instanceof ElevatorContactBlockEntity peekEcte))
|
if (!(level.getBlockEntity(peekPos) instanceof ElevatorContactBlockEntity peekEcbe))
|
||||||
continue;
|
continue;
|
||||||
Integer tryValueOf = tryValueOf(peekEcte.shortName);
|
Integer tryValueOf = tryValueOf(peekEcbe.shortName);
|
||||||
if (tryValueOf == null)
|
if (tryValueOf == null)
|
||||||
continue;
|
continue;
|
||||||
if (currentLevel != null && currentLevel >= tryValueOf) {
|
if (currentLevel != null && currentLevel >= tryValueOf) {
|
||||||
peekEcte.shortName = "";
|
peekEcbe.shortName = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nextLevel = tryValueOf;
|
nextLevel = tryValueOf;
|
||||||
|
@ -162,7 +162,7 @@ public class ElevatorColumn {
|
||||||
if (currentLevel == null)
|
if (currentLevel == null)
|
||||||
currentLevel = nextLevel != null ? nextLevel - 1 : 0;
|
currentLevel = nextLevel != null ? nextLevel - 1 : 0;
|
||||||
|
|
||||||
ecte.updateName(String.valueOf(currentLevel), ecte.longName);
|
ecbe.updateName(String.valueOf(currentLevel), ecbe.longName);
|
||||||
prevLevel = currentLevel;
|
prevLevel = currentLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLight(BlockState state) {
|
public static int getLight(BlockState state) {
|
||||||
return state.getValue(POWERING) ? 10 : state.getValue(CALLING) ? 5 : 0;
|
return state.getValue(POWERING) ? 10 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,10 +141,10 @@ public class ElevatorContraption extends PulleyContraption {
|
||||||
|
|
||||||
public void broadcastFloorData(Level level, BlockPos contactPos) {
|
public void broadcastFloorData(Level level, BlockPos contactPos) {
|
||||||
ElevatorColumn column = ElevatorColumn.get(level, getGlobalColumn());
|
ElevatorColumn column = ElevatorColumn.get(level, getGlobalColumn());
|
||||||
if (!(world.getBlockEntity(contactPos)instanceof ElevatorContactBlockEntity ecte))
|
if (!(world.getBlockEntity(contactPos) instanceof ElevatorContactBlockEntity ecbe))
|
||||||
return;
|
return;
|
||||||
if (column != null)
|
if (column != null)
|
||||||
column.floorReached(level, ecte.shortName);
|
column.floorReached(level, ecbe.shortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -81,13 +81,19 @@ public class ElevatorPulleyBlockEntity extends PulleyBlockEntity {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double y = movedContraption.getY();
|
double y = movedContraption.getY();
|
||||||
int targetLevel = Mth.floor(0.5f + y);
|
int targetLevel = Mth.floor(0.5f + y) + ec.contactYOffset;
|
||||||
|
|
||||||
|
Integer ecCurrentTargetY = ec.getCurrentTargetY(level);
|
||||||
|
if (ecCurrentTargetY != null)
|
||||||
|
targetLevel = ecCurrentTargetY;
|
||||||
|
if (level.isClientSide())
|
||||||
|
targetLevel = ec.clientYTarget;
|
||||||
if (!wasArrived && !level.isClientSide()) {
|
if (!wasArrived && !level.isClientSide()) {
|
||||||
triggerContact(ec, targetLevel);
|
triggerContact(ec, targetLevel);
|
||||||
AllSoundEvents.CONTRAPTION_DISASSEMBLE.play(level, null, worldPosition.below((int) offset), 0.75f, 0.8f);
|
AllSoundEvents.CONTRAPTION_DISASSEMBLE.play(level, null, worldPosition.below((int) offset), 0.75f, 0.8f);
|
||||||
}
|
}
|
||||||
|
|
||||||
double diff = targetLevel - y;
|
double diff = targetLevel - y - ec.contactYOffset;
|
||||||
if (Math.abs(diff) > 1f / 128)
|
if (Math.abs(diff) > 1f / 128)
|
||||||
diff *= 0.25f;
|
diff *= 0.25f;
|
||||||
movedContraption.setPos(movedContraption.position()
|
movedContraption.setPos(movedContraption.position()
|
||||||
|
@ -284,8 +290,8 @@ public class ElevatorPulleyBlockEntity extends PulleyBlockEntity {
|
||||||
continue;
|
continue;
|
||||||
pos = pos.offset(anchor);
|
pos = pos.offset(anchor);
|
||||||
if (level.getBlockEntity(new BlockPos(pos.getX(), worldPosition.getY(),
|
if (level.getBlockEntity(new BlockPos(pos.getX(), worldPosition.getY(),
|
||||||
pos.getZ()))instanceof ElevatorPulleyBlockEntity pte)
|
pos.getZ())) instanceof ElevatorPulleyBlockEntity pbe)
|
||||||
pte.startMirroringOther(worldPosition);
|
pbe.startMirroringOther(worldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
ElevatorColumn column = ElevatorColumn.getOrCreate(level, contraption.getGlobalColumn());
|
ElevatorColumn column = ElevatorColumn.getOrCreate(level, contraption.getGlobalColumn());
|
||||||
|
|
|
@ -158,8 +158,8 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
|
||||||
continue;
|
continue;
|
||||||
pos = pos.offset(anchor);
|
pos = pos.offset(anchor);
|
||||||
if (level.getBlockEntity(
|
if (level.getBlockEntity(
|
||||||
new BlockPos(pos.getX(), worldPosition.getY(), pos.getZ()))instanceof PulleyBlockEntity pte)
|
new BlockPos(pos.getX(), worldPosition.getY(), pos.getZ())) instanceof PulleyBlockEntity pbe)
|
||||||
pte.startMirroringOther(worldPosition);
|
pbe.startMirroringOther(worldPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,14 +307,14 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
|
||||||
public void startMirroringOther(BlockPos parent) {
|
public void startMirroringOther(BlockPos parent) {
|
||||||
if (parent.equals(worldPosition))
|
if (parent.equals(worldPosition))
|
||||||
return;
|
return;
|
||||||
if (!(level.getBlockEntity(parent)instanceof PulleyBlockEntity pte))
|
if (!(level.getBlockEntity(parent) instanceof PulleyBlockEntity pbe))
|
||||||
return;
|
return;
|
||||||
if (pte.getType() != getType())
|
if (pbe.getType() != getType())
|
||||||
return;
|
return;
|
||||||
if (pte.mirrorChildren == null)
|
if (pbe.mirrorChildren == null)
|
||||||
pte.mirrorChildren = new ArrayList<>();
|
pbe.mirrorChildren = new ArrayList<>();
|
||||||
pte.mirrorChildren.add(worldPosition);
|
pbe.mirrorChildren.add(worldPosition);
|
||||||
pte.notifyUpdate();
|
pbe.notifyUpdate();
|
||||||
|
|
||||||
mirrorParent = parent;
|
mirrorParent = parent;
|
||||||
try {
|
try {
|
||||||
|
@ -328,12 +328,12 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
|
||||||
if (mirrorChildren == null)
|
if (mirrorChildren == null)
|
||||||
return;
|
return;
|
||||||
for (BlockPos blockPos : mirrorChildren) {
|
for (BlockPos blockPos : mirrorChildren) {
|
||||||
if (!(level.getBlockEntity(blockPos)instanceof PulleyBlockEntity pte))
|
if (!(level.getBlockEntity(blockPos) instanceof PulleyBlockEntity pbe))
|
||||||
continue;
|
continue;
|
||||||
pte.offset = offset;
|
pbe.offset = offset;
|
||||||
pte.disassemble();
|
pbe.disassemble();
|
||||||
pte.mirrorParent = null;
|
pbe.mirrorParent = null;
|
||||||
pte.notifyUpdate();
|
pbe.notifyUpdate();
|
||||||
}
|
}
|
||||||
mirrorChildren.clear();
|
mirrorChildren.clear();
|
||||||
notifyUpdate();
|
notifyUpdate();
|
||||||
|
|
|
@ -181,6 +181,7 @@ public abstract class CopycatBlock extends Block implements IBE<CopycatBlockEnti
|
||||||
if (block instanceof StairBlock)
|
if (block instanceof StairBlock)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (pLevel != null) {
|
||||||
VoxelShape shape = appliedState.getShape(pLevel, pPos);
|
VoxelShape shape = appliedState.getShape(pLevel, pPos);
|
||||||
if (shape.isEmpty() || !shape.bounds()
|
if (shape.isEmpty() || !shape.bounds()
|
||||||
.equals(Shapes.block()
|
.equals(Shapes.block()
|
||||||
|
@ -191,6 +192,7 @@ public abstract class CopycatBlock extends Block implements IBE<CopycatBlockEnti
|
||||||
if (collisionShape.isEmpty())
|
if (collisionShape.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (face != null) {
|
if (face != null) {
|
||||||
Axis axis = face.getAxis();
|
Axis axis = face.getAxis();
|
||||||
|
@ -270,8 +272,8 @@ public abstract class CopycatBlock extends Block implements IBE<CopycatBlockEnti
|
||||||
//
|
//
|
||||||
|
|
||||||
public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) {
|
public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) {
|
||||||
if (reader.getBlockEntity(targetPos) instanceof CopycatBlockEntity ufte)
|
if (reader.getBlockEntity(targetPos) instanceof CopycatBlockEntity cbe)
|
||||||
return ufte.getMaterial();
|
return cbe.getMaterial();
|
||||||
return Blocks.AIR.defaultBlockState();
|
return Blocks.AIR.defaultBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +316,7 @@ public abstract class CopycatBlock extends Block implements IBE<CopycatBlockEnti
|
||||||
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos,
|
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos,
|
||||||
Player player) {
|
Player player) {
|
||||||
BlockState material = getMaterial(level, pos);
|
BlockState material = getMaterial(level, pos);
|
||||||
if (AllBlocks.COPYCAT_BASE.has(material))
|
if (AllBlocks.COPYCAT_BASE.has(material) || player != null && player.isSteppingCarefully())
|
||||||
return new ItemStack(this);
|
return new ItemStack(this);
|
||||||
return material.getCloneItemStack(target, level, pos, player);
|
return material.getCloneItemStack(target, level, pos, player);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.content.schematics.requirement.ItemRequirement;
|
||||||
import com.simibubi.create.content.schematics.requirement.ItemRequirement.ItemUseType;
|
import com.simibubi.create.content.schematics.requirement.ItemRequirement.ItemUseType;
|
||||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||||
|
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -26,7 +27,7 @@ import net.minecraftforge.client.model.data.ModelData;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
public class CopycatBlockEntity extends SmartBlockEntity
|
public class CopycatBlockEntity extends SmartBlockEntity
|
||||||
implements ISpecialBlockEntityItemRequirement, ITransformableBlockEntity {
|
implements ISpecialBlockEntityItemRequirement, ITransformableBlockEntity, IPartialSafeNBT {
|
||||||
|
|
||||||
private BlockState material;
|
private BlockState material;
|
||||||
private ItemStack consumedItem;
|
private ItemStack consumedItem;
|
||||||
|
@ -138,19 +139,49 @@ public class CopycatBlockEntity extends SmartBlockEntity
|
||||||
consumedItem = ItemStack.of(tag.getCompound("Item"));
|
consumedItem = ItemStack.of(tag.getCompound("Item"));
|
||||||
|
|
||||||
BlockState prevMaterial = material;
|
BlockState prevMaterial = material;
|
||||||
if (!tag.contains("Material"))
|
if (!tag.contains("Material")) {
|
||||||
|
consumedItem = ItemStack.EMPTY;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
material = NbtUtils.readBlockState(tag.getCompound("Material"));
|
material = NbtUtils.readBlockState(tag.getCompound("Material"));
|
||||||
|
|
||||||
|
// Validate Material
|
||||||
|
if (material != null && !clientPacket) {
|
||||||
|
BlockState blockState = getBlockState();
|
||||||
|
if (blockState == null)
|
||||||
|
return;
|
||||||
|
if (!(blockState.getBlock() instanceof CopycatBlock cb))
|
||||||
|
return;
|
||||||
|
BlockState acceptedBlockState = cb.getAcceptedBlockState(level, worldPosition, consumedItem, null);
|
||||||
|
if (acceptedBlockState != null && material.is(acceptedBlockState.getBlock()))
|
||||||
|
return;
|
||||||
|
consumedItem = ItemStack.EMPTY;
|
||||||
|
material = AllBlocks.COPYCAT_BASE.getDefaultState();
|
||||||
|
}
|
||||||
|
|
||||||
if (clientPacket && prevMaterial != material)
|
if (clientPacket && prevMaterial != material)
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSafe(CompoundTag tag) {
|
||||||
|
super.writeSafe(tag);
|
||||||
|
|
||||||
|
ItemStack stackWithoutNBT = consumedItem.copy();
|
||||||
|
stackWithoutNBT.setTag(null);
|
||||||
|
|
||||||
|
write(tag, stackWithoutNBT, material);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void write(CompoundTag tag, boolean clientPacket) {
|
protected void write(CompoundTag tag, boolean clientPacket) {
|
||||||
super.write(tag, clientPacket);
|
super.write(tag, clientPacket);
|
||||||
tag.put("Item", consumedItem.serializeNBT());
|
write(tag, consumedItem, material);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void write(CompoundTag tag, ItemStack stack, BlockState material) {
|
||||||
|
tag.put("Item", stack.serializeNBT());
|
||||||
tag.put("Material", NbtUtils.writeBlockState(material));
|
tag.put("Material", NbtUtils.writeBlockState(material));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,9 +236,9 @@ public class GirderBlock extends Block implements SimpleWaterloggedBlock, IWrenc
|
||||||
|
|
||||||
public static boolean isFacingBracket(BlockAndTintGetter level, BlockPos pos, Direction d) {
|
public static boolean isFacingBracket(BlockAndTintGetter level, BlockPos pos, Direction d) {
|
||||||
BlockEntity blockEntity = level.getBlockEntity(pos.relative(d));
|
BlockEntity blockEntity = level.getBlockEntity(pos.relative(d));
|
||||||
if (!(blockEntity instanceof SmartBlockEntity ste))
|
if (!(blockEntity instanceof SmartBlockEntity sbe))
|
||||||
return false;
|
return false;
|
||||||
BracketedBlockEntityBehaviour behaviour = ste.getBehaviour(BracketedBlockEntityBehaviour.TYPE);
|
BracketedBlockEntityBehaviour behaviour = sbe.getBehaviour(BracketedBlockEntityBehaviour.TYPE);
|
||||||
if (behaviour == null)
|
if (behaviour == null)
|
||||||
return false;
|
return false;
|
||||||
BlockState bracket = behaviour.getBracket();
|
BlockState bracket = behaviour.getBracket();
|
||||||
|
|
|
@ -55,13 +55,13 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour {
|
||||||
tickOpen(context, open);
|
tickOpen(context, open);
|
||||||
|
|
||||||
Map<BlockPos, BlockEntity> tes = context.contraption.presentBlockEntities;
|
Map<BlockPos, BlockEntity> tes = context.contraption.presentBlockEntities;
|
||||||
if (!(tes.get(context.localPos)instanceof SlidingDoorBlockEntity doorTE))
|
if (!(tes.get(context.localPos) instanceof SlidingDoorBlockEntity sdbe))
|
||||||
return;
|
return;
|
||||||
boolean wasSettled = doorTE.animation.settled();
|
boolean wasSettled = sdbe.animation.settled();
|
||||||
doorTE.animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR);
|
sdbe.animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR);
|
||||||
doorTE.animation.tickChaser();
|
sdbe.animation.tickChaser();
|
||||||
|
|
||||||
if (!wasSettled && doorTE.animation.settled() && !open)
|
if (!wasSettled && sdbe.animation.settled() && !open)
|
||||||
context.world.playLocalSound(context.position.x, context.position.y, context.position.z,
|
context.world.playLocalSound(context.position.x, context.position.y, context.position.z,
|
||||||
SoundEvents.IRON_DOOR_CLOSE, SoundSource.BLOCKS, .125f, 1, false);
|
SoundEvents.IRON_DOOR_CLOSE, SoundSource.BLOCKS, .125f, 1, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,8 +186,8 @@ public class WhistleBlockEntity extends SmartBlockEntity implements IHaveGoggleI
|
||||||
source = new WeakReference<>(null);
|
source = new WeakReference<>(null);
|
||||||
Direction facing = WhistleBlock.getAttachedDirection(getBlockState());
|
Direction facing = WhistleBlock.getAttachedDirection(getBlockState());
|
||||||
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing));
|
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing));
|
||||||
if (be instanceof FluidTankBlockEntity tankTe)
|
if (be instanceof FluidTankBlockEntity tankBe)
|
||||||
source = new WeakReference<>(tank = tankTe);
|
source = new WeakReference<>(tank = tankBe);
|
||||||
}
|
}
|
||||||
if (tank == null)
|
if (tank == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.FluidTags;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
@ -92,7 +93,8 @@ public class DivingBootsItem extends BaseArmorItem {
|
||||||
if (!entity.isOnGround()) {
|
if (!entity.isOnGround()) {
|
||||||
if (entity.jumping && entity.getPersistentData()
|
if (entity.jumping && entity.getPersistentData()
|
||||||
.contains("LavaGrounded")) {
|
.contains("LavaGrounded")) {
|
||||||
vMultiplier = yMotion == 0 ? 0 : 1 / yMotion;
|
boolean eyeInFluid = entity.isEyeInFluid(FluidTags.LAVA);
|
||||||
|
vMultiplier = yMotion == 0 ? 0 : (eyeInFluid ? 1 : 0.5) / yMotion;
|
||||||
} else if (yMotion > 0)
|
} else if (yMotion > 0)
|
||||||
vMultiplier = 1.3;
|
vMultiplier = 1.3;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.enchantment.Enchantment;
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.common.ForgeMod;
|
|
||||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
|
import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
|
@ -84,7 +83,7 @@ public class DivingHelmetItem extends BaseArmorItem {
|
||||||
entity.getPersistentData()
|
entity.getPersistentData()
|
||||||
.remove("VisualBacktankAir");
|
.remove("VisualBacktankAir");
|
||||||
|
|
||||||
boolean lavaDiving = entity.isEyeInFluidType(ForgeMod.LAVA_TYPE.get());
|
boolean lavaDiving = entity.isInLava();
|
||||||
if (!isWornBy(entity, lavaDiving))
|
if (!isWornBy(entity, lavaDiving))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class RemainingAirOverlay implements IGuiOverlay {
|
||||||
if (!player.getPersistentData()
|
if (!player.getPersistentData()
|
||||||
.contains("VisualBacktankAir"))
|
.contains("VisualBacktankAir"))
|
||||||
return;
|
return;
|
||||||
if (!player.isEyeInFluid(FluidTags.WATER) && !player.isEyeInFluid(FluidTags.LAVA))
|
if (!player.isEyeInFluid(FluidTags.WATER) && !player.isInLava())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int timeLeft = player.getPersistentData()
|
int timeLeft = player.getPersistentData()
|
||||||
|
|
|
@ -60,6 +60,8 @@ public class ClipboardBlock extends FaceAttachedHorizontalDirectionalBlock
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
||||||
BlockState stateForPlacement = super.getStateForPlacement(pContext);
|
BlockState stateForPlacement = super.getStateForPlacement(pContext);
|
||||||
|
if (stateForPlacement == null)
|
||||||
|
return null;
|
||||||
if (stateForPlacement.getValue(FACE) != AttachFace.WALL)
|
if (stateForPlacement.getValue(FACE) != AttachFace.WALL)
|
||||||
stateForPlacement = stateForPlacement.setValue(FACING, stateForPlacement.getValue(FACING)
|
stateForPlacement = stateForPlacement.setValue(FACING, stateForPlacement.getValue(FACING)
|
||||||
.getOpposite());
|
.getOpposite());
|
||||||
|
|
|
@ -327,8 +327,8 @@ public class BoilerData {
|
||||||
if (AllBlocks.STEAM_WHISTLE.has(attachedState)
|
if (AllBlocks.STEAM_WHISTLE.has(attachedState)
|
||||||
&& WhistleBlock.getAttachedDirection(attachedState)
|
&& WhistleBlock.getAttachedDirection(attachedState)
|
||||||
.getOpposite() == d) {
|
.getOpposite() == d) {
|
||||||
if (level.getBlockEntity(attachedPos)instanceof WhistleBlockEntity wte)
|
if (level.getBlockEntity(attachedPos) instanceof WhistleBlockEntity wbe)
|
||||||
whistlePitches.add(wte.getPitchId());
|
whistlePitches.add(wbe.getPitchId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,8 +315,8 @@ public class FluidTankBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||||
for (int xOffset = 0; xOffset < width; xOffset++)
|
for (int xOffset = 0; xOffset < width; xOffset++)
|
||||||
for (int zOffset = 0; zOffset < width; zOffset++)
|
for (int zOffset = 0; zOffset < width; zOffset++)
|
||||||
if (level.getBlockEntity(
|
if (level.getBlockEntity(
|
||||||
worldPosition.offset(xOffset, yOffset, zOffset)) instanceof FluidTankBlockEntity fte)
|
worldPosition.offset(xOffset, yOffset, zOffset)) instanceof FluidTankBlockEntity fbe)
|
||||||
fte.refreshCapability();
|
fbe.refreshCapability();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
|
@ -145,14 +145,14 @@ public class CrushingWheelControllerBlock extends DirectionalBlock implements IB
|
||||||
if (neighbour.getValue(BlockStateProperties.AXIS) == d.getAxis())
|
if (neighbour.getValue(BlockStateProperties.AXIS) == d.getAxis())
|
||||||
continue;
|
continue;
|
||||||
BlockEntity adjBE = world.getBlockEntity(pos.relative(d));
|
BlockEntity adjBE = world.getBlockEntity(pos.relative(d));
|
||||||
if (!(adjBE instanceof CrushingWheelBlockEntity cwte))
|
if (!(adjBE instanceof CrushingWheelBlockEntity cwbe))
|
||||||
continue;
|
continue;
|
||||||
be.crushingspeed = Math.abs(cwte.getSpeed() / 50f);
|
be.crushingspeed = Math.abs(cwbe.getSpeed() / 50f);
|
||||||
be.sendData();
|
be.sendData();
|
||||||
|
|
||||||
cwte.award(AllAdvancements.CRUSHING_WHEEL);
|
cwbe.award(AllAdvancements.CRUSHING_WHEEL);
|
||||||
if (cwte.getSpeed() > 255)
|
if (cwbe.getSpeed() > 255)
|
||||||
cwte.award(AllAdvancements.CRUSHER_MAXED);
|
cwbe.award(AllAdvancements.CRUSHER_MAXED);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import com.jozufozu.flywheel.api.MaterialManager;
|
||||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
|
||||||
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
|
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
|
||||||
import com.simibubi.create.content.contraptions.OrientedContraptionEntity;
|
import com.simibubi.create.content.contraptions.OrientedContraptionEntity;
|
||||||
import com.simibubi.create.content.contraptions.behaviour.MovementBehaviour;
|
import com.simibubi.create.content.contraptions.behaviour.MovementBehaviour;
|
||||||
|
@ -33,7 +32,6 @@ import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
import com.simibubi.create.foundation.utility.NBTProcessors;
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
|
@ -48,7 +46,6 @@ import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.common.util.BlockSnapshot;
|
import net.minecraftforge.common.util.BlockSnapshot;
|
||||||
|
@ -155,15 +152,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
|
||||||
ExtractionCountMode.EXACTLY, required.stack.getCount(), false);
|
ExtractionCountMode.EXACTLY, required.stack.getCount(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag data = null;
|
CompoundTag data = BlockHelper.prepareBlockEntityData(blockState, schematicWorld.getBlockEntity(pos));
|
||||||
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
|
|
||||||
BlockEntity blockEntity = schematicWorld.getBlockEntity(pos);
|
|
||||||
if (blockEntity != null) {
|
|
||||||
data = blockEntity.saveWithFullMetadata();
|
|
||||||
data = NBTProcessors.process(blockEntity, data, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockSnapshot blocksnapshot = BlockSnapshot.create(world.dimension(), world, pos);
|
BlockSnapshot blocksnapshot = BlockSnapshot.create(world.dimension(), world, pos);
|
||||||
BlockHelper.placeSchematicBlock(world, blockState, pos, contextStack, data);
|
BlockHelper.placeSchematicBlock(world, blockState, pos, contextStack, data);
|
||||||
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))
|
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -266,8 +267,12 @@ public class AirCurrent {
|
||||||
.below(offset);
|
.below(offset);
|
||||||
TransportedItemStackHandlerBehaviour behaviour =
|
TransportedItemStackHandlerBehaviour behaviour =
|
||||||
BlockEntityBehaviour.get(world, pos, TransportedItemStackHandlerBehaviour.TYPE);
|
BlockEntityBehaviour.get(world, pos, TransportedItemStackHandlerBehaviour.TYPE);
|
||||||
|
FanProcessing.Type typeAtHandler = type;
|
||||||
|
if (world.getFluidState(pos)
|
||||||
|
.is(Fluids.WATER))
|
||||||
|
typeAtHandler = Type.SPLASHING;
|
||||||
if (behaviour != null)
|
if (behaviour != null)
|
||||||
affectedItemHandlers.add(Pair.of(behaviour, type));
|
affectedItemHandlers.add(Pair.of(behaviour, typeAtHandler));
|
||||||
if (direction.getAxis()
|
if (direction.getAxis()
|
||||||
.isVertical())
|
.isVertical())
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -166,8 +166,8 @@ public class SteamEngineBlockEntity extends SmartBlockEntity implements IHaveGog
|
||||||
source = new WeakReference<>(null);
|
source = new WeakReference<>(null);
|
||||||
Direction facing = SteamEngineBlock.getFacing(getBlockState());
|
Direction facing = SteamEngineBlock.getFacing(getBlockState());
|
||||||
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing.getOpposite()));
|
BlockEntity be = level.getBlockEntity(worldPosition.relative(facing.getOpposite()));
|
||||||
if (be instanceof FluidTankBlockEntity tankTe)
|
if (be instanceof FluidTankBlockEntity tankBe)
|
||||||
source = new WeakReference<>(tank = tankTe);
|
source = new WeakReference<>(tank = tankBe);
|
||||||
}
|
}
|
||||||
if (tank == null)
|
if (tank == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -782,7 +782,7 @@ public class ChuteBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public Direction getAirflowOriginSide() {
|
// public Direction getAirflowOriginSide() {
|
||||||
// return world != null && !(world.getTileEntity(pos.down()) instanceof
|
// return world != null && !(world.getBlockEntity(pos.down()) instanceof
|
||||||
// IAirCurrentSource)
|
// IAirCurrentSource)
|
||||||
// && getBlockState().get(ChuteBlock.FACING) == Direction.DOWN ? Direction.DOWN
|
// && getBlockState().get(ChuteBlock.FACING) == Direction.DOWN ? Direction.DOWN
|
||||||
// : Direction.UP;
|
// : Direction.UP;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class FunnelRenderer extends SmartBlockEntityRenderer<FunnelBlockEntity>
|
||||||
msr.centre()
|
msr.centre()
|
||||||
.rotateY(horizontalAngle)
|
.rotateY(horizontalAngle)
|
||||||
.unCentre();
|
.unCentre();
|
||||||
ms.translate(0.075f, 0, -be.getFlapOffset());
|
ms.translate(0.075f / 16f, 0, -be.getFlapOffset());
|
||||||
|
|
||||||
for (int segment = 0; segment <= 3; segment++) {
|
for (int segment = 0; segment <= 3; segment++) {
|
||||||
ms.pushPose();
|
ms.pushPose();
|
||||||
|
|
|
@ -86,14 +86,14 @@ public class DisplayLinkBlock extends WrenchableDirectionalBlock implements IBE<
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BlockEntity blockEntity = level.getBlockEntity(offsetPos);
|
BlockEntity blockEntity = level.getBlockEntity(offsetPos);
|
||||||
if (!(blockEntity instanceof DisplayLinkBlockEntity dgte))
|
if (!(blockEntity instanceof DisplayLinkBlockEntity dlbe))
|
||||||
continue;
|
continue;
|
||||||
if (dgte.activeSource == null)
|
if (dlbe.activeSource == null)
|
||||||
continue;
|
continue;
|
||||||
if (dgte.getDirection() != d.getOpposite())
|
if (dlbe.getDirection() != d.getOpposite())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
callback.accept(dgte);
|
callback.accept(dlbe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@ public class CurrentFloorDisplaySource extends SingleLineDisplaySource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
||||||
if (!(context.getSourceBlockEntity() instanceof ElevatorContactBlockEntity ecte))
|
if (!(context.getSourceBlockEntity() instanceof ElevatorContactBlockEntity ecbe))
|
||||||
return EMPTY_LINE;
|
return EMPTY_LINE;
|
||||||
return Components.literal(ecte.lastReportedCurrentFloor);
|
return Components.literal(ecbe.lastReportedCurrentFloor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,9 +14,9 @@ public class FillLevelDisplaySource extends PercentOrProgressBarDisplaySource {
|
||||||
@Override
|
@Override
|
||||||
protected Float getProgress(DisplayLinkContext context) {
|
protected Float getProgress(DisplayLinkContext context) {
|
||||||
BlockEntity be = context.getSourceBlockEntity();
|
BlockEntity be = context.getSourceBlockEntity();
|
||||||
if (!(be instanceof ThresholdSwitchBlockEntity sste))
|
if (!(be instanceof ThresholdSwitchBlockEntity tsbe))
|
||||||
return null;
|
return null;
|
||||||
return sste.currentLevel;
|
return tsbe.currentLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,9 +15,9 @@ public class ObservedTrainNameSource extends SingleLineDisplaySource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
||||||
if (!(context.getSourceBlockEntity() instanceof TrackObserverBlockEntity observerTE))
|
if (!(context.getSourceBlockEntity() instanceof TrackObserverBlockEntity observerBE))
|
||||||
return EMPTY_LINE;
|
return EMPTY_LINE;
|
||||||
TrackObserver observer = observerTE.getObserver();
|
TrackObserver observer = observerBE.getObserver();
|
||||||
if (observer == null)
|
if (observer == null)
|
||||||
return EMPTY_LINE;
|
return EMPTY_LINE;
|
||||||
UUID currentTrain = observer.getCurrentTrain();
|
UUID currentTrain = observer.getCurrentTrain();
|
||||||
|
|
|
@ -172,9 +172,9 @@ public class StationSummaryDisplaySource extends DisplaySource {
|
||||||
|
|
||||||
if (conf.contains("Filter"))
|
if (conf.contains("Filter"))
|
||||||
return;
|
return;
|
||||||
if (!(context.getSourceBlockEntity() instanceof StationBlockEntity stationTe))
|
if (!(context.getSourceBlockEntity() instanceof StationBlockEntity stationBe))
|
||||||
return;
|
return;
|
||||||
GlobalStation station = stationTe.getStation();
|
GlobalStation station = stationBe.getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
return;
|
return;
|
||||||
conf.putString("Filter", station.name);
|
conf.putString("Filter", station.name);
|
||||||
|
|
|
@ -12,9 +12,9 @@ public class StopWatchDisplaySource extends SingleLineDisplaySource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
||||||
if (!(context.getSourceBlockEntity()instanceof CuckooClockBlockEntity ccte))
|
if (!(context.getSourceBlockEntity() instanceof CuckooClockBlockEntity ccbe))
|
||||||
return TimeOfDayDisplaySource.EMPTY_TIME;
|
return TimeOfDayDisplaySource.EMPTY_TIME;
|
||||||
if (ccte.getSpeed() == 0)
|
if (ccbe.getSpeed() == 0)
|
||||||
return TimeOfDayDisplaySource.EMPTY_TIME;
|
return TimeOfDayDisplaySource.EMPTY_TIME;
|
||||||
|
|
||||||
if (!context.sourceConfig()
|
if (!context.sourceConfig()
|
||||||
|
|
|
@ -22,9 +22,9 @@ public class TimeOfDayDisplaySource extends SingleLineDisplaySource {
|
||||||
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
||||||
if (!(context.level()instanceof ServerLevel sLevel))
|
if (!(context.level()instanceof ServerLevel sLevel))
|
||||||
return EMPTY_TIME;
|
return EMPTY_TIME;
|
||||||
if (!(context.getSourceBlockEntity() instanceof CuckooClockBlockEntity ccte))
|
if (!(context.getSourceBlockEntity() instanceof CuckooClockBlockEntity ccbe))
|
||||||
return EMPTY_TIME;
|
return EMPTY_TIME;
|
||||||
if (ccte.getSpeed() == 0)
|
if (ccbe.getSpeed() == 0)
|
||||||
return EMPTY_TIME;
|
return EMPTY_TIME;
|
||||||
|
|
||||||
boolean c12 = context.sourceConfig()
|
boolean c12 = context.sourceConfig()
|
||||||
|
|
|
@ -15,9 +15,9 @@ public class TrainStatusDisplaySource extends SingleLineDisplaySource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
||||||
if (!(context.getSourceBlockEntity() instanceof StationBlockEntity observerTE))
|
if (!(context.getSourceBlockEntity() instanceof StationBlockEntity observerBE))
|
||||||
return EMPTY_LINE;
|
return EMPTY_LINE;
|
||||||
GlobalStation observer = observerTE.getStation();
|
GlobalStation observer = observerBE.getStation();
|
||||||
if (observer == null)
|
if (observer == null)
|
||||||
return EMPTY_LINE;
|
return EMPTY_LINE;
|
||||||
Train currentTrain = observer.getPresentTrain();
|
Train currentTrain = observer.getPresentTrain();
|
||||||
|
|
|
@ -90,10 +90,10 @@ public class DisplayBoardTarget extends DisplayTarget {
|
||||||
AABB baseShape = super.getMultiblockBounds(level, pos);
|
AABB baseShape = super.getMultiblockBounds(level, pos);
|
||||||
BlockEntity be = level.getBlockEntity(pos);
|
BlockEntity be = level.getBlockEntity(pos);
|
||||||
|
|
||||||
if (!(be instanceof FlapDisplayBlockEntity fdte))
|
if (!(be instanceof FlapDisplayBlockEntity fdbe))
|
||||||
return baseShape;
|
return baseShape;
|
||||||
|
|
||||||
FlapDisplayBlockEntity controller = fdte.getController();
|
FlapDisplayBlockEntity controller = fdbe.getController();
|
||||||
if (controller == null)
|
if (controller == null)
|
||||||
return baseShape;
|
return baseShape;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor
|
||||||
BlockPos pos = globalPos.subtract(anchor);
|
BlockPos pos = globalPos.subtract(anchor);
|
||||||
|
|
||||||
if (pos.getY() - bounds.minY() == -1 && !renderMode)
|
if (pos.getY() - bounds.minY() == -1 && !renderMode)
|
||||||
return Blocks.GRASS_BLOCK.defaultBlockState();
|
return Blocks.DIRT.defaultBlockState();
|
||||||
if (getBounds().isInside(pos) && blocks.containsKey(pos))
|
if (getBounds().isInside(pos) && blocks.containsKey(pos))
|
||||||
return processBlockStateForPrinting(blocks.get(pos));
|
return processBlockStateForPrinting(blocks.get(pos));
|
||||||
return Blocks.AIR.defaultBlockState();
|
return Blocks.AIR.defaultBlockState();
|
||||||
|
|
|
@ -10,7 +10,6 @@ import javax.annotation.Nullable;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
|
||||||
import com.simibubi.create.content.kinetics.belt.BeltBlock;
|
import com.simibubi.create.content.kinetics.belt.BeltBlock;
|
||||||
import com.simibubi.create.content.kinetics.belt.BeltBlockEntity;
|
import com.simibubi.create.content.kinetics.belt.BeltBlockEntity;
|
||||||
import com.simibubi.create.content.kinetics.belt.BeltBlockEntity.CasingType;
|
import com.simibubi.create.content.kinetics.belt.BeltBlockEntity.CasingType;
|
||||||
|
@ -24,10 +23,9 @@ import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
||||||
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.NBTProcessors;
|
|
||||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||||
import com.simibubi.create.infrastructure.config.CSchematics;
|
import com.simibubi.create.infrastructure.config.CSchematics;
|
||||||
|
|
||||||
|
@ -773,18 +771,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag data = null;
|
CompoundTag data = BlockHelper.prepareBlockEntityData(blockState, blockEntity);
|
||||||
if (blockEntity != null) {
|
|
||||||
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
|
|
||||||
data = blockEntity.saveWithFullMetadata();
|
|
||||||
data = NBTProcessors.process(blockEntity, data, true);
|
|
||||||
} else if (blockEntity instanceof IPartialSafeNBT) {
|
|
||||||
data = new CompoundTag();
|
|
||||||
((IPartialSafeNBT) blockEntity).writeSafe(data);
|
|
||||||
data = NBTProcessors.process(blockEntity, data, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
launchBlock(target, icon, blockState, data);
|
launchBlock(target, icon, blockState, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class SchematicAndQuillHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Path file = result.file();
|
Path file = result.file();
|
||||||
Lang.translate("schematicAndQuill.saved", file)
|
Lang.translate("schematicAndQuill.saved", file.getFileName())
|
||||||
.sendStatus(player);
|
.sendStatus(player);
|
||||||
firstPos = null;
|
firstPos = null;
|
||||||
secondPos = null;
|
secondPos = null;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class SchematicPlacePacket extends SimplePacketBase {
|
||||||
if (placingAir && !includeAir)
|
if (placingAir && !includeAir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CompoundTag data = blockEntity != null ? blockEntity.saveWithFullMetadata() : null;
|
CompoundTag data = BlockHelper.prepareBlockEntityData(state, blockEntity);
|
||||||
BlockHelper.placeSchematicBlock(world, state, pos, null, data);
|
BlockHelper.placeSchematicBlock(world, state, pos, null, data);
|
||||||
}, (pos, entity) -> {
|
}, (pos, entity) -> {
|
||||||
world.addFreshEntity(entity);
|
world.addFreshEntity(entity);
|
||||||
|
|
|
@ -137,9 +137,9 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
|
||||||
public abstract BogeyStyle getDefaultStyle();
|
public abstract BogeyStyle getDefaultStyle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Legacy system doesn't capture bogey tile entities when constructing a train
|
* Legacy system doesn't capture bogey block entities when constructing a train
|
||||||
*/
|
*/
|
||||||
public boolean captureTileEntityForTrain() {
|
public boolean captureBlockEntityForTrain() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,11 +198,11 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
|
||||||
|
|
||||||
BlockEntity be = level.getBlockEntity(pos);
|
BlockEntity be = level.getBlockEntity(pos);
|
||||||
|
|
||||||
if (!(be instanceof AbstractBogeyBlockEntity sbte))
|
if (!(be instanceof AbstractBogeyBlockEntity sbbe))
|
||||||
return InteractionResult.FAIL;
|
return InteractionResult.FAIL;
|
||||||
|
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), 20);
|
player.getCooldowns().addCooldown(stack.getItem(), 20);
|
||||||
BogeyStyle currentStyle = sbte.getStyle();
|
BogeyStyle currentStyle = sbbe.getStyle();
|
||||||
|
|
||||||
BogeySizes.BogeySize size = getSize();
|
BogeySizes.BogeySize size = getSize();
|
||||||
|
|
||||||
|
@ -217,21 +217,21 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
|
||||||
size = size.increment();
|
size = size.increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
sbte.setBogeyStyle(style);
|
sbbe.setBogeyStyle(style);
|
||||||
|
|
||||||
CompoundTag defaultData = style.defaultData;
|
CompoundTag defaultData = style.defaultData;
|
||||||
sbte.setBogeyData(sbte.getBogeyData().merge(defaultData));
|
sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData));
|
||||||
|
|
||||||
if (size == getSize()) {
|
if (size == getSize()) {
|
||||||
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style")
|
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style")
|
||||||
.append(": ").append(style.displayName), true);
|
.append(": ").append(style.displayName), true);
|
||||||
} else {
|
} else {
|
||||||
CompoundTag oldData = sbte.getBogeyData();
|
CompoundTag oldData = sbbe.getBogeyData();
|
||||||
level.setBlock(pos, this.getStateOfSize(sbte, size), 3);
|
level.setBlock(pos, this.getStateOfSize(sbbe, size), 3);
|
||||||
BlockEntity newBlockEntity = level.getBlockEntity(pos);
|
BlockEntity newBlockEntity = level.getBlockEntity(pos);
|
||||||
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newTileEntity))
|
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newBlockEntity1))
|
||||||
return InteractionResult.FAIL;
|
return InteractionResult.FAIL;
|
||||||
newTileEntity.setBogeyData(oldData);
|
newBlockEntity1.setBogeyData(oldData);
|
||||||
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
|
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
|
||||||
.append(": ").append(style.displayName), true);
|
.append(": ").append(style.displayName), true);
|
||||||
}
|
}
|
||||||
|
@ -276,9 +276,9 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockState getNextSize(Level level, BlockPos pos) {
|
public BlockState getNextSize(Level level, BlockPos pos) {
|
||||||
BlockEntity te = level.getBlockEntity(pos);
|
BlockEntity be = level.getBlockEntity(pos);
|
||||||
if (te instanceof AbstractBogeyBlockEntity sbte)
|
if (be instanceof AbstractBogeyBlockEntity sbbe)
|
||||||
return this.getNextSize(sbte);
|
return this.getNextSize(sbbe);
|
||||||
return level.getBlockState(pos);
|
return level.getBlockState(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,8 +319,8 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
|
||||||
|
|
||||||
public BogeyStyle getNextStyle(Level level, BlockPos pos) {
|
public BogeyStyle getNextStyle(Level level, BlockPos pos) {
|
||||||
BlockEntity te = level.getBlockEntity(pos);
|
BlockEntity te = level.getBlockEntity(pos);
|
||||||
if (te instanceof AbstractBogeyBlockEntity sbte)
|
if (te instanceof AbstractBogeyBlockEntity sbbe)
|
||||||
return this.getNextStyle(sbte.getStyle());
|
return this.getNextStyle(sbbe.getStyle());
|
||||||
return getDefaultStyle();
|
return getDefaultStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ public class BogeyBlockEntityRenderer<T extends BlockEntity> extends SafeBlockEn
|
||||||
protected void renderSafe(T be, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light,
|
protected void renderSafe(T be, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light,
|
||||||
int overlay) {
|
int overlay) {
|
||||||
BlockState blockState = be.getBlockState();
|
BlockState blockState = be.getBlockState();
|
||||||
if (be instanceof AbstractBogeyBlockEntity sbte) {
|
if (be instanceof AbstractBogeyBlockEntity sbbe) {
|
||||||
float angle = sbte.getVirtualAngle(partialTicks);
|
float angle = sbbe.getVirtualAngle(partialTicks);
|
||||||
if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey)
|
if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey)
|
||||||
bogey.render(blockState, angle, ms, partialTicks, buffer, light, overlay, sbte.getStyle(), sbte.getBogeyData());
|
bogey.render(blockState, angle, ms, partialTicks, buffer, light, overlay, sbbe.getStyle(), sbbe.getBogeyData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,20 @@ public class BogeyStyle {
|
||||||
public final CompoundTag defaultData;
|
public final CompoundTag defaultData;
|
||||||
|
|
||||||
private Optional<Supplier<? extends CommonRenderer>> commonRendererFactory;
|
private Optional<Supplier<? extends CommonRenderer>> commonRendererFactory;
|
||||||
|
private Map<BogeySizes.BogeySize, ResourceLocation> sizes;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private Map<BogeySizes.BogeySize, SizeData> sizes;
|
private Map<BogeySizes.BogeySize, SizeRenderData> sizeRenderers;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private Optional<CommonRenderer> commonRenderer;
|
private Optional<CommonRenderer> commonRenderer;
|
||||||
|
|
||||||
public BogeyStyle(ResourceLocation name, ResourceLocation cycleGroup, Component displayName, ResourceLocation soundType, ParticleOptions contactParticle, ParticleOptions smokeParticle,
|
public BogeyStyle(ResourceLocation name, ResourceLocation cycleGroup, Component displayName,
|
||||||
CompoundTag defaultData, Map<BogeySizes.BogeySize, Supplier<SizeData>> sizes, Optional<Supplier<? extends CommonRenderer>> commonRenderer) {
|
ResourceLocation soundType, ParticleOptions contactParticle, ParticleOptions smokeParticle,
|
||||||
|
CompoundTag defaultData, Map<BogeySizes.BogeySize, ResourceLocation> sizes,
|
||||||
|
Map<BogeySizes.BogeySize, Supplier<SizeRenderData>> sizeRenderers,
|
||||||
|
Optional<Supplier<? extends CommonRenderer>> commonRenderer) {
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.cycleGroup = cycleGroup;
|
this.cycleGroup = cycleGroup;
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
|
@ -54,10 +59,11 @@ public class BogeyStyle {
|
||||||
this.contactParticle = contactParticle;
|
this.contactParticle = contactParticle;
|
||||||
this.smokeParticle = smokeParticle;
|
this.smokeParticle = smokeParticle;
|
||||||
this.defaultData = defaultData;
|
this.defaultData = defaultData;
|
||||||
|
this.sizes = sizes;
|
||||||
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
this.sizes = new HashMap<>();
|
this.sizeRenderers = new HashMap<>();
|
||||||
sizes.forEach((k, v) -> this.sizes.put(k, v.get()));
|
sizeRenderers.forEach((k, v) -> this.sizeRenderers.put(k, v.get()));
|
||||||
|
|
||||||
this.commonRendererFactory = commonRenderer;
|
this.commonRendererFactory = commonRenderer;
|
||||||
this.commonRenderer = commonRenderer.map(Supplier::get);
|
this.commonRenderer = commonRenderer.map(Supplier::get);
|
||||||
|
@ -72,12 +78,12 @@ public class BogeyStyle {
|
||||||
return Stream.iterate(currentSize.increment(), BogeySizes.BogeySize::increment)
|
return Stream.iterate(currentSize.increment(), BogeySizes.BogeySize::increment)
|
||||||
.filter(sizes::containsKey)
|
.filter(sizes::containsKey)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(size -> ForgeRegistries.BLOCKS.getValue(sizes.get(size).block()))
|
.map(this::getBlockOfSize)
|
||||||
.orElse(ForgeRegistries.BLOCKS.getValue(sizes.get(currentSize).block()));
|
.orElse(getBlockOfSize(currentSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlockOfSize(BogeySizes.BogeySize size) {
|
public Block getBlockOfSize(BogeySizes.BogeySize size) {
|
||||||
return ForgeRegistries.BLOCKS.getValue(sizes.get(size).block());
|
return ForgeRegistries.BLOCKS.getValue(sizes.get(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<BogeySizes.BogeySize> validSizes() {
|
public Set<BogeySizes.BogeySize> validSizes() {
|
||||||
|
@ -93,12 +99,12 @@ public class BogeyStyle {
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public BogeyRenderer createRendererInstance(BogeySizes.BogeySize size) {
|
public BogeyRenderer createRendererInstance(BogeySizes.BogeySize size) {
|
||||||
return this.sizes.get(size).createRenderInstance();
|
return this.sizeRenderers.get(size).createRenderInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public BogeyRenderer getInWorldRenderInstance(BogeySizes.BogeySize size) {
|
public BogeyRenderer getInWorldRenderInstance(BogeySizes.BogeySize size) {
|
||||||
SizeData sizeData = this.sizes.get(size);
|
SizeRenderData sizeData = this.sizeRenderers.get(size);
|
||||||
return sizeData != null ? sizeData.getInWorldInstance() : BackupBogeyRenderer.INSTANCE;
|
return sizeData != null ? sizeData.getInWorldInstance() : BackupBogeyRenderer.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +121,7 @@ public class BogeyStyle {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public record SizeData(ResourceLocation block, Supplier<? extends BogeyRenderer> rendererFactory, BogeyRenderer instance) {
|
public record SizeRenderData(Supplier<? extends BogeyRenderer> rendererFactory, BogeyRenderer instance) {
|
||||||
public BogeyRenderer createRenderInstance() {
|
public BogeyRenderer createRenderInstance() {
|
||||||
return rendererFactory.get();
|
return rendererFactory.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,12 +163,12 @@ public class CarriageContraption extends Contraption {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey) {
|
if (blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey) {
|
||||||
boolean captureTE = bogey.captureTileEntityForTrain();
|
boolean captureBE = bogey.captureBlockEntityForTrain();
|
||||||
bogeys++;
|
bogeys++;
|
||||||
if (bogeys == 2)
|
if (bogeys == 2)
|
||||||
secondBogeyPos = pos;
|
secondBogeyPos = pos;
|
||||||
return Pair.of(new StructureBlockInfo(pos, blockState, captureTE ? getBlockEntityNBT(world, pos) : null),
|
return Pair.of(new StructureBlockInfo(pos, blockState, captureBE ? getBlockEntityNBT(world, pos) : null),
|
||||||
captureTE ? world.getBlockEntity(pos) : null);
|
captureBE ? world.getBlockEntity(pos) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllBlocks.BLAZE_BURNER.has(blockState)
|
if (AllBlocks.BLAZE_BURNER.has(blockState)
|
||||||
|
|
|
@ -29,12 +29,12 @@ import com.simibubi.create.content.trains.bogey.AbstractBogeyBlockEntity;
|
||||||
import com.simibubi.create.content.trains.entity.Carriage.DimensionalCarriageEntity;
|
import com.simibubi.create.content.trains.entity.Carriage.DimensionalCarriageEntity;
|
||||||
import com.simibubi.create.content.trains.entity.TravellingPoint.IEdgePointListener;
|
import com.simibubi.create.content.trains.entity.TravellingPoint.IEdgePointListener;
|
||||||
import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection;
|
import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
|
||||||
import com.simibubi.create.content.trains.graph.DimensionPalette;
|
import com.simibubi.create.content.trains.graph.DimensionPalette;
|
||||||
import com.simibubi.create.content.trains.graph.EdgeData;
|
import com.simibubi.create.content.trains.graph.EdgeData;
|
||||||
import com.simibubi.create.content.trains.graph.EdgePointType;
|
import com.simibubi.create.content.trains.graph.EdgePointType;
|
||||||
import com.simibubi.create.content.trains.graph.TrackEdge;
|
import com.simibubi.create.content.trains.graph.TrackEdge;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraph;
|
import com.simibubi.create.content.trains.graph.TrackGraph;
|
||||||
|
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNode;
|
import com.simibubi.create.content.trains.graph.TrackNode;
|
||||||
import com.simibubi.create.content.trains.observer.TrackObserver;
|
import com.simibubi.create.content.trains.observer.TrackObserver;
|
||||||
import com.simibubi.create.content.trains.schedule.ScheduleRuntime;
|
import com.simibubi.create.content.trains.schedule.ScheduleRuntime;
|
||||||
|
@ -740,9 +740,9 @@ public class Train {
|
||||||
Vec3 bogeyPosition = bogey.getAnchorPosition();
|
Vec3 bogeyPosition = bogey.getAnchorPosition();
|
||||||
if (bogeyPosition == null) continue;
|
if (bogeyPosition == null) continue;
|
||||||
BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition));
|
BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition));
|
||||||
if (!(be instanceof AbstractBogeyBlockEntity sbte))
|
if (!(be instanceof AbstractBogeyBlockEntity sbbe))
|
||||||
continue;
|
continue;
|
||||||
sbte.setBogeyData(bogey.bogeyData);
|
sbbe.setBogeyData(bogey.bogeyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += carriage.bogeySpacing;
|
offset += carriage.bogeySpacing;
|
||||||
|
@ -755,8 +755,8 @@ public class Train {
|
||||||
if (currentStation != null) {
|
if (currentStation != null) {
|
||||||
currentStation.cancelReservation(this);
|
currentStation.cancelReservation(this);
|
||||||
BlockPos blockEntityPos = currentStation.getBlockEntityPos();
|
BlockPos blockEntityPos = currentStation.getBlockEntityPos();
|
||||||
if (level.getBlockEntity(blockEntityPos) instanceof StationBlockEntity ste)
|
if (level.getBlockEntity(blockEntityPos) instanceof StationBlockEntity sbe)
|
||||||
ste.lastDisassembledTrainName = name.copy();
|
sbe.lastDisassembledTrainName = name.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
Create.RAILWAYS.removeTrain(id);
|
Create.RAILWAYS.removeTrain(id);
|
||||||
|
|
|
@ -2,10 +2,10 @@ package com.simibubi.create.content.trains.entity;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
|
||||||
import com.simibubi.create.content.trains.graph.DimensionPalette;
|
import com.simibubi.create.content.trains.graph.DimensionPalette;
|
||||||
import com.simibubi.create.content.trains.graph.TrackEdge;
|
import com.simibubi.create.content.trains.graph.TrackEdge;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraph;
|
import com.simibubi.create.content.trains.graph.TrackGraph;
|
||||||
|
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNode;
|
import com.simibubi.create.content.trains.graph.TrackNode;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNodeLocation;
|
import com.simibubi.create.content.trains.graph.TrackNodeLocation;
|
||||||
import com.simibubi.create.foundation.utility.Couple;
|
import com.simibubi.create.foundation.utility.Couple;
|
||||||
|
|
|
@ -22,10 +22,10 @@ import com.simibubi.create.content.trains.entity.TravellingPoint.IEdgePointListe
|
||||||
import com.simibubi.create.content.trains.entity.TravellingPoint.ITrackSelector;
|
import com.simibubi.create.content.trains.entity.TravellingPoint.ITrackSelector;
|
||||||
import com.simibubi.create.content.trains.entity.TravellingPoint.ITurnListener;
|
import com.simibubi.create.content.trains.entity.TravellingPoint.ITurnListener;
|
||||||
import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection;
|
import com.simibubi.create.content.trains.entity.TravellingPoint.SteerDirection;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
|
||||||
import com.simibubi.create.content.trains.graph.TrackEdge;
|
import com.simibubi.create.content.trains.graph.TrackEdge;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraph;
|
import com.simibubi.create.content.trains.graph.TrackGraph;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraphHelper;
|
import com.simibubi.create.content.trains.graph.TrackGraphHelper;
|
||||||
|
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNode;
|
import com.simibubi.create.content.trains.graph.TrackNode;
|
||||||
import com.simibubi.create.content.trains.track.BezierTrackPointLocation;
|
import com.simibubi.create.content.trains.track.BezierTrackPointLocation;
|
||||||
import com.simibubi.create.content.trains.track.ITrackBlock;
|
import com.simibubi.create.content.trains.track.ITrackBlock;
|
||||||
|
|
|
@ -16,11 +16,11 @@ import java.util.function.Predicate;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
|
||||||
import com.simibubi.create.content.trains.graph.DimensionPalette;
|
import com.simibubi.create.content.trains.graph.DimensionPalette;
|
||||||
import com.simibubi.create.content.trains.graph.EdgeData;
|
import com.simibubi.create.content.trains.graph.EdgeData;
|
||||||
import com.simibubi.create.content.trains.graph.TrackEdge;
|
import com.simibubi.create.content.trains.graph.TrackEdge;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraph;
|
import com.simibubi.create.content.trains.graph.TrackGraph;
|
||||||
|
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNode;
|
import com.simibubi.create.content.trains.graph.TrackNode;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNodeLocation;
|
import com.simibubi.create.content.trains.graph.TrackNodeLocation;
|
||||||
import com.simibubi.create.content.trains.signal.TrackEdgePoint;
|
import com.simibubi.create.content.trains.signal.TrackEdgePoint;
|
||||||
|
|
|
@ -149,11 +149,11 @@ public class TrackGraphHelper {
|
||||||
BezierTrackPointLocation targetBezier) {
|
BezierTrackPointLocation targetBezier) {
|
||||||
BlockState state = level.getBlockState(pos);
|
BlockState state = level.getBlockState(pos);
|
||||||
|
|
||||||
if (!(state.getBlock()instanceof ITrackBlock track))
|
if (!(state.getBlock() instanceof ITrackBlock track))
|
||||||
return null;
|
return null;
|
||||||
if (!(level.getBlockEntity(pos)instanceof TrackBlockEntity trackTE))
|
if (!(level.getBlockEntity(pos) instanceof TrackBlockEntity trackBE))
|
||||||
return null;
|
return null;
|
||||||
BezierConnection bc = trackTE.getConnections()
|
BezierConnection bc = trackBE.getConnections()
|
||||||
.get(targetBezier.curveTarget());
|
.get(targetBezier.curveTarget());
|
||||||
if (bc == null || !bc.isPrimary())
|
if (bc == null || !bc.isPrimary())
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -36,10 +36,10 @@ import com.simibubi.create.content.trains.entity.CarriageContraption;
|
||||||
import com.simibubi.create.content.trains.entity.Train;
|
import com.simibubi.create.content.trains.entity.Train;
|
||||||
import com.simibubi.create.content.trains.entity.TrainPacket;
|
import com.simibubi.create.content.trains.entity.TrainPacket;
|
||||||
import com.simibubi.create.content.trains.entity.TravellingPoint;
|
import com.simibubi.create.content.trains.entity.TravellingPoint;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
|
||||||
import com.simibubi.create.content.trains.graph.EdgePointType;
|
import com.simibubi.create.content.trains.graph.EdgePointType;
|
||||||
import com.simibubi.create.content.trains.graph.TrackEdge;
|
import com.simibubi.create.content.trains.graph.TrackEdge;
|
||||||
import com.simibubi.create.content.trains.graph.TrackGraph;
|
import com.simibubi.create.content.trains.graph.TrackGraph;
|
||||||
|
import com.simibubi.create.content.trains.graph.TrackGraphLocation;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNode;
|
import com.simibubi.create.content.trains.graph.TrackNode;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNodeLocation;
|
import com.simibubi.create.content.trains.graph.TrackNodeLocation;
|
||||||
import com.simibubi.create.content.trains.graph.TrackNodeLocation.DiscoveredLocation;
|
import com.simibubi.create.content.trains.graph.TrackNodeLocation.DiscoveredLocation;
|
||||||
|
@ -296,18 +296,18 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||||
if (!(blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey))
|
if (!(blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey))
|
||||||
continue;
|
continue;
|
||||||
BlockEntity be = level.getBlockEntity(bogeyPos);
|
BlockEntity be = level.getBlockEntity(bogeyPos);
|
||||||
if (!(be instanceof AbstractBogeyBlockEntity oldTE))
|
if (!(be instanceof AbstractBogeyBlockEntity oldBE))
|
||||||
continue;
|
continue;
|
||||||
CompoundTag oldData = oldTE.getBogeyData();
|
CompoundTag oldData = oldBE.getBogeyData();
|
||||||
BlockState newBlock = bogey.getNextSize(oldTE);
|
BlockState newBlock = bogey.getNextSize(oldBE);
|
||||||
if (newBlock.getBlock() == bogey)
|
if (newBlock.getBlock() == bogey)
|
||||||
player.displayClientMessage(Lang.translateDirect("bogey.style.no_other_sizes")
|
player.displayClientMessage(Lang.translateDirect("bogey.style.no_other_sizes")
|
||||||
.withStyle(ChatFormatting.RED), true);
|
.withStyle(ChatFormatting.RED), true);
|
||||||
level.setBlock(bogeyPos, newBlock, 3);
|
level.setBlock(bogeyPos, newBlock, 3);
|
||||||
BlockEntity newEntity = level.getBlockEntity(bogeyPos);
|
BlockEntity newEntity = level.getBlockEntity(bogeyPos);
|
||||||
if (!(newEntity instanceof AbstractBogeyBlockEntity newTE))
|
if (!(newEntity instanceof AbstractBogeyBlockEntity newBE))
|
||||||
continue;
|
continue;
|
||||||
newTE.setBogeyData(oldData);
|
newBE.setBogeyData(oldData);
|
||||||
bogey.playRotateSound(level, bogeyPos);
|
bogey.playRotateSound(level, bogeyPos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -748,9 +748,9 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||||
AbstractBogeyBlock<?> typeOfFirstBogey = bogeyTypes[bogeyIndex];
|
AbstractBogeyBlock<?> typeOfFirstBogey = bogeyTypes[bogeyIndex];
|
||||||
boolean firstBogeyIsUpsideDown = upsideDownBogeys[bogeyIndex];
|
boolean firstBogeyIsUpsideDown = upsideDownBogeys[bogeyIndex];
|
||||||
BlockPos firstBogeyPos = contraption.anchor;
|
BlockPos firstBogeyPos = contraption.anchor;
|
||||||
AbstractBogeyBlockEntity firstBogeyTileEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos);
|
AbstractBogeyBlockEntity firstBogeyBlockEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos);
|
||||||
CarriageBogey firstBogey =
|
CarriageBogey firstBogey =
|
||||||
new CarriageBogey(typeOfFirstBogey, firstBogeyIsUpsideDown, firstBogeyTileEntity.getBogeyData(), points.get(pointIndex), points.get(pointIndex + 1));
|
new CarriageBogey(typeOfFirstBogey, firstBogeyIsUpsideDown, firstBogeyBlockEntity.getBogeyData(), points.get(pointIndex), points.get(pointIndex + 1));
|
||||||
CarriageBogey secondBogey = null;
|
CarriageBogey secondBogey = null;
|
||||||
BlockPos secondBogeyPos = contraption.getSecondBogeyPos();
|
BlockPos secondBogeyPos = contraption.getSecondBogeyPos();
|
||||||
int bogeySpacing = 0;
|
int bogeySpacing = 0;
|
||||||
|
@ -762,10 +762,10 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||||
contraptions.size() + 1);
|
contraptions.size() + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AbstractBogeyBlockEntity secondBogeyTileEntity =
|
AbstractBogeyBlockEntity secondBogeyBlockEntity =
|
||||||
(AbstractBogeyBlockEntity) level.getBlockEntity(secondBogeyPos);
|
(AbstractBogeyBlockEntity) level.getBlockEntity(secondBogeyPos);
|
||||||
bogeySpacing = bogeyLocations[bogeyIndex + 1] - bogeyLocations[bogeyIndex];
|
bogeySpacing = bogeyLocations[bogeyIndex + 1] - bogeyLocations[bogeyIndex];
|
||||||
secondBogey = new CarriageBogey(bogeyTypes[bogeyIndex + 1], upsideDownBogeys[bogeyIndex + 1], secondBogeyTileEntity.getBogeyData(),
|
secondBogey = new CarriageBogey(bogeyTypes[bogeyIndex + 1], upsideDownBogeys[bogeyIndex + 1], secondBogeyBlockEntity.getBogeyData(),
|
||||||
points.get(pointIndex + 2), points.get(pointIndex + 3));
|
points.get(pointIndex + 2), points.get(pointIndex + 3));
|
||||||
bogeyIndex++;
|
bogeyIndex++;
|
||||||
|
|
||||||
|
|
|
@ -281,8 +281,8 @@ public class TrackBlock extends Block
|
||||||
level.setBlock(pos, state.setValue(SHAPE, TrackShape.asPortal(d))
|
level.setBlock(pos, state.setValue(SHAPE, TrackShape.asPortal(d))
|
||||||
.setValue(HAS_BE, true), 3);
|
.setValue(HAS_BE, true), 3);
|
||||||
BlockEntity be = level.getBlockEntity(pos);
|
BlockEntity be = level.getBlockEntity(pos);
|
||||||
if (be instanceof TrackBlockEntity tte)
|
if (be instanceof TrackBlockEntity tbe)
|
||||||
tte.bind(otherLevel.dimension(), otherTrackPos);
|
tbe.bind(otherLevel.dimension(), otherTrackPos);
|
||||||
|
|
||||||
otherLevel.setBlock(otherTrackPos, state.setValue(SHAPE, TrackShape.asPortal(otherTrack.getFace()))
|
otherLevel.setBlock(otherTrackPos, state.setValue(SHAPE, TrackShape.asPortal(otherTrack.getFace()))
|
||||||
.setValue(HAS_BE, true), 3);
|
.setValue(HAS_BE, true), 3);
|
||||||
|
@ -403,24 +403,24 @@ public class TrackBlock extends Block
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (!(blockEntity instanceof TrackBlockEntity trackTE))
|
if (!(blockEntity instanceof TrackBlockEntity trackBE))
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
Map<BlockPos, BezierConnection> connections = trackTE.getConnections();
|
Map<BlockPos, BezierConnection> connections = trackBE.getConnections();
|
||||||
connections.forEach((connectedPos, bc) -> ITrackBlock.addToListIfConnected(connectedTo, list,
|
connections.forEach((connectedPos, bc) -> ITrackBlock.addToListIfConnected(connectedTo, list,
|
||||||
(d, b) -> d == 1 ? Vec3.atLowerCornerOf(bc.tePositions.get(b)) : bc.starts.get(b), bc.normals::get,
|
(d, b) -> d == 1 ? Vec3.atLowerCornerOf(bc.tePositions.get(b)) : bc.starts.get(b), bc.normals::get,
|
||||||
b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, bc::yOffsetAt, null, bc,
|
b -> world instanceof Level l ? l.dimension() : Level.OVERWORLD, bc::yOffsetAt, null, bc,
|
||||||
(b, v) -> ITrackBlock.getMaterialSimple(world, v, bc.getMaterial())));
|
(b, v) -> ITrackBlock.getMaterialSimple(world, v, bc.getMaterial())));
|
||||||
|
|
||||||
if (trackTE.boundLocation == null || !(world instanceof ServerLevel level))
|
if (trackBE.boundLocation == null || !(world instanceof ServerLevel level))
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
ResourceKey<Level> otherDim = trackTE.boundLocation.getFirst();
|
ResourceKey<Level> otherDim = trackBE.boundLocation.getFirst();
|
||||||
ServerLevel otherLevel = level.getServer()
|
ServerLevel otherLevel = level.getServer()
|
||||||
.getLevel(otherDim);
|
.getLevel(otherDim);
|
||||||
if (otherLevel == null)
|
if (otherLevel == null)
|
||||||
return list;
|
return list;
|
||||||
BlockPos boundPos = trackTE.boundLocation.getSecond();
|
BlockPos boundPos = trackBE.boundLocation.getSecond();
|
||||||
BlockState boundState = otherLevel.getBlockState(boundPos);
|
BlockState boundState = otherLevel.getBlockState(boundPos);
|
||||||
if (!AllTags.AllBlockTags.TRACKS.matches(boundState))
|
if (!AllTags.AllBlockTags.TRACKS.matches(boundState))
|
||||||
return list;
|
return list;
|
||||||
|
@ -628,9 +628,9 @@ public class TrackBlock extends Block
|
||||||
Level level = context.getLevel();
|
Level level = context.getLevel();
|
||||||
if (!level.isClientSide && !player.isCreative() && state.getValue(HAS_BE)) {
|
if (!level.isClientSide && !player.isCreative() && state.getValue(HAS_BE)) {
|
||||||
BlockEntity blockEntity = level.getBlockEntity(context.getClickedPos());
|
BlockEntity blockEntity = level.getBlockEntity(context.getClickedPos());
|
||||||
if (blockEntity instanceof TrackBlockEntity trackTE) {
|
if (blockEntity instanceof TrackBlockEntity trackBE) {
|
||||||
trackTE.cancelDrops = true;
|
trackBE.cancelDrops = true;
|
||||||
trackTE.connections.values()
|
trackBE.connections.values()
|
||||||
.forEach(bc -> bc.addItemsToPlayer(player));
|
.forEach(bc -> bc.addItemsToPlayer(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -707,8 +707,8 @@ public class TrackBlock extends Block
|
||||||
Vec3 normal = null;
|
Vec3 normal = null;
|
||||||
Vec3 offset = null;
|
Vec3 offset = null;
|
||||||
|
|
||||||
if (bezierPoint != null && world.getBlockEntity(pos) instanceof TrackBlockEntity trackTE) {
|
if (bezierPoint != null && world.getBlockEntity(pos) instanceof TrackBlockEntity trackBE) {
|
||||||
BezierConnection bc = trackTE.connections.get(bezierPoint.curveTarget());
|
BezierConnection bc = trackBE.connections.get(bezierPoint.curveTarget());
|
||||||
if (bc != null) {
|
if (bc != null) {
|
||||||
double length = Mth.floor(bc.getLength() * 2);
|
double length = Mth.floor(bc.getLength() * 2);
|
||||||
int seg = bezierPoint.segment() + 1;
|
int seg = bezierPoint.segment() + 1;
|
||||||
|
|
|
@ -107,14 +107,14 @@ public class TrackBlockEntity extends SmartBlockEntity implements ITransformable
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockEntity blockEntity = level.getBlockEntity(key);
|
BlockEntity blockEntity = level.getBlockEntity(key);
|
||||||
if (!(blockEntity instanceof TrackBlockEntity trackTE) || blockEntity.isRemoved()) {
|
if (!(blockEntity instanceof TrackBlockEntity trackBE) || blockEntity.isRemoved()) {
|
||||||
invalid.add(key);
|
invalid.add(key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trackTE.connections.containsKey(worldPosition)) {
|
if (!trackBE.connections.containsKey(worldPosition)) {
|
||||||
trackTE.addConnection(bc.secondary());
|
trackBE.addConnection(bc.secondary());
|
||||||
trackTE.tilt.tryApplySmoothing();
|
trackBE.tilt.tryApplySmoothing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class TrackBlockItem extends BlockItem {
|
||||||
Vec3 lookAngle = player.getLookAngle();
|
Vec3 lookAngle = player.getLookAngle();
|
||||||
|
|
||||||
if (!isFoil(stack)) {
|
if (!isFoil(stack)) {
|
||||||
if (state.getBlock()instanceof TrackBlock track && track.getTrackAxes(level, pos, state)
|
if (state.getBlock() instanceof TrackBlock track && track.getTrackAxes(level, pos, state)
|
||||||
.size() > 1) {
|
.size() > 1) {
|
||||||
if (!level.isClientSide)
|
if (!level.isClientSide)
|
||||||
player.displayClientMessage(Lang.translateDirect("track.junction_start")
|
player.displayClientMessage(Lang.translateDirect("track.junction_start")
|
||||||
|
|
|
@ -269,8 +269,8 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends BlockEnti
|
||||||
|
|
||||||
public BlockPos getPositionForMapMarker() {
|
public BlockPos getPositionForMapMarker() {
|
||||||
BlockPos target = targetTrack.offset(blockEntity.getBlockPos());
|
BlockPos target = targetTrack.offset(blockEntity.getBlockPos());
|
||||||
if (targetBezier != null && getWorld().getBlockEntity(target) instanceof TrackBlockEntity tte) {
|
if (targetBezier != null && getWorld().getBlockEntity(target) instanceof TrackBlockEntity tbe) {
|
||||||
BezierConnection bc = tte.getConnections()
|
BezierConnection bc = tbe.getConnections()
|
||||||
.get(targetBezier.curveTarget());
|
.get(targetBezier.curveTarget());
|
||||||
if (bc == null)
|
if (bc == null)
|
||||||
return target;
|
return target;
|
||||||
|
|
|
@ -44,8 +44,8 @@ public interface IBE<T extends BlockEntity> extends EntityBlock {
|
||||||
if (blockState.is(newBlockState.getBlock()) && newBlockState.hasBlockEntity())
|
if (blockState.is(newBlockState.getBlock()) && newBlockState.hasBlockEntity())
|
||||||
return;
|
return;
|
||||||
BlockEntity blockEntity = level.getBlockEntity(pos);
|
BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||||
if (blockEntity instanceof SmartBlockEntity ste)
|
if (blockEntity instanceof SmartBlockEntity sbe)
|
||||||
ste.destroy();
|
sbe.destroy();
|
||||||
level.removeBlockEntity(pos);
|
level.removeBlockEntity(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.Window;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.simibubi.create.AllKeys;
|
import com.simibubi.create.AllKeys;
|
||||||
|
@ -222,7 +223,7 @@ public class ValueSettingsScreen extends AbstractSimiScreen {
|
||||||
.format(closest);
|
.format(closest);
|
||||||
|
|
||||||
AllIcons cursorIcon = null;
|
AllIcons cursorIcon = null;
|
||||||
if (board.formatter()instanceof ScrollOptionSettingsFormatter sosf)
|
if (board.formatter() instanceof ScrollOptionSettingsFormatter sosf)
|
||||||
cursorIcon = sosf.getIcon(closest);
|
cursorIcon = sosf.getIcon(closest);
|
||||||
|
|
||||||
int cursorWidth = ((cursorIcon != null ? 16 : font.width(cursorText)) / 2) * 2 + 3;
|
int cursorWidth = ((cursorIcon != null ? 16 : font.width(cursorText)) / 2) * 2 + 3;
|
||||||
|
@ -293,18 +294,34 @@ public class ValueSettingsScreen extends AbstractSimiScreen {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyReleased(int pKeyCode, int pScanCode, int pModifiers) {
|
||||||
|
if (minecraft.options.keyUse.matches(pKeyCode, pScanCode)) {
|
||||||
|
Window window = minecraft.getWindow();
|
||||||
|
double x = minecraft.mouseHandler.xpos() * window.getGuiScaledWidth() / window.getScreenWidth();
|
||||||
|
double y = minecraft.mouseHandler.ypos() * window.getGuiScaledHeight() / window.getScreenHeight();
|
||||||
|
saveAndClose(x, y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.keyReleased(pKeyCode, pScanCode, pModifiers);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double pMouseX, double pMouseY, int pButton) {
|
public boolean mouseReleased(double pMouseX, double pMouseY, int pButton) {
|
||||||
if (pButton == 1) {
|
if (minecraft.options.keyUse.matchesMouse(pButton)) {
|
||||||
|
saveAndClose(pMouseX, pMouseY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.mouseReleased(pMouseX, pMouseY, pButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void saveAndClose(double pMouseX, double pMouseY) {
|
||||||
ValueSettings closest = getClosestCoordinate((int) pMouseX, (int) pMouseY);
|
ValueSettings closest = getClosestCoordinate((int) pMouseX, (int) pMouseY);
|
||||||
// FIXME: value settings may be face-sensitive on future components
|
// FIXME: value settings may be face-sensitive on future components
|
||||||
AllPackets.getChannel()
|
AllPackets.getChannel()
|
||||||
.sendToServer(new ValueSettingsPacket(pos, closest.row(), closest.value(), null, Direction.UP,
|
.sendToServer(new ValueSettingsPacket(pos, closest.row(), closest.value(), null, Direction.UP,
|
||||||
AllKeys.ctrlDown()));
|
AllKeys.ctrlDown()));
|
||||||
onClose();
|
onClose();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.mouseReleased(pMouseX, pMouseY, pButton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -263,7 +263,7 @@ public class FilteringBehaviour extends BlockEntityBehaviour implements ValueSet
|
||||||
|
|
||||||
public MutableComponent formatValue(ValueSettings value) {
|
public MutableComponent formatValue(ValueSettings value) {
|
||||||
if (value.row() == 0 && value.value() == filter.getMaxStackSize())
|
if (value.row() == 0 && value.value() == filter.getMaxStackSize())
|
||||||
return Components.literal("Any");
|
return Lang.translateDirect("logistics.filter.any_amount_short");
|
||||||
return Components.literal(((value.row() == 0) ? "\u2264" : "=") + Math.max(1, value.value()));
|
return Components.literal(((value.row() == 0) ? "\u2264" : "=") + Math.max(1, value.value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,18 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsBehavio
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsBoard;
|
import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsBoard;
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatter;
|
import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatter;
|
||||||
import com.simibubi.create.foundation.utility.Components;
|
import com.simibubi.create.foundation.utility.Components;
|
||||||
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
|
||||||
public class ScrollValueBehaviour extends BlockEntityBehaviour implements ValueSettingsBehaviour {
|
public class ScrollValueBehaviour extends BlockEntityBehaviour implements ValueSettingsBehaviour {
|
||||||
|
|
||||||
|
@ -175,4 +179,12 @@ public class ScrollValueBehaviour extends BlockEntityBehaviour implements ValueS
|
||||||
return needsWrench;
|
return needsWrench;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShortInteract(Player player, InteractionHand hand, Direction side) {
|
||||||
|
if (player instanceof FakePlayer)
|
||||||
|
blockEntity.getBlockState()
|
||||||
|
.use(getWorld(), player, hand,
|
||||||
|
new BlockHitResult(VecHelper.getCenterOf(getPos()), side, getPos(), true));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,6 @@ public class BuilderTransformers {
|
||||||
.addLayer(() -> RenderType::cutoutMipped)
|
.addLayer(() -> RenderType::cutoutMipped)
|
||||||
.addLayer(() -> RenderType::translucent)
|
.addLayer(() -> RenderType::translucent)
|
||||||
.color(() -> CopycatBlock::wrappedColor)
|
.color(() -> CopycatBlock::wrappedColor)
|
||||||
.tag(AllBlockTags.SAFE_NBT.tag)
|
|
||||||
.transform(TagGen.axeOrPickaxe());
|
.transform(TagGen.axeOrPickaxe());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,12 @@ public class MetalBarsGen {
|
||||||
String name, boolean specialEdge) {
|
String name, boolean specialEdge) {
|
||||||
return (c, p) -> {
|
return (c, p) -> {
|
||||||
|
|
||||||
ModelFile post_ends = barsSubModel(p, name, "_post_ends", specialEdge);
|
ModelFile post_ends = barsSubModel(p, name, "post_ends", specialEdge);
|
||||||
ModelFile post = barsSubModel(p, name, "_post", specialEdge);
|
ModelFile post = barsSubModel(p, name, "post", specialEdge);
|
||||||
ModelFile cap = barsSubModel(p, name, "_cap", specialEdge);
|
ModelFile cap = barsSubModel(p, name, "cap", specialEdge);
|
||||||
ModelFile cap_alt = barsSubModel(p, name, "_cap_alt", specialEdge);
|
ModelFile cap_alt = barsSubModel(p, name, "cap_alt", specialEdge);
|
||||||
ModelFile side = barsSubModel(p, name, "_side", specialEdge);
|
ModelFile side = barsSubModel(p, name, "side", specialEdge);
|
||||||
ModelFile side_alt = barsSubModel(p, name, "_side_alt", specialEdge);
|
ModelFile side_alt = barsSubModel(p, name, "side_alt", specialEdge);
|
||||||
|
|
||||||
p.getMultipartBuilder(c.get())
|
p.getMultipartBuilder(c.get())
|
||||||
.part()
|
.part()
|
||||||
|
@ -115,7 +115,7 @@ public class MetalBarsGen {
|
||||||
ResourceLocation barsTexture = p.modLoc("block/bars/" + name + "_bars");
|
ResourceLocation barsTexture = p.modLoc("block/bars/" + name + "_bars");
|
||||||
ResourceLocation edgeTexture = specialEdge ? p.modLoc("block/bars/" + name + "_bars_edge") : barsTexture;
|
ResourceLocation edgeTexture = specialEdge ? p.modLoc("block/bars/" + name + "_bars_edge") : barsTexture;
|
||||||
return p.models()
|
return p.models()
|
||||||
.withExistingParent(name + suffix, p.mcLoc("block/iron_bars" + suffix))
|
.withExistingParent(name + "_" + suffix, p.modLoc("block/bars/" + suffix))
|
||||||
.texture("bars", barsTexture)
|
.texture("bars", barsTexture)
|
||||||
.texture("particle", barsTexture)
|
.texture("particle", barsTexture)
|
||||||
.texture("edge", edgeTexture);
|
.texture("edge", edgeTexture);
|
||||||
|
@ -130,6 +130,7 @@ public class MetalBarsGen {
|
||||||
.color(color))
|
.color(color))
|
||||||
.tag(AllBlockTags.WRENCH_PICKUP.tag)
|
.tag(AllBlockTags.WRENCH_PICKUP.tag)
|
||||||
.tag(AllBlockTags.FAN_TRANSPARENT.tag)
|
.tag(AllBlockTags.FAN_TRANSPARENT.tag)
|
||||||
|
.transform(TagGen.pickaxeOnly())
|
||||||
.blockstate(barsBlockState(name, specialEdge))
|
.blockstate(barsBlockState(name, specialEdge))
|
||||||
.item()
|
.item()
|
||||||
.model((c, p) -> {
|
.model((c, p) -> {
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class ScrollInput extends AbstractSimiWidget {
|
||||||
protected Component hint = null;
|
protected Component hint = null;
|
||||||
protected Label displayLabel;
|
protected Label displayLabel;
|
||||||
protected boolean inverted;
|
protected boolean inverted;
|
||||||
|
protected boolean soundPlayed;
|
||||||
protected Function<Integer, Component> formatter;
|
protected Function<Integer, Component> formatter;
|
||||||
|
|
||||||
protected int min, max;
|
protected int min, max;
|
||||||
|
@ -39,6 +40,7 @@ public class ScrollInput extends AbstractSimiWidget {
|
||||||
shiftStep = 5;
|
shiftStep = 5;
|
||||||
step = standardStep();
|
step = standardStep();
|
||||||
formatter = i -> Components.literal(String.valueOf(i));
|
formatter = i -> Components.literal(String.valueOf(i));
|
||||||
|
soundPlayed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Function<StepContext, Integer> standardStep() {
|
public Function<StepContext, Integer> standardStep() {
|
||||||
|
@ -95,6 +97,12 @@ public class ScrollInput extends AbstractSimiWidget {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
soundPlayed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public int getState() {
|
public int getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -135,10 +143,12 @@ public class ScrollInput extends AbstractSimiWidget {
|
||||||
clampState();
|
clampState();
|
||||||
|
|
||||||
if (priorState != state) {
|
if (priorState != state) {
|
||||||
|
if (!soundPlayed)
|
||||||
Minecraft.getInstance()
|
Minecraft.getInstance()
|
||||||
.getSoundManager()
|
.getSoundManager()
|
||||||
.play(SimpleSoundInstance.forUI(AllSoundEvents.SCROLL_VALUE.getMainEvent(),
|
.play(SimpleSoundInstance.forUI(AllSoundEvents.SCROLL_VALUE.getMainEvent(),
|
||||||
1.5f + 0.1f * (state - min) / (max - min)));
|
1.5f + 0.1f * (state - min) / (max - min)));
|
||||||
|
soundPlayed = true;
|
||||||
onChanged();
|
onChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,17 @@ import com.simibubi.create.content.equipment.armor.NetheriteDivingHandler;
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(value = Entity.class, priority = 900)
|
||||||
public class EntityMixin {
|
public class EntityMixin {
|
||||||
|
|
||||||
@Inject(method = "fireImmune()Z", at = @At("RETURN"), cancellable = true)
|
@Inject(method = "fireImmune()Z", at = @At("RETURN"), cancellable = true)
|
||||||
public void create$onFireImmune(CallbackInfoReturnable<Boolean> cir) {
|
public void create$onFireImmune(CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (!cir.getReturnValueZ()) {
|
if (!cir.getReturnValueZ()) {
|
||||||
Entity self = (Entity) (Object) this;
|
Entity self = (Entity) (Object) this;
|
||||||
boolean immune = self.getPersistentData().getBoolean(NetheriteDivingHandler.FIRE_IMMUNE_KEY);
|
boolean immune = self.getPersistentData().getBoolean(NetheriteDivingHandler.FIRE_IMMUNE_KEY);
|
||||||
|
if (immune)
|
||||||
cir.setReturnValue(immune);
|
cir.setReturnValue(immune);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.function.Consumer;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||||
import com.simibubi.create.foundation.blockEntity.IMergeableBE;
|
import com.simibubi.create.foundation.blockEntity.IMergeableBE;
|
||||||
|
|
||||||
|
@ -233,6 +234,21 @@ public class BlockHelper {
|
||||||
.getBlock(), target.below());
|
.getBlock(), target.below());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CompoundTag prepareBlockEntityData(BlockState blockState, BlockEntity blockEntity) {
|
||||||
|
CompoundTag data = null;
|
||||||
|
if (blockEntity == null)
|
||||||
|
return data;
|
||||||
|
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
|
||||||
|
data = blockEntity.saveWithFullMetadata();
|
||||||
|
data = NBTProcessors.process(blockEntity, data, true);
|
||||||
|
} else if (blockEntity instanceof IPartialSafeNBT) {
|
||||||
|
data = new CompoundTag();
|
||||||
|
((IPartialSafeNBT) blockEntity).writeSafe(data);
|
||||||
|
data = NBTProcessors.process(blockEntity, data, true);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public static void placeSchematicBlock(Level world, BlockState state, BlockPos target, ItemStack stack,
|
public static void placeSchematicBlock(Level world, BlockState state, BlockPos target, ItemStack stack,
|
||||||
@Nullable CompoundTag data) {
|
@Nullable CompoundTag data) {
|
||||||
BlockEntity existingBlockEntity = world.getBlockEntity(target);
|
BlockEntity existingBlockEntity = world.getBlockEntity(target);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue