added support for crops, fix #1539
This commit is contained in:
parent
d4038e763c
commit
7e4b40f254
3 changed files with 85 additions and 2 deletions
|
@ -60,6 +60,7 @@ import buildcraft.builders.schematics.SchematicBed;
|
|||
import buildcraft.builders.schematics.SchematicCustomStack;
|
||||
import buildcraft.builders.schematics.SchematicDirt;
|
||||
import buildcraft.builders.schematics.SchematicDoor;
|
||||
import buildcraft.builders.schematics.SchematicFarmland;
|
||||
import buildcraft.builders.schematics.SchematicFire;
|
||||
import buildcraft.builders.schematics.SchematicFluid;
|
||||
import buildcraft.builders.schematics.SchematicHanging;
|
||||
|
@ -75,6 +76,7 @@ import buildcraft.builders.schematics.SchematicRail;
|
|||
import buildcraft.builders.schematics.SchematicRedstoneDiode;
|
||||
import buildcraft.builders.schematics.SchematicRotateInventory;
|
||||
import buildcraft.builders.schematics.SchematicRotateMeta;
|
||||
import buildcraft.builders.schematics.SchematicSeeds;
|
||||
import buildcraft.builders.schematics.SchematicSign;
|
||||
import buildcraft.builders.schematics.SchematicStairs;
|
||||
import buildcraft.builders.schematics.SchematicWallSide;
|
||||
|
@ -158,7 +160,12 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.dirt, SchematicDirt.class);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.grass, SchematicDirt.class);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.farmland, SchematicDirt.class);
|
||||
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.farmland, SchematicFarmland.class);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.wheat, SchematicSeeds.class, Items.wheat_seeds);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.pumpkin_stem, SchematicSeeds.class, Items.pumpkin_seeds);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicSeeds.class, Items.melon_seeds);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.nether_wart, SchematicSeeds.class, Items.nether_wart);
|
||||
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.torch, SchematicWallSide.class);
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.redstone_torch, SchematicWallSide.class);
|
||||
|
@ -189,7 +196,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
SchematicRegistry.registerSchematicBlock(Blocks.stone, SchematicCustomStack.class, new ItemStack(Blocks.stone));
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.redstone_wire, SchematicCustomStack.class, new ItemStack(Items.redstone));
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake));
|
||||
//new BptBlockCustomStack(Blocks.crops.blockID, new ItemStack(Items.seeds));
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.pumpkin_stem, SchematicCustomStack.class, new ItemStack(Items.pumpkin_seeds));
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds));
|
||||
SchematicRegistry.registerSchematicBlock(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
|
||||
|
|
37
common/buildcraft/builders/schematics/SchematicFarmland.java
Executable file
37
common/buildcraft/builders/schematics/SchematicFarmland.java
Executable file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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.builders.schematics;
|
||||
|
||||
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;
|
||||
|
||||
public class SchematicFarmland extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(Blocks.dirt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToWorld(IBuilderContext context, int x, int y, int z) {
|
||||
context.world().setBlock(x, y, z, block, 0, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(IBuilderContext context, int x, int y, int z) {
|
||||
Block block = context.world().getBlock(x, y, z);
|
||||
|
||||
return block == Blocks.farmland;
|
||||
}
|
||||
}
|
40
common/buildcraft/builders/schematics/SchematicSeeds.java
Executable file
40
common/buildcraft/builders/schematics/SchematicSeeds.java
Executable file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* 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.builders.schematics;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
|
||||
public class SchematicSeeds extends SchematicBlock {
|
||||
|
||||
public Item seeds;
|
||||
|
||||
public SchematicSeeds (Item seeds) {
|
||||
this.seeds = seeds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(new ItemStack(seeds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToWorld(IBuilderContext context, int x, int y, int z) {
|
||||
context.world().setBlock(x, y, z, block, 0, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(IBuilderContext context, int x, int y, int z) {
|
||||
return context.world().getBlock(x, y, z) == block;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue