Skip to content

Commit

Permalink
fixed class cast exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 8, 2023
1 parent 4f487a0 commit c1462b1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ public <U> LazyOptional<U> getCapability(@NotNull Capability<U> cap, @Nullable D
if (pipeCaps[side.get3DDataValue()] == null || !pipeCaps[side.get3DDataValue()].isPresent()){
pipeCaps[side.get3DDataValue()] = fromEnergyHolder(pipeCapHolder, side).cast();
}
return pipeCaps[side.get3DDataValue()].cast();
}
if (cap == ITEM_HANDLER_CAPABILITY && getCapClass() == ExtendedItemContainer.class){
if (pipeCaps[side.get3DDataValue()] == null || !pipeCaps[side.get3DDataValue()].isPresent()){
pipeCaps[side.get3DDataValue()] = fromItemHolder(pipeCapHolder, side).cast();
}
return pipeCaps[side.get3DDataValue()].cast();
}
try {
if (cap == AntimatterCaps.CAP_MAP.get(getCapClass())){
Expand All @@ -90,7 +92,7 @@ public <U> LazyOptional<U> getCapability(@NotNull Capability<U> cap, @Nullable D
e.printStackTrace();
return LazyOptional.empty();
}
if (pipeCaps[side.get3DDataValue()] != null){
if (pipeCaps[side.get3DDataValue()] != null && cap == AntimatterCaps.CAP_MAP.get(getCapClass())){
return pipeCaps[side.get3DDataValue()].cast();
}
return LazyOptional.empty();
Expand Down

0 comments on commit c1462b1

Please sign in to comment.