Skip to content

Commit

Permalink
Update BC API
Browse files Browse the repository at this point in the history
  • Loading branch information
unpairedbracket committed Jul 21, 2015
1 parent 7323a13 commit 22282fc
Show file tree
Hide file tree
Showing 80 changed files with 772 additions and 1,147 deletions.
10 changes: 5 additions & 5 deletions src/api/java/buildcraft/api/core/BCLog.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

Expand All @@ -27,7 +27,7 @@ private BCLog() {
public static void initLog() {

logger.info("Starting BuildCraft " + getVersion());
logger.info("Copyright (c) SpaceToad, 2011-2014");
logger.info("Copyright (c) SpaceToad, 2011-2015");
logger.info("http://www.mod-buildcraft.com");
}

Expand Down
12 changes: 6 additions & 6 deletions src/api/java/buildcraft/api/core/BlockIndex.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

Expand All @@ -15,7 +15,7 @@
import net.minecraft.world.World;

/**
* This class is a comparable container for block positions. TODO: should this be merged with position?
* This class is a comparable container for integer block positions.
*/
public class BlockIndex implements Comparable<BlockIndex> {

Expand Down Expand Up @@ -99,7 +99,7 @@ public boolean equals(Object obj) {
return b.x == x && b.y == y && b.z == z;
}

return super.equals(obj);
return false;
}

@Override
Expand Down
33 changes: 18 additions & 15 deletions src/api/java/buildcraft/api/core/BuildCraftAPI.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

Expand All @@ -19,24 +20,26 @@ public final class BuildCraftAPI {
public static ICoreProxy proxy;

public static final Set<Block> softBlocks = new HashSet<Block>();

public static IWorldProperty isSoftProperty;
public static IWorldProperty isWoodProperty;
public static IWorldProperty isLeavesProperty;
public static IWorldProperty[] isOreProperty;
public static IWorldProperty isHarvestableProperty;
public static IWorldProperty isFarmlandProperty;
public static IWorldProperty isDirtProperty;
public static IWorldProperty isShoveled;
public static IWorldProperty isFluidSource;
public static final HashMap<String, IWorldProperty> worldProperties = new HashMap<String, IWorldProperty>();

/**
* Deactivate constructor
*/
private BuildCraftAPI() {
}

public static IWorldProperty getWorldProperty(String name) {
return worldProperties.get(name);
}

public static void registerWorldProperty(String name, IWorldProperty property) {
if (worldProperties.containsKey(name)) {
BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!");
}
worldProperties.put(name, property);
}

public static boolean isSoftBlock(World world, int x, int y, int z) {
return isSoftProperty.get(world, x, y, z);
return worldProperties.get("soft").get(world, x, y, z);
}
}
20 changes: 7 additions & 13 deletions src/api/java/buildcraft/api/core/EnumColor.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

import java.util.Locale;
import java.util.Random;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

Expand All @@ -36,6 +34,7 @@ public enum EnumColor {
MAGENTA,
ORANGE,
WHITE;

public static final EnumColor[] VALUES = values();
public static final String[] DYES = {
"dyeBlack",
Expand Down Expand Up @@ -191,13 +190,8 @@ public String toString() {
return b.toString().trim();
}

@SideOnly(Side.CLIENT)
public static void registerIcons(IIconRegister iconRegister) {
brushIcons = new IIcon[16];
for (EnumColor c : values()) {
brushIcons[c.ordinal()] = iconRegister.registerIcon("buildcraft:triggers/color_"
+ c.name().toLowerCase(Locale.ENGLISH));
}
public static void setIconArray(IIcon[] icons) {
brushIcons = icons;
}

@SideOnly(Side.CLIENT)
Expand Down
10 changes: 4 additions & 6 deletions src/api/java/buildcraft/api/core/IAreaProvider.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

/**
* To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers.
*/
public interface IAreaProvider {

int xMin();

int yMin();
Expand All @@ -29,5 +28,4 @@ public interface IAreaProvider {
* Remove from the world all objects used to define the area.
*/
void removeFromWorld();

}
8 changes: 4 additions & 4 deletions src/api/java/buildcraft/api/core/IBox.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

Expand Down
8 changes: 4 additions & 4 deletions src/api/java/buildcraft/api/core/ICoreProxy.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

Expand Down
9 changes: 4 additions & 5 deletions src/api/java/buildcraft/api/core/IIconProvider.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

Expand Down
10 changes: 6 additions & 4 deletions src/api/java/buildcraft/api/core/IInvSlot.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

Expand All @@ -22,6 +22,8 @@ public interface IInvSlot {

boolean canTakeStackFromSlot(ItemStack stack);

boolean isItemValidForSlot(ItemStack stack);

ItemStack decreaseStackInSlot(int amount);

ItemStack getStackInSlot();
Expand Down
8 changes: 8 additions & 0 deletions src/api/java/buildcraft/api/core/INBTStoreable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package buildcraft.api.core;

import net.minecraft.nbt.NBTTagCompound;

public interface INBTStoreable {
void readFromNBT(NBTTagCompound tag);
void writeToNBT(NBTTagCompound tag);
}
30 changes: 30 additions & 0 deletions src/api/java/buildcraft/api/core/ISerializable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;

import io.netty.buffer.ByteBuf;

/**
* Implemented by classes representing serializable packet state
*/
public interface ISerializable {
/**
* Serializes the state to the stream
*
* @param data
*/
void writeData(ByteBuf data);

/**
* Deserializes the state from the stream
*
* @param data
*/
void readData(ByteBuf data);
}
9 changes: 4 additions & 5 deletions src/api/java/buildcraft/api/core/IWorldProperty.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

import net.minecraft.world.World;

public interface IWorldProperty {

boolean get(World world, int x, int y, int z);

void clear();
Expand Down
10 changes: 6 additions & 4 deletions src/api/java/buildcraft/api/core/IZone.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;

Expand All @@ -14,6 +14,8 @@ public interface IZone {

double distanceTo(BlockIndex index);

double distanceToSquared(BlockIndex index);

boolean contains(double x, double y, double z);

BlockIndex getRandomBlockIndex(Random rand);
Expand Down
Loading

0 comments on commit 22282fc

Please sign in to comment.