Skip to content

Commit f9863cc

Browse files
Add Bucket/Tank items interaction with coke oven (#4190)
1 parent 764750d commit f9863cc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CokeOvenMachine.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
import net.minecraft.sounds.SoundEvents;
2323
import net.minecraft.sounds.SoundSource;
2424
import net.minecraft.util.RandomSource;
25+
import net.minecraft.world.InteractionHand;
26+
import net.minecraft.world.InteractionResult;
2527
import net.minecraft.world.entity.player.Player;
28+
import net.minecraft.world.level.Level;
29+
import net.minecraft.world.level.block.state.BlockState;
30+
import net.minecraft.world.phys.BlockHitResult;
31+
import net.minecraftforge.fluids.FluidUtil;
2632

2733
import javax.annotation.ParametersAreNonnullByDefault;
2834

@@ -84,4 +90,19 @@ public void animateTick(RandomSource random) {
8490
getLevel().addParticle(ParticleTypes.FLAME, x, y, z, 0, 0, 0);
8591
}
8692
}
93+
94+
@Override
95+
public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand,
96+
BlockHitResult hit) {
97+
if (!isRemote()) {
98+
if (super.onUse(state, world, pos, player, hand, hit) == InteractionResult.SUCCESS) {
99+
return InteractionResult.SUCCESS;
100+
}
101+
if (FluidUtil.interactWithFluidHandler(player, hand, exportFluids)) {
102+
return InteractionResult.SUCCESS;
103+
}
104+
return InteractionResult.PASS;
105+
}
106+
return super.onUse(state, world, pos, player, hand, hit);
107+
}
87108
}

0 commit comments

Comments
 (0)