Choo Choo, Part II

- Whistles animate and play a test sound when powered
This commit is contained in:
simibubi 2022-05-07 17:04:52 +02:00
parent 76c57e4695
commit 56f4cd524d
23 changed files with 201 additions and 35 deletions

View file

@ -544,22 +544,22 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
875f9aff979888b9d63d6a425cbf544431f1af5a assets/create/lang/en_ud.json
9920f89987afa7a5a534f913f930affb5fadaa33 assets/create/lang/en_us.json
13c213be9595e8fe1ad165a14cdd0ec16a092204 assets/create/lang/unfinished/de_de.json
687b9acd091e4222219057ac647402aab2f05ca2 assets/create/lang/unfinished/es_cl.json
20984bb318badfb2a49d1a5467de0aef5fa4a14f assets/create/lang/unfinished/es_es.json
3ef90285ab19e24ff80354849a253a5caf5062f4 assets/create/lang/unfinished/fr_fr.json
af40251171a29093bb6d4f99172af15a734a47f7 assets/create/lang/unfinished/it_it.json
98304b8aebf8db14d0a764140f2e4703bbcffb29 assets/create/lang/unfinished/ja_jp.json
4d7f1ba7e3ced59666d9113577d2e20af54d00ef assets/create/lang/unfinished/ko_kr.json
3530e4d047cf4a654a95d069d874ac73306cbac3 assets/create/lang/unfinished/nl_nl.json
3a82a8398f74ece7d5f6440613fecc14d7056b30 assets/create/lang/unfinished/pl_pl.json
5723fa37dbdd24e31bfd14f71586f67e3a23047f assets/create/lang/unfinished/pt_br.json
f394d6ff13e89051f7582a789ab1cf81905620b4 assets/create/lang/unfinished/pt_pt.json
01ccdd4a7c1beaa84cc6bdc7cd0cc912440fb0c7 assets/create/lang/unfinished/ro_ro.json
d0b58764408454fc6df71e0a340e210c0bc5f70b assets/create/lang/unfinished/ru_ru.json
bf4a93e64419cdacf1636e1a283086e33f853bf5 assets/create/lang/unfinished/zh_cn.json
6a615c911ea01faac6c52f58e98904aef5660dc5 assets/create/lang/unfinished/zh_tw.json
97c53a163e253dd1a8933a0ace74b9654d893587 assets/create/lang/en_us.json
12311e1c34d28139bbf8d7da53a116e066be6b9e assets/create/lang/unfinished/de_de.json
c63ceb535bf91819590021a3889dcd86cf529923 assets/create/lang/unfinished/es_cl.json
6862db283b26fbdcd901939e6c4b60641711a410 assets/create/lang/unfinished/es_es.json
1e66f6f48c7cebe998dcf9611cb41d3616444df6 assets/create/lang/unfinished/fr_fr.json
3fcccff2e2aa3029e260c5b521db927a99528658 assets/create/lang/unfinished/it_it.json
1b514b1cd75ea524b38ec1da48fdaa535827fcb4 assets/create/lang/unfinished/ja_jp.json
5b6f470baf2fef6252530fe88cc58530b948b44c assets/create/lang/unfinished/ko_kr.json
952e931c4d99d0c42c59ebc8f292d00cadd853dd assets/create/lang/unfinished/nl_nl.json
6c892826366d463b52a0cd2d2eeff00f6289346a assets/create/lang/unfinished/pl_pl.json
df275e393b8e8930d1863955d5563e49638d48c0 assets/create/lang/unfinished/pt_br.json
582a9e4d94df44f283103024781395791569dd4d assets/create/lang/unfinished/pt_pt.json
a114cdc8701e158bbb1ddbd90aa6b3a6615e1ca6 assets/create/lang/unfinished/ro_ro.json
4be727c1026bd66dce98518eb851de127eadab51 assets/create/lang/unfinished/ru_ru.json
e09205abffde3d10717284de6e405bb17c59b902 assets/create/lang/unfinished/zh_cn.json
e1f9d9ce9d4835fb69151af2908c3359c696d481 assets/create/lang/unfinished/zh_tw.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
@ -2155,7 +2155,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
866fbb0ce2878a73e0440d1caf6534c8bd7c384f assets/create/models/item/zinc_ingot.json
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
5049f72c327a88f175f6f9425909e098fc711100 assets/create/sounds.json
8b9dcd869179ac21a800b11693db6bb8cdd479a9 assets/create/sounds.json
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
613e64b44bed959da899fdd54c1cacb227fb33f2 data/create/advancements/andesite_alloy.json
81885c6bfb85792c88aaa7c9b70f58832945d31f data/create/advancements/andesite_casing.json

View file

@ -1584,6 +1584,7 @@
"create.subtitle.cranking": "Hand Crank turns",
"create.subtitle.wrench_remove": "Component breaks",
"create.subtitle.sanding_short": "Sanding noises",
"create.subtitle.whistle": "Whistling",
"create.subtitle.cogs": "Cogwheels rumble",
"create.subtitle.slime_added": "Slime squishes",
"create.subtitle.wrench_rotate": "Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1531",
"_": "Missing Localizations: 1532",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "UNLOCALIZED: Hand Crank turns",
"create.subtitle.wrench_remove": "UNLOCALIZED: Component breaks",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "UNLOCALIZED: Cogwheels rumble",
"create.subtitle.slime_added": "Schleim matscht",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 553",
"_": "Missing Localizations: 554",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "Manivela gira",
"create.subtitle.wrench_remove": "Componente se rompe",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "Engranajes suenan",
"create.subtitle.slime_added": "Slime chapotea",
"create.subtitle.wrench_rotate": "Llave Inglesa usada",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 224",
"_": "Missing Localizations: 225",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "Manivela gira",
"create.subtitle.wrench_remove": "Componente se rompe",
"create.subtitle.sanding_short": "Lijando",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "Engranajes retumban",
"create.subtitle.slime_added": "Pegamento chapotea",
"create.subtitle.wrench_rotate": "Llave inglesa usada",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1793",
"_": "Missing Localizations: 1794",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "UNLOCALIZED: Hand Crank turns",
"create.subtitle.wrench_remove": "UNLOCALIZED: Component breaks",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "UNLOCALIZED: Cogwheels rumble",
"create.subtitle.slime_added": "Bruit de slime",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1482",
"_": "Missing Localizations: 1483",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "UNLOCALIZED: Hand Crank turns",
"create.subtitle.wrench_remove": "UNLOCALIZED: Component breaks",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "UNLOCALIZED: Cogwheels rumble",
"create.subtitle.slime_added": "Slime schiacciato",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 219",
"_": "Missing Localizations: 220",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "ハンドクランクが回る",
"create.subtitle.wrench_remove": "機械を壊す",
"create.subtitle.sanding_short": "研磨音",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "歯車がゴロゴロと鳴る",
"create.subtitle.slime_added": "スライムがぐしゃっとつぶれる",
"create.subtitle.wrench_rotate": "レンチが使用される",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 219",
"_": "Missing Localizations: 220",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "크랭크가 돌아감",
"create.subtitle.wrench_remove": "장치가 부숴짐",
"create.subtitle.sanding_short": "사포를 사용함",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "톱니바퀴가 돌아감",
"create.subtitle.slime_added": "슬라임이 철퍽거림",
"create.subtitle.wrench_rotate": "렌치를 사용함",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 2145",
"_": "Missing Localizations: 2146",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "UNLOCALIZED: Hand Crank turns",
"create.subtitle.wrench_remove": "UNLOCALIZED: Component breaks",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "UNLOCALIZED: Cogwheels rumble",
"create.subtitle.slime_added": "UNLOCALIZED: Slime squishes",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 592",
"_": "Missing Localizations: 593",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "Ręczna korba obraca się",
"create.subtitle.wrench_remove": "Komponent niszczy się",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "Koła zębate terkoczą",
"create.subtitle.slime_added": "Szlam plaska",
"create.subtitle.wrench_rotate": "Klucz skrzypi",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1393",
"_": "Missing Localizations: 1394",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "UNLOCALIZED: Hand Crank turns",
"create.subtitle.wrench_remove": "UNLOCALIZED: Component breaks",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "UNLOCALIZED: Cogwheels rumble",
"create.subtitle.slime_added": "UNLOCALIZED: Slime squishes",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1765",
"_": "Missing Localizations: 1766",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "UNLOCALIZED: Hand Crank turns",
"create.subtitle.wrench_remove": "UNLOCALIZED: Component breaks",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "UNLOCALIZED: Cogwheels rumble",
"create.subtitle.slime_added": "UNLOCALIZED: Slime squishes",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 220",
"_": "Missing Localizations: 221",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "Manivelă se rotește",
"create.subtitle.wrench_remove": "Component se sparge",
"create.subtitle.sanding_short": "Sunete de șlefuit",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "Roți Dințate vuie",
"create.subtitle.slime_added": "Mâzgă zdrobește",
"create.subtitle.wrench_rotate": "Cheie folosită",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 597",
"_": "Missing Localizations: 598",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "Вращается рукоятка",
"create.subtitle.wrench_remove": "Компонент ломается",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "Шестерни грохочут",
"create.subtitle.slime_added": "Намазывание слизи",
"create.subtitle.wrench_rotate": "Использован гаечный ключ",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 219",
"_": "Missing Localizations: 220",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "手摇曲柄:转动",
"create.subtitle.wrench_remove": "组件:被破坏",
"create.subtitle.sanding_short": "打磨噪音",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "齿轮:嘎吱作响",
"create.subtitle.slime_added": "粘液:挤碎声",
"create.subtitle.wrench_rotate": "扳手:拧动",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 611",
"_": "Missing Localizations: 612",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1585,6 +1585,7 @@
"create.subtitle.cranking": "手搖把手轉動聲",
"create.subtitle.wrench_remove": "零件移除聲",
"create.subtitle.sanding_short": "UNLOCALIZED: Sanding noises",
"create.subtitle.whistle": "UNLOCALIZED: Whistling",
"create.subtitle.cogs": "齒輪隆隆聲",
"create.subtitle.slime_added": "黏液擠壓",
"create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used",

View file

@ -359,6 +359,12 @@
],
"subtitle": "create.subtitle.slime_added"
},
"whistle": {
"sounds": [
"create:whistle"
],
"subtitle": "create.subtitle.whistle"
},
"worldshaper_place": {
"sounds": [
{

View file

@ -223,6 +223,10 @@ public class AllSoundEvents {
.category(SoundSource.BLOCKS)
.build(),
WHISTLE = create("whistle").subtitle("Whistling")
.category(SoundSource.RECORDS)
.build(),
HAUNTED_BELL_CONVERT = create("haunted_bell_convert").subtitle("Haunted Bell awakens")
.category(SoundSource.BLOCKS)
.build(),

View file

@ -7,11 +7,13 @@ import com.simibubi.create.content.contraptions.components.steam.whistle.Whistle
import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState;
public class WhistleRenderer extends SafeTileEntityRenderer<WhistleTileEntity> {
@ -31,7 +33,12 @@ public class WhistleRenderer extends SafeTileEntityRenderer<WhistleTileEntity> {
PartialModel mouth = size == WhistleSize.LARGE ? AllBlockPartials.WHISTLE_MOUTH_LARGE
: size == WhistleSize.MEDIUM ? AllBlockPartials.WHISTLE_MOUTH_MEDIUM : AllBlockPartials.WHISTLE_MOUTH_SMALL;
float offset = 0;
float offset = te.animation.getValue(partialTicks);
if (te.animation.getChaseTarget() > 0 && te.animation.getValue() > 0.5f) {
float wiggleProgress = (AnimationTickHolder.getTicks(te.getLevel()) + partialTicks) / 8f;
offset -= Math.sin(wiggleProgress * (2 * Mth.PI) * (4 - size.ordinal())) / 16f;
}
CachedBufferer.partial(mouth, blockState)
.centre()
.rotateY(AngleHelper.horizontalAngle(direction))

View file

@ -0,0 +1,60 @@
package com.simibubi.create.content.contraptions.components.steam.whistle;
import com.simibubi.create.AllSoundEvents;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
public class WhistleSoundInstance extends AbstractTickableSoundInstance {
private boolean active;
private int keepAlive;
public WhistleSoundInstance(BlockPos worldPosition) {
super(AllSoundEvents.WHISTLE.getMainEvent(), SoundSource.RECORDS);
looping = true;
active = true;
volume = 0.05f;
delay = 0;
keepAlive();
Vec3 v = Vec3.atCenterOf(worldPosition);
x = v.x;
y = v.y;
z = v.z;
}
public void fadeOut() {
this.active = false;
}
public void keepAlive() {
keepAlive = 2;
}
public void setPitch(float pitch) {
this.pitch = pitch;
}
@Override
public void tick() {
Vec3 eyePosition = Minecraft.getInstance().cameraEntity.getEyePosition();
float maxVolume = (float) Mth.clamp((30 - eyePosition.distanceTo(new Vec3(x, y, z))) / 30, 0, 1);
if (active) {
volume = Math.min(1, volume + .25f);
volume = Math.min(volume, maxVolume);
keepAlive--;
if (keepAlive == 0)
fadeOut();
return;
}
volume = Math.max(0, volume - .25f);
volume = Math.min(volume, maxVolume);
if (volume == 0)
stop();
}
}

View file

@ -1,26 +1,40 @@
package com.simibubi.create.content.contraptions.components.steam.whistle;
import java.lang.ref.WeakReference;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.steam.whistle.WhistleExtenderBlock.WhistleExtenderShape;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankConnectivityHandler;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInformation {
protected int pitch = 0;
public WeakReference<FluidTankTileEntity> source;
public LerpedFloat animation;
protected int pitch;
public WhistleTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
source = new WeakReference<>(null);
animation = LerpedFloat.linear();
}
@Override
@ -44,6 +58,20 @@ public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInf
notifyUpdate();
}
@Override
public void tick() {
super.tick();
if (!level.isClientSide())
return;
FluidTankTileEntity tank = getTank();
boolean powered = isPowered() && tank != null && tank.boiler.isActive()
&& tank.boiler.getEngineEfficiency(tank.getTotalTankSize()) > 0;
animation.chase(powered ? 1 : 0, powered ? .5f : .4f, powered ? Chaser.EXP : Chaser.LINEAR);
animation.tickChaser();
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio(powered));
}
@Override
protected void write(CompoundTag tag, boolean clientPacket) {
tag.putInt("Pitch", pitch);
@ -58,8 +86,53 @@ public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInf
@Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
tooltip.add(new TextComponent(spacing + "Pitch: " + pitch));
String[] pitches = "F#;F;E;D#;D;C#;C;B;A#;A;G#;G".split(";");
tooltip.add(new TextComponent(spacing + "Pitch: " + pitches[pitch % pitches.length]));
return true;
}
protected boolean isPowered() {
return getBlockState().getOptionalValue(WhistleBlock.POWERED)
.orElse(false);
}
@OnlyIn(Dist.CLIENT)
protected WhistleSoundInstance soundInstance;
@OnlyIn(Dist.CLIENT)
protected void tickAudio(boolean powered) {
if (!powered) {
if (soundInstance != null) {
soundInstance.fadeOut();
soundInstance = null;
}
return;
}
if (soundInstance == null || soundInstance.isStopped())
Minecraft.getInstance()
.getSoundManager()
.play(soundInstance = new WhistleSoundInstance(worldPosition));
float f = (float) Math.pow(2.0D, (double) ((24 - pitch) - 12) / 12.0D);
soundInstance.keepAlive();
soundInstance.setPitch(f);
}
public FluidTankTileEntity getTank() {
FluidTankTileEntity tank = source.get();
if (tank == null || tank.isRemoved()) {
if (tank != null)
source = new WeakReference<>(null);
Direction facing = WhistleBlock.getAttachedDirection(getBlockState());
FluidTankTileEntity anyTankAt =
FluidTankConnectivityHandler.anyTankAt(level, worldPosition.relative(facing));
if (anyTankAt != null)
source = new WeakReference<>(tank = anyTankAt);
}
if (tank == null)
return null;
return tank.getControllerTE();
}
}

Binary file not shown.