Skip to content
Browse files

Updated with oil sand block

  • Loading branch information...
1 parent ce5ca7d commit 9afa40c0d9a06565bd53dfc9bc588cf64769ca92 @diamondq committed Jan 1, 2013
View
BIN PetrolCraft/src/PetrolCraft_Texture.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN PetrolCraft/src/PetrolCraft_Texture.xcf
Binary file not shown.
View
9 PetrolCraft/src/petrolcraft/blocks/Blocks.java
@@ -7,6 +7,7 @@
public class Blocks {
public static OilDirt sOilDirt;
+ public static OilSand sOilSand;
private static final int sDEFAULT_BLOCK_START_ID = 1318;
@@ -18,5 +19,13 @@ public static void init() {
"Oil infused Dirt Block ID").getInt());
GameRegistry.registerBlock(sOilDirt, ItemBlock.class, sOilDirt.getBlockName(), Mod_PetrolCraft.sMOD_ID);
LanguageRegistry.addName(sOilDirt, "Oil infused Dirt");
+
+ /* Oil infused Sand */
+
+ sOilSand = new OilSand(Mod_PetrolCraft.sConfig.getBlock("Oil_Sand_Block_ID", sDEFAULT_BLOCK_START_ID + 2,
+ "Oil infused Sand Block ID").getInt());
+ GameRegistry.registerBlock(sOilSand, ItemBlock.class, sOilSand.getBlockName(), Mod_PetrolCraft.sMOD_ID);
+ LanguageRegistry.addName(sOilSand, "Oil infused Sand");
+
}
}
View
17 PetrolCraft/src/petrolcraft/blocks/OilSand.java
@@ -0,0 +1,17 @@
+package petrolcraft.blocks;
+
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import petrolcraft.common.Textures;
+
+public class OilSand extends AbstractOilSand {
+
+ public OilSand(int pBlockID) {
+ super(pBlockID, Textures.sOIL_SAND_TEXTURE_ID, Material.ground);
+ setBlockName("OilSand");
+ setResistance(0F);
+ setHardness(0.5F);
+ setCreativeTab(CreativeTabs.tabBlock);
+ setStepSound(soundSandFootstep);
+ }
+}
View
7 PetrolCraft/src/petrolcraft/common/Textures.java
@@ -4,6 +4,13 @@
public static final String sBLOCK_TEXTURES = "/PetrolCraft_Texture.png";
public static final int sOIL_DIRT_TEXTURE_ID = 0;
+ public static final int sOIL_SAND_TEXTURE_ID = 1;
+ public static final int sOIL_EXTRACTOR_TOP_ID = 2;
+ public static final int sOIL_EXTRACTOR_BOTTOM_ID = 3;
+ public static final int sOIL_EXTRACTOR_FRONT_ID = 4;
+ public static final int sOIL_EXTRACTOR_BACK_ID = 5;
+ public static final int sOIL_EXTRACTOR_LEFT_ID = 6;
+ public static final int sOIL_EXTRACTOR_RIGHT_ID = 7;
public void setupRender() {
View
5 PetrolCraft/src/petrolcraft/generation/WorldGenerator.java
@@ -56,9 +56,10 @@ private void generateOilSand(int pCenterX, int pCenterZ, World pWorld, Random pR
int testZ = pCenterZ - (radius / 2) + z;
int height = pWorld.getHeightValue(testX, testZ) - 1;
int blockId = pWorld.getBlockId(testX, height, testZ);
- if ((blockId == Block.grass.blockID) || (blockId == Block.dirt.blockID) || (blockId == Block.sand.blockID)) {
+ if ((blockId == Block.grass.blockID) || (blockId == Block.dirt.blockID))
pWorld.setBlock(testX, height, testZ, Blocks.sOilDirt.blockID);
- }
+ else if (blockId == Block.sand.blockID)
+ pWorld.setBlock(testX, height, testZ, Blocks.sOilSand.blockID);
}
}
View
9 PetrolCraft/src/petrolcraft/machines/OilExtractorBlock.java
@@ -11,14 +11,19 @@
public class OilExtractorBlock extends Block {
public OilExtractorBlock(int pBlockID) {
- super(pBlockID, 1, Material.ground);
+ super(pBlockID, Textures.sOIL_EXTRACTOR_TOP_ID, Material.ground);
setBlockName("OilExtractor");
setResistance(0F);
setHardness(0.5F);
setCreativeTab(CreativeTabs.tabTools);
setStepSound(soundMetalFootstep);
}
+ @Override
+ public int getBlockTextureFromSide(int pSide) {
+ return Textures.sOIL_EXTRACTOR_TOP_ID + pSide;
+ }
+
/**
* All sides of the extractor can accept a redstone wire
*
@@ -38,7 +43,7 @@ public boolean canPlaceBlockAt(World pWorld, int pX, int pY, int pZ) {
/* Check to see if the extractor will be sitting on an oil sands */
int belowID = pWorld.getBlockId(pX, pY - 1, pZ);
- if (belowID == Blocks.sOilDirt.blockID)
+ if ((belowID == Blocks.sOilDirt.blockID) || (belowID == Blocks.sOilSand.blockID))
return true;
return false;
}

0 comments on commit 9afa40c

Please sign in to comment.
Something went wrong with that request. Please try again.