mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +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.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
@ -513,6 +514,15 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
return new Object[] {};
|
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
|
@Override
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public String[] methods() {
|
public String[] methods() {
|
||||||
@ -524,7 +534,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
"getCarbonDioxide",
|
"getCarbonDioxide",
|
||||||
"isActive",
|
"isActive",
|
||||||
"getInfo",
|
"getInfo",
|
||||||
"setActive"
|
"setActive",
|
||||||
|
"ventCarbonDioxide"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,6 +559,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
return getInfo(context, args);
|
return getInfo(context, args);
|
||||||
case ("setActive"):
|
case ("setActive"):
|
||||||
return setActive(context, args);
|
return setActive(context, args);
|
||||||
|
case ("ventCarbonDioxide"):
|
||||||
|
return ventCarbonDioxide(context, args);
|
||||||
}
|
}
|
||||||
throw new NoSuchMethodException();
|
throw new NoSuchMethodException();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user