Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential pipe collision NPE #2330

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.api.block;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity;
import com.gregtechceu.gtceu.api.capability.ICoverable;
import com.gregtechceu.gtceu.api.cover.CoverBehavior;
Expand Down Expand Up @@ -366,6 +367,10 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player
@Override
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
var pipeNode = getPipeTile(level, pos);
if (pipeNode == null) {
GTCEu.LOGGER.error("Pipe was null");
return;
}
if (pipeNode.getFrameMaterial() != null) {
BlockState frameState = GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, pipeNode.getFrameMaterial())
.getDefaultState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.common.block;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.block.MaterialPipeBlock;
import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity;
Expand Down Expand Up @@ -118,6 +119,10 @@ public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List<C
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
// dont apply damage if there is a frame box
var pipeNode = getPipeTile(level, pos);
if (pipeNode == null) {
GTCEu.LOGGER.error("Pipe was null");
return;
}
if (pipeNode.getFrameMaterial() != null) {
BlockState frameState = GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, pipeNode.getFrameMaterial())
.getDefaultState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.common.block;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.block.MaterialPipeBlock;
import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity;
import com.gregtechceu.gtceu.api.data.chemical.material.Material;
Expand Down Expand Up @@ -121,6 +122,10 @@ public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List<C
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
// dont apply damage if there is a frame box
var pipeNode = getPipeTile(level, pos);
if (pipeNode == null) {
GTCEu.LOGGER.error("Pipe was null");
return;
}
if (pipeNode.getFrameMaterial() != null) {
BlockState frameState = GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, pipeNode.getFrameMaterial())
.getDefaultState();
Expand Down