From c260287ed32e3d05383fd1eddd52f51d7410e3d8 Mon Sep 17 00:00:00 2001 From: Mochaccino Date: Mon, 18 Mar 2013 21:13:17 +0100 Subject: [PATCH] Pattern Klasse --- .../java/de/craftinc/replicator/Pattern.java | 79 +++++++++++++++++++ .../de/craftinc/replicator/Replicator.java | 6 +- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 src/main/java/de/craftinc/replicator/Pattern.java diff --git a/src/main/java/de/craftinc/replicator/Pattern.java b/src/main/java/de/craftinc/replicator/Pattern.java new file mode 100644 index 0000000..90eaee7 --- /dev/null +++ b/src/main/java/de/craftinc/replicator/Pattern.java @@ -0,0 +1,79 @@ +/* Craft Inc. Replicator + Copyright (C) 2013 Paul Schulze, Maximilian Häckel, Moritz Kaltofen + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +package de.craftinc.replicator; + +import org.bukkit.Material; + +/** + * Created with IntelliJ IDEA. + * User: Mochaccino + * Date: 18.03.13 + * Time: 20:33 + * To change this template use File | Settings | File Templates. + */ +public class Pattern { + private static final Material[][][] repPattern = {{{Material.OBSIDIAN,Material.OBSIDIAN,null},{Material.MOSSY_COBBLESTONE,Material.OBSIDIAN,null},{Material.GLOWSTONE,Material.OBSIDIAN,null}}, + {{Material.GOLD_BLOCK,Material.DIAMOND_BLOCK,Material.OBSIDIAN},{Material.AIR,Material.JACK_O_LANTERN,Material.OBSIDIAN},{Material.MOSSY_COBBLESTONE,Material.OBSIDIAN,null}}, + {{Material.OBSIDIAN,Material.OBSIDIAN,null},{Material.MOSSY_COBBLESTONE,Material.OBSIDIAN,null},{Material.GLOWSTONE,Material.OBSIDIAN,null}}}; + //direction north (replicator direction) + + public Material getCenter(){ + return repPattern[1][1][1]; + } + + public Material[][][] getNorth(){ + return repPattern; + } + + public Material[][][] getSouth(){ + Material[][][] newPattern = new Material[3][3][3]; + for(int x=0;x<=2;x++){ + for(int y=0;y<=2;y++){ + newPattern[x][y][0] = repPattern[x][y][2]; + newPattern[x][y][1] = repPattern[x][y][1]; + newPattern[x][y][2] = repPattern[x][y][0]; + } + } + return newPattern; + } + + public Material[][][] getWest(){ + Material[][][] newPattern = new Material[3][3][3]; + for(int x=0;x<=2;x++){ + for(int y=0;y<=2;y++){ + for(int z=0;z<=2;z++){ + newPattern[x][y][z] = repPattern[z][y][x]; + } + } + } + return newPattern; + } + + public Material[][][] getEast(){ + Material[][][] westPattern = getWest(); + Material[][][] newPattern = new Material[3][3][3]; + for(int y=0;y<=2;y++){ + for(int z=0;z<=2;z++){ + newPattern[0][y][z] = westPattern[2][y][z]; + newPattern[1][y][z] = westPattern[1][y][z]; + newPattern[2][y][z] = westPattern[0][y][z]; + } + } + return newPattern; + } +} diff --git a/src/main/java/de/craftinc/replicator/Replicator.java b/src/main/java/de/craftinc/replicator/Replicator.java index 1b30d2d..e449a10 100644 --- a/src/main/java/de/craftinc/replicator/Replicator.java +++ b/src/main/java/de/craftinc/replicator/Replicator.java @@ -65,7 +65,7 @@ public class Replicator { else return false; } - private BlockFace getDirection() { + private BlockFace getDirection(Location pumpkin) { if(this.pumpkin.getBlock().get) @@ -76,8 +76,10 @@ public class Replicator { else return null; } - private boolean isValid(){ + private boolean isValid(Location pumpkin){ + if(pumpkin.getBlock().getRelative(BlockFace.DOWN).equals(Material.DIAMOND_BLOCK)){ + } return false; }