Merge pull request #2443 from KellenHurrey/master

Some RBMK OC integration
This commit is contained in:
HbmMods 2025-09-21 21:04:09 +02:00 committed by GitHub
commit 7285867856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 73 additions and 42 deletions

View File

@ -25,12 +25,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
import net.minecraft.world.World;
import li.cil.oc.api.machine.Arguments;
@ -631,6 +629,15 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
TileEntityRBMKOutgasser irradiationChannel = (TileEntityRBMKOutgasser)te;
data_table.put("fluxProgress", irradiationChannel.progress);
data_table.put("requiredFlux", irradiationChannel.duration);
ItemStack input = irradiationChannel.getStackInSlot(0);
if (input != null){
data_table.put("craftingName", input.getUnlocalizedName());
data_table.put("craftingNumber", input.stackSize);
}
else {
data_table.put("craftingName", "");
data_table.put("craftingNumber", 0);
}
}
if(te instanceof TileEntityRBMKHeater){
@ -760,6 +767,7 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] pressAZ5(Context context, Arguments args) {
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5,"hbm:block.shutdown",1.0F, 1.0F);
boolean hasRods = false;
for(int i = -7; i <= 7; i++) {
for(int j = -7; j <= 7; j++) {

View File

@ -273,6 +273,15 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
return new Object[] {progress};
}
@Callback(direct = true, doc = "Returns the unlocalized name and size of the stack that the outgasser is crafting (the input), or nil, nil if there is no stack")
@Optional.Method(modid = "OpenComputers")
public Object[] getCrafting(Context context, Arguments args) {
if (slots[0] == null)
return new Object[] { "", 0 };
else
return new Object[]{slots[0].getUnlocalizedName(), slots[0].stackSize };
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
@ -282,7 +291,11 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {gas.getFill(), gas.getMaxFill(), progress, gas.getTankType().getID(), xCoord, yCoord, zCoord};
ItemStack input = slots[0];
if (input != null)
return new Object[] {gas.getFill(), gas.getMaxFill(), progress, gas.getTankType().getID(), xCoord, yCoord, zCoord, input.getUnlocalizedName(), input.stackSize };
else
return new Object[] {gas.getFill(), gas.getMaxFill(), progress, gas.getTankType().getID(), xCoord, yCoord, zCoord, "", 0 };
}
@Override

View File

@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.rbmk;
import com.hbm.tileentity.IGUIProvider;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -87,6 +88,15 @@ public abstract class TileEntityRBMKSlottedBase extends TileEntityRBMKActiveBase
return false;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
} else {
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 128;
}
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
if(slots[slot] != null) {