Skip to content

Commit

Permalink
Final API for 1.10.2 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Speiger committed Jun 17, 2017
1 parent 63ebc27 commit 1f757ae
Show file tree
Hide file tree
Showing 37 changed files with 1,334 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/main/java/ic2/api/classic/audio/ISoundModifier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package ic2.api.classic.audio;

import net.minecraft.world.World;

public interface ISoundModifier
{
/**
* Validates that the modifier is in the right world.
* And if it is valid for being used.
* @param world The world that the player is in
* @return if it is valid.
*/
public boolean isModifierValid(World world);

/**
* Client tick if that is needed. Could be that you need that.
* @param world The player is in
*/
public void onAudioTick(World world);

/**
* Function for checking if it has a effect for that type.
* If not its getting skipped.
* @param type The sound type it checks.
* @return if it has a effect
*/
public boolean hasEffect(PositionSpec type);

/**
* the modifier that the SoundModifier has.
* @param type the Type of sound it checks for.
* @return the Modifier of the sound
*/
public float getAudioEffect(PositionSpec type);

/**
* The Range of the modifier. only for is in range check
* @param type The type it is in
* @return the max radius into each direction
*/
public int getEffectRange(PositionSpec type);

/**
* Position where the modifier is.
* Get requested every tick
* @return the position
*/
public IAudioPosition getPosition();
}
29 changes: 29 additions & 0 deletions src/main/java/ic2/api/classic/crops/ClassicBaseSeed.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ic2.api.classic.crops;

import ic2.api.crops.BaseSeed;
import ic2.api.crops.CropCard;

public class ClassicBaseSeed extends BaseSeed
{
public final int stackSize;

public ClassicBaseSeed(BaseSeed seed)
{
this(seed.crop, seed.size, seed.statGrowth, seed.statGain, seed.statResistance, 1);
}

public ClassicBaseSeed(CropCard crop, int size, int statGrowth, int statGain, int statResistance)
{
this(crop, size, statGrowth, statGain, statResistance, 1);
}

public ClassicBaseSeed(CropCard crop, int size, int statGrowth, int statGain, int statResistance, int stackSize)
{
super(crop, size, statGrowth, statGain, statResistance);
this.stackSize = stackSize;
}




}
32 changes: 32 additions & 0 deletions src/main/java/ic2/api/classic/crops/ISeedCrop.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package ic2.api.classic.crops;

import ic2.api.crops.ICropTile;
import net.minecraft.item.ItemStack;

/**
*
* @author Speiger
*
* Support for the feature that Crops can drop Seeds
* optionally when you rightclick it with the hoe
* to toggle its mode. Its not the best item to use for but i had no
* better idea.
* This does not mean IC2 Seeds i mean the original crop seeds.
*/
public interface ISeedCrop
{
/**
* If the Crop drops seeds instead of
* @param tile the Crop it is planted on.
* @return if it should drop seeds instead of the usual Gain
*/
public boolean doDropSeeds(ICropTile tile);

/**
* Function to gain the CropSeeds.
* Note this is not about IC2Seeds this is about the base crop seeds.
* @param tile the Crop it is planted on.
* @return the Seed that it should drop
*/
public ItemStack getSeed(ICropTile tile);
}
8 changes: 8 additions & 0 deletions src/main/java/ic2/api/classic/item/ICropAnalyzer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ic2.api.classic.item;

import net.minecraft.item.ItemStack;

public interface ICropAnalyzer
{
public boolean isCropAnalyzer(ItemStack stack);
}
8 changes: 8 additions & 0 deletions src/main/java/ic2/api/classic/item/IEUReader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ic2.api.classic.item;

import net.minecraft.item.ItemStack;

public interface IEUReader
{
public boolean isEUReader(ItemStack stack);
}
16 changes: 16 additions & 0 deletions src/main/java/ic2/api/classic/item/ISortedTerraformerBP.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ic2.api.classic.item;

import ic2.api.item.ITerraformingBP;
import net.minecraft.item.ItemStack;

public interface ISortedTerraformerBP extends ITerraformingBP
{
/**
* This function determens if the logic from the Terraformer
* should be random or a Final List that actually can end.
* The Biome BluePrints from classic need only to run once thats why it exists.
* @param stack yourBluePrint
* @return true = SortedLogic, false = defaultLogic
*/
public boolean needsSortedLogic(ItemStack stack);
}
8 changes: 8 additions & 0 deletions src/main/java/ic2/api/classic/item/IThermometer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ic2.api.classic.item;

import net.minecraft.item.ItemStack;

public interface IThermometer
{
public boolean isThermometer(ItemStack stack);
}
10 changes: 10 additions & 0 deletions src/main/java/ic2/api/classic/network/adv/IBitLevelOverride.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ic2.api.classic.network.adv;

import ic2.api.classic.network.adv.NetworkField.BitLevel;

public interface IBitLevelOverride
{
public BitLevel getOverride(int fieldID, String fieldName);

public boolean hasOverride(int fieldID, String fieldName);
}
49 changes: 49 additions & 0 deletions src/main/java/ic2/api/classic/network/adv/IInputBuffer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package ic2.api.classic.network.adv;

import java.util.UUID;

import ic2.api.classic.network.adv.NetworkField.BitLevel;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;


public interface IInputBuffer
{

public boolean readBoolean();

public byte readByte();

public short readShort();

public int readMedium();

public int readInt();

public float readFloat();

public double readDouble();

public long readLong();

public long readData(BitLevel length);

public char readChar();

public byte[] readBytes();

public byte[] readBytes(BitLevel length);

public String readString();

public String readString(BitLevel length);

public NBTTagCompound readNBTData();

public <T extends IForgeRegistryEntry> T readForgeRegistryEntry(IForgeRegistry registry);

public UUID readUUID();


}
45 changes: 45 additions & 0 deletions src/main/java/ic2/api/classic/network/adv/IOutputBuffer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package ic2.api.classic.network.adv;

import java.util.UUID;

import ic2.api.classic.network.adv.NetworkField.BitLevel;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;

public interface IOutputBuffer
{
public void writeBoolean(boolean value);

public void writeByte(byte value);

public void writeShort(short value);

public void writeMedium(int value);

public void writeInt(int value);

public void writeFloat(float value);

public void writeDouble(double value);

public void writeLong(long value);

public void writeData(long value, BitLevel type);

public void writeChar(char value);

public void writeString(String value);

public void writeString(String value, BitLevel length);

public void writeBytes(byte[] value);

public void writeBytes(byte[] value, BitLevel length);

public void writeNBTData(NBTTagCompound value);

public void writeForgeEntry(IForgeRegistryEntry value);

public void writeUUID(UUID value);

}
81 changes: 81 additions & 0 deletions src/main/java/ic2/api/classic/network/adv/NetworkField.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package ic2.api.classic.network.adv;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.CLASS;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

@Retention(CLASS)
@Target(FIELD)
public @interface NetworkField
{
public int index();

public BitLevel compression() default BitLevel.Bit0;

public boolean override() default false;

public static enum BitLevel
{
Bit0(0), //IgnoreCase
Bit8(1), //Byte
Bit16(2), //Short
Bit24(3), //Medium
Bit32(4), //Integer
Bit40(5), //Integer + Byte
Bit48(6), //Integer + Short
Bit56(7), //Integer + Medium
Bit64(8); //long

final int index;
final long maxNumber;
public static BitLevel[] levels;

private BitLevel(int lvl)
{
index = lvl;
maxNumber = (1L << (lvl * 8));
}

public int getIndex()
{
return index;
}

public boolean isSkip()
{
return index == 0;
}

public boolean isValid(BitLevel limit)
{
if(index == 0) return false;
else return index < limit.index;
}

public long limitNumber(long input)
{
if(index == 0) return 0;
if(input >= maxNumber) return maxNumber - 1;
return input;
}

public static BitLevel getLevel(int index)
{
if(index < 0 || index > 8)
{
return BitLevel.Bit32;
}
return levels[index];
}
static
{
levels = new BitLevel[values().length];
for(BitLevel level : values())
{
levels[level.getIndex()] = level;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ic2.api.classic.recipe.machine;

public interface ISawmillOutput
{
public boolean increaseResuls(int amount);
}
15 changes: 15 additions & 0 deletions src/main/java/ic2/api/classic/tile/IFakeMachine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ic2.api.classic.tile;

/**
*
* @author Speiger
*
* Class to get upgrade information out of a Upgrade
* If you implement that class then it means you
* only want to read data for ReadOnly purpose.
* Not to use it on machines
*/
public interface IFakeMachine extends IMachine
{

}
6 changes: 6 additions & 0 deletions src/main/java/ic2/api/classic/tile/ISawMill.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ic2.api.classic.tile;

public interface ISawMill extends IMachine
{

}
Loading

0 comments on commit 1f757ae

Please sign in to comment.