Merge pull request #1558 from BallOfEnergy1/OC_bugfix

oops (fixing OC bug)
This commit is contained in:
HbmMods 2024-06-28 11:08:50 +02:00 committed by GitHub
commit 09af834a99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 5 additions and 35 deletions

View File

@ -14,6 +14,8 @@ import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import java.lang.reflect.Array;
/**
* General handler for OpenComputers compatibility.
@ -96,11 +98,9 @@ public class CompatHandler {
if(!info.equals(""))
player.addChatComponentMessage(new ChatComponentTranslation(info).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)));
}
TileEntity te = player.worldObj.getTileEntity((int) hitX, (int) hitY, (int) hitZ);
OCComponent component = (OCComponent) te;
if((component.methods() == null && te instanceof TileEntityProxyCombo) || component.getComponentName().equals("ntm_null")) {
TileEntity te = (TileEntity) this;
if(Array.getLength(this.methods()) == 0 && te instanceof TileEntityProxyCombo || this.getComponentName().equals("ntm_null"))
player.addChatComponentMessage(new ChatComponentTranslation("analyze.error").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
}
return null;
}
@ -109,7 +109,7 @@ public class CompatHandler {
* @return Array of methods to expose to the computer.
*/
@Override
default String[] methods() {return null;}
default String[] methods() {return new String[0];}
/**
* Standard invoke function from {@link li.cil.oc.api.network.ManagedPeripheral} extending {@link li.cil.oc.api.network.SimpleComponent}.

View File

@ -404,11 +404,6 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
return new Object[] {true};
}
@Override
public boolean canConnectNode(ForgeDirection side) {
return side == ForgeDirection.DOWN;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKGeneric(player.inventory);

View File

@ -166,9 +166,4 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im
targetLevel = MathHelper.clamp_double(newLevel, 0, 1);
return new Object[] {};
}
@Override
public boolean canConnectNode(ForgeDirection side) {
return side == ForgeDirection.DOWN;
}
}

View File

@ -180,9 +180,4 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{heat, tank.getFill(), tank.getMaxFill(), xCoord, yCoord, zCoord};
}
@Override
public boolean canConnectNode(ForgeDirection side) {
return side == ForgeDirection.DOWN;
}
}

View File

@ -336,11 +336,6 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
return new Object[] {xCoord, yCoord, zCoord};
}
@Override
public boolean canConnectNode(ForgeDirection side) {
return side == ForgeDirection.DOWN;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKHeater(player.inventory, this);

View File

@ -264,11 +264,6 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
return new Object[] {gas.getFill(), gas.getMaxFill(), progress, gas.getTankType().getID(), xCoord, yCoord, zCoord};
}
@Override
public boolean canConnectNode(ForgeDirection side) {
return side == ForgeDirection.DOWN;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKOutgasser(player.inventory, this);

View File

@ -496,11 +496,6 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return new Object[] {xCoord, yCoord, zCoord};
}
@Override
public boolean canConnectNode(ForgeDirection side) {
return side == ForgeDirection.DOWN;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKRod(player.inventory, this);