Skip to content

Commit

Permalink
fixed tesseract not checking if instances of IEnergyItem actually can…
Browse files Browse the repository at this point in the history
… create energy handlers
  • Loading branch information
Trinsdar committed Mar 4, 2024
1 parent a9c343d commit cdef7d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fabric/src/main/java/tesseract/fabric/TesseractImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import tesseract.Tesseract;
import tesseract.TesseractConfig;
import tesseract.api.GraphWrapper;
import tesseract.api.context.TesseractItemContext;
import tesseract.api.fabric.TesseractLookups;
import tesseract.api.fabric.wrapper.ContainerItemContextWrapper;
import tesseract.api.gt.IEnergyHandler;
Expand Down Expand Up @@ -78,8 +79,9 @@ public void onInitialize() {
ServerTickEvents.END_WORLD_TICK.register(TesseractImpl::onEndTick);
ServerWorldEvents.UNLOAD.register((TesseractImpl::onWorldUnload));
TesseractLookups.ENERGY_HANDLER_ITEM.registerFallback((s, c) -> {
if (s.getItem() instanceof IEnergyItem energyItem){
return energyItem.createEnergyHandler(new ContainerItemContextWrapper(c));
TesseractItemContext context = new ContainerItemContextWrapper(c);
if (s.getItem() instanceof IEnergyItem energyItem && energyItem.canCreate(context)){
return energyItem.createEnergyHandler(context);
}
return null;
});
Expand Down

0 comments on commit cdef7d1

Please sign in to comment.