Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicit height flag for grass path. Bukkit model for stairs.
- Loading branch information
Showing
9 changed files
with
144 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...mpatBukkit/src/main/java/fr/neatmonster/nocheatplus/compat/bukkit/model/BukkitStairs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package fr.neatmonster.nocheatplus.compat.bukkit.model; | ||
|
||
import org.bukkit.World; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.block.BlockState; | ||
import org.bukkit.block.data.Bisected.Half; | ||
import org.bukkit.block.data.BlockData; | ||
import org.bukkit.block.data.type.Stairs; | ||
|
||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache; | ||
|
||
public class BukkitStairs implements BukkitShapeModel { | ||
|
||
@Override | ||
public double[] getShape(final BlockCache blockCache, | ||
final World world, final int x, final int y, final int z) { | ||
|
||
// TODO: With fake data, this could simply return full bounds. | ||
|
||
// final Block block = world.getBlockAt(x, y, z); | ||
// final BlockState state = block.getState(); | ||
// final BlockData blockData = state.getBlockData(); | ||
// | ||
// if (blockData instanceof Stairs) { | ||
// final Stairs stairs = (Stairs) blockData; | ||
// final Half half = stairs.getHalf(); | ||
// //final Shape shape = stairs.getShape(); | ||
// // TODO: Refine later, with sub shapes. | ||
// switch (half) { | ||
// case BOTTOM: | ||
// return new double[] {0.0, 0.0, 0.0, 1.0, 0.5, 1.0}; | ||
// case TOP: | ||
// return new double[] {0.0, 0.5, 0.0, 1.0, 1.0, 1.0}; | ||
// default: | ||
// break; | ||
// | ||
// } | ||
// } | ||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0}; | ||
} | ||
|
||
@Override | ||
public int getFakeData(final BlockCache blockCache, | ||
final World world, final int x, final int y, final int z) { | ||
final Block block = world.getBlockAt(x, y, z); | ||
final BlockState state = block.getState(); | ||
final BlockData blockData = state.getBlockData(); | ||
|
||
if (blockData instanceof Stairs) { | ||
final Stairs stairs = (Stairs) blockData; | ||
final Half half = stairs.getHalf(); | ||
//final Shape shape = stairs.getShape(); | ||
// TODO: Refine later, with sub shapes. | ||
switch (half) { | ||
case TOP: | ||
return 0x4; | ||
default: | ||
break; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters