Merge pull request #1119 from BallOfEnergy1/master

Updated OpenComputers compatibility + slight change to concrete blast res
This commit is contained in:
HbmMods 2023-08-11 08:05:06 +02:00 committed by GitHub
commit e3d77e54e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 177 additions and 53 deletions

View File

@ -14,6 +14,8 @@
* All current nether bedrock ores are tier 1 and do not require any bore fluid
* Custom machines now show their recipes in NEI
* All it took was battling NEI's source code for 3 hours and my sanity
* Changed energy OC compatibility
* Make sure to update your programs, as the getEnergyStored and getMaxEnergy have been deprecated.
* The chlorocalcite centrifugation process now requires 8,000mB of sulfuric acid instead of 100mB of water
* Mixed chlorocalcite solution now requires flux as a reducing agent
* All chlorine producing electrolysis recipes have been moved to the electrolysis machine and can no longer be done in the chemical plant
@ -24,4 +26,5 @@
## Fixed
* Fixed custom machines not sending fluid
* Fixed custom machine item IO not working beyond the first slot
* Fixed the player's arms clipping through the armor model when punching
* Fixed target designators not accepting coordinates when not designated first (OC compatibility)
* Fixed the player's arms clipping through the armor model when punching

View File

@ -1555,9 +1555,9 @@ public class ModBlocks {
concrete_asbestos = new BlockGeneric(Material.rock).setBlockName("concrete_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete_asbestos");
concrete_super = new BlockUberConcrete().setBlockName("concrete_super").setCreativeTab(MainRegistry.blockTab).setHardness(150.0F).setResistance(10000.0F);
concrete_super_broken = new BlockFalling(Material.rock).setBlockName("concrete_super_broken").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":concrete_super_broken");
concrete_pillar = new BlockRotatablePillar(Material.rock, RefStrings.MODID + ":concrete_pillar_top").setBlockName("concrete_pillar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete_pillar_side");
brick_concrete = new BlockGeneric(Material.rock).setBlockName("brick_concrete").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
brick_concrete_mossy = new BlockGeneric(Material.rock).setBlockName("brick_concrete_mossy").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete_mossy");
concrete_pillar = new BlockRotatablePillar(Material.rock, RefStrings.MODID + ":concrete_pillar_top").setBlockName("concrete_pillar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":concrete_pillar_side");
brick_concrete = new BlockGeneric(Material.rock).setBlockName("brick_concrete").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(5000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
brick_concrete_mossy = new BlockGeneric(Material.rock).setBlockName("brick_concrete_mossy").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(5000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete_mossy");
brick_concrete_cracked = new BlockGeneric(Material.rock).setBlockName("brick_concrete_cracked").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(2000.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete_cracked");
brick_concrete_broken = new BlockGeneric(Material.rock).setBlockName("brick_concrete_broken").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(1500.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete_broken");
brick_concrete_marked = new BlockWriting(Material.rock, RefStrings.MODID + ":brick_concrete").setBlockName("brick_concrete_marked").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(1500.0F).setBlockTextureName(RefStrings.MODID + ":brick_concrete_marked");

View File

@ -151,33 +151,26 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
}
@Override
public String getComponentName() {
return "ntm_fluid_gauge";
}
@Callback(direct = true, limit = 16)
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getTick(Context context, Arguments args) {
return new Object[] {deltaTick};
public Object[] getTransfer(Context context, Arguments args) {
return new Object[] {deltaTick, deltaSecond};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getSecond(Context context, Arguments args) {
return new Object[] {deltaSecond};
public Object[] getFluid(Context context, Arguments args) {
return new Object[] {getType().getName()};
}
@Callback(direct = true, limit = 16)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return new Object[] {I18nUtil.resolveKey(getType().getUnlocalizedName())};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {deltaTick, deltaSecond, I18nUtil.resolveKey(getType().getUnlocalizedName()), xCoord, yCoord, zCoord};
return new Object[] {deltaTick, deltaSecond, getType().getName(), xCoord, yCoord, zCoord};
}
}
}

View File

@ -4,6 +4,8 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.bomb.LaunchPad;
import com.hbm.inventory.container.ContainerLaunchPadTier1;
import com.hbm.inventory.gui.GUILaunchPadTier1;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemDesingator;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.PacketDispatcher;
@ -280,40 +282,54 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyStored(Context context, Arguments args) {
return new Object[] {getPower()};
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxEnergy(Context context, Arguments args) {
return new Object[] {getMaxPower()};
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getCoords(Context context, Arguments args) {
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
int xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
int xCoord2;
int zCoord2;
if (slots[1].stackTagCompound != null) {
xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
} else
return new Object[] {false};
// Not sure if i should have this
/*
if(xCoord2 == xCoord && zCoord2 == zCoord) {
xCoord2 += 1;
}
*/
return new Object[] {xCoord2, zCoord2};
}
return new Object[] {"Designator not found"};
return new Object[] {false, "Designator not found"};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] setCoords(Context context, Arguments args) {
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
slots[1].stackTagCompound = new NBTTagCompound();
slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0));
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
return new Object[] {"Success"};
return new Object[] {true};
}
return new Object[] {"Designator not found"};
return new Object[] {false, "Designator not found"};
}
@Callback

View File

@ -2,6 +2,8 @@ package com.hbm.tileentity.bomb;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.bomb.LaunchPad;
import com.hbm.entity.missile.EntityMissileCustom;
import com.hbm.handler.MissileStruct;
import com.hbm.interfaces.IFluidAcceptor;
@ -28,9 +30,14 @@ import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.item.IDesignatorItem;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@ -43,7 +50,8 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IGUIProvider {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IGUIProvider, SimpleComponent {
private ItemStack slots[];
@ -597,6 +605,86 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
return tanks;
}
// do some opencomputer stuff
@Override
public String getComponentName() {
return "large_launch_pad";
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyStored(Context context, Arguments args) {
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxEnergy(Context context, Arguments args) {
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getContents(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getName(), tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getName(), solid, maxSolid};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getLaunchInfo(Context context, Arguments args) {
return new Object[] {canLaunch(), isMissileValid(), hasDesignator(), hasFuel()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getCoords(Context context, Arguments args) {
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
int xCoord2;
int zCoord2;
if (slots[1].stackTagCompound != null) {
xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
} else
return new Object[] {false};
// Not sure if i should have this
/*
if(xCoord2 == xCoord && zCoord2 == zCoord) {
xCoord2 += 1;
}
*/
return new Object[] {xCoord2, zCoord2};
}
return new Object[] {false, "Designator not found"};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] setCoords(Context context, Arguments args) {
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
slots[1].stackTagCompound = new NBTTagCompound();
slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0));
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
return new Object[] {true};
}
return new Object[] {false, "Designator not found"};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] launch(Context context, Arguments args) {
//worldObj.getBlock(xCoord, yCoord, zCoord).explode(worldObj, xCoord, yCoord, zCoord);
((LaunchPad) ModBlocks.launch_pad).explode(worldObj, xCoord, yCoord, zCoord);
return new Object[] {};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerLaunchTable(player.inventory, this);

View File

@ -279,13 +279,19 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyStored(Context context, Arguments args) {
return new Object[] {getPower()};
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxEnergy(Context context, Arguments args) {
return new Object[] {getMaxPower()};
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback(direct = true, limit = 4)

View File

@ -202,20 +202,20 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
@Callback(direct = true, limit = 2)
@Optional.Method(modid = "OpenComputers")
public Object[] getFirstFuel(Context context, Arguments args) {
return new Object[] {tanks[0].getFill()};
public Object[] getFuel(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[1].getFill()};
}
@Callback(direct = true, limit = 2)
@Optional.Method(modid = "OpenComputers")
public Object[] getSecondFuel(Context context, Arguments args) {
return new Object[] {tanks[1].getFill()};
public Object[] getTypes(Context context, Arguments args) {
return new Object[] {tanks[0].getTankType().getName(), tanks[1].getTankType().getName()};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[1].getFill()};
return new Object[] {tanks[0].getFill(), tanks[0].getTankType().getName(), tanks[1].getFill(), tanks[1].getTankType().getName()};
}
@Override

View File

@ -194,13 +194,19 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getInput(Context context, Arguments args) {
return new Object[] {joules};
return new Object[] {joules, "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getOutput(Context context, Arguments args) {
return new Object[] {power};
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {joules, getPower()}; //literally only doing this for the consistency between components
}
@Callback(direct = true, limit = 4)
@ -212,7 +218,7 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {joules, power, tank.getFill()};
return new Object[] {joules, getPower(), tank.getFill()};
}
@Override

View File

@ -176,13 +176,19 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyStored(Context context, Arguments args) {
return new Object[] {power};
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxEnergy(Context context, Arguments args) {
return new Object[] {maxPower};
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback(direct = true, limit = 4)

View File

@ -375,7 +375,7 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
else if(type == Fluids.HOTSTEAM) {type_1 = "1";}
else if(type == Fluids.SUPERHOTSTEAM) {type_1 = "2";}
else if(type == Fluids.ULTRAHOTSTEAM) {type_1 = "3";}
else {type_1 = "Steam out-of-bounds";}
else {type_1 = "Unknown Error";}
return new Object[] {heat, steam.getFill(), steam.getMaxFill(), feed.getFill(), feed.getMaxFill(), type_1, xCoord, yCoord, zCoord};
}

View File

@ -312,19 +312,19 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getFillType(Context context, Arguments args) {
return new Object[] {feed.getTankType().getID()};
return new Object[] {feed.getTankType().getName()};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getExportType(Context context, Arguments args) {
return new Object[] {steam.getTankType().getID()};
return new Object[] {steam.getTankType().getName()};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, feed.getFill(), feed.getMaxFill(), steam.getFill(), steam.getMaxFill(), feed.getTankType().getID(), steam.getTankType().getID(), xCoord, yCoord, zCoord};
return new Object[] {heat, feed.getFill(), feed.getMaxFill(), steam.getFill(), steam.getMaxFill(), feed.getTankType().getName(), steam.getTankType().getName(), xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 8)

View File

@ -389,12 +389,12 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getTypeStored(Context context, Arguments args) {
return new Object[] {tank.getTankType().getUnlocalizedName()};
return new Object[] {tank.getTankType().getName()};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getUnlocalizedName()};
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getName()};
}
}

View File

@ -392,19 +392,25 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
// do some opencomputer stuff
@Override
public String getComponentName() {
return "ntm_energy_storage"; // need a way to somehow detect the first word of the energy storage block so people wont get confused when it comes to multiple energy storage blocks
return "ntm_energy_storage"; //ok if someone else can figure out how to do this that'd be nice (change the component name based on the type of storage block)
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyStored(Context context, Arguments args) {
return new Object[] {getPower()};
public Object[] getEnergyStored(Context context, Arguments args) { //TODO for gamma: when ready remove these deprecated functions in all components
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxEnergy(Context context, Arguments args) {
return new Object[] {getMaxPower()};
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback(direct = true, limit = 8)

View File

@ -487,12 +487,12 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getTypeStored(Context context, Arguments args) {
return new Object[] {tank.getTankType().getUnlocalizedName()};
return new Object[] {tank.getTankType().getName()};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getUnlocalizedName()};
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getName()};
}
}