mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-23 14:30:51 +00:00
Merge pull request #1873 from Agarmal/OpenComputers-Better-Integration
Add vent carbon dioxide function in Zirnox for OpenComputers
This commit is contained in:
commit
2d007e836f
@ -43,6 +43,7 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -513,6 +514,15 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] ventCarbonDioxide(Context context, Arguments args) {
|
||||
int ventAmount = MathHelper.clamp_int(args.optInteger(0, 1000), 0, carbonDioxide.getMaxFill()); // Get how much CO2 to vent in mB (1000mB default), clamp between 0 and carbonDioxide's max fill.
|
||||
int fill = this.carbonDioxide.getFill();
|
||||
this.carbonDioxide.setFill(Math.max(fill - ventAmount, 0)); // Make sure it isn't a negative number.
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
@ -524,7 +534,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
"getCarbonDioxide",
|
||||
"isActive",
|
||||
"getInfo",
|
||||
"setActive"
|
||||
"setActive",
|
||||
"ventCarbonDioxide"
|
||||
};
|
||||
}
|
||||
|
||||
@ -548,6 +559,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
return getInfo(context, args);
|
||||
case ("setActive"):
|
||||
return setActive(context, args);
|
||||
case ("ventCarbonDioxide"):
|
||||
return ventCarbonDioxide(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user