private Material createMaterial(String side) { Material mat = new Material(boxle.getAssetManager(), jm3dName); mat.setName("block_" + block.getName() + "_" + side); mat.setTransparent( block.isTransparent()); // Does not actually do anything, but is used as a marker mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha); mat.getAdditionalRenderState().setAlphaTest(true); mat.getAdditionalRenderState().setAlphaFallOff(.9f); return mat; }
@Override public boolean place( Item item, Block block, Block target, int face, double fx, double fy, double fz, Player player) { Block below = this.getSide(0); if (!target.isTransparent() && face != 0) { int[] faces = new int[] { 0, // 0, nerver used 5, // 1 4, // 2 3, // 3 2, // 4 1, // 5 }; this.meta = faces[face]; this.getLevel().setBlock(block, this, true, true); return true; } else if (!below.isTransparent() || below instanceof BlockFence || below.getId() == COBBLE_WALL) { this.meta = 0; this.getLevel().setBlock(block, this, true, true); return true; } return false; }
@Override public boolean place( Item item, Block block, Block target, int face, double fx, double fy, double fz, Player player) { Block down = getSide(0); if (!down.isTransparent()) { getLevel().setBlock(block, this, true, true); return true; } return false; }
public boolean canConnect(Block block) { return (!(block.getId() != COBBLE_WALL && block.getId() != FENCE_GATE)) || block.isSolid() && !block.isTransparent(); }