Updated coding standard, and enforce it in the entire BuildCraft codebase.

Close #1662.
This commit is contained in:
SpaceToad 2014-05-03 18:59:52 +02:00
parent f4a6d621e3
commit 7b77008d97
483 changed files with 4759 additions and 3456 deletions

View file

@ -9,6 +9,7 @@
package buildcraft.api.blueprints;
import net.minecraft.world.World;
import buildcraft.api.core.IBox;
import buildcraft.api.core.Position;
@ -18,11 +19,11 @@ import buildcraft.api.core.Position;
*/
public interface IBuilderContext {
public Position rotatePositionLeft(Position pos);
Position rotatePositionLeft(Position pos);
public IBox surroundingBox();
IBox surroundingBox();
public World world();
World world();
public MappingRegistry getMappingRegistry ();
MappingRegistry getMappingRegistry();
}

View file

@ -11,7 +11,5 @@ package buildcraft.api.blueprints;
import net.minecraft.inventory.IInventory;
public interface ITileBuilder extends IInventory {
public boolean isBuildingMaterialSlot(int i);
boolean isBuildingMaterialSlot(int i);
}

View file

@ -16,18 +16,19 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
public class MappingRegistry {
public HashMap <Block, Integer> blockToId = new HashMap<Block, Integer>();
public ArrayList <Block> idToBlock = new ArrayList<Block>();
public HashMap<Block, Integer> blockToId = new HashMap<Block, Integer>();
public ArrayList<Block> idToBlock = new ArrayList<Block>();
public HashMap <Item, Integer> itemToId = new HashMap<Item, Integer>();
public ArrayList <Item> idToItem = new ArrayList<Item>();
public HashMap<Item, Integer> itemToId = new HashMap<Item, Integer>();
public ArrayList<Item> idToItem = new ArrayList<Item>();
public HashMap <Class <? extends Entity>, Integer> entityToId = new HashMap<Class <? extends Entity>, Integer>();
public ArrayList <Class <? extends Entity>> idToEntity = new ArrayList<Class <? extends Entity>>();
public HashMap<Class<? extends Entity>, Integer> entityToId = new HashMap<Class<? extends Entity>, Integer>();
public ArrayList<Class<? extends Entity>> idToEntity = new ArrayList<Class<? extends Entity>>();
private void registerItem (Item item) {
if (!itemToId.containsKey(item)) {
@ -43,7 +44,7 @@ public class MappingRegistry {
}
}
private void registerEntity (Class <? extends Entity> entityClass) {
private void registerEntity(Class<? extends Entity> entityClass) {
if (!entityToId.containsKey(entityClass)) {
idToEntity.add(entityClass);
entityToId.put(entityClass, idToEntity.size() - 1);
@ -82,7 +83,7 @@ public class MappingRegistry {
return blockToId.get(block);
}
public Class <? extends Entity> getEntityForId(int id) {
public Class<? extends Entity> getEntityForId(int id) {
if (id >= idToEntity.size()) {
return null;
}
@ -90,7 +91,7 @@ public class MappingRegistry {
return idToEntity.get(id);
}
public int getIdForEntity(Class <? extends Entity> entity) {
public int getIdForEntity(Class<? extends Entity> entity) {
if (!entityToId.containsKey(entity)) {
registerEntity (entity);
}
@ -123,7 +124,7 @@ public class MappingRegistry {
NBTTagList entitiesMapping = new NBTTagList();
for (Class <? extends Entity> e : idToEntity) {
for (Class<? extends Entity> e : idToEntity) {
NBTTagCompound sub = new NBTTagCompound();
sub.setString("name", e.getCanonicalName());
entitiesMapping.appendTag(sub);
@ -162,7 +163,7 @@ public class MappingRegistry {
Class<? extends Entity> e = null;
try {
e = (Class <? extends Entity>) Class.forName(name);
e = (Class<? extends Entity>) Class.forName(name);
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
@ -170,18 +171,4 @@ public class MappingRegistry {
registerEntity (e);
}
}
@Override
public final MappingRegistry clone() {
MappingRegistry result = new MappingRegistry();
result.blockToId = (HashMap<Block, Integer>) blockToId.clone();
result.idToBlock = (ArrayList<Block>) idToBlock.clone();
result.itemToId = (HashMap<Item, Integer>) itemToId.clone();
result.idToItem = (ArrayList<Item>) idToItem.clone();
result.entityToId = (HashMap<Class <? extends Entity>, Integer>) entityToId.clone();
result.idToEntity = (ArrayList<Class <? extends Entity>>) idToEntity.clone();
return result;
}
}

View file

@ -14,7 +14,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import buildcraft.api.core.IInvSlot;
/**
@ -177,7 +179,7 @@ public abstract class Schematic {
* Places the block in the world, at the location specified in the slot,
* using the stack in parameters
*/
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
}

View file

@ -18,6 +18,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.BlockFluidBase;
@ -73,7 +74,7 @@ public class SchematicBlock extends SchematicBlockBase {
* Places the block in the world, at the location specified in the slot.
*/
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
// Meta needs to be specified twice, depending on the block behavior
context.world().setBlock(x, y, z, block, meta, 3);
context.world().setBlockMetadataWithNotify(x, y, z, meta, 3);

View file

@ -12,13 +12,11 @@ import java.util.HashMap;
import net.minecraft.nbt.NBTTagCompound;
public abstract class SchematicFactory <S extends Schematic> {
public abstract class SchematicFactory<S extends Schematic> {
private static final HashMap <String, SchematicFactory> factories =
new HashMap <String, SchematicFactory> ();
private static final HashMap<String, SchematicFactory> factories = new HashMap<String, SchematicFactory>();
private static final HashMap <Class <? extends Schematic>, SchematicFactory> schematicToFactory =
new HashMap <Class <? extends Schematic>, SchematicFactory> ();
private static final HashMap<Class<? extends Schematic>, SchematicFactory> schematicToFactory = new HashMap<Class<? extends Schematic>, SchematicFactory>();
protected abstract S loadSchematicFromWorldNBT (NBTTagCompound nbt, MappingRegistry registry);
@ -36,12 +34,12 @@ public abstract class SchematicFactory <S extends Schematic> {
}
}
public static void registerSchematicFactory (Class <? extends Schematic> clas, SchematicFactory factory) {
public static void registerSchematicFactory(Class<? extends Schematic> clas, SchematicFactory factory) {
schematicToFactory.put(clas, factory);
factories.put(factory.getClass().getCanonicalName(), factory);
}
public static SchematicFactory getFactory (Class <? extends Schematic> clas) {
public static SchematicFactory getFactory(Class<? extends Schematic> clas) {
Class superClass = clas.getSuperclass();
if (schematicToFactory.containsKey(clas)) {

View file

@ -13,6 +13,7 @@ import java.util.LinkedList;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.core.BuildCraftAPI;
public class SchematicMask extends SchematicBlockBase {
@ -28,7 +29,7 @@ public class SchematicMask extends SchematicBlockBase {
}
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
if (isConcrete) {
if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), x, y, z)) {
return;

View file

@ -16,31 +16,38 @@ import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.api.core.JavaTools;
public class SchematicRegistry {
public final class SchematicRegistry {
public static double BREAK_ENERGY = 10;
public static final double BUILD_ENERGY = 20;
private static class SchematicConstructor {
Class <? extends SchematicEntity> clas;
Object [] params;
}
private static final HashSet<Block> explicitSchematicBlocks = new HashSet<Block>();
private static final HashSet <Block> explicitSchematicBlocks = new HashSet<Block>();
private static final HashMap <Block, SchematicConstructor> schematicBlocks =
private static final HashMap<Block, SchematicConstructor> schematicBlocks =
new HashMap<Block, SchematicConstructor>();
private static final HashMap <Class <? extends Entity>, SchematicConstructor> schematicEntities =
new HashMap<Class <? extends Entity>, SchematicConstructor>();
private static final HashMap<Class<? extends Entity>, SchematicConstructor> schematicEntities = new HashMap<Class<? extends Entity>, SchematicConstructor>();
private static final HashSet <String> modsSupporting = new HashSet<String>();
private static final HashSet <String> modsForbidden = new HashSet<String>();
private static final HashSet <String> blocksForbidden = new HashSet<String>();
private static final HashSet<String> modsSupporting = new HashSet<String>();
private static final HashSet<String> modsForbidden = new HashSet<String>();
private static final HashSet<String> blocksForbidden = new HashSet<String>();
/**
* Deactivate constructor
*/
private SchematicRegistry() {
}
private static class SchematicConstructor {
Class<? extends SchematicEntity> clas;
Object [] params;
}
public static void registerSchematicBlock (Block block, Class clas, Object ... params) {
explicitSchematicBlocks.add(block);
@ -99,7 +106,7 @@ public class SchematicRegistry {
return null;
}
public static SchematicEntity newSchematicEntity (Class <? extends Entity> entityClass) {
public static SchematicEntity newSchematicEntity(Class<? extends Entity> entityClass) {
if (!schematicEntities.containsKey(entityClass)) {
return null;
}
@ -148,18 +155,18 @@ public class SchematicRegistry {
"blocks that should be excluded from the builder.");
for (String id : excludedMods.getStringList()) {
id = JavaTools.stripSurroundingQuotes (id.trim());
String strippedId = JavaTools.stripSurroundingQuotes(id.trim());
if (id.length() > 0) {
modsForbidden.add(id);
if (strippedId.length() > 0) {
modsForbidden.add(strippedId);
}
}
for (String id : excludedBlocks.getStringList()) {
id = JavaTools.stripSurroundingQuotes (id.trim());
String strippedId = JavaTools.stripSurroundingQuotes(id.trim());
if (id.length() > 0) {
blocksForbidden.add(id);
if (strippedId.length() > 0) {
blocksForbidden.add(strippedId);
}
}
}

View file

@ -15,6 +15,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import buildcraft.api.core.JavaTools;
public class SchematicTile extends SchematicBlock {
@ -41,7 +42,7 @@ public class SchematicTile extends SchematicBlock {
* Places the block in the world, at the location specified in the slot.
*/
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
super.writeToWorld(context, x, y, z, stacks);
if (block.hasTileEntity(meta)) {
@ -80,7 +81,7 @@ public class SchematicTile extends SchematicBlock {
if (tile instanceof IInventory) {
IInventory inv = (IInventory) tile;
ArrayList <ItemStack> rqs = new ArrayList <ItemStack> ();
ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();
for (int i = 0; i < inv.getSizeInventory(); ++i) {
if (inv.getStackInSlot(i) != null) {

View file

@ -1,3 +1,11 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|blueprints")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints")
package buildcraft.api.blueprints;
import cpw.mods.fml.common.API;

View file

@ -12,10 +12,16 @@ import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
public class BCLog {
public final class BCLog {
public static final Logger logger = Logger.getLogger("Buildcraft");
/**
* Deactivate constructor
*/
private BCLog() {
}
public static void initLog() {
// TODO: check if the code below is still useful and remove otherwise.
//logger.setParent(FMLLog.getLogger());
@ -29,8 +35,10 @@ public class BCLog {
StringBuilder msg = new StringBuilder(mod);
msg.append(" API error, please update your mods. Error: ").append(error);
StackTraceElement[] stackTrace = error.getStackTrace();
if (stackTrace.length > 0)
if (stackTrace.length > 0) {
msg.append(", ").append(stackTrace[0]);
}
logger.log(Level.SEVERE, msg.toString());
if (classFile != null) {

View file

@ -14,11 +14,17 @@ import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
public class BuildCraftAPI {
public final class BuildCraftAPI {
public static ICoreProxy proxy;
public static final Set <Block> softBlocks = new HashSet<Block>();
public static final Set<Block> softBlocks = new HashSet<Block>();
/**
* Deactivate constructor
*/
private BuildCraftAPI() {
}
public static boolean isSoftBlock(IBlockAccess world, int x, int y, int z) {
return isSoftBlock(world.getBlock(x, y, z), world, x, y, z);

View file

@ -13,21 +13,21 @@ package buildcraft.api.core;
*/
public interface IAreaProvider {
public int xMin();
int xMin();
public int yMin();
int yMin();
public int zMin();
int zMin();
public int xMax();
int xMax();
public int yMax();
int yMax();
public int zMax();
int zMax();
/**
* Remove from the world all objects used to define the area.
*/
public void removeFromWorld();
void removeFromWorld();
}

View file

@ -10,16 +10,16 @@ package buildcraft.api.core;
public interface IBox {
public IBox expand(int amount);
IBox expand(int amount);
public IBox contract(int amount);
IBox contract(int amount);
public boolean contains(double x, double y, double z);
boolean contains(double x, double y, double z);
public Position pMin();
Position pMin();
public Position pMax();
Position pMax();
public void createLaserData();
void createLaserData();
}

View file

@ -12,5 +12,5 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface ICoreProxy {
public EntityPlayer getBuildCraftPlayer(World world);
EntityPlayer getBuildCraftPlayer(World world);
}

View file

@ -8,11 +8,12 @@
*/
package buildcraft.api.core;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public interface IIconProvider {
/**
@ -20,13 +21,13 @@ public interface IIconProvider {
* @return
*/
@SideOnly(Side.CLIENT)
public IIcon getIcon(int iconIndex);
IIcon getIcon(int iconIndex);
/**
* A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider
* @param iconRegister
*/
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister);
void registerIcons(IIconRegister iconRegister);
}

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, 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 net.minecraft.item.ItemStack;

View file

@ -35,16 +35,16 @@ public class JavaTools {
return result;
}
public <T> T[] concatenate (T[] A, T[] B) {
int aLen = A.length;
int bLen = B.length;
public <T> T[] concatenate (T[] a, T[] b) {
int aLen = a.length;
int bLen = b.length;
@SuppressWarnings("unchecked")
T[] C = (T[]) Array.newInstance(A.getClass().getComponentType(), aLen+bLen);
System.arraycopy(A, 0, C, 0, aLen);
System.arraycopy(B, 0, C, aLen, bLen);
T[] c = (T[]) Array.newInstance(a.getClass().getComponentType(), aLen + bLen);
System.arraycopy(a, 0, c, 0, aLen);
System.arraycopy(b, 0, c, aLen, bLen);
return C;
return c;
}
public static List<Field> getAllFields(Class clas) {
@ -79,7 +79,7 @@ public class JavaTools {
return result;
}
public static String surroundWithQuotes(String stringToSurroundWithQuotes){
public static String surroundWithQuotes(String stringToSurroundWithQuotes) {
return String.format("\"%s\"", stringToSurroundWithQuotes);
}

View file

@ -10,6 +10,7 @@ package buildcraft.api.core;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class Position {
@ -159,11 +160,7 @@ public class Position {
double sqrDis = dx * dx + dy * dy + dz * dz;
if (sqrDis > f * f) {
return false;
} else {
return true;
}
return !(sqrDis > f * f);
}
}

View file

@ -55,8 +55,9 @@ public class SafeTimeTracker {
* this function without a parameter
*/
public boolean markTimeIfDelay(World world, long delay) {
if (world == null)
if (world == null) {
return false;
}
long currentTime = world.getTotalWorldTime();

View file

@ -49,10 +49,8 @@ public class StackKey {
return false;
} else if (stack.getHasSubtypes() && stack.getItemDamage() != other.stack.getItemDamage()) {
return false;
} else if (stack.stackTagCompound != null && !stack.stackTagCompound.equals(other.stack.stackTagCompound)) {
return false;
} else {
return true;
return !(stack.stackTagCompound != null && !stack.stackTagCompound.equals(other.stack.stackTagCompound));
}
}
}

View file

@ -1,3 +1,11 @@
@API(apiVersion="1.0",owner="BuildCraft|Core",provides="BuildCraftAPI|core")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "1.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
package buildcraft.api.core;
import cpw.mods.fml.common.API;

View file

@ -8,8 +8,13 @@
*/
package buildcraft.api.filler;
public class FillerManager {
public final class FillerManager {
public static IFillerRegistry registry;
/**
* Deactivate constructor
*/
private FillerManager() {
}
}

View file

@ -9,15 +9,16 @@
package buildcraft.api.filler;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public interface IFillerPattern {
public String getUniqueTag();
String getUniqueTag();
@SideOnly(Side.CLIENT)
public IIcon getIcon();
IIcon getIcon();
public String getDisplayName();
String getDisplayName();
}

View file

@ -8,18 +8,19 @@
*/
package buildcraft.api.filler;
import buildcraft.api.gates.IAction;
import java.util.Set;
import buildcraft.api.gates.IAction;
public interface IFillerRegistry {
public void addPattern(IFillerPattern pattern);
void addPattern(IFillerPattern pattern);
public IFillerPattern getPattern(String patternName);
IFillerPattern getPattern(String patternName);
public IFillerPattern getNextPattern(IFillerPattern currentPattern);
IFillerPattern getNextPattern(IFillerPattern currentPattern);
public IFillerPattern getPreviousPattern(IFillerPattern currentPattern);
IFillerPattern getPreviousPattern(IFillerPattern currentPattern);
public Set<? extends IAction> getActions();
Set<? extends IAction> getActions();
}

View file

@ -1,16 +0,0 @@
/**
* Copyright (c) 2011-2014, 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.filler;
import net.minecraft.item.ItemStack;
public interface IPatternIterator {
public boolean iteratePattern(ItemStack stackToPlace);
}

View file

@ -1,3 +1,11 @@
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|filler")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|filler")
package buildcraft.api.filler;
import cpw.mods.fml.common.API;

View file

@ -8,22 +8,26 @@
*/
package buildcraft.api.fuels;
import buildcraft.api.core.StackKey;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.core.StackKey;
public final class IronEngineCoolant {
public static Map<String, Coolant> liquidCoolants = new HashMap<String, Coolant>();
public static Map<StackKey, FluidStack> solidCoolants = new HashMap<StackKey, FluidStack>();
private IronEngineCoolant() {
}
public static FluidStack getFluidCoolant(ItemStack stack) {
return solidCoolants.get(new StackKey(stack));
}
@ -36,10 +40,7 @@ public final class IronEngineCoolant {
return fluidStack != null && fluidStack.getFluid() != null ? liquidCoolants.get(fluidStack.getFluid().getName()) : null;
}
private IronEngineCoolant() {
}
public static interface Coolant {
public interface Coolant {
float getDegreesCoolingPerMB(float currentHeat);
}

View file

@ -10,21 +10,22 @@ package buildcraft.api.fuels;
import java.util.HashMap;
import java.util.Map;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
public class IronEngineFuel {
public final class IronEngineFuel {
public static Map<String, Fuel> fuels = new HashMap<String, Fuel>();
private IronEngineFuel() {
}
public static Fuel getFuelForFluid(Fluid liquid) {
return liquid == null ? null : fuels.get(liquid.getName());
}
private IronEngineFuel() {
}
public static class Fuel {
public static final class Fuel {
public final Fluid liquid;
public final float powerPerCycle;

View file

@ -1,3 +1,11 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|fuels")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|fuels")
package buildcraft.api.fuels;
import cpw.mods.fml.common.API;

View file

@ -8,21 +8,29 @@
*/
package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
public class ActionManager {
import buildcraft.api.transport.IPipeTile;
public final class ActionManager {
public static Map<String, ITrigger> triggers = new HashMap<String, ITrigger>();
public static Map<String, IAction> actions = new HashMap<String, IAction>();
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
/**
* Deactivate constructor
*/
private ActionManager() {
}
public static void registerTriggerProvider(ITriggerProvider provider) {
if (provider != null && !triggerProviders.contains(provider)) {
triggerProviders.add(provider);
@ -38,21 +46,21 @@ public class ActionManager {
}
public static List<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
List<ITrigger> triggers = new LinkedList<ITrigger>();
List<ITrigger> result = new LinkedList<ITrigger>();
for (ITriggerProvider provider : triggerProviders) {
List<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
if (toAdd != null) {
for (ITrigger t : toAdd) {
if (!triggers.contains(t)) {
triggers.add(t);
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return triggers;
return result;
}
public static void registerActionProvider(IActionProvider provider) {
@ -62,38 +70,38 @@ public class ActionManager {
}
public static List<IAction> getNeighborActions(Block block, TileEntity entity) {
List<IAction> actions = new LinkedList<IAction>();
List<IAction> result = new LinkedList<IAction>();
for (IActionProvider provider : actionProviders) {
List<IAction> toAdd = provider.getNeighborActions(block, entity);
if (toAdd != null) {
for (IAction t : toAdd) {
if (!actions.contains(t)) {
actions.add(t);
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return actions;
return result;
}
public static List<ITrigger> getPipeTriggers(IPipeTile pipe) {
List<ITrigger> triggers = new LinkedList<ITrigger>();
List<ITrigger> result = new LinkedList<ITrigger>();
for (ITriggerProvider provider : triggerProviders) {
List<ITrigger> toAdd = provider.getPipeTriggers(pipe);
if (toAdd != null) {
for (ITrigger t : toAdd) {
if (!triggers.contains(t)) {
triggers.add(t);
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return triggers;
return result;
}
}

View file

@ -8,13 +8,14 @@
*/
package buildcraft.api.gates;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
public final class GateExpansions {
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
@ -39,9 +40,11 @@ public final class GateExpansions {
}
public static IGateExpansion getExpansionClient(int id) {
if (id < 0 || id >= 128)
if (id < 0 || id >= 128) {
return null;
return expansions.get(clientIDMap.get((byte) id));
} else {
return expansions.get(clientIDMap.get((byte) id));
}
}
public static byte getServerExpansionID(String identifier) {

View file

@ -9,6 +9,7 @@
package buildcraft.api.gates;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
@ -17,6 +18,5 @@ public interface IActionProvider {
/**
* Returns the list of actions available to a gate next to the given block.
*/
public abstract LinkedList<IAction> getNeighborActions(Block block, TileEntity tile);
LinkedList<IAction> getNeighborActions(Block block, TileEntity tile);
}

View file

@ -9,7 +9,5 @@
package buildcraft.api.gates;
public interface IActionReceptor {
public void actionActivated(IAction action);
void actionActivated(IAction action);
}

View file

@ -13,15 +13,15 @@ import net.minecraft.nbt.NBTTagCompound;
public interface ITriggerParameter {
public abstract ItemStack getItemStack();
ItemStack getItemStack();
public abstract void set(ItemStack stack);
void set(ItemStack stack);
public abstract void writeToNBT(NBTTagCompound compound);
void writeToNBT(NBTTagCompound compound);
public abstract void readFromNBT(NBTTagCompound compound);
void readFromNBT(NBTTagCompound compound);
@Deprecated
public abstract ItemStack getItem();
ItemStack getItem();
}

View file

@ -8,21 +8,23 @@
*/
package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import buildcraft.api.transport.IPipeTile;
public interface ITriggerProvider {
/**
* Returns the list of triggers that are available from the pipe holding the gate.
*/
public abstract LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe);
LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe);
/**
* Returns the list of triggers available to a gate next to the given block.
*/
public abstract LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile);
LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile);
}

View file

@ -1,3 +1,12 @@
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
package buildcraft.api.gates;
import cpw.mods.fml.common.API;

View file

@ -14,7 +14,9 @@ import java.util.Map;
import buildcraft.api.core.JavaTools;
public class MjAPI {
public final class MjAPI {
static Map<Class, BatteryField> MjBatteries = new HashMap<Class, BatteryField>();
private enum BatteryKind {
Value, Container
@ -103,6 +105,12 @@ public class MjAPI {
}
}
/**
* Deactivate constructor
*/
private MjAPI() {
}
public static BatteryObject getMjBattery (Object o) {
if (o == null) {
return null;
@ -131,8 +139,6 @@ public class MjAPI {
}
}
static Map <Class, BatteryField> MjBatteries = new HashMap <Class, BatteryField> ();
private static BatteryField getMjBattery (Class c) {
if (!MjBatteries.containsKey(c)) {
for (Field f : JavaTools.getAllFields(c)) {
@ -144,7 +150,7 @@ public class MjAPI {
bField.field = f;
bField.battery = battery;
if (f.getType().equals(double.class)) {
if (double.class.equals(f.getType())) {
bField.kind = BatteryKind.Value;
} else if (f.getType().isPrimitive()) {
throw new RuntimeException(

View file

@ -35,8 +35,10 @@ import java.lang.annotation.Target;
@Inherited
public @interface MjBattery {
public double maxCapacity () default 100.0;
public double maxReceivedPerCycle () default 10.0;
public double minimumConsumption () default 0.1;
double maxCapacity() default 100.0;
double maxReceivedPerCycle() default 10.0;
double minimumConsumption() default 0.1;
}

View file

@ -1,3 +1,11 @@
@API(apiVersion="1.0",owner="BuildCraft|Core",provides="BuildCraftAPI|core")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "1.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
package buildcraft.api;
import cpw.mods.fml.common.API;

View file

@ -17,6 +17,5 @@ import net.minecraftforge.common.util.ForgeDirection;
* from a specific side.
*/
public interface IPowerEmitter {
public boolean canEmitPowerFrom(ForgeDirection side);
boolean canEmitPowerFrom(ForgeDirection side);
}

View file

@ -9,6 +9,7 @@
package buildcraft.api.power;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
@ -29,7 +30,7 @@ public interface IPowerReceptor {
* @param side
* @return
*/
public PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side);
PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side);
/**
* Call back from the PowerHandler that is called when the stored power
@ -39,7 +40,7 @@ public interface IPowerReceptor {
*
* @param workProvider
*/
public void doWork(PowerHandler workProvider);
void doWork(PowerHandler workProvider);
public World getWorld();
World getWorld();
}

View file

@ -9,7 +9,9 @@
package buildcraft.api.power;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.SafeTimeTracker;
/**
@ -77,9 +79,10 @@ public final class PowerHandler {
*/
public PerditionCalculator(double powerLoss) {
if (powerLoss < MIN_POWERLOSS) {
powerLoss = MIN_POWERLOSS;
this.powerLoss = MIN_POWERLOSS;
} else {
this.powerLoss = powerLoss;
}
this.powerLoss = powerLoss;
}
/**
@ -93,11 +96,13 @@ public final class PowerHandler {
* @return
*/
public double applyPerdition(PowerHandler powerHandler, double current, long ticksPassed) {
current -= powerLoss * ticksPassed;
if (current < 0) {
current = 0;
double newPower = current - powerLoss * ticksPassed;
if (newPower < 0) {
newPower = 0;
}
return current;
return newPower;
}
/**
@ -115,6 +120,9 @@ public final class PowerHandler {
public static final double ROLLING_AVERAGE_WEIGHT = 100.0;
public static final double ROLLING_AVERAGE_NUMERATOR = ROLLING_AVERAGE_WEIGHT - 1;
public static final double ROLLING_AVERAGE_DENOMINATOR = 1.0 / ROLLING_AVERAGE_WEIGHT;
public final int[] powerSources = new int[6];
public final IPowerReceptor receptor;
private double minEnergyReceived;
private double maxEnergyReceived;
private double maxEnergyStored;
@ -123,8 +131,6 @@ public final class PowerHandler {
private final SafeTimeTracker doWorkTracker = new SafeTimeTracker();
private final SafeTimeTracker sourcesTracker = new SafeTimeTracker();
private final SafeTimeTracker perditionTracker = new SafeTimeTracker();
public final int[] powerSources = new int[6];
public final IPowerReceptor receptor;
private PerditionCalculator perdition;
private final PowerReceiver receiver;
private final Type type;
@ -182,12 +188,15 @@ public final class PowerHandler {
* store. Values tend to range between 100 and 5000. With 1000 and 1500
* being common.
*/
public void configure(double minEnergyReceived, double maxEnergyReceived, double activationEnergy, double maxStoredEnergy) {
if (minEnergyReceived > maxEnergyReceived) {
maxEnergyReceived = minEnergyReceived;
public void configure(double minEnergyReceived, double maxEnergyReceivedI, double activationEnergy,
double maxStoredEnergy) {
double localMaxEnergyReceived = maxEnergyReceivedI;
if (minEnergyReceived > localMaxEnergyReceived) {
localMaxEnergyReceived = minEnergyReceived;
}
this.minEnergyReceived = minEnergyReceived;
this.maxEnergyReceived = maxEnergyReceived;
this.maxEnergyReceived = localMaxEnergyReceived;
this.maxEnergyStored = maxStoredEnergy;
this.activationEnergy = activationEnergy;
}
@ -221,16 +230,18 @@ public final class PowerHandler {
*/
public void setPerdition(PerditionCalculator perdition) {
if (perdition == null) {
perdition = DEFAULT_PERDITION;
this.perdition = DEFAULT_PERDITION;
} else {
this.perdition = perdition;
}
this.perdition = perdition;
}
public PerditionCalculator getPerdition() {
if (perdition == null) {
return DEFAULT_PERDITION;
} else {
return perdition;
}
return perdition;
}
/**
@ -438,7 +449,9 @@ public final class PowerHandler {
*
* @return the amount the power changed by
*/
public double addEnergy(double quantity) {
public double addEnergy(double quantityI) {
double quantity = quantityI;
energyStored += quantity;
if (energyStored > maxEnergyStored) {

View file

@ -1,3 +1,11 @@
@API(apiVersion="1.1",owner="BuildCraftAPI|core",provides="BuildCraftAPI|power")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|power")
package buildcraft.api.power;
import cpw.mods.fml.common.API;

View file

@ -9,11 +9,12 @@
package buildcraft.api.recipes;
import java.util.List;
import net.minecraft.item.ItemStack;
public interface IAssemblyRecipeManager {
public static interface IAssemblyRecipe {
public interface IAssemblyRecipe {
ItemStack getOutput();

View file

@ -8,10 +8,10 @@
*/
package buildcraft.api.recipes;
import net.minecraft.item.ItemStack;
import java.util.List;
import net.minecraft.item.ItemStack;
/**
* The Integration Table's primary purpose is to modify an input item's NBT
* data. As such its not a "traditional" type of recipe. Rather than predefined
@ -19,7 +19,7 @@ import java.util.List;
*/
public interface IIntegrationRecipeManager {
public static interface IIntegrationRecipe {
public interface IIntegrationRecipe {
double getEnergyCost();

View file

@ -9,6 +9,7 @@
package buildcraft.api.recipes;
import java.util.SortedSet;
import net.minecraftforge.fluids.FluidStack;
public interface IRefineryRecipeManager {
@ -21,7 +22,7 @@ public interface IRefineryRecipeManager {
IRefineryRecipe findRefineryRecipe(FluidStack ingredient1, FluidStack ingredient2);
public static interface IRefineryRecipe {
public interface IRefineryRecipe {
FluidStack getIngredient1();

View file

@ -1,3 +1,12 @@
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|recipes")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|recipes")
package buildcraft.api.recipes;
import cpw.mods.fml.common.API;

View file

@ -25,7 +25,7 @@ public interface IToolWrench {
*
* @return true if wrenching is allowed, false if not
*/
public boolean canWrench(EntityPlayer player, int x, int y, int z);
boolean canWrench(EntityPlayer player, int x, int y, int z);
/***
* Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get the ItemStack that was used, check
@ -36,5 +36,5 @@ public interface IToolWrench {
* @param x
* ,y,z - The coordinates of the block being wrenched
*/
public void wrenchUsed(EntityPlayer player, int x, int y, int z);
void wrenchUsed(EntityPlayer player, int x, int y, int z);
}

View file

@ -1,3 +1,11 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|tools")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tools")
package buildcraft.api.tools;
import cpw.mods.fml.common.API;

View file

@ -8,9 +8,10 @@
*/
package buildcraft.api.transport;
import buildcraft.api.transport.IPipeTile.PipeType;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.transport.IPipeTile.PipeType;
public interface IPipeConnection {
enum ConnectOverride {
@ -26,5 +27,5 @@ public interface IPipeConnection {
* @return CONNECT to force a connection, DISCONNECT to force no connection,
* and DEFAULT to let the pipe decide.
*/
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with);
ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with);
}

View file

@ -10,6 +10,7 @@ package buildcraft.api.transport;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.world.World;
public abstract class PipeManager {
@ -24,9 +25,11 @@ public abstract class PipeManager {
* param extractor can be null
*/
public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) {
for (IExtractionHandler handler : extractionHandlers)
if (!handler.canExtractItems(extractor, world, i, j, k))
for (IExtractionHandler handler : extractionHandlers) {
if (!handler.canExtractItems(extractor, world, i, j, k)) {
return false;
}
}
return true;
}
@ -35,9 +38,11 @@ public abstract class PipeManager {
* param extractor can be null
*/
public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) {
for (IExtractionHandler handler : extractionHandlers)
if (!handler.canExtractFluids(extractor, world, i, j, k))
for (IExtractionHandler handler : extractionHandlers) {
if (!handler.canExtractFluids(extractor, world, i, j, k)) {
return false;
}
}
return true;
}

View file

@ -8,11 +8,11 @@
*/
package buildcraft.api.transport;
import java.util.Locale;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.Locale;
public enum PipeWire {
RED, BLUE, GREEN, YELLOW;
@ -47,22 +47,28 @@ public enum PipeWire {
}
public ItemStack getStack(int qty) {
if (item == null)
if (item == null) {
return null;
return new ItemStack(item, qty, ordinal());
} else {
return new ItemStack(item, qty, ordinal());
}
}
public boolean isPipeWire(ItemStack stack) {
if (stack == null)
if (stack == null) {
return false;
if (stack.getItem() != item)
} else if (stack.getItem() != item) {
return false;
return stack.getItemDamage() == ordinal();
} else {
return stack.getItemDamage() == ordinal();
}
}
public static PipeWire fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length)
if (ordinal < 0 || ordinal >= VALUES.length) {
return RED;
return VALUES[ordinal];
} else {
return VALUES[ordinal];
}
}
}

View file

@ -1,3 +1,12 @@
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|transport")
/**
* Copyright (c) 2011-2014, 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
*/
@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport")
package buildcraft.api.transport;
import cpw.mods.fml.common.API;

View file

@ -20,10 +20,23 @@ import net.minecraft.entity.item.EntityPainting;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.api.blueprints.BlueprintDeployer;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
@ -108,16 +121,6 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.RealBlueprintDeployer;
import buildcraft.core.proxy.CoreProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mod(name = "BuildCraft Builders", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftBuilders extends BuildCraftMod {
@ -445,7 +448,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
}
@Mod.EventHandler
public void ServerStop(FMLServerStoppingEvent event) {
public void serverStop(FMLServerStoppingEvent event) {
TilePathMarker.clearAvailableMarkersList();
}

View file

@ -14,6 +14,10 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.TreeMap;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.client.renderer.GLAllocation;
@ -24,6 +28,20 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.IIcon;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.AchievementPage;
@ -34,10 +52,6 @@ import net.minecraftforge.common.config.Property;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BuildCraftAPI;
@ -50,7 +64,6 @@ import buildcraft.core.BlockSpring;
import buildcraft.core.BuildCraftConfiguration;
import buildcraft.core.CommandBuildCraft;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
@ -86,18 +99,6 @@ import buildcraft.core.triggers.TriggerInventoryLevel;
import buildcraft.core.triggers.TriggerMachine;
import buildcraft.core.triggers.TriggerRedstoneInput;
import buildcraft.core.utils.CraftingHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.7.2,1.8)", dependencies = "required-after:Forge@[10.12.0.1024,)")
public class BuildCraftCore extends BuildCraftMod {
@ -199,6 +200,14 @@ public class BuildCraftCore extends BuildCraftMod {
public static AchievementPage BuildcraftAchievements;
public static float diffX, diffY, diffZ;
private static FloatBuffer modelviewF;
private static FloatBuffer projectionF;
private static IntBuffer viewport;
private static FloatBuffer pos = ByteBuffer.allocateDirect(3 * 4).asFloatBuffer();
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Core");
@ -391,14 +400,6 @@ public class BuildCraftCore extends BuildCraftMod {
InterModComms.processIMC(event);
}
public static float diffX, diffY, diffZ;
static FloatBuffer modelviewF;
static FloatBuffer projectionF;
static IntBuffer viewport;
static FloatBuffer pos = ByteBuffer.allocateDirect(3 * 4).asFloatBuffer();
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderLast (RenderWorldLastEvent evt) {
@ -459,7 +460,7 @@ public class BuildCraftCore extends BuildCraftMod {
@Mod.EventHandler
public void load(FMLInitializationEvent event) {
woodenGearAchievement = new Achievement("achievement.woodenGear", "woodenGearAchievement", 0, 0,woodenGearItem, null).registerStat();
woodenGearAchievement = new Achievement("achievement.woodenGear", "woodenGearAchievement", 0, 0, woodenGearItem, null).registerStat();
stoneGearAchievement = new Achievement("achievement.stoneGear", "stoneGearAchievement", 2, 0, stoneGearItem, woodenGearAchievement).registerStat();
ironGearAchievement = new Achievement("achievement.ironGear", "ironGearAchievement", 4, 0, ironGearItem, stoneGearAchievement).registerStat();
goldGearAchievement = new Achievement("achievement.goldGear", "goldGearAchievement", 6, 0, goldGearItem, ironGearAchievement).registerStat();
@ -474,7 +475,8 @@ public class BuildCraftCore extends BuildCraftMod {
fasterFillingAchievement = new Achievement("achievement.fasterFilling", "fasterFillingAchievement", 7, 2, BuildCraftBuilders.fillerBlock, goldGearAchievement).registerStat();
timeForSomeLogicAchievement = new Achievement("achievement.timeForSomeLogic", "timeForSomeLogicAchievement", 9, -2, BuildCraftSilicon.assemblyTableBlock, diamondGearAchievement).registerStat();
refineAndRedefineAchievement = new Achievement("achievement.refineAndRedefine", "refineAndRedefineAchievement", 10, 0, BuildCraftFactory.refineryBlock, diamondGearAchievement).registerStat();
tinglyLaserAchievement = new Achievement("achievement.tinglyLaser", "tinglyLaserAchievement", 11, -2, BuildCraftSilicon.laserBlock ,timeForSomeLogicAchievement).registerStat();
tinglyLaserAchievement = new Achievement("achievement.tinglyLaser", "tinglyLaserAchievement", 11, -2, BuildCraftSilicon.laserBlock,
timeForSomeLogicAchievement).registerStat();
architectAchievement = new Achievement("achievement.architect", "architectAchievement", 11, 2, BuildCraftBuilders.architectBlock, chunkDestroyerAchievement).registerStat();
builderAchievement = new Achievement("achievement.builder", "builderAchievement", 13, 2, BuildCraftBuilders.builderBlock, architectAchievement).registerStat();
blueprintAchievement = new Achievement("achievement.blueprint", "blueprintAchievement", 11, 4, BuildCraftBuilders.blueprintItem, architectAchievement).registerStat();

View file

@ -20,6 +20,17 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
@ -28,6 +39,7 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.fuels.IronEngineCoolant;
@ -35,7 +47,6 @@ import buildcraft.api.fuels.IronEngineFuel;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.core.BlockIndex;
import buildcraft.core.BlockSpring;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
@ -60,30 +71,18 @@ import buildcraft.energy.worldgen.BiomeGenOilOcean;
import buildcraft.energy.worldgen.BiomeInitializer;
import buildcraft.energy.worldgen.OilPopulate;
import buildcraft.transport.network.PacketHandlerTransport;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftEnergy extends BuildCraftMod {
public final static int ENERGY_REMOVE_BLOCK = 25;
public final static int ENERGY_EXTRACT_ITEM = 2;
public static final int ENERGY_REMOVE_BLOCK = 25;
public static final int ENERGY_EXTRACT_ITEM = 2;
public static boolean spawnOilSprings = true;
public static BiomeGenOilDesert biomeOilDesert;
public static BiomeGenOilOcean biomeOilOcean;
public static BlockEngine engineBlock;
public static BlockEnergyEmitter emitterBlock;
public static BlockEnergyReceiver receiverBlock;
private static Fluid buildcraftFluidOil;
private static Fluid buildcraftFluidFuel;
private static Fluid buildcraftFluidRedPlasma;
public static Fluid fluidOil;
public static Fluid fluidFuel;
public static Fluid fluidRedPlasma;
@ -107,6 +106,10 @@ public class BuildCraftEnergy extends BuildCraftMod {
@Mod.Instance("BuildCraft|Energy")
public static BuildCraftEnergy instance;
private static Fluid buildcraftFluidOil;
private static Fluid buildcraftFluidFuel;
private static Fluid buildcraftFluidRedPlasma;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Energy");
@ -115,50 +118,77 @@ public class BuildCraftEnergy extends BuildCraftMod {
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
canOilBurn = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "burnOil", true, "Can oil burn?").getBoolean(true);
oilWellScalar = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "oilWellGenerationRate", 1.0, "Probability of oil well generation").getDouble(1.0);
for (String id : BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "oilBiomeIDs", BiomeDictionary.Type.DESERT.toString() +","+BiomeGenBase.taiga.biomeID, "IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that should have increased oil generation rates.").getString().trim().split(",")){
id = id.trim();
if(id.length() > 0){
try{oilBiomeIDs.add(Integer.parseInt(id));}
catch(NumberFormatException ex){ //not an int so try and parse it as a biome type
try{
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(id.toUpperCase()))){
for (String id : BuildCraftCore.mainConfiguration
.get(Configuration.CATEGORY_GENERAL, "oilBiomeIDs", BiomeDictionary.Type.DESERT.toString() + "," + BiomeGenBase.taiga.biomeID,
"IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that should have increased oil generation rates.").getString().trim().split(",")) {
String strippedId = id.trim();
if (strippedId.length() > 0) {
try {
oilBiomeIDs.add(Integer.parseInt(strippedId));
} catch (NumberFormatException ex) { // not an int so try and
// parse it as a biome
// type
try {
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(strippedId
.toUpperCase()))) {
oilBiomeIDs.add(b.biomeID);
}
}
catch (Exception e){
BCLog.logger.log(Level.WARNING,"config.oilBiomeIDs: Could not find biome type: " + id + " ; Skipping!");
} catch (Exception e) {
BCLog.logger.log(Level.WARNING, "config.oilBiomeIDs: Could not find biome type: " + strippedId
+ " ; Skipping!");
}
}
}
}
for(String id : BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "excessiveOilBiomeIDs", "", "IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that should have GREATLY increased oil generation rates.").getString().trim().split(",")) {
id = id.trim();
if(id.length() > 0){
try{excessiveOilBiomeIDs.add(Integer.parseInt(id));}
catch(NumberFormatException ex){ //not an int so try and parse it as a biome type
try{
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(id.toUpperCase()))){
for (String id : BuildCraftCore.mainConfiguration
.get(Configuration.CATEGORY_GENERAL,
"excessiveOilBiomeIDs",
"",
"IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that should have GREATLY increased oil generation rates.")
.getString().trim().split(",")) {
String strippedId = id.trim();
if (strippedId.length() > 0) {
try {
excessiveOilBiomeIDs.add(Integer.parseInt(strippedId));
} catch (NumberFormatException ex) { // not an int so try and
// parse it as a biome
// type
try {
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(strippedId
.toUpperCase()))) {
excessiveOilBiomeIDs.add(b.biomeID);
}
}
catch (Exception e){
BCLog.logger.log(Level.WARNING,"config.excessiveOilBiomeIDs: Could not find biome type: " + id + " ; Skipping!");
} catch (Exception e) {
BCLog.logger.log(Level.WARNING, "config.excessiveOilBiomeIDs: Could not find biome type: "
+ strippedId + " ; Skipping!");
}
}
}
}
for(String id : BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "excludeOilBiomeIDs", BiomeGenBase.sky.biomeID +","+BiomeGenBase.hell.biomeID, "IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that are excluded from generating oil.").getString().trim().split(",")){
id = id.trim();
if(id.length() > 0){
try{excludeOilBiomeIDs.add(Integer.parseInt(id));}
catch(NumberFormatException ex){ //not an int so try and parse it as a biome type
try{
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(id.toUpperCase()))){
for (String id : BuildCraftCore.mainConfiguration
.get(Configuration.CATEGORY_GENERAL, "excludeOilBiomeIDs",
BiomeGenBase.sky.biomeID + "," + BiomeGenBase.hell.biomeID,
"IDs or Biome Types (e.g. DESERT,OCEAN) of biomes that are excluded from generating oil.")
.getString().trim().split(",")) {
String strippedId = id.trim();
if (strippedId.length() > 0) {
try {
excludeOilBiomeIDs.add(Integer.parseInt(strippedId));
} catch (NumberFormatException ex) { // not an int so try and
// parse it as a biome
// type
try {
for (BiomeGenBase b : BiomeDictionary.getBiomesForType(BiomeDictionary.Type.valueOf(strippedId
.toUpperCase()))) {
excludeOilBiomeIDs.add(b.biomeID);
}
}
catch (Exception e){
BCLog.logger.log(Level.WARNING,"config.excludeOilBiomeIDs: Could not find biome type: " + id + " ; Skipping!");
} catch (Exception e) {
BCLog.logger.log(Level.WARNING, "config.excludeOilBiomeIDs: Could not find biome type: "
+ strippedId + " ; Skipping!");
}
}
}

View file

@ -10,18 +10,32 @@ package buildcraft;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.builders.schematics.SchematicIgnoreMeta;
import buildcraft.core.DefaultProps;
@ -55,18 +69,6 @@ import buildcraft.factory.TileRefinery;
import buildcraft.factory.TileTank;
import buildcraft.factory.network.PacketHandlerFactory;
import com.google.common.collect.Lists;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mod(name = "BuildCraft Factory", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftFactory extends BuildCraftMod {

View file

@ -10,13 +10,15 @@ package buildcraft;
import java.util.EnumMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
import buildcraft.core.network.BuildCraftPacket;
public class BuildCraftMod {

View file

@ -15,6 +15,13 @@ import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.PipeWire;
@ -44,11 +51,6 @@ import buildcraft.transport.gates.GateExpansionPulsar;
import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.gates.ItemGate;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
public class BuildCraftSilicon extends BuildCraftMod {

View file

@ -17,10 +17,20 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.RecipeSorter;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.core.JavaTools;
@ -108,13 +118,6 @@ import buildcraft.transport.triggers.TriggerPipeContents;
import buildcraft.transport.triggers.TriggerPipeContents.PipeContents;
import buildcraft.transport.triggers.TriggerPipeSignal;
import buildcraft.transport.triggers.TriggerRedstoneFaderInput;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftTransport extends BuildCraftMod {
@ -179,12 +182,15 @@ public class BuildCraftTransport extends BuildCraftMod {
public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE);
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
public static BCAction actionExtractionPresetYellow = new ActionExtractionPreset(EnumColor.YELLOW);
public IIconProvider pipeIconProvider = new PipeIconProvider();
public IIconProvider wireIconProvider = new WireIconProvider();
@Mod.Instance("BuildCraft|Transport")
public static BuildCraftTransport instance;
private static LinkedList<PipeRecipe> pipeRecipes = new LinkedList<PipeRecipe>();
public IIconProvider pipeIconProvider = new PipeIconProvider();
public IIconProvider wireIconProvider = new WireIconProvider();
private static class PipeRecipe {
boolean isShapeless = false; // pipe recipes come shaped and unshaped.
@ -234,7 +240,6 @@ public class BuildCraftTransport extends BuildCraftMod {
return true;
}
}
private static LinkedList<PipeRecipe> pipeRecipes = new LinkedList<PipeRecipe>();
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {

View file

@ -8,12 +8,6 @@
*/
package buildcraft.builders;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.BlockMultiTexture;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.GuiIds;
import buildcraft.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@ -23,8 +17,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.BlockMultiTexture;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.GuiIds;
import buildcraft.core.utils.Utils;
public class BlockArchitect extends BlockMultiTexture {
public BlockArchitect() {
@ -40,8 +42,9 @@ public class BlockArchitect extends BlockMultiTexture {
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
// Drop through if the player is sneaking
if (entityplayer.isSneaking())
if (entityplayer.isSneaking()) {
return false;
}
Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null;
if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityplayer, i, j, k)) {
@ -50,17 +53,17 @@ public class BlockArchitect extends BlockMultiTexture {
switch (ForgeDirection.values()[meta]) {
case WEST:
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.SOUTH.ordinal(),0);
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.SOUTH.ordinal(), 0);
break;
case EAST:
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.NORTH.ordinal(),0);
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.NORTH.ordinal(), 0);
break;
case NORTH:
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.WEST.ordinal(),0);
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.WEST.ordinal(), 0);
break;
case SOUTH:
default:
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.EAST.ordinal(),0);
world.setBlockMetadataWithNotify(i, j, k, ForgeDirection.EAST.ordinal(), 0);
break;
}
@ -90,7 +93,7 @@ public class BlockArchitect extends BlockMultiTexture {
ForgeDirection orientation = Utils.get2dOrientation(entityliving);
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(),1);
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(), 1);
}
@Override

View file

@ -17,11 +17,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.BuildCraftBuilders;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.GuiIds;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBlueprintLibrary extends BlockContainer {
@ -39,18 +41,18 @@ public class BlockBlueprintLibrary extends BlockContainer {
super.onBlockActivated(world, i, j, k, entityplayer, par6, par7, par8, par9);
// Drop through if the player is sneaking
if (entityplayer.isSneaking())
if (entityplayer.isSneaking()) {
return false;
}
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof TileBlueprintLibrary) {
TileBlueprintLibrary tileBlueprint = (TileBlueprintLibrary)tile;
if (!tileBlueprint.locked || entityplayer.getDisplayName().equals(tileBlueprint.owner))
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
}
}
TileBlueprintLibrary tileBlueprint = (TileBlueprintLibrary) tile;
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
}
}
return true;
}
@ -75,15 +77,16 @@ public class BlockBlueprintLibrary extends BlockContainer {
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
if (!world.isRemote && entityliving instanceof EntityPlayer) {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof TileBlueprintLibrary)
((TileBlueprintLibrary)tile).owner = ((EntityPlayer) entityliving).getDisplayName();
if (tile instanceof TileBlueprintLibrary) {
((TileBlueprintLibrary) tile).owner = ((EntityPlayer) entityliving).getDisplayName();
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
public void registerBlockIcons(IIconRegister par1IconRegister) {
textureTop = par1IconRegister.registerIcon("buildcraft:library_topbottom");
textureSide = par1IconRegister.registerIcon("buildcraft:library_side");
}

View file

@ -12,17 +12,18 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBuildTool extends Block {
private IIcon texture;
public BlockBuildTool() {
super(Material.iron);
}
IIcon texture;
@Override
public IIcon getIcon(int i, int j) {
return texture;

View file

@ -20,14 +20,17 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.GuiIds;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBuilder extends BlockContainer {

View file

@ -17,21 +17,24 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.filler.IFillerPattern;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.GuiIds;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockFiller extends BlockContainer {
IIcon textureSides;
IIcon textureTopOn;
IIcon textureTopOff;
public IFillerPattern currentPattern;
private IIcon textureSides;
private IIcon textureTopOn;
private IIcon textureTopOff;
public BlockFiller() {
super(Material.iron);

View file

@ -17,12 +17,15 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftCore;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockMarker extends BlockContainer {
@ -86,8 +89,9 @@ public class BlockMarker extends BlockContainer {
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof TileMarker)
((TileMarker) tile).tryConnection();
if (tile instanceof TileMarker) {
((TileMarker) tile).tryConnection();
}
return true;
}
@ -115,8 +119,9 @@ public class BlockMarker extends BlockContainer {
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileMarker)
((TileMarker) tile).updateSignals();
if (tile instanceof TileMarker) {
((TileMarker) tile).updateSignals();
}
dropTorchIfCantStay(world, x, y, z);
}

View file

@ -14,11 +14,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.utils.Utils;
public class BlockPathMarker extends BlockMarker {
private IIcon activeMarker;
@ -43,16 +44,16 @@ public class BlockPathMarker extends BlockMarker {
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
TilePathMarker marker = (TilePathMarker) iblockaccess.getTileEntity(i, j, k);
if (l == 1 || (marker != null && marker.tryingToConnect))
if (l == 1 || (marker != null && marker.tryingToConnect)) {
return activeMarker;
else
} else {
return super.getIcon(iblockaccess, i, j, k, l);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
public void registerBlockIcons(IIconRegister par1IconRegister) {
blockIcon = par1IconRegister.registerIcon("buildcraft:blockPathMarker");
activeMarker = par1IconRegister.registerIcon("buildcraft:blockPathMarkerActive");
}

View file

@ -8,11 +8,12 @@
*/
package buildcraft.builders;
import buildcraft.builders.urbanism.RenderBoxProvider;
import buildcraft.core.render.RenderBlockMultiTexture;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import buildcraft.builders.urbanism.RenderBoxProvider;
import buildcraft.core.render.RenderBlockMultiTexture;
public class BuilderProxyClient extends BuilderProxy {
@Override

View file

@ -11,15 +11,19 @@ package buildcraft.builders;
import net.minecraft.block.Block;
import net.minecraft.world.World;
public class BuildersProxy {
public final class BuildersProxy {
/**
* Forbid contruction of this class
*/
private BuildersProxy() {
}
public static boolean canPlaceTorch(World world, int i, int j, int k) {
Block block = world.getBlock(i, j, k);
if (block == null || !block.renderAsNormalBlock())
return false;
else
return true;
return !(block == null || !block.renderAsNormalBlock());
}
public static String getOwner(TileBlueprintLibrary library) {

View file

@ -15,7 +15,9 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingRegistry;
@ -32,26 +34,26 @@ public class BuildingItem implements IBuilder {
public Position origin, destination;
@NetworkData
double lifetime = 0;
@NetworkData
public LinkedList <StackAtPosition> stacksToDisplay = new LinkedList<StackAtPosition>();
public LinkedList<StackAtPosition> stacksToDisplay = new LinkedList<StackAtPosition>();
public Position posDisplay = new Position();
public boolean isDone = false;
long previousUpdate;
double lifetimeDisplay = 0;
double maxLifetime = 0;
private boolean initialized = false;
double vx, vy, vz;
double maxHeight;
public BuildingSlot slotToBuild;
public IBuilderContext context;
public double receivedProgress = 0;
private long previousUpdate;
private double lifetimeDisplay = 0;
private double maxLifetime = 0;
private boolean initialized = false;
private double vx, vy, vz;
private double maxHeight;
@NetworkData
private double lifetime = 0;
public void initialize () {
if (!initialized) {
double dx = destination.x - origin.x;
@ -62,7 +64,7 @@ public class BuildingItem implements IBuilder {
maxLifetime = size * 5.0;
maxHeight = (5.0 + (destination.y - origin.y) / 2.0);
maxHeight = 5.0 + (destination.y - origin.y) / 2.0;
// the below computation is an approximation of the distance to
// travel for the object. It really follows a sinus, but we compute
@ -165,9 +167,9 @@ public class BuildingItem implements IBuilder {
private void build() {
if (slotToBuild != null) {
int destX = (int)Math.floor(destination.x);
int destY = (int)Math.floor(destination.y);
int destZ = (int)Math.floor(destination.z);
int destX = (int) Math.floor(destination.x);
int destY = (int) Math.floor(destination.y);
int destZ = (int) Math.floor(destination.z);
Block block = context.world().getBlock(destX, destY, destZ);
int meta = context.world().getBlockMetadata(destX, destY, destZ);
@ -185,7 +187,7 @@ public class BuildingItem implements IBuilder {
}
}
public LinkedList <StackAtPosition> getStacks () {
public LinkedList<StackAtPosition> getStacks() {
int d = 0;
for (StackAtPosition s : stacksToDisplay) {

View file

@ -8,58 +8,65 @@
*/
package buildcraft.builders;
import buildcraft.builders.gui.ContainerBlueprintLibrary;
import buildcraft.builders.gui.ContainerBuilder;
import buildcraft.builders.gui.ContainerFiller;
import buildcraft.builders.gui.ContainerArchitect;
import buildcraft.builders.gui.GuiBlueprintLibrary;
import buildcraft.builders.gui.GuiBuilder;
import buildcraft.builders.gui.GuiFiller;
import buildcraft.builders.gui.GuiArchitect;
import buildcraft.builders.urbanism.ContainerUrbanist;
import buildcraft.builders.urbanism.GuiUrbanist;
import buildcraft.builders.urbanism.TileUrbanist;
import buildcraft.core.GuiIds;
import buildcraft.core.proxy.CoreProxy;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import buildcraft.builders.gui.ContainerArchitect;
import buildcraft.builders.gui.ContainerBlueprintLibrary;
import buildcraft.builders.gui.ContainerBuilder;
import buildcraft.builders.gui.ContainerFiller;
import buildcraft.builders.gui.GuiArchitect;
import buildcraft.builders.gui.GuiBlueprintLibrary;
import buildcraft.builders.gui.GuiBuilder;
import buildcraft.builders.gui.GuiFiller;
import buildcraft.builders.urbanism.ContainerUrbanist;
import buildcraft.builders.urbanism.GuiUrbanist;
import buildcraft.builders.urbanism.TileUrbanist;
import buildcraft.core.GuiIds;
public class GuiHandler implements IGuiHandler {
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (!world.blockExists(x, y, z))
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (!world.blockExists(x, y, z)) {
return null;
}
TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) {
switch (id) {
case GuiIds.ARCHITECT_TABLE:
if (!(tile instanceof TileArchitect))
if (!(tile instanceof TileArchitect)) {
return null;
}
return new GuiArchitect(player.inventory, (TileArchitect) tile);
case GuiIds.BLUEPRINT_LIBRARY:
if (!(tile instanceof TileBlueprintLibrary))
if (!(tile instanceof TileBlueprintLibrary)) {
return null;
}
return new GuiBlueprintLibrary(player, (TileBlueprintLibrary) tile);
case GuiIds.BUILDER:
if (!(tile instanceof TileBuilder))
if (!(tile instanceof TileBuilder)) {
return null;
}
return new GuiBuilder(player.inventory, (TileBuilder) tile);
case GuiIds.FILLER:
if (!(tile instanceof TileFiller))
if (!(tile instanceof TileFiller)) {
return null;
}
return new GuiFiller(player.inventory, (TileFiller) tile);
case GuiIds.URBANIST:
if (!(tile instanceof TileUrbanist))
if (!(tile instanceof TileUrbanist)) {
return null;
}
return new GuiUrbanist(player.inventory, (TileUrbanist) tile);
@ -70,33 +77,38 @@ public class GuiHandler implements IGuiHandler {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (!world.blockExists(x, y, z))
if (!world.blockExists(x, y, z)) {
return null;
}
TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) {
switch (id) {
case GuiIds.ARCHITECT_TABLE:
if (!(tile instanceof TileArchitect))
if (!(tile instanceof TileArchitect)) {
return null;
}
return new ContainerArchitect(player.inventory, (TileArchitect) tile);
case GuiIds.BLUEPRINT_LIBRARY:
if (!(tile instanceof TileBlueprintLibrary))
if (!(tile instanceof TileBlueprintLibrary)) {
return null;
}
return new ContainerBlueprintLibrary(player, (TileBlueprintLibrary) tile);
case GuiIds.BUILDER:
if (!(tile instanceof TileBuilder))
if (!(tile instanceof TileBuilder)) {
return null;
}
return new ContainerBuilder(player.inventory, (TileBuilder) tile);
case GuiIds.FILLER:
if (!(tile instanceof TileFiller))
if (!(tile instanceof TileFiller)) {
return null;
}
return new ContainerFiller(player.inventory, (TileFiller) tile);
case GuiIds.URBANIST:

View file

@ -13,6 +13,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.BuildingPermission;
import buildcraft.builders.blueprints.BlueprintId;
@ -34,14 +35,13 @@ public abstract class ItemBlueprint extends ItemBuildCraft {
if (NBTUtils.getItemData(stack).hasKey("name")) {
String name = NBTUtils.getItemData(stack).getString("name");
if (name.equals("")) {
if ("".equals(name)) {
list.add(String.format(StringUtils.localize("item.blueprint.unnamed")));
} else {
list.add(String.format (name));
}
list.add(String.format(StringUtils
.localize("item.blueprint.author")
list.add(String.format(StringUtils.localize("item.blueprint.author")
+ " "
+ NBTUtils.getItemData(stack).getString("author")));
} else {
@ -49,15 +49,12 @@ public abstract class ItemBlueprint extends ItemBuildCraft {
}
if (NBTUtils.getItemData(stack).hasKey("permission")) {
BuildingPermission p = BuildingPermission.values()[NBTUtils
.getItemData(stack).getByte("permission")];
BuildingPermission p = BuildingPermission.values()[NBTUtils.getItemData(stack).getByte("permission")];
if (p == BuildingPermission.CREATIVE_ONLY) {
list.add(String.format(StringUtils
.localize("item.blueprint.creative_only")));
list.add(String.format(StringUtils.localize("item.blueprint.creative_only")));
} else if (p == BuildingPermission.NONE) {
list.add(String.format(StringUtils
.localize("item.blueprint.no_build")));
list.add(String.format(StringUtils.localize("item.blueprint.no_build")));
}
}
}

View file

@ -11,10 +11,12 @@ package buildcraft.builders;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import buildcraft.core.utils.NBTUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.utils.NBTUtils;
public class ItemBlueprintStandard extends ItemBlueprint {
private IIcon cleanBlueprint;

View file

@ -11,10 +11,12 @@ package buildcraft.builders;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import buildcraft.core.utils.NBTUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.utils.NBTUtils;
public class ItemBlueprintTemplate extends ItemBlueprint {
private IIcon usedTemplate;

View file

@ -8,14 +8,14 @@
*/
package buildcraft.builders;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import buildcraft.builders.urbanism.RenderBoxProvider;
import buildcraft.core.EntityLaser;
import buildcraft.core.LaserData;

View file

@ -8,6 +8,8 @@
*/
package buildcraft.builders;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
@ -15,8 +17,6 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import buildcraft.core.DefaultProps;
import buildcraft.core.EntityLaser;
import buildcraft.core.LaserData;
@ -24,12 +24,13 @@ import buildcraft.core.render.RenderLaser;
public class RenderPathMarker extends TileEntitySpecialRenderer {
private static final ResourceLocation CHAMBER_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS
+ "/chamber2.png");
private ModelBase model = new ModelBase() {
};
private ModelRenderer box;
private static final ResourceLocation CHAMBER_TEXTURE = new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/chamber2.png");
public RenderPathMarker() {
box = new ModelRenderer(model, 0, 1);
box.addBox(-8F, -8F, -8F, 16, 4, 16);

View file

@ -13,6 +13,7 @@ import java.util.LinkedList;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.ITileBuilder;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.NetworkData;
@ -35,19 +36,18 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
*/
private static final double FULL_CHEST_ENERGY = 9 * 3 * 64 * SchematicRegistry.BUILD_ENERGY + 1000;
@NetworkData
public LinkedList<LaserData> pathLasers = new LinkedList<LaserData> ();
public ArrayList<BuildingItem> buildersInAction = new ArrayList<BuildingItem>();
protected SafeTimeTracker buildTracker = new SafeTimeTracker(5);
@MjBattery(maxReceivedPerCycle = 100, maxCapacity = FULL_CHEST_ENERGY, minimumConsumption = 1)
protected double mjStored = 0;
private double mjPrev = 0;
private int mjUnchangedCycles = 0;
@NetworkData
public LinkedList<LaserData> pathLasers = new LinkedList<LaserData> ();
public ArrayList <BuildingItem> buildersInAction = new ArrayList<BuildingItem>();
protected SafeTimeTracker buildTracker = new SafeTimeTracker(5);
@Override
public void initialize () {
super.initialize();

View file

@ -14,8 +14,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.Translation;
import buildcraft.api.core.IAreaProvider;
@ -37,25 +39,22 @@ import buildcraft.core.network.RPCSide;
import buildcraft.core.utils.Utils;
public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider {
private final static int SCANNER_ITERATION = 100;
private BlueprintBase writingBlueprint;
private BptContext writingContext;
private BlockScanner blockScanner;
private static final int SCANNER_ITERATION = 100;
public int computingTime = 0;
public String currentAuthorName = "";
@NetworkData
public Box box = new Box();
@NetworkData
public String name = "";
@NetworkData
public BlueprintReadConfiguration readConfiguration = new BlueprintReadConfiguration();
@NetworkData
public Box box = new Box();
private ItemStack items[] = new ItemStack[2];
@NetworkData
public String name = "";
public String currentAuthorName = "";
private ItemStack[] items = new ItemStack[2];
private BlueprintBase writingBlueprint;
private BptContext writingContext;
private BlockScanner blockScanner;
public TileArchitect() {
box.kind = Kind.STRIPES;

View file

@ -16,6 +16,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.core.NetworkData;
import buildcraft.builders.blueprints.BlueprintId;
@ -33,10 +34,10 @@ import buildcraft.core.network.RPCSide;
* environment, and save blueprints to the server environment.
*/
public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
public ItemStack[] stack = new ItemStack[4];
private static final int PROGRESS_TIME = 100;
public ItemStack[] stack = new ItemStack[4];
public int progressIn = 0;
public int progressOut = 0;
@ -46,12 +47,11 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
public ArrayList<BlueprintId> currentPage;
public int selected = -1;
boolean locked = false;
public EntityPlayer uploadingPlayer = null;
public EntityPlayer downloadingPlayer = null;
int pageId = 0;
private int pageId = 0;
public TileBlueprintLibrary() {
@ -106,7 +106,6 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
super.readFromNBT(nbttagcompound);
owner = nbttagcompound.getString("owner");
locked = nbttagcompound.getBoolean("locked");
InvUtils.readStacksFromNBT(nbttagcompound, "stack", stack);
}
@ -116,7 +115,6 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
super.writeToNBT(nbttagcompound);
nbttagcompound.setString("owner", owner);
nbttagcompound.setBoolean("locked", locked);
InvUtils.writeStacksToNBT(nbttagcompound, "stack", stack);
}

View file

@ -19,8 +19,10 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.BuildingPermission;
import buildcraft.api.blueprints.Translation;
@ -47,18 +49,16 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
private static int POWER_ACTIVATION = 50;
private final ItemStack items[] = new ItemStack[28];
private BptBuilderBase bluePrintBuilder;
@NetworkData
public Box box = new Box();
public PathIterator currentPathIterator;
private final ItemStack[] items = new ItemStack[28];
private BptBuilderBase bluePrintBuilder;
private LinkedList<BlockIndex> path;
private LinkedList <ItemStack> requiredToBuild;
private LinkedList<ItemStack> requiredToBuild;
private NBTTagCompound initNBT = null;
private boolean done = true;
private class PathIterator {
@ -177,10 +177,6 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
}
}
public PathIterator currentPathIterator;
private boolean done = true;
public TileBuilder() {
super();
@ -630,7 +626,7 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
}
@RPC (RPCSide.CLIENT)
public void setItemRequirements (LinkedList <ItemStack> rq, LinkedList <Integer> realSizes) {
public void setItemRequirements(LinkedList<ItemStack> rq, LinkedList<Integer> realSizes) {
// Item stack serialized are represented through bytes, so 0-255. In
// order to get the real amounts, we need to pass the real sizes of the
// stacks as a separate list.
@ -638,8 +634,8 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
requiredToBuild = rq;
if (rq != null && rq.size() > 0) {
Iterator <ItemStack> itStack = rq.iterator();
Iterator <Integer> size = realSizes.iterator();
Iterator<ItemStack> itStack = rq.iterator();
Iterator<Integer> size = realSizes.iterator();
while (true) {
ItemStack stack = itStack.next();
@ -711,7 +707,7 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
public void updateRequirements () {
if (bluePrintBuilder instanceof BptBuilderBlueprint) {
LinkedList <Integer> realSize = new LinkedList<Integer>();
LinkedList<Integer> realSize = new LinkedList<Integer>();
for (ItemStack stack : ((BptBuilderBlueprint) bluePrintBuilder).neededItems) {
realSize.add(stack.stackSize);

View file

@ -8,14 +8,15 @@
*/
package buildcraft.builders;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import buildcraft.BuildCraftCore;
import buildcraft.api.core.IAreaProvider;
import buildcraft.api.filler.FillerManager;
@ -41,12 +42,13 @@ import buildcraft.core.utils.Utils;
public class TileFiller extends TileAbstractBuilder implements IMachine, IActionReceptor {
private static int POWER_ACTIVATION = 50;
public FillerPattern currentPattern = PatternFill.INSTANCE;
private BptBuilderTemplate currentTemplate;
private BptContext context;
private static int POWER_ACTIVATION = 50;
private final Box box = new Box();
private boolean done = false;
private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown;
@ -119,7 +121,7 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
if (done) {
if (lastMode == Mode.Loop) {
done = false;
}else{
} else {
return;
}
}
@ -138,7 +140,7 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
}
}
if(oldDone != done){
if (oldDone != done) {
sendNetworkUpdate();
}
}

View file

@ -11,6 +11,7 @@ package buildcraft.builders;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.core.IAreaProvider;
import buildcraft.api.core.NetworkData;
@ -23,13 +24,13 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
public class TileMarker extends TileBuildCraft implements IAreaProvider {
private static int maxSize = 64;
public static class TileWrapper {
public @NetworkData
int x, y, z;
@NetworkData
public int x, y, z;
private TileMarker marker;
public TileWrapper() {
x = Integer.MAX_VALUE;
@ -43,8 +44,6 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
this.z = z;
}
private TileMarker marker;
public boolean isSet() {
return x != Integer.MAX_VALUE;
}
@ -69,28 +68,28 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
}
public static class Origin {
@NetworkData
public TileWrapper vectO = new TileWrapper();
@NetworkData
public TileWrapper[] vect = {new TileWrapper(), new TileWrapper(), new TileWrapper()};
@NetworkData
public int xMin, yMin, zMin, xMax, yMax, zMax;
public boolean isSet() {
return vectO.isSet();
}
public @NetworkData
TileWrapper vectO = new TileWrapper();
public @NetworkData
TileWrapper[] vect = { new TileWrapper(), new TileWrapper(), new TileWrapper() };
public @NetworkData
int xMin, yMin, zMin, xMax, yMax, zMax;
}
public @NetworkData
Origin origin = new Origin();
@NetworkData
public Origin origin = new Origin();
@NetworkData
public boolean showSignals = false;
private Position initVectO;
private Position[] initVect;
private EntityBlock[] lasers;
private EntityBlock[] signals;
public @NetworkData
boolean showSignals = false;
public void updateSignals() {
if (!worldObj.isRemote) {
showSignals = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
@ -132,8 +131,6 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
}
}
private Position initVectO, initVect[];
@Override
public void initialize() {
super.initialize();

View file

@ -16,6 +16,7 @@ import java.util.TreeSet;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import buildcraft.api.core.NetworkData;
import buildcraft.api.core.Position;
import buildcraft.core.BlockIndex;
@ -24,17 +25,6 @@ import buildcraft.core.network.PacketUpdate;
public class TilePathMarker extends TileMarker {
public int x0, y0, z0, x1, y1, z1;
public boolean loadLink0 = false, loadLink1 = false;
@NetworkData
public LaserData lasers[] = new LaserData [2];
@NetworkData
public boolean tryingToConnect = false;
public TilePathMarker links[] = new TilePathMarker[2];
// TODO: this should be moved to default props
// A list with the pathMarkers that aren't fully connected
// It only contains markers within the loaded chunks
@ -42,6 +32,18 @@ public class TilePathMarker extends TileMarker {
private static LinkedList<TilePathMarker> availableMarkers = new LinkedList<TilePathMarker>();
public int x0, y0, z0, x1, y1, z1;
public boolean loadLink0 = false;
public boolean loadLink1 = false;
@NetworkData
public LaserData[] lasers = new LaserData[2];
@NetworkData
public boolean tryingToConnect = false;
public TilePathMarker[] links = new TilePathMarker[2];
public boolean isFullyConnected() {
return lasers[0] != null && lasers[1] != null;
}

View file

@ -24,18 +24,20 @@ import java.util.logging.Logger;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.BuildCraftBuilders;
import buildcraft.builders.blueprints.BlueprintId.Kind;
import buildcraft.core.blueprints.BlueprintBase;
public class BlueprintDatabase {
private final int bufferSize = 8192;
private final static String BPT_EXTENSION = ".bpt";
private final static String TPL_EXTENSION = ".tpl";
private File blueprintFolder;
private final static int PAGE_SIZE = 12;
private static final String BPT_EXTENSION = ".bpt";
private static final String TPL_EXTENSION = ".tpl";
private static final int PAGE_SIZE = 12;
private Set <BlueprintId> blueprintIds = new TreeSet<BlueprintId> ();
private final int bufferSize = 8192;
private File blueprintFolder;
private Set<BlueprintId> blueprintIds = new TreeSet<BlueprintId>();
private BlueprintId [] pages = new BlueprintId [0];
/**

View file

@ -12,16 +12,18 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import net.minecraft.nbt.NBTTagCompound;
import org.apache.commons.lang3.ArrayUtils;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.core.NetworkData;
public final class BlueprintId implements Comparable<BlueprintId> {
public enum Kind {Template, Blueprint};
public enum Kind {
Template, Blueprint
};
@NetworkData
public byte[] uniqueId;

View file

@ -12,10 +12,10 @@ import net.minecraft.inventory.IInventory;
public interface IBlueprintBuilderAgent {
public boolean breakBlock (int x, int y, int z);
boolean breakBlock(int x, int y, int z);
public IInventory getInventory ();
IInventory getInventory();
public boolean buildBlock(int x, int y, int z);
boolean buildBlock(int x, int y, int z);
}

View file

@ -9,10 +9,11 @@
package buildcraft.builders.filler.pattern;
import net.minecraft.world.World;
import buildcraft.core.Box;
import buildcraft.core.blueprints.Template;
public class PatternFill extends FillerPattern {
public final class PatternFill extends FillerPattern {
public static final PatternFill INSTANCE = new PatternFill();

View file

@ -9,19 +9,20 @@
package buildcraft.builders.filler.pattern;
import net.minecraft.world.World;
import buildcraft.api.blueprints.SchematicMask;
import buildcraft.core.Box;
import buildcraft.core.blueprints.Template;
public class PatternPyramid extends FillerPattern {
// TODO: These parameters need to be settable from the filler
private boolean param1 = true;
public PatternPyramid() {
super("pyramid");
}
// TODO: These parameters need to be settable from the filler
boolean param1 = true;
@Override
public Template getTemplate (Box box, World world) {
int xMin = (int) box.pMin().x;

View file

@ -9,22 +9,22 @@
package buildcraft.builders.filler.pattern;
import net.minecraft.world.World;
import buildcraft.core.Box;
import buildcraft.core.blueprints.Template;
public class PatternStairs extends FillerPattern {
// TODO: These parameters need to be settable from the filler
private boolean param1 = true;
private int param2 = 0;
private int param3 = 0;
private int param4 = 0;
public PatternStairs() {
super("stairs");
}
// TODO: These parameters need to be settable from the filler
boolean param1 = true;
int param2 = 0;
int param3 = 0;
int param4 = 0;
@Override
public Template getTemplate(Box box, World world) {
int xMin = 0;
@ -55,7 +55,7 @@ public class PatternStairs extends FillerPattern {
int kind = 0;
int steps[] = new int[]{0, 0, 0, 0};
int[] steps = new int[] {0, 0, 0, 0};
int x = 0, z = 0;
int stepDiagX = 0, stepDiagZ = 0;

View file

@ -13,6 +13,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import buildcraft.builders.TileBlueprintLibrary;
import buildcraft.core.gui.BuildCraftContainer;
@ -58,7 +59,7 @@ public class ContainerBlueprintLibrary extends BuildCraftContainer {
if (slotNum == 0) {
library.uploadingPlayer = player;
} else if (slotNum == 2){
} else if (slotNum == 2) {
library.downloadingPlayer = player;
}

View file

@ -8,12 +8,13 @@
*/
package buildcraft.builders.gui;
import buildcraft.builders.TileBuilder;
import buildcraft.core.gui.BuildCraftContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import buildcraft.builders.TileBuilder;
import buildcraft.core.gui.BuildCraftContainer;
public class ContainerBuilder extends BuildCraftContainer {
IInventory playerIInventory;

View file

@ -8,17 +8,19 @@
*/
package buildcraft.builders.gui;
import buildcraft.builders.TileFiller;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.gui.widgets.Widget;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.builders.TileFiller;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.gui.widgets.Widget;
public class ContainerFiller extends BuildCraftContainer {
IInventory playerIInventory;

View file

@ -10,12 +10,12 @@ package buildcraft.builders.gui;
import java.util.Date;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import buildcraft.builders.TileArchitect;
import buildcraft.core.DefaultProps;
import buildcraft.core.blueprints.BlueprintReadConfiguration;

View file

@ -8,12 +8,12 @@
*/
package buildcraft.builders.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import buildcraft.BuildCraftBuilders;
import buildcraft.builders.TileBlueprintLibrary;
import buildcraft.builders.blueprints.BlueprintId;
@ -24,12 +24,16 @@ import buildcraft.core.utils.StringUtils;
public class GuiBlueprintLibrary extends GuiBuildCraft {
private static final ResourceLocation TEXTURE = new ResourceLocation(
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/library_rw.png");
EntityPlayer player;
TileBlueprintLibrary library;
ContainerBlueprintLibrary container;
boolean computeInput;
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/library_rw.png");
private GuiButton nextPageButton;
private GuiButton prevPageButton;
private GuiButton lockButton;
private GuiButton deleteButton;
private EntityPlayer player;
private TileBlueprintLibrary library;
private ContainerBlueprintLibrary container;
private boolean computeInput;
public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) {
super(new ContainerBlueprintLibrary(player, library), library, TEXTURE);
this.player = player;
@ -40,11 +44,6 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
container = (ContainerBlueprintLibrary) inventorySlots;
}
private GuiButton nextPageButton;
private GuiButton prevPageButton;
private GuiButton lockButton;
private GuiButton deleteButton;
@SuppressWarnings("unchecked")
@Override
public void initGui() {

View file

@ -10,12 +10,12 @@ package buildcraft.builders.gui;
import java.util.Collection;
import org.lwjgl.opengl.GL11;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import buildcraft.builders.TileBuilder;
import buildcraft.core.DefaultProps;
import buildcraft.core.gui.AdvancedSlot;
@ -26,8 +26,9 @@ public class GuiBuilder extends GuiAdvancedInterface {
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/builder.png");
private static final ResourceLocation BLUEPRINT_TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/builder_blueprint.png");
IInventory playerInventory;
TileBuilder builder;
private IInventory playerInventory;
private TileBuilder builder;
private int inventoryRows = 6;
public GuiBuilder(IInventory playerInventory, TileBuilder builder) {
super(new ContainerBuilder(playerInventory, builder), builder, TEXTURE);
@ -96,5 +97,4 @@ public class GuiBuilder extends GuiAdvancedInterface {
drawBackgroundSlots();
}
int inventoryRows = 6;
}

View file

@ -12,6 +12,7 @@ import java.util.LinkedList;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
@ -26,7 +27,7 @@ public class SchematicBed extends SchematicBlock {
@Override
public void rotateLeft(IBuilderContext context) {
int orientation = (meta & 7);
int orientation = meta & 7;
int others = meta - orientation;
switch (orientation) {
@ -46,7 +47,7 @@ public class SchematicBed extends SchematicBlock {
}
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
if ((meta & 8) != 0) {
return;
}

View file

@ -12,6 +12,7 @@ import java.util.LinkedList;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
@ -23,7 +24,7 @@ public class SchematicCactus extends SchematicBlock {
}
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
context.world().setBlock(x, y, z, Blocks.cactus, 0, 3);
}

View file

@ -11,8 +11,9 @@ package buildcraft.builders.schematics;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
public class SchematicCustomStack extends SchematicBlock {

View file

@ -13,6 +13,7 @@ import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
@ -24,7 +25,7 @@ public class SchematicDirt extends SchematicBlock {
}
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
context.world().setBlock(x, y, z, Blocks.dirt, meta, 3);
}

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