Guest User

Structure

a guest
Jun 17th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.19 KB | None | 0 0
  1. /*
  2. *** MADE BY MRPONYCAPTAIN'S .SCHEMATIC TO .JAVA CONVERTING TOOL v2.0 ***
  3. */
  4.  
  5. package com.crazyhoorse961.core.WorldGen;
  6.  
  7. import java.util.Random;
  8.  
  9. import net.minecraft.block.Block;
  10. import net.minecraft.init.Blocks;
  11. import net.minecraft.world.World;
  12. import net.minecraft.world.chunk.IChunkProvider;
  13. import net.minecraft.world.gen.feature.WorldGenerator;
  14. import net.minecraftforge.fml.common.IWorldGenerator;
  15.  
  16. public abstract class Trap extends WorldGenerator implements IWorldGenerator
  17. {
  18. protected Block[] getValidSpawnBlocks() {
  19. return new Block[] {
  20. Blocks.grass
  21. };
  22. }
  23.  
  24. public boolean locationIsValidSpawn(World world, int i, int j, int k){
  25. int distanceToAir = 0;
  26. Block check = world.getBlock(i, j, k);
  27.  
  28. while (check != Blocks.air){
  29. if (distanceToAir > 3){
  30. return false;
  31. }
  32.  
  33. distanceToAir++;
  34. check = world.getBlock(i, j + distanceToAir, k);
  35. }
  36.  
  37. j += distanceToAir - 1;
  38.  
  39. Block block = (world).getBlock(i, j, k);
  40. Block blockAbove = world.getBlock(i, j+1, k);
  41. Block blockBelow = world.getBlock
  42. (i, j-1, k);
  43.  
  44. for (Block x : getValidSpawnBlocks()){
  45. if (blockAbove != Blocks.air){
  46. return false;
  47. }
  48. if (block == x){
  49. return true;
  50. }else if (block == Blocks.snow && blockBelow == x){
  51. return true;
  52. }
  53. }
  54.  
  55. return false;
  56. }
  57.  
  58. public Trap() { }
  59.  
  60. @Override
  61. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { }
  62.  
  63. public void setBlock(World world, int x, int y, int z, Block block, int metadata)
  64. {
  65. Block b1 = world.getBlock(x, y, z);
  66.  
  67. if(b1.isAir(world, x, y, z) || b1.isLeaves(world, x, y, z))
  68. {
  69. (world).setBlockState(x, y, z, block, metadata, 2);
  70. }
  71. }
  72.  
  73.  
  74.  
  75.  
  76.  
  77. public boolean generate(World world, Random rand, int i, int j, int k) {
  78. //check that each corner is one of the valid spawn blocks
  79. if(!locationIsValidSpawn(world, i, j, k) || !locationIsValidSpawn(world, i + 6, j, k) || !locationIsValidSpawn(world, i + 6, j, k + 5) || !locationIsValidSpawn(world, i, j, k + 5))
  80. {
  81. return false;
  82. }
  83.  
  84. k = k - 10;
  85. i = i - 10;
  86.  
  87. this.setBlock(world, i + 0, j + 0, k + 0, Blocks.dirt, 0);
  88. this.setBlock(world, i + 0, j + 0, k + 1, Blocks.dirt, 0);
  89. this.setBlock(world, i + 0, j + 0, k + 2, Blocks.dirt, 0);
  90. this.setBlock(world, i + 0, j + 0, k + 3, Blocks.grass, 0);
  91. this.setBlock(world, i + 0, j + 0, k + 4, Blocks.dirt, 0);
  92. this.setBlock(world, i + 0, j + 0, k + 5, Blocks.dirt, 0);
  93. this.setBlock(world, i + 0, j + 1, k + 0, Blocks.dirt, 0);
  94. this.setBlock(world, i + 0, j + 1, k + 1, Blocks.dirt, 0);
  95. this.setBlock(world, i + 0, j + 1, k + 2, Blocks.dirt, 0);
  96. this.setBlock(world, i + 0, j + 1, k + 3, Blocks.dirt, 0);
  97. this.setBlock(world, i + 0, j + 1, k + 4, Blocks.dirt, 0);
  98. this.setBlock(world, i + 0, j + 1, k + 5, Blocks.dirt, 0);
  99. this.setBlock(world, i + 0, j + 2, k + 0, Blocks.dirt, 0);
  100. this.setBlock(world, i + 0, j + 2, k + 1, Blocks.dirt, 0);
  101. this.setBlock(world, i + 0, j + 2, k + 2, Blocks.dirt, 0);
  102. this.setBlock(world, i + 0, j + 2, k + 3, Blocks.dirt, 0);
  103. this.setBlock(world, i + 0, j + 2, k + 4, Blocks.dirt, 0);
  104. this.setBlock(world, i + 0, j + 2, k + 5, Blocks.grass, 0);
  105. this.setBlock(world, i + 0, j + 3, k + 0, Blocks.stonebrick, 0);
  106. this.setBlock(world, i + 0, j + 3, k + 1, Blocks.stonebrick, 0);
  107. this.setBlock(world, i + 0, j + 3, k + 2, Blocks.stone, 0);
  108. this.setBlock(world, i + 0, j + 3, k + 3, Blocks.stone, 0);
  109. this.setBlock(world, i + 0, j + 3, k + 4, Blocks.stonebrick, 0);
  110. this.setBlock(world, i + 0, j + 3, k + 5, Blocks.stonebrick, 0);
  111. this.setBlock(world, i + 0, j + 4, k + 1, Blocks.stone_slab, 5);
  112. this.setBlock(world, i + 0, j + 4, k + 4, Blocks.stone_slab, 5);
  113. this.setBlock(world, i + 1, j + 0, k + 0, Blocks.dirt, 0);
  114. this.setBlock(world, i + 1, j + 0, k + 1, Blocks.dirt, 0);
  115. this.setBlock(world, i + 1, j + 0, k + 2, Blocks.grass, 0);
  116. this.setBlock(world, i + 1, j + 0, k + 3, Blocks.grass, 0);
  117. this.setBlock(world, i + 1, j + 0, k + 4, Blocks.grass, 0);
  118. this.setBlock(world, i + 1, j + 0, k + 5, Blocks.dirt, 0);
  119. this.setBlock(world, i + 1, j + 1, k + 0, Blocks.grass, 0);
  120. this.setBlock(world, i + 1, j + 1, k + 1, Blocks.grass, 0);
  121. this.setBlock(world, i + 1, j + 1, k + 5, Blocks.dirt, 0);
  122. this.setBlock(world, i + 1, j + 2, k + 0, Blocks.dirt, 0);
  123. this.setBlock(world, i + 1, j + 2, k + 5, Blocks.dirt, 0);
  124. this.setBlock(world, i + 1, j + 3, k + 0, Blocks.stonebrick, 0);
  125. this.setBlock(world, i + 1, j + 3, k + 1, Blocks.dirt, 0);
  126. this.setBlock(world, i + 1, j + 3, k + 2, Blocks.stone, 0);
  127. this.setBlock(world, i + 1, j + 3, k + 3, Blocks.stone, 0);
  128. this.setBlock(world, i + 1, j + 3, k + 4, Blocks.dirt, 0);
  129. this.setBlock(world, i + 1, j + 3, k + 5, Blocks.stonebrick, 0);
  130. this.setBlock(world, i + 1, j + 4, k + 0, Blocks.stone_slab, 5);
  131. this.setBlock(world, i + 1, j + 4, k + 1, Blocks.stonebrick, 3);
  132. this.setBlock(world, i + 1, j + 4, k + 4, Blocks.stonebrick, 1);
  133. this.setBlock(world, i + 1, j + 4, k + 5, Blocks.stone_slab, 5);
  134. this.setBlock(world, i + 1, j + 5, k + 1, Blocks.stonebrick, 1);
  135. this.setBlock(world, i + 1, j + 5, k + 4, Blocks.stonebrick, 3);
  136. this.setBlock(world, i + 1, j + 6, k + 1, Blocks.stonebrick, 3);
  137. this.setBlock(world, i + 1, j + 6, k + 4, Blocks.stonebrick, 1);
  138. this.setBlock(world, i + 1, j + 7, k + 1, Blocks.stone_slab, 0);
  139. this.setBlock(world, i + 1, j + 7, k + 2, Blocks.stone_slab, 0);
  140. this.setBlock(world, i + 1, j + 7, k + 3, Blocks.stone_slab, 0);
  141. this.setBlock(world, i + 1, j + 7, k + 4, Blocks.stone_slab, 0);
  142. this.setBlock(world, i + 2, j + 0, k + 0, Blocks.dirt, 0);
  143. this.setBlock(world, i + 2, j + 0, k + 1, Blocks.dirt, 0);
  144. this.setBlock(world, i + 2, j + 0, k + 2, Blocks.grass, 0);
  145. this.setBlock(world, i + 2, j + 0, k + 3, Blocks.dirt, 0);
  146. this.setBlock(world, i + 2, j + 0, k + 4, Blocks.grass, 0);
  147. this.setBlock(world, i + 2, j + 0, k + 5, Blocks.dirt, 0);
  148. this.setBlock(world, i + 2, j + 1, k + 0, Blocks.dirt, 0);
  149. this.setBlock(world, i + 2, j + 1, k + 1, Blocks.grass, 0);
  150. this.setBlock(world, i + 2, j + 1, k + 2, Blocks.stone, 0);
  151. this.setBlock(world, i + 2, j + 1, k + 3, Blocks.stone, 0);
  152. this.setBlock(world, i + 2, j + 1, k + 5, Blocks.dirt, 0);
  153. this.setBlock(world, i + 2, j + 2, k + 0, Blocks.dirt, 0);
  154. this.setBlock(world, i + 2, j + 2, k + 2, Blocks.tnt, 0);
  155. this.setBlock(world, i + 2, j + 2, k + 3, Blocks.tnt, 0);
  156. this.setBlock(world, i + 2, j + 2, k + 5, Blocks.dirt, 0);
  157. this.setBlock(world, i + 2, j + 3, k + 0, Blocks.stone, 0);
  158. this.setBlock(world, i + 2, j + 3, k + 1, Blocks.stone, 0);
  159. this.setBlock(world, i + 2, j + 3, k + 2, Blocks.stone, 0);
  160. this.setBlock(world, i + 2, j + 3, k + 3, Blocks.stone, 0);
  161. this.setBlock(world, i + 2, j + 3, k + 4, Blocks.stone, 0);
  162. this.setBlock(world, i + 2, j + 3, k + 5, Blocks.stone, 0);
  163. this.setBlock(world, i + 2, j + 7, k + 1, Blocks.stone_slab, 0);
  164. this.setBlock(world, i + 2, j + 7, k + 2, Blocks.stonebrick, 5);
  165. this.setBlock(world, i + 2, j + 7, k + 3, Blocks.double_stone_slab, 5);
  166. this.setBlock(world, i + 2, j + 7, k + 4, Blocks.stone_slab, 0);
  167. this.setBlock(world, i + 3, j + 0, k + 0, Blocks.dirt, 0);
  168. this.setBlock(world, i + 3, j + 0, k + 1, Blocks.grass, 0);
  169. this.setBlock(world, i + 3, j + 0, k + 2, Blocks.grass, 0);
  170. this.setBlock(world, i + 3, j + 0, k + 3, Blocks.dirt, 0);
  171. this.setBlock(world, i + 3, j + 0, k + 4, Blocks.grass, 0);
  172. this.setBlock(world, i + 3, j + 0, k + 5, Blocks.dirt, 0);
  173. this.setBlock(world, i + 3, j + 1, k + 0, Blocks.dirt, 0);
  174. this.setBlock(world, i + 3, j + 1, k + 2, Blocks.dirt, 0);
  175. this.setBlock(world, i + 3, j + 1, k + 3, Blocks.dirt, 0);
  176. this.setBlock(world, i + 3, j + 1, k + 5, Blocks.dirt, 0);
  177. this.setBlock(world, i + 3, j + 2, k + 0, Blocks.dirt, 0);
  178. this.setBlock(world, i + 3, j + 2, k + 1, Blocks.dirt, 0);
  179. this.setBlock(world, i + 3, j + 2, k + 2, Blocks.tnt, 0);
  180. this.setBlock(world, i + 3, j + 2, k + 3, Blocks.tnt, 0);
  181. this.setBlock(world, i + 3, j + 2, k + 5, Blocks.dirt, 0);
  182. this.setBlock(world, i + 3, j + 3, k + 0, Blocks.stone, 0);
  183. this.setBlock(world, i + 3, j + 3, k + 1, Blocks.stone, 0);
  184. this.setBlock(world, i + 3, j + 3, k + 2, Blocks.grass, 0);
  185. this.setBlock(world, i + 3, j + 3, k + 3, Blocks.grass, 0);
  186. this.setBlock(world, i + 3, j + 3, k + 4, Blocks.stone, 0);
  187. this.setBlock(world, i + 3, j + 3, k + 5, Blocks.stone, 0);
  188. this.setBlock(world, i + 3, j + 4, k + 2, Blocks.air, 5);
  189. this.setBlock(world, i + 3, j + 4, k + 3, Blocks.air, 5);
  190. this.setBlock(world, i + 3, j + 7, k + 1, Blocks.stone_slab, 0);
  191. this.setBlock(world, i + 3, j + 7, k + 2, Blocks.double_stone_slab, 5);
  192. this.setBlock(world, i + 3, j + 7, k + 3, Blocks.double_stone_slab, 5);
  193. this.setBlock(world, i + 3, j + 7, k + 4, Blocks.stone_slab, 0);
  194. this.setBlock(world, i + 4, j + 0, k + 0, Blocks.dirt, 0);
  195. this.setBlock(world, i + 4, j + 0, k + 1, Blocks.grass, 0);
  196. this.setBlock(world, i + 4, j + 0, k + 2, Blocks.dirt, 0);
  197. this.setBlock(world, i + 4, j + 0, k + 3, Blocks.dirt, 0);
  198. this.setBlock(world, i + 4, j + 0, k + 4, Blocks.grass, 0);
  199. this.setBlock(world, i + 4, j + 0, k + 5, Blocks.dirt, 0);
  200. this.setBlock(world, i + 4, j + 1, k + 0, Blocks.dirt, 0);
  201. this.setBlock(world, i + 4, j + 1, k + 2, Blocks.stone, 0);
  202. this.setBlock(world, i + 4, j + 1, k + 3, Blocks.stone, 0);
  203. this.setBlock(world, i + 4, j + 1, k + 5, Blocks.dirt, 0);
  204. this.setBlock(world, i + 4, j + 2, k + 0, Blocks.dirt, 0);
  205. this.setBlock(world, i + 4, j + 2, k + 2, Blocks.tnt, 0);
  206. this.setBlock(world, i + 4, j + 2, k + 3, Blocks.tnt, 0);
  207. this.setBlock(world, i + 4, j + 2, k + 5, Blocks.dirt, 0);
  208. this.setBlock(world, i + 4, j + 3, k + 0, Blocks.stone, 0);
  209. this.setBlock(world, i + 4, j + 3, k + 1, Blocks.stone, 0);
  210. this.setBlock(world, i + 4, j + 3, k + 2, Blocks.stone, 0);
  211. this.setBlock(world, i + 4, j + 3, k + 3, Blocks.stone, 0);
  212. this.setBlock(world, i + 4, j + 3, k + 4, Blocks.stone, 0);
  213. this.setBlock(world, i + 4, j + 3, k + 5, Blocks.stone, 0);
  214. this.setBlock(world, i + 4, j + 7, k + 1, Blocks.stone_slab, 0);
  215. this.setBlock(world, i + 4, j + 7, k + 2, Blocks.double_stone_slab, 5);
  216. this.setBlock(world, i + 4, j + 7, k + 3, Blocks.double_stone_slab, 5);
  217. this.setBlock(world, i + 4, j + 7, k + 4, Blocks.stone_slab, 0);
  218. this.setBlock(world, i + 5, j + 0, k + 0, Blocks.dirt, 0);
  219. this.setBlock(world, i + 5, j + 0, k + 1, Blocks.grass, 0);
  220. this.setBlock(world, i + 5, j + 0, k + 2, Blocks.grass, 0);
  221. this.setBlock(world, i + 5, j + 0, k + 3, Blocks.grass, 0);
  222. this.setBlock(world, i + 5, j + 0, k + 4, Blocks.grass, 0);
  223. this.setBlock(world, i + 5, j + 0, k + 5, Blocks.dirt, 0);
  224. this.setBlock(world, i + 5, j + 1, k + 0, Blocks.dirt, 0);
  225. this.setBlock(world, i + 5, j + 1, k + 5, Blocks.dirt, 0);
  226. this.setBlock(world, i + 5, j + 2, k + 0, Blocks.dirt, 0);
  227. this.setBlock(world, i + 5, j + 2, k + 5, Blocks.dirt, 0);
  228. this.setBlock(world, i + 5, j + 3, k + 0, Blocks.stonebrick, 0);
  229. this.setBlock(world, i + 5, j + 3, k + 1, Blocks.dirt, 0);
  230. this.setBlock(world, i + 5, j + 3, k + 2, Blocks.stone, 0);
  231. this.setBlock(world, i + 5, j + 3, k + 3, Blocks.stone, 0);
  232. this.setBlock(world, i + 5, j + 3, k + 4, Blocks.dirt, 0);
  233. this.setBlock(world, i + 5, j + 3, k + 5, Blocks.stonebrick, 0);
  234. this.setBlock(world, i + 5, j + 4, k + 0, Blocks.stone_slab, 5);
  235. this.setBlock(world, i + 5, j + 4, k + 1, Blocks.stonebrick, 3);
  236. this.setBlock(world, i + 5, j + 4, k + 4, Blocks.stonebrick, 1);
  237. this.setBlock(world, i + 5, j + 4, k + 5, Blocks.stone_slab, 5);
  238. this.setBlock(world, i + 5, j + 5, k + 1, Blocks.stonebrick, 1);
  239. this.setBlock(world, i + 5, j + 5, k + 4, Blocks.stonebrick, 3);
  240. this.setBlock(world, i + 5, j + 6, k + 1, Blocks.stonebrick, 3);
  241. this.setBlock(world, i + 5, j + 6, k + 4, Blocks.stonebrick, 1);
  242. this.setBlock(world, i + 5, j + 7, k + 1, Blocks.stone_slab, 0);
  243. this.setBlock(world, i + 5, j + 7, k + 2, Blocks.stone_slab, 0);
  244. this.setBlock(world, i + 5, j + 7, k + 3, Blocks.stone_slab, 0);
  245. this.setBlock(world, i + 5, j + 7, k + 4, Blocks.stone_slab, 0);
  246. this.setBlock(world, i + 6, j + 0, k + 0, Blocks.dirt, 0);
  247. this.setBlock(world, i + 6, j + 0, k + 1, Blocks.dirt, 0);
  248. this.setBlock(world, i + 6, j + 0, k + 2, Blocks.dirt, 0);
  249. this.setBlock(world, i + 6, j + 0, k + 3, Blocks.dirt, 0);
  250. this.setBlock(world, i + 6, j + 0, k + 4, Blocks.dirt, 0);
  251. this.setBlock(world, i + 6, j + 0, k + 5, Blocks.dirt, 0);
  252. this.setBlock(world, i + 6, j + 1, k + 0, Blocks.dirt, 0);
  253. this.setBlock(world, i + 6, j + 1, k + 1, Blocks.dirt, 0);
  254. this.setBlock(world, i + 6, j + 1, k + 2, Blocks.dirt, 0);
  255. this.setBlock(world, i + 6, j + 1, k + 3, Blocks.dirt, 0);
  256. this.setBlock(world, i + 6, j + 1, k + 4, Blocks.dirt, 0);
  257. this.setBlock(world, i + 6, j + 1, k + 5, Blocks.grass, 0);
  258. this.setBlock(world, i + 6, j + 2, k + 0, Blocks.dirt, 0);
  259. this.setBlock(world, i + 6, j + 2, k + 1, Blocks.dirt, 0);
  260. this.setBlock(world, i + 6, j + 2, k + 2, Blocks.dirt, 0);
  261. this.setBlock(world, i + 6, j + 2, k + 3, Blocks.dirt, 0);
  262. this.setBlock(world, i + 6, j + 2, k + 4, Blocks.dirt, 0);
  263. this.setBlock(world, i + 6, j + 2, k + 5, Blocks.grass, 0);
  264. this.setBlock(world, i + 6, j + 3, k + 0, Blocks.stonebrick, 0);
  265. this.setBlock(world, i + 6, j + 3, k + 1, Blocks.stonebrick, 0);
  266. this.setBlock(world, i + 6, j + 3, k + 2, Blocks.stone, 0);
  267. this.setBlock(world, i + 6, j + 3, k + 3, Blocks.stone, 0);
  268. this.setBlock(world, i + 6, j + 3, k + 4, Blocks.stonebrick, 0);
  269. this.setBlock(world, i + 6, j + 3, k + 5, Blocks.stonebrick, 0);
  270. this.setBlock(world, i + 6, j + 4, k + 1, Blocks.stone_slab, 5);
  271. this.setBlock(world, i + 6, j + 4, k + 4, Blocks.stone_slab, 5);
  272. this.setBlock(world, i + 2, j + 4, k + 2, Blocks.stone_pressure_plate, 0);
  273. this.setBlock(world, i + 2, j + 4, k + 3, Blocks.stone_pressure_plate, 0);
  274. this.setBlock(world, i + 3, j + 4, k + 1, Blocks.stone_pressure_plate, 0);
  275. this.setBlock(world, i + 3, j + 4, k + 4, Blocks.stone_pressure_plate, 0);
  276. this.setBlock(world, i + 4, j + 4, k + 2, Blocks.stone_pressure_plate, 0);
  277. this.setBlock(world, i + 4, j + 4, k + 3, Blocks.stone_pressure_plate, 0);
  278.  
  279. return true;
  280. }
  281. }
Advertisement
Add Comment
Please, Sign In to add comment