various fixes
This commit is contained in:
parent
1e007896e0
commit
a5758d1bf1
9 changed files with 31 additions and 37 deletions
|
@ -23,8 +23,7 @@ public final class BuildCraftAPI {
|
|||
public static IWorldProperty isSoftProperty;
|
||||
public static IWorldProperty isWoodProperty;
|
||||
public static IWorldProperty isLeavesProperty;
|
||||
public static IWorldProperty isBasicOreProperty;
|
||||
public static IWorldProperty isExtendedOreProperty;
|
||||
public static IWorldProperty[] isOreProperty;
|
||||
public static IWorldProperty isHarvestableProperty;
|
||||
public static IWorldProperty isFarmlandProperty;
|
||||
public static IWorldProperty isDirtProperty;
|
||||
|
|
|
@ -60,6 +60,7 @@ import buildcraft.api.core.BlockIndex;
|
|||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import buildcraft.api.core.EnumColor;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.api.core.IWorldProperty;
|
||||
import buildcraft.api.core.JavaTools;
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
|
@ -116,7 +117,7 @@ import buildcraft.core.utils.WorldPropertyIsDirt;
|
|||
import buildcraft.core.utils.WorldPropertyIsFarmland;
|
||||
import buildcraft.core.utils.WorldPropertyIsFluidSource;
|
||||
import buildcraft.core.utils.WorldPropertyIsHarvestable;
|
||||
import buildcraft.core.utils.WorldPropertyIsLeave;
|
||||
import buildcraft.core.utils.WorldPropertyIsLeaf;
|
||||
import buildcraft.core.utils.WorldPropertyIsOre;
|
||||
import buildcraft.core.utils.WorldPropertyIsShoveled;
|
||||
import buildcraft.core.utils.WorldPropertyIsSoft;
|
||||
|
@ -397,9 +398,11 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
|
||||
BuildCraftAPI.isSoftProperty = new WorldPropertyIsSoft();
|
||||
BuildCraftAPI.isWoodProperty = new WorldPropertyIsWood();
|
||||
BuildCraftAPI.isLeavesProperty = new WorldPropertyIsLeave();
|
||||
BuildCraftAPI.isBasicOreProperty = new WorldPropertyIsOre(false);
|
||||
BuildCraftAPI.isExtendedOreProperty = new WorldPropertyIsOre(true);
|
||||
BuildCraftAPI.isLeavesProperty = new WorldPropertyIsLeaf();
|
||||
BuildCraftAPI.isOreProperty = new IWorldProperty[4];
|
||||
for (int i = 0; i < BuildCraftAPI.isOreProperty.length; i++) {
|
||||
BuildCraftAPI.isOreProperty[i] = new WorldPropertyIsOre(i);
|
||||
}
|
||||
BuildCraftAPI.isHarvestableProperty = new WorldPropertyIsHarvestable();
|
||||
BuildCraftAPI.isFarmlandProperty = new WorldPropertyIsFarmland();
|
||||
BuildCraftAPI.isShoveled = new WorldPropertyIsShoveled();
|
||||
|
@ -527,8 +530,9 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
BuildCraftAPI.isSoftProperty.clear();
|
||||
BuildCraftAPI.isWoodProperty.clear();
|
||||
BuildCraftAPI.isLeavesProperty.clear();
|
||||
BuildCraftAPI.isBasicOreProperty.clear();
|
||||
BuildCraftAPI.isExtendedOreProperty.clear();
|
||||
for (int i = 0; i < BuildCraftAPI.isOreProperty.length; i++) {
|
||||
BuildCraftAPI.isOreProperty[i].clear();
|
||||
}
|
||||
BuildCraftAPI.isHarvestableProperty.clear();
|
||||
BuildCraftAPI.isFarmlandProperty.clear();
|
||||
BuildCraftAPI.isShoveled.clear();
|
||||
|
|
|
@ -21,7 +21,7 @@ import buildcraft.core.robots.AIRobotFetchAndEquipItemStack;
|
|||
|
||||
public class BoardRobotMiner extends BoardRobotGenericBreakBlock {
|
||||
|
||||
private boolean extendedOre = false;
|
||||
private int harvestLevel = 0;
|
||||
|
||||
public BoardRobotMiner(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
|
@ -37,8 +37,7 @@ public class BoardRobotMiner extends BoardRobotGenericBreakBlock {
|
|||
if (stack != null && stack.getItem() instanceof ItemPickaxe) {
|
||||
ItemPickaxe pickaxe = (ItemPickaxe) stack.getItem();
|
||||
|
||||
extendedOre = pickaxe.func_150913_i() == Item.ToolMaterial.EMERALD
|
||||
|| pickaxe.func_150913_i() == Item.ToolMaterial.IRON;
|
||||
harvestLevel = pickaxe.getHarvestLevel(stack, "pickaxe");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,11 +54,8 @@ public class BoardRobotMiner extends BoardRobotGenericBreakBlock {
|
|||
|
||||
@Override
|
||||
public boolean isExpectedBlock(World world, int x, int y, int z) {
|
||||
if (!extendedOre) {
|
||||
return BuildCraftAPI.isBasicOreProperty.get(world, x, y, z);
|
||||
} else {
|
||||
return BuildCraftAPI.isExtendedOreProperty.get(world, x, y, z);
|
||||
}
|
||||
return BuildCraftAPI.isOreProperty[Math.min(BuildCraftAPI.isOreProperty.length, harvestLevel)]
|
||||
.get(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,10 @@ public class StatementParameterRedstoneGateSideOnly implements
|
|||
@NetworkData
|
||||
public boolean isOn = false;
|
||||
|
||||
public StatementParameterRedstoneGateSideOnly() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStackToDraw() {
|
||||
return null;
|
||||
|
|
|
@ -19,7 +19,7 @@ public final class BitSetUtils {
|
|||
}
|
||||
|
||||
public static byte[] toByteArray(BitSet bits) {
|
||||
byte[] bytes = new byte[(int) Math.ceil(bits.length() / 8)];
|
||||
byte[] bytes = new byte[(bits.length() >> 3) + (bits.length() & 7) == 0 ? 0 : 1];
|
||||
for (int i = 0; i < bits.length(); i++) {
|
||||
if (bits.get(i)) {
|
||||
bytes[bytes.length - (i >> 3) - 1] |= 1 << (i & 7);
|
||||
|
|
|
@ -14,11 +14,11 @@ import net.minecraft.world.IBlockAccess;
|
|||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class WorldPropertyIsLeave extends WorldProperty {
|
||||
public class WorldPropertyIsLeaf extends WorldProperty {
|
||||
|
||||
private int leavesId = 0;
|
||||
|
||||
public WorldPropertyIsLeave() {
|
||||
public WorldPropertyIsLeaf() {
|
||||
leavesId = OreDictionary.getOreID("treeLeaves");
|
||||
}
|
||||
|
|
@ -20,32 +20,21 @@ public class WorldPropertyIsOre extends WorldProperty {
|
|||
|
||||
public HashSet<Integer> ores = new HashSet<Integer>();
|
||||
|
||||
public WorldPropertyIsOre(boolean extendedHarvest) {
|
||||
ores.add(OreDictionary.getOreID("oreCoal"));
|
||||
ores.add(OreDictionary.getOreID("oreIron"));
|
||||
ores.add(OreDictionary.getOreID("oreQuartz"));
|
||||
|
||||
if (extendedHarvest) {
|
||||
ores.add(OreDictionary.getOreID("oreGold"));
|
||||
ores.add(OreDictionary.getOreID("oreDiamond"));
|
||||
ores.add(OreDictionary.getOreID("oreEmerald"));
|
||||
ores.add(OreDictionary.getOreID("oreLapis"));
|
||||
ores.add(OreDictionary.getOreID("oreRedstone"));
|
||||
}
|
||||
|
||||
public WorldPropertyIsOre(int harvestLevel) {
|
||||
for (String oreName : OreDictionary.getOreNames()) {
|
||||
if (oreName.startsWith("ore")) {
|
||||
ArrayList<ItemStack> oreStacks = OreDictionary.getOres(oreName);
|
||||
if (oreStacks.size() > 0) {
|
||||
Block block = Block.getBlockFromItem(oreStacks.get(0).getItem());
|
||||
int meta = oreStacks.get(0).getItemDamage();
|
||||
if (meta == OreDictionary.WILDCARD_VALUE) {
|
||||
if (meta >= 16 || meta < 0) {
|
||||
meta = 0;
|
||||
}
|
||||
if (block == null) {
|
||||
continue;
|
||||
}
|
||||
if (extendedHarvest) {
|
||||
if ("pickaxe".equals(block.getHarvestTool(meta)) &&
|
||||
block.getHarvestLevel(meta) <= harvestLevel) {
|
||||
ores.add(OreDictionary.getOreID(oreName));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
if (pipe != null) {
|
||||
nbt.setInteger("pipeId", Item.itemRegistry.getIDForObject(pipe.item));
|
||||
nbt.setInteger("pipeId", Item.getIdFromItem(pipe.item));
|
||||
pipe.writeToNBT(nbt);
|
||||
} else {
|
||||
nbt.setInteger("pipeId", coreState.pipeId);
|
||||
|
@ -303,7 +303,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
coreState.pipeId = nbt.getInteger("pipeId");
|
||||
pipe = BlockGenericPipe.createPipe((Item) Item.itemRegistry.getObjectById(coreState.pipeId));
|
||||
pipe = BlockGenericPipe.createPipe((Item) Item.getItemById(coreState.pipeId));
|
||||
bindPipe();
|
||||
|
||||
if (pipe != null) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -33,7 +34,8 @@ public class StripesHandlerBucket implements IStripesHandler {
|
|||
public boolean handle(World world, int x, int y, int z,
|
||||
ForgeDirection direction, ItemStack stack, EntityPlayer player,
|
||||
IStripesPipe pipe) {
|
||||
if (world.getBlock(x, y, z) == Blocks.air) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == Blocks.air) {
|
||||
Block underblock = world.getBlock(x, y - 1, z);
|
||||
|
||||
boolean rollback = false;
|
||||
|
|
Loading…
Reference in a new issue