Begin chisel mode implementation

This commit is contained in:
tterrag1098 committed 2015-01-18 14:40:39 -05:00
1 parent 86713ab449
commit 89299f6e27
8 files changed
+141 -33

No files matched your search

@@ -2,6 +2,7 @@ package com.cricketcraft.chisel.utils;
import java.util.Random;
import joptsimple.internal.Strings;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -14,6 +15,10 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import com.cricketcraft.chisel.api.ChiselMode;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.cricketcraft.chisel.carving.Carving;
public class General {
public static Random rand = new Random();
@@ -98,8 +103,8 @@ public class General {
public static final String[] sGNames = new String[] { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink", "Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green",
"Red", "Black" };
public static final String[] featureColors = new String[] { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "darkgray", "lightgray", "cyan", "purple", "blue", "brown", "green",
"red", "black" };
public static final String[] featureColors = new String[] { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "darkgray", "lightgray", "cyan", "purple", "blue", "brown",
"green", "red", "black" };
public static void setChiselTarget(ItemStack chisel, ItemStack target) {
initTag(chisel);
@@ -115,4 +120,23 @@ public class General {
stack.setTagCompound(new NBTTagCompound());
}
}
private static final String MODE_KEY = "chiselMode";
public static ChiselMode getChiselMode(ItemStack chisel) {
if (chisel.stackTagCompound == null || Strings.isNullOrEmpty(chisel.stackTagCompound.getString(MODE_KEY))) {
initTag(chisel);
chisel.stackTagCompound.setString(MODE_KEY, ChiselMode.SINGLE.name());
}
return Enum.valueOf(ChiselMode.class, chisel.stackTagCompound.getString(MODE_KEY));
}
public static void setChiselMode(ItemStack chisel, ChiselMode mode) {
initTag(chisel);
chisel.stackTagCompound.setString(MODE_KEY, mode.name());
}
public static ICarvingVariation getVariation(ItemStack stack) {
return Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
}
}