Move IC2 api

This commit is contained in:
modmuss50 2016-02-20 17:02:28 +00:00
parent 71c2bfee7f
commit ac43b5afc4
138 changed files with 30 additions and 2664 deletions

View file

@ -1,70 +0,0 @@
package ic2.api;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public enum Direction
{
XN,
XP,
YN,
YP,
ZN,
ZP;
public static final Direction[] directions;
public static Direction fromSideValue(final int side) {
return Direction.directions[(side + 2) % 6];
}
public static Direction fromEnumFacing(final EnumFacing dir) {
if (dir == null) {
return null;
}
return fromSideValue(dir.getIndex());
}
public TileEntity applyToTileEntity(final TileEntity te) {
return this.applyTo(te.getWorld(), te.getPos());
}
public TileEntity applyTo(final World world, final BlockPos pos) {
final int[] array;
final int[] coords = array = new int[] { pos.getX(), pos.getY(), pos.getZ() };
final int n = this.ordinal() / 2;
array[n] += this.getSign();
BlockPos pos2 = new BlockPos(coords[0], coords[1], coords[2]);
if (world != null && world.isBlockLoaded(pos2)) {
try {
return world.getTileEntity(pos2);
}
catch (Exception e) {
throw new RuntimeException("error getting TileEntity at dim " + world.provider.getDimensionId() + " " + pos2.toString());
}
}
return null;
}
public Direction getInverse() {
return Direction.directions[this.ordinal() ^ 0x1];
}
public int toSideValue() {
return (this.ordinal() + 4) % 6;
}
private int getSign() {
return this.ordinal() % 2 * 2 - 1;
}
public EnumFacing toEnumFacing() {
return EnumFacing.getFront(this.toSideValue());
}
static {
directions = values();
}
}

View file

@ -1,35 +0,0 @@
package ic2.api.crops;
public class BaseSeed
{
public final CropCard crop;
@Deprecated
public int id;
public int size;
public int statGrowth;
public int statGain;
public int statResistance;
public int stackSize;
public BaseSeed(final CropCard crop, final int size, final int statGrowth, final int statGain, final int statResistance, final int stackSize) {
this.crop = crop;
this.id = Crops.instance.getIdFor(crop);
this.size = size;
this.statGrowth = statGrowth;
this.statGain = statGain;
this.statResistance = statResistance;
this.stackSize = stackSize;
}
public BaseSeed(final int id, final int size, final int statGrowth, final int statGain, final int statResistance, final int stackSize) {
this(getCropFromId(id), size, statGrowth, statGain, statResistance, stackSize);
}
private static CropCard getCropFromId(final int id) {
final CropCard[] crops = Crops.instance.getCropList();
if (id < 0 || id >= crops.length) {
return null;
}
return crops[id];
}
}

View file

@ -1,165 +0,0 @@
package ic2.api.crops;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
public abstract class CropCard
{
private final String modId;
public CropCard() {
this.modId = getModId();
}
public abstract String name();
public String owner() {
return this.modId;
}
public String displayName() {
return this.name();
}
public String discoveredBy() {
return "unknown";
}
public String desc(final int i) {
final String[] att = this.attributes();
if (att == null || att.length == 0) {
return "";
}
if (i == 0) {
String s = att[0];
if (att.length >= 2) {
s = s + ", " + att[1];
if (att.length >= 3) {
s += ",";
}
}
return s;
}
if (att.length < 3) {
return "";
}
String s = att[2];
if (att.length >= 4) {
s = s + ", " + att[3];
}
return s;
}
public int getrootslength(final ICropTile crop) {
return 1;
}
public abstract int tier();
public abstract int stat(final int p0);
public abstract String[] attributes();
public abstract int maxSize();
public int growthDuration(final ICropTile crop) {
return this.tier() * 200;
}
public abstract boolean canGrow(final ICropTile p0);
public int weightInfluences(final ICropTile crop, final float humidity, final float nutrients, final float air) {
return (int)(humidity + nutrients + air);
}
public boolean canCross(final ICropTile crop) {
return crop.getSize() >= 3;
}
public boolean rightclick(final ICropTile crop, final EntityPlayer player) {
return crop.harvest(true);
}
public abstract int getOptimalHavestSize(final ICropTile p0);
public abstract boolean canBeHarvested(final ICropTile p0);
public float dropGainChance() {
float base = 1.0f;
for (int i = 0; i < this.tier(); ++i) {
base *= 0.95;
}
return base;
}
public abstract ItemStack getGain(final ICropTile p0);
public byte getSizeAfterHarvest(final ICropTile crop) {
return 1;
}
public boolean leftclick(final ICropTile crop, final EntityPlayer player) {
return crop.pick(true);
}
public float dropSeedChance(final ICropTile crop) {
if (crop.getSize() == 1) {
return 0.0f;
}
float base = 0.5f;
if (crop.getSize() == 2) {
base /= 2.0f;
}
for (int i = 0; i < this.tier(); ++i) {
base *= 0.8;
}
return base;
}
public ItemStack getSeeds(final ICropTile crop) {
return crop.generateSeeds(crop.getCrop(), crop.getGrowth(), crop.getGain(), crop.getResistance(), crop.getScanLevel());
}
public void onNeighbourChange(final ICropTile crop) {
}
public int emitRedstone(final ICropTile crop) {
return 0;
}
public void onBlockDestroyed(final ICropTile crop) {
}
public int getEmittedLight(final ICropTile crop) {
return 0;
}
public boolean onEntityCollision(final ICropTile crop, final Entity entity) {
return entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isSprinting();
}
public void tick(final ICropTile crop) {
}
public boolean isWeed(final ICropTile crop) {
return crop.getSize() >= 2 && (crop == Crops.weed || crop.getGrowth() >= 24);
}
@Deprecated
public final int getId() {
return Crops.instance.getIdFor(this);
}
private static String getModId() {
final ModContainer modContainer = Loader.instance().activeModContainer();
if (modContainer != null) {
return modContainer.getModId();
}
assert false;
return "unknown";
}
}

View file

@ -1,44 +0,0 @@
package ic2.api.crops;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import java.util.Collection;
public abstract class Crops
{
public static Crops instance;
public static CropCard weed;
public abstract void addBiomenutrientsBonus(final BiomeDictionary.Type p0, final int p1);
public abstract void addBiomehumidityBonus(final BiomeDictionary.Type p0, final int p1);
public abstract int getHumidityBiomeBonus(final BiomeGenBase p0);
public abstract int getNutrientBiomeBonus(final BiomeGenBase p0);
public abstract CropCard getCropCard(final String p0, final String p1);
public abstract CropCard getCropCard(final ItemStack p0);
public abstract Collection<CropCard> getCrops();
@Deprecated
public abstract CropCard[] getCropList();
public abstract short registerCrop(final CropCard p0);
public abstract boolean registerCrop(final CropCard p0, final int p1);
@Deprecated
public abstract boolean registerBaseSeed(final ItemStack p0, final int p1, final int p2, final int p3, final int p4, final int p5);
public abstract boolean registerBaseSeed(final ItemStack p0, final CropCard p1, final int p2, final int p3, final int p4, final int p5);
public abstract BaseSeed getBaseSeed(final ItemStack p0);
@Deprecated
public abstract int getIdFor(final CropCard p0);
}

View file

@ -1,83 +0,0 @@
package ic2.api.crops;
import net.minecraft.nbt.*;
import net.minecraft.world.*;
import net.minecraft.util.*;
import net.minecraft.item.*;
import net.minecraft.block.*;
public interface ICropTile
{
CropCard getCrop();
void setCrop(CropCard p0);
@Deprecated
short getID();
@Deprecated
void setID(short p0);
byte getSize();
void setSize(byte p0);
byte getGrowth();
void setGrowth(byte p0);
byte getGain();
void setGain(byte p0);
byte getResistance();
void setResistance(byte p0);
byte getScanLevel();
void setScanLevel(byte p0);
NBTTagCompound getCustomData();
int getNutrientStorage();
void setNutrientStorage(int p0);
int getHydrationStorage();
void setHydrationStorage(int p0);
int getWeedExStorage();
void setWeedExStorage(int p0);
byte getHumidity();
byte getNutrients();
byte getAirQuality();
World getWorld();
BlockPos getLocation();
int getLightLevel();
boolean pick(boolean p0);
boolean harvest(boolean p0);
ItemStack[] harvest_automated(boolean p0);
void reset();
void updateState();
boolean isBlockBelow(Block p0);
ItemStack generateSeeds(CropCard p0, byte p1, byte p2, byte p3, byte p4);
@Deprecated
ItemStack generateSeeds(short p0, byte p1, byte p2, byte p3, byte p4);
}

View file

@ -1,6 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.crops;
import net.minecraftforge.fml.common.*;

View file

@ -1,6 +0,0 @@
package ic2.api.energy;
public final class EnergyNet
{
public static IEnergyNet instance;
}

View file

@ -1,25 +0,0 @@
package ic2.api.energy;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public interface IEnergyNet
{
TileEntity getTileEntity(World p0, BlockPos pos);
TileEntity getNeighbor(TileEntity p0, EnumFacing p1);
@Deprecated
double getTotalEnergyEmitted(TileEntity p0);
@Deprecated
double getTotalEnergySunken(TileEntity p0);
NodeStats getNodeStats(TileEntity p0);
double getPowerFromTier(int p0);
int getTierFromPower(double p0);
}

View file

@ -1,11 +0,0 @@
package ic2.api.energy;
import net.minecraft.tileentity.*;
import java.util.*;
public interface IPacketEnergyNet extends IEnergyNet
{
List<PacketStat> getSendedPackets(TileEntity p0);
List<PacketStat> getTotalSendedPackets(TileEntity p0);
}

View file

@ -1,26 +0,0 @@
package ic2.api.energy;
public class NodeStats
{
protected double energyIn;
protected double energyOut;
protected double voltage;
public NodeStats(final double energyIn, final double energyOut, final double voltage) {
this.energyIn = energyIn;
this.energyOut = energyOut;
this.voltage = voltage;
}
public double getEnergyIn() {
return this.energyIn;
}
public double getEnergyOut() {
return this.energyOut;
}
public double getVoltage() {
return this.voltage;
}
}

View file

@ -1,31 +0,0 @@
package ic2.api.energy;
public class PacketStat implements Comparable<PacketStat>
{
public final int energy;
public final long count;
public PacketStat(final int par1, final long par2) {
this.energy = par1;
this.count = par2;
}
public long getPacketCount() {
return this.count;
}
public int getPacketEnergy() {
return this.energy;
}
@Override
public int compareTo(final PacketStat o) {
if (o.energy < this.energy) {
return 1;
}
if (o.energy > this.energy) {
return -1;
}
return 0;
}
}

View file

@ -1,18 +0,0 @@
package ic2.api.energy.event;
import net.minecraftforge.event.world.*;
import ic2.api.energy.tile.*;
import net.minecraft.tileentity.*;
public class EnergyTileEvent extends WorldEvent
{
public final IEnergyTile energyTile;
public EnergyTileEvent(final IEnergyTile energyTile1) {
super(((TileEntity)energyTile1).getWorld());
if (this.world == null) {
throw new NullPointerException("world is null");
}
this.energyTile = energyTile1;
}
}

View file

@ -1,10 +0,0 @@
package ic2.api.energy.event;
import ic2.api.energy.tile.*;
public class EnergyTileLoadEvent extends EnergyTileEvent
{
public EnergyTileLoadEvent(final IEnergyTile energyTile1) {
super(energyTile1);
}
}

View file

@ -1,10 +0,0 @@
package ic2.api.energy.event;
import ic2.api.energy.tile.*;
public class EnergyTileUnloadEvent extends EnergyTileEvent
{
public EnergyTileUnloadEvent(final IEnergyTile energyTile1) {
super(energyTile1);
}
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.energy.event;
import net.minecraftforge.fml.common.*;

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.energy;
import net.minecraftforge.fml.common.*;

View file

@ -1,167 +0,0 @@
package ic2.api.energy.prefab;
import net.minecraft.util.ITickable;
import net.minecraft.tileentity.*;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.common.*;
import ic2.api.info.*;
import net.minecraftforge.common.*;
import ic2.api.energy.tile.*;
import net.minecraftforge.fml.common.eventhandler.*;
import ic2.api.energy.event.*;
import net.minecraft.nbt.*;
import net.minecraft.item.*;
import ic2.api.item.*;
public class BasicSink extends TileEntity implements IEnergySink, ITickable
{
public final TileEntity parent;
protected int capacity;
protected int tier;
protected double energyStored;
protected boolean addedToEnet;
public BasicSink(final TileEntity parent1, final int capacity1, final int tier1) {
this.parent = parent1;
this.capacity = capacity1;
this.tier = tier1;
}
@Override
public void update() {
if (!this.addedToEnet) {
this.onLoaded();
}
}
public void onLoaded() {
if (!this.addedToEnet && !FMLCommonHandler.instance().getEffectiveSide().isClient() && Info.isIc2Available()) {
this.worldObj = this.parent.getWorld();
this.pos = this.parent.getPos();
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
this.addedToEnet = true;
}
}
public void invalidate() {
super.invalidate();
this.onChunkUnload();
}
public void onChunkUnload() {
if (this.addedToEnet && Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post((Event)new EnergyTileUnloadEvent(this));
this.addedToEnet = false;
}
}
public void readFromNBT(final NBTTagCompound tag) {
super.readFromNBT(tag);
final NBTTagCompound data = tag.getCompoundTag("IC2BasicSink");
this.energyStored = data.getDouble("energy");
}
public void writeToNBT(final NBTTagCompound tag) {
try {
super.writeToNBT(tag);
}
catch (RuntimeException ex) {}
final NBTTagCompound data = new NBTTagCompound();
data.setDouble("energy", this.energyStored);
tag.setTag("IC2BasicSink", (NBTBase)data);
}
public int getCapacity() {
return this.capacity;
}
public void setCapacity(final int capacity1) {
this.capacity = capacity1;
}
public int getTier() {
return this.tier;
}
public void setTier(final int tier1) {
this.tier = tier1;
}
public double getEnergyStored() {
return this.energyStored;
}
public void setEnergyStored(final double amount) {
this.energyStored = amount;
}
public boolean canUseEnergy(final double amount) {
return this.energyStored >= amount;
}
public boolean useEnergy(final double amount) {
if (this.canUseEnergy(amount) && !FMLCommonHandler.instance().getEffectiveSide().isClient()) {
this.energyStored -= amount;
return true;
}
return false;
}
public boolean discharge(final ItemStack stack, final int limit) {
if (stack == null || !Info.isIc2Available()) {
return false;
}
double amount = this.capacity - this.energyStored;
if (amount <= 0.0) {
return false;
}
if (limit > 0 && limit < amount) {
amount = limit;
}
amount = ElectricItem.manager.discharge(stack, amount, this.tier, limit > 0, true, false);
this.energyStored += amount;
return amount > 0.0;
}
@Deprecated
public void onUpdateEntity() {
this.update();
}
@Deprecated
public void onInvalidate() {
this.invalidate();
}
@Deprecated
public void onOnChunkUnload() {
this.onChunkUnload();
}
@Deprecated
public void onReadFromNbt(final NBTTagCompound tag) {
this.readFromNBT(tag);
}
@Deprecated
public void onWriteToNbt(final NBTTagCompound tag) {
this.writeToNBT(tag);
}
public boolean acceptsEnergyFrom(final TileEntity emitter, final EnumFacing direction) {
return true;
}
public double getDemandedEnergy() {
return Math.max(0.0, this.capacity - this.energyStored);
}
public double injectEnergy(final EnumFacing directionFrom, final double amount, final double voltage) {
this.energyStored += amount;
return 0.0;
}
public int getSinkTier() {
return this.tier;
}
}

View file

@ -1,174 +0,0 @@
package ic2.api.energy.prefab;
import net.minecraft.util.ITickable;
import net.minecraft.tileentity.*;
import ic2.api.energy.*;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.common.*;
import ic2.api.info.*;
import net.minecraftforge.common.*;
import ic2.api.energy.tile.*;
import net.minecraftforge.fml.common.eventhandler.*;
import ic2.api.energy.event.*;
import net.minecraft.nbt.*;
import net.minecraft.item.*;
import ic2.api.item.*;
public class BasicSource extends TileEntity implements IEnergySource, ITickable
{
public final TileEntity parent;
protected double capacity;
protected int tier;
protected double power;
protected double energyStored;
protected boolean addedToEnet;
public BasicSource(final TileEntity parent1, final double capacity1, final int tier1) {
final double power = EnergyNet.instance.getPowerFromTier(tier1);
this.parent = parent1;
this.capacity = ((capacity1 < power) ? power : capacity1);
this.tier = tier1;
this.power = power;
}
@Override
public void update() {
if (!this.addedToEnet) {
this.onLoaded();
}
}
public void onLoaded() {
if (!this.addedToEnet && !FMLCommonHandler.instance().getEffectiveSide().isClient() && Info.isIc2Available()) {
this.worldObj = this.parent.getWorld();
this.pos = this.parent.getPos();
MinecraftForge.EVENT_BUS.post((Event)new EnergyTileLoadEvent(this));
this.addedToEnet = true;
}
}
public void invalidate() {
super.invalidate();
this.onChunkUnload();
}
public void onChunkUnload() {
if (this.addedToEnet && Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
this.addedToEnet = false;
}
}
public void readFromNBT(final NBTTagCompound tag) {
super.readFromNBT(tag);
final NBTTagCompound data = tag.getCompoundTag("IC2BasicSource");
this.energyStored = data.getDouble("energy");
}
public void writeToNBT(final NBTTagCompound tag) {
try {
super.writeToNBT(tag);
}
catch (RuntimeException ex) {}
final NBTTagCompound data = new NBTTagCompound();
data.setDouble("energy", this.energyStored);
tag.setTag("IC2BasicSource", (NBTBase)data);
}
public double getCapacity() {
return this.capacity;
}
public void setCapacity(double capacity1) {
if (capacity1 < this.power) {
capacity1 = this.power;
}
this.capacity = capacity1;
}
public int getTier() {
return this.tier;
}
public void setTier(final int tier1) {
final double power = EnergyNet.instance.getPowerFromTier(tier1);
if (this.capacity < power) {
this.capacity = power;
}
this.tier = tier1;
this.power = power;
}
public double getEnergyStored() {
return this.energyStored;
}
public void setEnergyStored(final double amount) {
this.energyStored = amount;
}
public double getFreeCapacity() {
return this.capacity - this.energyStored;
}
public double addEnergy(double amount) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return 0.0;
}
if (amount > this.capacity - this.energyStored) {
amount = this.capacity - this.energyStored;
}
this.energyStored += amount;
return amount;
}
public boolean charge(final ItemStack stack) {
if (stack == null || !Info.isIc2Available()) {
return false;
}
final double amount = ElectricItem.manager.charge(stack, this.energyStored, this.tier, false, false);
this.energyStored -= amount;
return amount > 0.0;
}
@Deprecated
public void onUpdateEntity() {
this.update();
}
@Deprecated
public void onInvalidate() {
this.invalidate();
}
@Deprecated
public void onOnChunkUnload() {
this.onChunkUnload();
}
@Deprecated
public void onReadFromNbt(final NBTTagCompound tag) {
this.readFromNBT(tag);
}
@Deprecated
public void onWriteToNbt(final NBTTagCompound tag) {
this.writeToNBT(tag);
}
public boolean emitsEnergyTo(final TileEntity receiver, final EnumFacing direction) {
return true;
}
public double getOfferedEnergy() {
return Math.min(this.energyStored, this.power);
}
public void drawEnergy(final double amount) {
this.energyStored -= amount;
}
public int getSourceTier() {
return this.tier;
}
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.energy.prefab;
import net.minecraftforge.fml.common.*;

View file

@ -1,9 +0,0 @@
package ic2.api.energy.tile;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
public interface IEnergyAcceptor extends IEnergyTile
{
boolean acceptsEnergyFrom(TileEntity p0, EnumFacing p1);
}

View file

@ -1,16 +0,0 @@
package ic2.api.energy.tile;
public interface IEnergyConductor extends IEnergyAcceptor, IEnergyEmitter
{
double getConductionLoss();
double getInsulationEnergyAbsorption();
double getInsulationBreakdownEnergy();
double getConductorBreakdownEnergy();
void removeInsulation();
void removeConductor();
}

View file

@ -1,6 +0,0 @@
package ic2.api.energy.tile;
public interface IEnergyConductorColored extends IEnergyConductor
{
int getConductorColor();
}

View file

@ -1,9 +0,0 @@
package ic2.api.energy.tile;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
public interface IEnergyEmitter extends IEnergyTile
{
boolean emitsEnergyTo(TileEntity p0, EnumFacing p1);
}

View file

@ -1,12 +0,0 @@
package ic2.api.energy.tile;
import net.minecraft.util.EnumFacing;
public interface IEnergySink extends IEnergyAcceptor
{
double getDemandedEnergy();
int getSinkTier();
double injectEnergy(EnumFacing p0, double p1, double p2);
}

View file

@ -1,10 +0,0 @@
package ic2.api.energy.tile;
public interface IEnergySource extends IEnergyEmitter
{
double getOfferedEnergy();
void drawEnergy(double p0);
int getSourceTier();
}

View file

@ -1,6 +0,0 @@
package ic2.api.energy.tile;
public interface IEnergySourceInfo extends IEnergySource
{
int getMaxEnergyAmount();
}

View file

@ -1,5 +0,0 @@
package ic2.api.energy.tile;
public interface IEnergyTile
{
}

View file

@ -1,10 +0,0 @@
package ic2.api.energy.tile;
import net.minecraft.util.EnumFacing;
public interface IHeatSource
{
int maxrequestHeatTick(EnumFacing p0);
int requestHeat(EnumFacing p0, int p1);
}

View file

@ -1,10 +0,0 @@
package ic2.api.energy.tile;
import net.minecraft.util.EnumFacing;
public interface IKineticSource
{
int maxrequestkineticenergyTick(EnumFacing p0);
int requestkineticenergy(EnumFacing p0, int p1);
}

View file

@ -1,9 +0,0 @@
package ic2.api.energy.tile;
import java.util.*;
import net.minecraft.tileentity.*;
public interface IMetaDelegate extends IEnergyTile
{
List<TileEntity> getSubTiles();
}

View file

@ -1,8 +0,0 @@
package ic2.api.energy.tile;
public interface IMultiEnergySource extends IEnergySource
{
boolean sendMultibleEnergyPackets();
int getMultibleEnergyPacketAmount();
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.energy.tile;
import net.minecraftforge.fml.common.*;

View file

@ -1,31 +0,0 @@
package ic2.api.event;
import net.minecraftforge.event.world.*;
import net.minecraftforge.fml.common.eventhandler.*;
import net.minecraft.entity.*;
import net.minecraft.world.*;
@Cancelable
public class ExplosionEvent extends WorldEvent
{
public final Entity entity;
public double x;
public double y;
public double z;
public double power;
public final EntityLivingBase igniter;
public final int radiationRange;
public final double rangeLimit;
public ExplosionEvent(final World world, final Entity entity, final double x, final double y, final double z, final double power, final EntityLivingBase igniter, final int radiationRange, final double rangeLimit) {
super(world);
this.entity = entity;
this.x = x;
this.y = y;
this.z = z;
this.power = power;
this.igniter = igniter;
this.radiationRange = radiationRange;
this.rangeLimit = rangeLimit;
}
}

View file

@ -1,32 +0,0 @@
package ic2.api.event;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
public class FoamEvent extends WorldEvent
{
public BlockPos pos;
public FoamEvent(final World world, final BlockPos pos) {
super(world);
this.pos = pos;
}
@Cancelable
public static class Check extends FoamEvent
{
public Check(final World world, final BlockPos pos) {
super(world, pos);
}
}
@Cancelable
public static class Foam extends FoamEvent
{
public Foam(final World world, final BlockPos pos) {
super(world, pos);
}
}
}

View file

@ -1,85 +0,0 @@
package ic2.api.event;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
@Cancelable
public class LaserEvent extends WorldEvent
{
public final Entity lasershot;
public EntityLivingBase owner;
public float range;
public float power;
public int blockBreaks;
public boolean explosive;
public boolean smelt;
public LaserEvent(final World world1, final Entity lasershot1, final EntityLivingBase owner1, final float range1, final float power1, final int blockBreaks1, final boolean explosive1, final boolean smelt1) {
super(world1);
this.lasershot = lasershot1;
this.owner = owner1;
this.range = range1;
this.power = power1;
this.blockBreaks = blockBreaks1;
this.explosive = explosive1;
this.smelt = smelt1;
}
public static class LaserShootEvent extends LaserEvent
{
ItemStack laseritem;
public LaserShootEvent(final World world1, final Entity lasershot1, final EntityLivingBase owner1, final float range1, final float power1, final int blockBreaks1, final boolean explosive1, final boolean smelt1, final ItemStack laseritem1) {
super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1);
this.laseritem = laseritem1;
}
}
public static class LaserExplodesEvent extends LaserEvent
{
public float explosionpower;
public float explosiondroprate;
public float explosionentitydamage;
public LaserExplodesEvent(final World world1, final Entity lasershot1, final EntityLivingBase owner1, final float range1, final float power1, final int blockBreaks1, final boolean explosive1, final boolean smelt1, final float explosionpower1, final float explosiondroprate1, final float explosionentitydamage1) {
super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1);
this.explosionpower = explosionpower1;
this.explosiondroprate = explosiondroprate1;
this.explosionentitydamage = explosionentitydamage1;
}
}
public static class LaserHitsBlockEvent extends LaserEvent
{
public BlockPos pos;
public EnumFacing side;
public boolean removeBlock;
public boolean dropBlock;
public float dropChance;
public LaserHitsBlockEvent(final World world1, final Entity lasershot1, final EntityLivingBase owner1, final float range1, final float power1, final int blockBreaks1, final boolean explosive1, final boolean smelt1, final BlockPos pos, final EnumFacing side1, final float dropChance1, final boolean removeBlock1, final boolean dropBlock1) {
super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1);
this.pos = pos;
this.side = side1;
this.removeBlock = removeBlock1;
this.dropBlock = dropBlock1;
this.dropChance = dropChance1;
}
}
public static class LaserHitsEntityEvent extends LaserEvent
{
public Entity hitentity;
public LaserHitsEntityEvent(final World world1, final Entity lasershot1, final EntityLivingBase owner1, final float range1, final float power1, final int blockBreaks1, final boolean explosive1, final boolean smelt1, final Entity hitentity1) {
super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1);
this.hitentity = hitentity1;
}
}
}

View file

@ -1,25 +0,0 @@
package ic2.api.event;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
@Cancelable
public class PaintEvent extends WorldEvent
{
public final BlockPos pos;
public final EnumFacing side;
public final EnumDyeColor color;
public boolean painted;
public PaintEvent(final World world1, final BlockPos pos, final EnumFacing side1, final EnumDyeColor color1) {
super(world1);
this.painted = false;
this.pos = pos;
this.side = side1;
this.color = color1;
}
}

View file

@ -1,27 +0,0 @@
package ic2.api.event;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
@Cancelable
public class RetextureEvent extends WorldEvent
{
public final BlockPos pos;
public final EnumFacing side;
public final IBlockState referencedState;
public final EnumFacing referencedSide;
public boolean applied;
public RetextureEvent(final World world1, final BlockPos pos, final EnumFacing side1, final IBlockState state, final EnumFacing referencedSide1) {
super(world1);
this.applied = false;
this.pos = pos;
this.side = side1;
this.referencedState = state;
this.referencedSide = referencedSide1;
}
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.event;
import net.minecraftforge.fml.common.*;

View file

@ -1,38 +0,0 @@
package ic2.api.event.recipe;
import net.minecraft.item.*;
public abstract class CannerRecipe extends RecipeEvent
{
int fuel;
public CannerRecipe(final ItemStack input, final int fuel) {
super(input, input);
this.fuel = fuel;
}
public int getFuelValue() {
return this.fuel;
}
public static class FuelValue extends CannerRecipe
{
public FuelValue(final ItemStack input, final int fuel) {
super(input, fuel);
}
}
public static class FuelMultiplier extends CannerRecipe
{
public FuelMultiplier(final ItemStack input, final int percentage) {
super(input, percentage);
}
}
public static class FoodEffect extends CannerRecipe
{
public FoodEffect(final ItemStack input, final int meta) {
super(input, meta);
}
}
}

View file

@ -1,17 +0,0 @@
package ic2.api.event.recipe;
import net.minecraft.item.*;
public class ElectrolyzerRecipeEvent extends RecipeEvent
{
public final int energy;
public final boolean charge;
public final boolean discharge;
public ElectrolyzerRecipeEvent(final ItemStack par1, final ItemStack par2, final int par3, final boolean par4, final boolean par5) {
super(par1, par2);
this.energy = par3;
this.charge = par4;
this.discharge = par5;
}
}

View file

@ -1,24 +0,0 @@
package ic2.api.event.recipe;
import net.minecraftforge.fml.common.eventhandler.*;
import net.minecraft.item.*;
@Cancelable
public class RecipeEvent extends Event
{
final ItemStack input;
final ItemStack output;
public RecipeEvent(final ItemStack input, final ItemStack output) {
this.input = input;
this.output = output;
}
public final ItemStack getInput() {
return this.input.copy();
}
public final ItemStack getOutput() {
return this.output.copy();
}
}

View file

@ -1,68 +0,0 @@
package ic2.api.info;
import net.minecraftforge.fml.common.*;
public class IC2Classic
{
public static IWindTicker windNetwork;
private static IC2Type ic2;
public static IC2Type getLoadedIC2Type() {
if (IC2Classic.ic2 == IC2Type.NeedLoad) {
updateState();
}
return IC2Classic.ic2;
}
public static boolean isIc2ExpLoaded() {
if (IC2Classic.ic2 == IC2Type.NeedLoad) {
updateState();
}
return IC2Classic.ic2 == IC2Type.Experimental;
}
public static boolean isIc2ClassicLoaded() {
if (IC2Classic.ic2 == IC2Type.NeedLoad) {
updateState();
}
return IC2Classic.ic2 == IC2Type.SpeigersClassic;
}
public static IWindTicker getWindNetwork() {
return IC2Classic.windNetwork;
}
public static boolean enabledCustoWindNetwork() {
return IC2Classic.windNetwork != null;
}
static void updateState() {
if (Loader.isModLoaded("IC2-Classic")) {
IC2Classic.ic2 = IC2Type.ImmibisClassic;
return;
}
if (Loader.isModLoaded("IC2")) {
if (Loader.isModLoaded("IC2-Classic-Spmod")) {
IC2Classic.ic2 = IC2Type.SpeigersClassic;
return;
}
IC2Classic.ic2 = IC2Type.Experimental;
}
else {
IC2Classic.ic2 = IC2Type.None;
}
}
static {
IC2Classic.ic2 = IC2Type.NeedLoad;
}
public enum IC2Type
{
NeedLoad,
Experimental,
SpeigersClassic,
ImmibisClassic,
None;
}
}

View file

@ -1,8 +0,0 @@
package ic2.api.info;
import net.minecraft.item.*;
public interface IEnergyValueProvider
{
double getEnergyValue(ItemStack p0);
}

View file

@ -1,8 +0,0 @@
package ic2.api.info;
import net.minecraft.item.*;
public interface IFuelValueProvider
{
int getFuelValue(ItemStack p0, boolean p1);
}

View file

@ -1,8 +0,0 @@
package ic2.api.info;
import net.minecraft.world.*;
public interface IWindTicker
{
int getWindStrenght(World p0);
}

View file

@ -1,30 +0,0 @@
package ic2.api.info;
import net.minecraft.util.*;
import net.minecraftforge.fml.common.*;
public class Info
{
public static IEnergyValueProvider itemEnergy;
public static IFuelValueProvider itemFuel;
public static Object ic2ModInstance;
public static DamageSource DMG_ELECTRIC;
public static DamageSource DMG_NUKE_EXPLOSION;
public static DamageSource DMG_RADIATION;
private static Boolean ic2Available;
public static boolean isIc2Available() {
if (Info.ic2Available != null) {
return Info.ic2Available;
}
final boolean loaded = Loader.isModLoaded("IC2");
if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) {
Info.ic2Available = loaded;
}
return loaded;
}
static {
Info.ic2Available = null;
}
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.info;
import net.minecraftforge.fml.common.*;

View file

@ -1,28 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import java.util.*;
public final class ElectricItem
{
public static IElectricItemManager manager;
public static IElectricItemManager rawManager;
private static final List<IBackupElectricItemManager> backupManagers;
public static void registerBackupManager(final IBackupElectricItemManager manager) {
ElectricItem.backupManagers.add(manager);
}
public static IBackupElectricItemManager getBackupManager(final ItemStack stack) {
for (final IBackupElectricItemManager manager : ElectricItem.backupManagers) {
if (manager.handles(stack)) {
return manager;
}
}
return null;
}
static {
backupManagers = new ArrayList<IBackupElectricItemManager>();
}
}

View file

@ -1,8 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
public interface IBackupElectricItemManager extends IElectricItemManager
{
boolean handles(ItemStack p0);
}

View file

@ -1,6 +0,0 @@
package ic2.api.item;
public interface IBlockCuttingBlade
{
int gethardness();
}

View file

@ -1,8 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
public interface IBoxable
{
boolean canBeStoredInToolbox(ItemStack p0);
}

View file

@ -1,34 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
public final class IC2Items
{
private static Class<?> Ic2Items;
public static ItemStack getItem(final String name) {
try {
if (IC2Items.Ic2Items == null) {
IC2Items.Ic2Items = Class.forName(getPackage() + ".core.Ic2Items");
}
final Object ret = IC2Items.Ic2Items.getField(name).get(null);
if (ret instanceof ItemStack) {
return (ItemStack)ret;
}
return null;
}
catch (Exception e) {
System.out.println("IC2 API: Call getItem failed for " + name);
return null;
}
}
private static String getPackage() {
final Package pkg = IC2Items.class.getPackage();
if (pkg != null) {
final String packageName = pkg.getName();
return packageName.substring(0, packageName.length() - ".api.item".length());
}
return "ic2";
}
}

View file

@ -1,15 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import net.minecraft.entity.*;
public interface ICustomDamageItem
{
int getCustomDamage(ItemStack p0);
int getMaxCustomDamage(ItemStack p0);
void setCustomDamage(ItemStack p0, int p1);
boolean applyCustomDamage(ItemStack p0, int p1, EntityLivingBase p2);
}

View file

@ -1,8 +0,0 @@
package ic2.api.item;
public interface IDebuggable
{
boolean isDebuggable();
String getDebugText();
}

View file

@ -1,18 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
public interface IElectricItem
{
boolean canProvideEnergy(ItemStack p0);
Item getChargedItem(ItemStack p0);
Item getEmptyItem(ItemStack p0);
double getMaxCharge(ItemStack p0);
int getTier(ItemStack p0);
double getTransferLimit(ItemStack p0);
}

View file

@ -1,21 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import net.minecraft.entity.*;
public interface IElectricItemManager
{
double charge(ItemStack p0, double p1, int p2, boolean p3, boolean p4);
double discharge(ItemStack p0, double p1, int p2, boolean p3, boolean p4, boolean p5);
double getCharge(ItemStack p0);
boolean canUse(ItemStack p0, double p1);
boolean use(ItemStack p0, double p1, EntityLivingBase p2);
void chargeFromArmor(ItemStack p0, EntityLivingBase p1);
String getToolTip(ItemStack p0);
}

View file

@ -1,9 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import java.util.*;
public interface IItemHudInfo
{
List<String> getHudInfo(ItemStack p0);
}

View file

@ -1,12 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
public interface IJetpack
{
void dissableJetpack(ItemStack p0);
boolean isJetpackActive(ItemStack p0);
void onLeavingEnergyShield(ItemStack p0);
}

View file

@ -1,17 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import net.minecraft.util.*;
public interface IKineticWindRotor
{
int getDiameter(ItemStack p0);
ResourceLocation getRotorRenderTexture(ItemStack p0);
float getEfficiency(ItemStack p0);
int getMinWindStrength(ItemStack p0);
int getMaxWindStrength(ItemStack p0);
}

View file

@ -1,21 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraftforge.fml.relauncher.*;
public interface ILatheItem
{
int getWidth(ItemStack p0);
int[] getCurrentState(ItemStack p0);
void setState(ItemStack p0, int p1, int p2);
ItemStack getOutputItem(ItemStack p0, int p1);
float getOutputChance(ItemStack p0, int p1);
@SideOnly(Side.CLIENT)
ResourceLocation getTexture(ItemStack p0);
}

View file

@ -1,34 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import ic2.api.tile.*;
import java.util.*;
public interface IMachineUpgradeItem
{
int getExtraProcessTime(ItemStack p0, IMachine p1);
double getProcessTimeMultiplier(ItemStack p0, IMachine p1);
int getExtraEnergyDemand(ItemStack p0, IMachine p1);
double getEnergyDemandMultiplier(ItemStack p0, IMachine p1);
int getExtraEnergyStorage(ItemStack p0, IMachine p1);
double getEnergyStorageMultiplier(ItemStack p0, IMachine p1);
int getExtraTier(ItemStack p0, IMachine p1);
boolean onTick(ItemStack p0, IMachine p1);
void onProcessEnd(ItemStack p0, IMachine p1, List<ItemStack> p2);
boolean useRedstoneinverter(ItemStack p0, IMachine p1);
void onInstalling(ItemStack p0, IMachine p1);
float getSoundVolumeMultiplier(ItemStack p0, IMachine p1);
IMachine.UpgradeType getType(ItemStack p0);
}

View file

@ -1,9 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
import net.minecraft.entity.player.*;
public interface IMetalArmor
{
boolean isMetalArmor(ItemStack p0, EntityPlayer p1);
}

View file

@ -1,17 +0,0 @@
package ic2.api.item;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public interface IScannerItem extends IElectricItem
{
int startLayerScan(ItemStack p0);
boolean isValuableOre(ItemStack p0, IBlockState state);
int getOreValue(ItemStack p0, IBlockState state);
int getOreValueOfArea(ItemStack p0, World p1, BlockPos pos);
}

View file

@ -1,8 +0,0 @@
package ic2.api.item;
import net.minecraft.item.*;
public interface ISpecialElectricItem extends IElectricItem
{
IElectricItemManager getManager(ItemStack p0);
}

View file

@ -1,13 +0,0 @@
package ic2.api.item;
import net.minecraft.util.BlockPos;
import net.minecraft.world.*;
public interface ITerraformingBP
{
int getConsume();
int getRange();
boolean terraform(World p0, BlockPos pos);
}

View file

@ -1,46 +0,0 @@
package ic2.api.item;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemWrapper
{
private static final Multimap<Item, IBoxable> boxableItems;
private static final Multimap<Item, IMetalArmor> metalArmorItems;
public static void registerBoxable(final Item item, final IBoxable boxable) {
ItemWrapper.boxableItems.put(item, boxable);
}
public static boolean canBeStoredInToolbox(final ItemStack stack) {
final Item item = stack.getItem();
for (final IBoxable boxable : ItemWrapper.boxableItems.get(item)) {
if (boxable.canBeStoredInToolbox(stack)) {
return true;
}
}
return item instanceof IBoxable && ((IBoxable)item).canBeStoredInToolbox(stack);
}
public static void registerMetalArmor(final Item item, final IMetalArmor armor) {
ItemWrapper.metalArmorItems.put(item, armor);
}
public static boolean isMetalArmor(final ItemStack stack, final EntityPlayer player) {
final Item item = stack.getItem();
for (final IMetalArmor metalArmor : ItemWrapper.metalArmorItems.get(item)) {
if (metalArmor.isMetalArmor(stack, player)) {
return true;
}
}
return item instanceof IMetalArmor && ((IMetalArmor)item).isMetalArmor(stack, player);
}
static {
boxableItems = ArrayListMultimap.create();
metalArmorItems = ArrayListMultimap.create();
}
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.item;
import net.minecraftforge.fml.common.*;

View file

@ -1,8 +0,0 @@
package ic2.api.network;
import net.minecraft.entity.player.*;
public interface INetworkClientTileEntityEventListener
{
void onNetworkEvent(EntityPlayer p0, int p1);
}

View file

@ -1,26 +0,0 @@
package ic2.api.network;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Map;
public interface INetworkDataProvider
{
/**
* Returns the fields this object has
*/
ImmutableList<String> getNetworkedFields();
/**
* Request the specified fields from this object
* @param fields
*/
ImmutableMap<String, Object> getFieldsForSync(Collection<String> fields);
/**
* Update all fields present in the map
*/
void updateFields(Map<String, Object> fields);
}

View file

@ -1,9 +0,0 @@
package ic2.api.network;
import net.minecraft.item.*;
import net.minecraft.entity.player.*;
public interface INetworkItemEventListener
{
void onNetworkEvent(ItemStack p0, EntityPlayer p1, int p2);
}

View file

@ -1,6 +0,0 @@
package ic2.api.network;
public interface INetworkTileEntityEventListener
{
void onNetworkEvent(int p0);
}

View file

@ -1,6 +0,0 @@
package ic2.api.network;
public interface INetworkUpdateListener
{
void onNetworkUpdate(String p0);
}

View file

@ -1,109 +0,0 @@
package ic2.api.network;
import java.lang.reflect.*;
import net.minecraft.tileentity.*;
import net.minecraft.entity.player.*;
import net.minecraft.item.*;
public final class NetworkHelper
{
private static Object instance;
private static Method NetworkManager_updateTileEntityField;
private static Method NetworkManager_initiateTileEntityEvent;
private static Method NetworkManager_initiateItemEvent;
private static Method NetworkManager_initiateClientTileEntityEvent;
private static Method NetworkManager_initiateClientItemEvent;
public static void updateTileEntityField(final TileEntity te, final String field) {
try {
if (NetworkHelper.NetworkManager_updateTileEntityField == null) {
NetworkHelper.NetworkManager_updateTileEntityField = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("updateTileEntityField", TileEntity.class, String.class);
}
if (NetworkHelper.instance == null) {
NetworkHelper.instance = getInstance();
}
NetworkHelper.NetworkManager_updateTileEntityField.invoke(NetworkHelper.instance, te, field);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void initiateTileEntityEvent(final TileEntity te, final int event, final boolean limitRange) {
try {
if (NetworkHelper.NetworkManager_initiateTileEntityEvent == null) {
NetworkHelper.NetworkManager_initiateTileEntityEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateTileEntityEvent", TileEntity.class, Integer.TYPE, Boolean.TYPE);
}
if (NetworkHelper.instance == null) {
NetworkHelper.instance = getInstance();
}
NetworkHelper.NetworkManager_initiateTileEntityEvent.invoke(NetworkHelper.instance, te, event, limitRange);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void initiateItemEvent(final EntityPlayer player, final ItemStack itemStack, final int event, final boolean limitRange) {
try {
if (NetworkHelper.NetworkManager_initiateItemEvent == null) {
NetworkHelper.NetworkManager_initiateItemEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateItemEvent", EntityPlayer.class, ItemStack.class, Integer.TYPE, Boolean.TYPE);
}
if (NetworkHelper.instance == null) {
NetworkHelper.instance = getInstance();
}
NetworkHelper.NetworkManager_initiateItemEvent.invoke(NetworkHelper.instance, player, itemStack, event, limitRange);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void initiateClientTileEntityEvent(final TileEntity te, final int event) {
try {
if (NetworkHelper.NetworkManager_initiateClientTileEntityEvent == null) {
NetworkHelper.NetworkManager_initiateClientTileEntityEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateClientTileEntityEvent", TileEntity.class, Integer.TYPE);
}
if (NetworkHelper.instance == null) {
NetworkHelper.instance = getInstance();
}
NetworkHelper.NetworkManager_initiateClientTileEntityEvent.invoke(NetworkHelper.instance, te, event);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void initiateClientItemEvent(final ItemStack itemStack, final int event) {
try {
if (NetworkHelper.NetworkManager_initiateClientItemEvent == null) {
NetworkHelper.NetworkManager_initiateClientItemEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateClientItemEvent", ItemStack.class, Integer.TYPE);
}
if (NetworkHelper.instance == null) {
NetworkHelper.instance = getInstance();
}
NetworkHelper.NetworkManager_initiateClientItemEvent.invoke(NetworkHelper.instance, itemStack, event);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
private static String getPackage() {
final Package pkg = NetworkHelper.class.getPackage();
if (pkg != null) {
final String packageName = pkg.getName();
return packageName.substring(0, packageName.length() - ".api.network".length());
}
return "ic2";
}
private static Object getInstance() {
try {
return Class.forName(getPackage() + ".core.IC2").getDeclaredField("network").get(null);
}
catch (Throwable e) {
throw new RuntimeException(e);
}
}
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.network;
import net.minecraftforge.fml.common.*;

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api;
import net.minecraftforge.fml.common.*;

View file

@ -1,48 +0,0 @@
package ic2.api.reactor;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraft.item.*;
public interface IReactor
{
BlockPos getPosition();
World getWorld();
int getHeat();
void setHeat(int p0);
int addHeat(int p0);
int getMaxHeat();
void setMaxHeat(int p0);
void addEmitHeat(int p0);
float getHeatEffectModifier();
void setHeatEffectModifier(float p0);
float getReactorEnergyOutput();
double getReactorEUEnergyOutput();
float addOutput(float p0);
ItemStack getItemAt(int p0, int p1);
void setItemAt(int p0, int p1, ItemStack p2);
void explode();
int getTickRate();
boolean produceEnergy();
void setRedstoneSignal(boolean p0);
boolean isFluidCooled();
}

View file

@ -1,8 +0,0 @@
package ic2.api.reactor;
public interface IReactorChamber
{
IReactor getReactor();
void setRedstoneSignal(boolean p0);
}

View file

@ -1,20 +0,0 @@
package ic2.api.reactor;
import net.minecraft.item.*;
public interface IReactorComponent
{
void processChamber(IReactor p0, ItemStack p1, int p2, int p3, boolean p4);
boolean acceptUraniumPulse(IReactor p0, ItemStack p1, ItemStack p2, int p3, int p4, int p5, int p6, boolean p7);
boolean canStoreHeat(IReactor p0, ItemStack p1, int p2, int p3);
int getMaxHeat(IReactor p0, ItemStack p1, int p2, int p3);
int getCurrentHeat(IReactor p0, ItemStack p1, int p2, int p3);
int alterHeat(IReactor p0, ItemStack p1, int p2, int p3, int p4);
float influenceExplosion(IReactor p0, ItemStack p1);
}

View file

@ -1,10 +0,0 @@
package ic2.api.reactor;
import net.minecraftforge.fluids.*;
public interface ISteamReactor extends IReactor
{
FluidTank getWaterTank();
FluidTank getSteamTank();
}

View file

@ -1,6 +0,0 @@
package ic2.api.reactor;
public interface ISteamReactorChamber extends IReactorChamber
{
ISteamReactor getReactor();
}

View file

@ -1,8 +0,0 @@
package ic2.api.reactor;
import net.minecraft.item.*;
public interface ISteamReactorComponent extends IReactorComponent
{
void processTick(ISteamReactor p0, ItemStack p1, int p2, int p3, boolean p4, boolean p5);
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.reactor;
import net.minecraftforge.fml.common.*;

View file

@ -1,28 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
public interface ICannerBottleRecipeManager
{
void addRecipe(IRecipeInput p0, IRecipeInput p1, ItemStack p2);
RecipeOutput getOutputFor(ItemStack p0, ItemStack p1, boolean p2, boolean p3);
Map<Input, RecipeOutput> getRecipes();
class Input
{
public final IRecipeInput container;
public final IRecipeInput fill;
public Input(IRecipeInput container1, IRecipeInput fill1) {
this.container = container1;
this.fill = fill1;
}
public boolean matches(ItemStack container1, ItemStack fill1) {
return this.container.matches(container1) && this.fill.matches(fill1);
}
}
}

View file

@ -1,29 +0,0 @@
package ic2.api.recipe;
import net.minecraftforge.fluids.*;
import net.minecraft.item.*;
import java.util.*;
public interface ICannerEnrichRecipeManager
{
void addRecipe(FluidStack p0, IRecipeInput p1, FluidStack p2);
RecipeOutput getOutputFor(FluidStack p0, ItemStack p1, boolean p2, boolean p3);
Map<Input, FluidStack> getRecipes();
class Input
{
public final FluidStack fluid;
public final IRecipeInput additive;
public Input(FluidStack fluid1, IRecipeInput additive1) {
this.fluid = fluid1;
this.additive = additive1;
}
public boolean matches(FluidStack fluid1, ItemStack additive1) {
return (this.fluid == null || this.fluid.isFluidEqual(fluid1)) && this.additive.matches(additive1);
}
}
}

View file

@ -1,10 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
public interface ICraftingRecipeManager
{
void addRecipe(ItemStack p0, Object... p1);
void addShapelessRecipe(ItemStack p0, Object... p1);
}

View file

@ -1,24 +0,0 @@
package ic2.api.recipe;
import net.minecraftforge.fluids.*;
import java.util.*;
public interface IFluidHeatManager extends ILiquidAcceptManager
{
void addFluid(String p0, int p1, int p2);
BurnProperty getBurnProperty(Fluid p0);
Map<String, BurnProperty> getBurnProperties();
class BurnProperty
{
public final int amount;
public final int heat;
public BurnProperty(int amount1, int heat1) {
this.amount = amount1;
this.heat = heat1;
}
}
}

View file

@ -1,11 +0,0 @@
package ic2.api.recipe;
import net.minecraftforge.fluids.*;
import java.util.*;
public interface ILiquidAcceptManager
{
boolean acceptsFluid(Fluid p0);
Set<Fluid> getAcceptedFluids();
}

View file

@ -1,15 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
public interface IListRecipeManager extends Iterable<IRecipeInput>
{
void add(IRecipeInput p0);
boolean contains(ItemStack p0);
boolean isEmpty();
List<IRecipeInput> getInputs();
}

View file

@ -1,14 +0,0 @@
package ic2.api.recipe;
import net.minecraft.nbt.*;
import net.minecraft.item.*;
import java.util.*;
public interface IMachineRecipeManager
{
void addRecipe(IRecipeInput p0, NBTTagCompound p1, ItemStack... p2);
RecipeOutput getOutputFor(ItemStack p0, boolean p1);
Map<IRecipeInput, RecipeOutput> getRecipes();
}

View file

@ -1,9 +0,0 @@
package ic2.api.recipe;
import net.minecraft.nbt.*;
import net.minecraft.item.*;
public interface IMachineRecipeManagerExt extends IMachineRecipeManager
{
boolean addRecipe(IRecipeInput p0, NBTTagCompound p1, boolean p2, ItemStack... p3);
}

View file

@ -1,11 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
public interface IPatternStorage
{
boolean addPattern(ItemStack p0);
List<ItemStack> getPatterns();
}

View file

@ -1,13 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
public interface IRecipeInput
{
boolean matches(ItemStack p0);
int getAmount();
List<ItemStack> getInputs();
}

View file

@ -1,13 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
public interface IScrapboxManager
{
void addDrop(ItemStack p0, float p1);
ItemStack getDrop(ItemStack p0, boolean p1);
Map<ItemStack, Float> getDrops();
}

View file

@ -1,24 +0,0 @@
package ic2.api.recipe;
import net.minecraftforge.fluids.*;
import java.util.*;
public interface ISemiFluidFuelManager extends ILiquidAcceptManager
{
void addFluid(String p0, int p1, double p2);
BurnProperty getBurnProperty(Fluid p0);
Map<String, BurnProperty> getBurnProperties();
class BurnProperty
{
public final int amount;
public final double power;
public BurnProperty(int amount1, double power1) {
this.amount = amount1;
this.power = power1;
}
}
}

View file

@ -1,47 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import net.minecraftforge.fluids.*;
import java.util.*;
public class RecipeInputFluidContainer implements IRecipeInput
{
public final Fluid fluid;
public final int amount;
public RecipeInputFluidContainer(final Fluid fluid) {
this(fluid, 1000);
}
public RecipeInputFluidContainer(final Fluid fluid, final int amount) {
this.fluid = fluid;
this.amount = amount;
}
@Override
public boolean matches(final ItemStack subject) {
final FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(subject);
return fs != null && fs.getFluid() == this.fluid;
}
@Override
public int getAmount() {
return this.amount;
}
@Override
public List<ItemStack> getInputs() {
final List<ItemStack> ret = new ArrayList<ItemStack>();
for (final FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.fluid.getFluid() == this.fluid) {
ret.add(data.filledContainer);
}
}
return ret;
}
@Override
public String toString() {
return "RInputFluidContainer<" + this.amount + "x" + this.fluid.getName() + ">";
}
}

View file

@ -1,44 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
public class RecipeInputItemStack implements IRecipeInput
{
public final ItemStack input;
public final int amount;
public RecipeInputItemStack(final ItemStack aInput) {
this(aInput, aInput.stackSize);
}
public RecipeInputItemStack(final ItemStack aInput, final int aAmount) {
if (aInput.getItem() == null) {
throw new IllegalArgumentException("Invalid item stack specfied");
}
this.input = aInput.copy();
this.amount = aAmount;
}
@Override
public boolean matches(final ItemStack subject) {
return subject.getItem() == this.input.getItem() && (subject.getItemDamage() == this.input.getItemDamage() || this.input.getItemDamage() == 32767);
}
@Override
public int getAmount() {
return this.amount;
}
@Override
public List<ItemStack> getInputs() {
return Arrays.asList(this.input);
}
@Override
public String toString() {
final ItemStack stack = this.input.copy();
this.input.stackSize = this.amount;
return "RInputItemStack<" + stack + ">";
}
}

View file

@ -1,92 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import java.util.*;
import net.minecraftforge.oredict.*;
public class RecipeInputOreDict implements IRecipeInput
{
public final String input;
public final int amount;
public final Integer meta;
private List<ItemStack> ores;
public RecipeInputOreDict(final String input1) {
this(input1, 1);
}
public RecipeInputOreDict(final String input1, final int amount1) {
this(input1, amount1, null);
}
public RecipeInputOreDict(final String input1, final int amount1, final Integer meta) {
this.input = input1;
this.amount = amount1;
this.meta = meta;
}
@Override
public boolean matches(final ItemStack subject) {
final List<ItemStack> inputs = this.getOres();
final boolean useOreStackMeta = this.meta == null;
final Item subjectItem = subject.getItem();
final int subjectMeta = subject.getItemDamage();
for (final ItemStack oreStack : inputs) {
final Item oreItem = oreStack.getItem();
if (oreItem == null) {
continue;
}
final int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : this.meta;
if (subjectItem == oreItem && (subjectMeta == metaRequired || metaRequired == 32767)) {
return true;
}
}
return false;
}
@Override
public int getAmount() {
return this.amount;
}
@Override
public List<ItemStack> getInputs() {
final List<ItemStack> ores = this.getOres();
boolean hasInvalidEntries = false;
for (final ItemStack stack : ores) {
if (stack.getItem() == null) {
hasInvalidEntries = true;
break;
}
}
if (!hasInvalidEntries) {
return ores;
}
final List<ItemStack> ret = new ArrayList<ItemStack>(ores.size());
for (final ItemStack stack2 : ores) {
if (stack2.getItem() != null) {
ret.add(stack2);
}
}
return Collections.unmodifiableList((List<? extends ItemStack>)ret);
}
@Override
public String toString() {
if (this.meta == null) {
return "RInputOreDict<" + this.amount + "x" + this.input + ">";
}
return "RInputOreDict<" + this.amount + "x" + this.input + "@" + this.meta + ">";
}
private List<ItemStack> getOres() {
if (this.ores != null) {
return this.ores;
}
final List<ItemStack> ret = (List<ItemStack>)OreDictionary.getOres(this.input);
if (ret != OreDictionary.EMPTY_LIST) {
this.ores = ret;
}
return ret;
}
}

View file

@ -1,46 +0,0 @@
package ic2.api.recipe;
import net.minecraft.item.*;
import net.minecraft.nbt.*;
import java.util.*;
public final class RecipeOutput
{
public final List<ItemStack> items;
public final NBTTagCompound metadata;
public RecipeOutput(final NBTTagCompound metadata1, final List<ItemStack> items1) {
assert !items1.contains(null);
this.metadata = metadata1;
this.items = items1;
}
public RecipeOutput(final NBTTagCompound metadata1, final ItemStack... items1) {
this(metadata1, Arrays.asList(items1));
}
@Override
public boolean equals(final Object obj) {
if (obj instanceof RecipeOutput) {
final RecipeOutput ro = (RecipeOutput)obj;
if (this.items.size() == ro.items.size() && ((this.metadata == null && ro.metadata == null) || (this.metadata != null && ro.metadata != null)) && this.metadata.equals((Object)ro.metadata)) {
final Iterator<ItemStack> itA = this.items.iterator();
final Iterator<ItemStack> itB = ro.items.iterator();
while (itA.hasNext() && itB.hasNext()) {
final ItemStack stackA = itA.next();
final ItemStack stackB = itB.next();
if (ItemStack.areItemStacksEqual(stackA, stackB)) {
return false;
}
}
return true;
}
}
return false;
}
@Override
public String toString() {
return "ROutput<" + this.items + "," + this.metadata + ">";
}
}

View file

@ -1,25 +0,0 @@
package ic2.api.recipe;
public class Recipes
{
public static IMachineRecipeManager macerator;
public static IMachineRecipeManager extractor;
public static IMachineRecipeManager compressor;
public static IMachineRecipeManager centrifuge;
public static IMachineRecipeManager blockcutter;
public static IMachineRecipeManager blastfurance;
public static IMachineRecipeManager recycler;
public static IMachineRecipeManager metalformerExtruding;
public static IMachineRecipeManager metalformerCutting;
public static IMachineRecipeManager metalformerRolling;
public static IMachineRecipeManager oreWashing;
public static ICannerBottleRecipeManager cannerBottle;
public static ICannerEnrichRecipeManager cannerEnrich;
public static IMachineRecipeManager matterAmplifier;
public static IScrapboxManager scrapboxDrops;
public static IListRecipeManager recyclerBlacklist;
public static IListRecipeManager recyclerWhitelist;
public static ICraftingRecipeManager advRecipes;
public static ISemiFluidFuelManager semiFluidGenerator;
public static IFluidHeatManager FluidHeatGenerator;
}

View file

@ -1,5 +0,0 @@
@API(apiVersion = "1.0", owner = "IC2", provides = "IC2API")
package ic2.api.recipe;
import net.minecraftforge.fml.common.*;

Some files were not shown because too many files have changed in this diff Show more