Skip to content

Commit

Permalink
Botarium Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
MarbleGateKeeper committed Dec 27, 2023
1 parent 1f09c61 commit 70b8696
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package plus.dragons.createcentralkitchen.foundation.mixin.common.botarium;

import earth.terrarium.botarium.forge.BotariumForge;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import plus.dragons.createcentralkitchen.api.block.entity.DelegatingSmartTileEntity;

@Mixin(value = BotariumForge.class, remap = false)
public class BotariumForgeMixin {
@Inject(method = "attachBlockCapabilities", at = @At("HEAD"), cancellable = true)
private static void injected(AttachCapabilitiesEvent<BlockEntity> event, CallbackInfo ci) {
Object var2 = event.getObject();
if(var2 instanceof DelegatingSmartTileEntity){
ci.cancel();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@
public abstract class BasketBlockEntityMixin extends RandomizableContainerBlockEntity implements Basket, SmartBlockEntityLike {

@Unique
private SmartBlockEntity smartBlockEntity;
private final SmartBlockEntity smartBlockEntity = new SmartBasketBlockEntity((BasketBlockEntity) (Object) this);

private BasketBlockEntityMixin(BlockEntityType<?> pType, BlockPos pPos, BlockState pBlockState) {
super(pType, pPos, pBlockState);
}

@Override
public SmartBlockEntity asSmartBlockEntity() {
// Initialize here so mods like botarium will work
if(smartBlockEntity == null){
smartBlockEntity = new SmartBasketBlockEntity((BasketBlockEntity) (Object) this);
}
return smartBlockEntity;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@
public abstract class StickyBasketBlockEntityMixin extends RandomizableContainerBlockEntity implements Basket, SmartBlockEntityLike {

@Unique
private SmartBlockEntity smartBlockEntity;
private final SmartBlockEntity smartBlockEntity = new SmartBasketBlockEntity((BasketBlockEntity) (Object) this);

private StickyBasketBlockEntityMixin(BlockEntityType<?> pType, BlockPos pPos, BlockState pBlockState) {
super(pType, pPos, pBlockState);
}

@Override
public SmartBlockEntity asSmartBlockEntity() {
// Initialize here so mods like botarium will work
if(smartBlockEntity == null){
smartBlockEntity = new SmartBasketBlockEntity((BasketBlockEntity) (Object) this);
}
return smartBlockEntity;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/create_central_kitchen.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"compatibilityLevel": "JAVA_17",
"refmap": "create_central_kitchen.refmap.json",
"mixins": [
"common.botarium.BotariumForgeMixin",
"common.create.BeltHelperMixin",
"common.create.BlockEntityBehaviourMixin",
"common.create.CreateJEIMixin",
Expand Down

0 comments on commit 70b8696

Please sign in to comment.