mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-27 15:43:14 +00:00
Add ability for chisels to define their own chisel modes
This commit is contained in:
1 parent
999f96c63c
commit
da162db40a
7 files changed
+91
-17
No files matched your search
@@ -13,6 +13,7 @@ import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.carving.CarvingVariation;
|
||||
import com.cricketcraft.chisel.utils.General;
|
||||
@@ -72,7 +73,7 @@ public final class ChiselController {
|
||||
|
||||
if (chisel.canChiselBlock(event.world, x, y, z, block, metadata)) {
|
||||
ItemStack target = General.getChiselTarget(held);
|
||||
ChiselMode mode = General.getChiselMode(held);
|
||||
IChiselMode mode = General.getChiselMode(held);
|
||||
ForgeDirection sideHit = ForgeDirection.VALID_DIRECTIONS[event.face];
|
||||
|
||||
if (target != null) {
|
||||
|
||||
@@ -10,10 +10,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
import com.cricketcraft.chisel.network.PacketHandler;
|
||||
import com.cricketcraft.chisel.network.message.MessageChiselSound;
|
||||
|
||||
public enum ChiselMode {
|
||||
public enum ChiselMode implements IChiselMode {
|
||||
|
||||
SINGLE {
|
||||
|
||||
@@ -86,8 +87,6 @@ public enum ChiselMode {
|
||||
}
|
||||
};
|
||||
|
||||
public abstract void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation);
|
||||
|
||||
/**
|
||||
* Assumes that the player is holding a chisel
|
||||
*/
|
||||
@@ -116,8 +115,11 @@ public enum ChiselMode {
|
||||
}
|
||||
}
|
||||
|
||||
public ChiselMode next() {
|
||||
ChiselMode[] values = values();
|
||||
return values[(ordinal() + 1) % values.length];
|
||||
public static ChiselMode next(IChiselMode currentMode) {
|
||||
if (currentMode instanceof ChiselMode) {
|
||||
ChiselMode[] values = values();
|
||||
return values[(((ChiselMode) currentMode).ordinal() + 1) % values.length];
|
||||
}
|
||||
return SINGLE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user