Added tuning rod (continuation)
Simplified usage Prepared second tier Fixed block interaction Added recipes
This commit is contained in:
parent
f6b72830b7
commit
d928ed4bb3
5 changed files with 336 additions and 153 deletions
|
@ -166,7 +166,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
public static Item itemIC2reactorLaserFocus;
|
||||
public static ItemComponent itemComponent;
|
||||
public static ItemUpgrade itemUpgrade;
|
||||
public static ItemTuningRod itemWarptuner;
|
||||
public static ItemTuningRod itemTuningRod;
|
||||
|
||||
public static ArmorMaterial armorMaterial = EnumHelper.addArmorMaterial("WARP", 5, new int[] { 1, 3, 2, 1 }, 15);
|
||||
public static ItemHelmet itemHelmet;
|
||||
|
@ -409,8 +409,8 @@ public class WarpDrive implements LoadingCallback {
|
|||
GameRegistry.registerItem(itemUpgrade, "itemUpgrade");
|
||||
}
|
||||
|
||||
itemWarptuner = new ItemTuningRod();
|
||||
GameRegistry.registerItem(itemWarptuner, "itemWarptuner");
|
||||
itemTuningRod = new ItemTuningRod();
|
||||
GameRegistry.registerItem(itemTuningRod, "itemTuningRod");
|
||||
|
||||
|
||||
proxy.registerEntities();
|
||||
|
|
|
@ -26,6 +26,24 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|||
*
|
||||
*/
|
||||
public class Recipes {
|
||||
public static final String[] oreDyes = {
|
||||
"dyeBlack",
|
||||
"dyeRed",
|
||||
"dyeGreen",
|
||||
"dyeBrown",
|
||||
"dyeBlue",
|
||||
"dyePurple",
|
||||
"dyeCyan",
|
||||
"dyeLightGray",
|
||||
"dyeGray",
|
||||
"dyePink",
|
||||
"dyeLime",
|
||||
"dyeYellow",
|
||||
"dyeLightBlue",
|
||||
"dyeMagenta",
|
||||
"dyeOrange",
|
||||
"dyeWhite"
|
||||
};
|
||||
|
||||
public static void initVanilla() {
|
||||
// Components recipes
|
||||
|
@ -1163,6 +1181,26 @@ public class Recipes {
|
|||
'g', "blockGlassColorless",
|
||||
'c', ItemComponent.getItemStack(ComponentType.AIR_CANISTER)));
|
||||
|
||||
// Tuning rod ore dictionary
|
||||
for (int dyeColor = 0; dyeColor < 16; dyeColor++) {
|
||||
OreDictionary.registerOre("itemTuningRod", new ItemStack(WarpDrive.itemTuningRod, 1, dyeColor));
|
||||
}
|
||||
|
||||
// Tuning rod variations
|
||||
for (int dyeColor = 0; dyeColor < 16; dyeColor++) {
|
||||
|
||||
// crafting tuning rod
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.itemTuningRod, 1, dyeColor), false, " q", "iD ", " i ",
|
||||
'q', Items.quartz, // "gemQuartz", // Items.quartz,
|
||||
'i', Items.iron_ingot, // "ingotIron",
|
||||
'D', oreDyes[dyeColor] ));
|
||||
|
||||
// changing colors
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(WarpDrive.itemTuningRod, 1, dyeColor),
|
||||
oreDyes[dyeColor],
|
||||
"itemTuningRod"));
|
||||
}
|
||||
|
||||
// HULL blocks and variations
|
||||
initDynamicHull();
|
||||
}
|
||||
|
|
235
src/main/java/cr0s/warpdrive/item/ItemMultiWarpTuner.java
Normal file
235
src/main/java/cr0s/warpdrive/item/ItemMultiWarpTuner.java
Normal file
|
@ -0,0 +1,235 @@
|
|||
package cr0s.warpdrive.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.IBeamFrequency;
|
||||
import cr0s.warpdrive.api.IVideoChannel;
|
||||
|
||||
public class ItemMultiWarpTuner extends Item {
|
||||
static final int MODE_VIDEO_CHANNEL = 0;
|
||||
static final int MODE_BEAM_FREQUENCY = 1;
|
||||
static final String TAG_VIDEO_CHANNEL = "videoChannel";
|
||||
static final String TAG_BEAM_FREQUENCY = "beamFrequency";
|
||||
|
||||
private IIcon icons[];
|
||||
|
||||
public ItemMultiWarpTuner() {
|
||||
super();
|
||||
setMaxDamage(0);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("warpdrive.tool.MultiWarpTuner");
|
||||
setFull3D();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[16];
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("warpdrive:toolMultiWarpTuner_" + getDyeColorName(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDyeColorName(int metadata) {
|
||||
return ItemDye.field_150921_b[metadata];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
if (damage < icons.length) {
|
||||
return icons[damage];
|
||||
}
|
||||
return Blocks.fire.getFireIcon(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
|
||||
for(int dyeColor = 0; dyeColor < 16; dyeColor++) {
|
||||
list.add(new ItemStack(item, 1, dyeColor));
|
||||
}
|
||||
}
|
||||
|
||||
public static int getVideoChannel(ItemStack itemStack) {
|
||||
if (!(itemStack.getItem() instanceof ItemMultiWarpTuner)) {
|
||||
return -1;
|
||||
}
|
||||
if (!itemStack.hasTagCompound()) {
|
||||
return -1;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
if (nbt.hasKey(TAG_VIDEO_CHANNEL)) {
|
||||
return nbt.getInteger(TAG_VIDEO_CHANNEL);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack setVideoChannel(ItemStack itemStack, int videoChannel) {
|
||||
if (!(itemStack.getItem() instanceof ItemMultiWarpTuner) || videoChannel == -1) {
|
||||
return itemStack;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();;
|
||||
if (nbt == null) {
|
||||
nbt = new NBTTagCompound();
|
||||
}
|
||||
nbt.setInteger(TAG_VIDEO_CHANNEL, videoChannel);
|
||||
itemStack.setTagCompound(nbt);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static int getBeamFrequency(ItemStack itemStack) {
|
||||
if (!(itemStack.getItem() instanceof ItemMultiWarpTuner)) {
|
||||
return -1;
|
||||
}
|
||||
if (!itemStack.hasTagCompound()) {
|
||||
return -1;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
if (nbt.hasKey(TAG_BEAM_FREQUENCY)) {
|
||||
return nbt.getInteger(TAG_BEAM_FREQUENCY);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack setBeamFrequency(ItemStack itemStack, int beamFrequency) {
|
||||
if (!(itemStack.getItem() instanceof ItemMultiWarpTuner) || beamFrequency == -1) {
|
||||
return itemStack;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
if (nbt == null) {
|
||||
nbt = new NBTTagCompound();
|
||||
}
|
||||
nbt.setInteger(TAG_BEAM_FREQUENCY, beamFrequency);
|
||||
itemStack.setTagCompound(nbt);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (world.isRemote || !(itemStack.getItem() instanceof ItemMultiWarpTuner)) {
|
||||
return itemStack;
|
||||
}
|
||||
if (entityPlayer.isSneaking()) {
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
setVideoChannel(itemStack, world.rand.nextInt(32768));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.use.getVideoChannel",
|
||||
getVideoChannel(itemStack)));
|
||||
return itemStack;
|
||||
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
setBeamFrequency(itemStack, world.rand.nextInt(65000));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.use.getBeamFrequency",
|
||||
getBeamFrequency(itemStack)));
|
||||
return itemStack;
|
||||
|
||||
default:
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
itemStack.setItemDamage(MODE_BEAM_FREQUENCY);
|
||||
entityPlayer.setCurrentItemOrArmor(0, itemStack);
|
||||
break;
|
||||
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
itemStack.setItemDamage(MODE_VIDEO_CHANNEL);
|
||||
entityPlayer.setCurrentItemOrArmor(0, itemStack);
|
||||
break;
|
||||
|
||||
default:
|
||||
itemStack.setItemDamage(MODE_VIDEO_CHANNEL);
|
||||
break;
|
||||
}
|
||||
world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
if (tileEntity instanceof IVideoChannel) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
setVideoChannel(itemStack, ((IVideoChannel)tileEntity).getVideoChannel());
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.use.getVideoChannel",
|
||||
getVideoChannel(itemStack)));
|
||||
} else {
|
||||
((IVideoChannel)tileEntity).setVideoChannel(getVideoChannel(itemStack));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.use.setVideoChannel",
|
||||
tileEntity.getBlockType().getLocalizedName(),
|
||||
getVideoChannel(itemStack)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
if (tileEntity instanceof IBeamFrequency) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
setBeamFrequency(itemStack, ((IBeamFrequency)tileEntity).getBeamFrequency());
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.use.getBeamFrequency",
|
||||
getBeamFrequency(itemStack)));
|
||||
} else {
|
||||
((IBeamFrequency)tileEntity).setBeamFrequency(getBeamFrequency(itemStack));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.use.setBeamFrequency",
|
||||
tileEntity.getBlockType().getLocalizedName(),
|
||||
getBeamFrequency(itemStack)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean advancedItemTooltips) {
|
||||
super.addInformation(itemStack, entityPlayer, list, advancedItemTooltips);
|
||||
|
||||
String tooltip = "";
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
tooltip += StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.tooltip.videoChannel", getVideoChannel(itemStack));
|
||||
// String.format("Video channel set to %1$d", getVideoChannel(itemStack));
|
||||
break;
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
tooltip += StatCollector.translateToLocalFormatted("item.warpdrive.tool.MultiWarpTuner.tooltip.beamFrequency", getBeamFrequency(itemStack));
|
||||
// tooltip = String.format("Laser frequency set to %{0}i", getBeamFrequency(itemStack));
|
||||
break;
|
||||
default:
|
||||
tooltip += "I'm broken :(";
|
||||
break;
|
||||
}
|
||||
|
||||
tooltip += StatCollector.translateToLocal("item.warpdrive.tool.MultiWarpTuner.tooltip.usage");
|
||||
|
||||
WarpDrive.addTooltip(list, tooltip);
|
||||
}
|
||||
}
|
|
@ -3,11 +3,12 @@ package cr0s.warpdrive.item;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
@ -17,11 +18,6 @@ import cr0s.warpdrive.api.IBeamFrequency;
|
|||
import cr0s.warpdrive.api.IVideoChannel;
|
||||
|
||||
public class ItemTuningRod extends Item {
|
||||
static final int MODE_VIDEO_CHANNEL = 0;
|
||||
static final int MODE_BEAM_FREQUENCY = 1;
|
||||
static final String TAG_VIDEO_CHANNEL = "videoChannel";
|
||||
static final String TAG_BEAM_FREQUENCY = "beamFrequency";
|
||||
|
||||
private IIcon icons[];
|
||||
|
||||
public ItemTuningRod() {
|
||||
|
@ -30,13 +26,21 @@ public class ItemTuningRod extends Item {
|
|||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("warpdrive.tool.TuningRod");
|
||||
setFull3D();
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[2];
|
||||
icons[MODE_VIDEO_CHANNEL] = iconRegister.registerIcon("warpdrive:toolTuningRod_videoChannel");
|
||||
icons[MODE_BEAM_FREQUENCY] = iconRegister.registerIcon("warpdrive:toolTuningRod_beamFrequency");
|
||||
icons = new IIcon[16];
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("warpdrive:toolTuningRod_" + getDyeColorName(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDyeColorName(int metadata) {
|
||||
return ItemDye.field_150921_b[metadata];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,106 +51,38 @@ public class ItemTuningRod extends Item {
|
|||
return Blocks.fire.getFireIcon(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
|
||||
for(int dyeColor = 0; dyeColor < 16; dyeColor++) {
|
||||
list.add(new ItemStack(item, 1, dyeColor));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int damage = itemStack.getItemDamage();
|
||||
if (damage >= 0 && damage < 16) {
|
||||
return "item.warpdrive.cratool.TuningRod." + getDyeColorName(damage);
|
||||
}
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
public static int getVideoChannel(ItemStack itemStack) {
|
||||
if (!(itemStack.getItem() instanceof ItemTuningRod)) {
|
||||
return -1;
|
||||
}
|
||||
if (!itemStack.hasTagCompound()) {
|
||||
return -1;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
if (nbt.hasKey(TAG_VIDEO_CHANNEL)) {
|
||||
return nbt.getInteger(TAG_VIDEO_CHANNEL);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack setVideoChannel(ItemStack itemStack, int videoChannel) {
|
||||
if (!(itemStack.getItem() instanceof ItemTuningRod) || videoChannel == -1) {
|
||||
return itemStack;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();;
|
||||
if (nbt == null) {
|
||||
nbt = new NBTTagCompound();
|
||||
}
|
||||
nbt.setInteger(TAG_VIDEO_CHANNEL, videoChannel);
|
||||
itemStack.setTagCompound(nbt);
|
||||
return itemStack;
|
||||
return (itemStack.getItemDamage() % 16) + 100;
|
||||
}
|
||||
|
||||
public static int getBeamFrequency(ItemStack itemStack) {
|
||||
if (!(itemStack.getItem() instanceof ItemTuningRod)) {
|
||||
return -1;
|
||||
}
|
||||
if (!itemStack.hasTagCompound()) {
|
||||
return -1;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
if (nbt.hasKey(TAG_BEAM_FREQUENCY)) {
|
||||
return nbt.getInteger(TAG_BEAM_FREQUENCY);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack setBeamFrequency(ItemStack itemStack, int beamFrequency) {
|
||||
if (!(itemStack.getItem() instanceof ItemTuningRod) || beamFrequency == -1) {
|
||||
return itemStack;
|
||||
}
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();;
|
||||
if (nbt == null) {
|
||||
nbt = new NBTTagCompound();
|
||||
}
|
||||
nbt.setInteger(TAG_BEAM_FREQUENCY, beamFrequency);
|
||||
itemStack.setTagCompound(nbt);
|
||||
return itemStack;
|
||||
return ((itemStack.getItemDamage() % 16) + 1) * 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (world.isRemote || !(itemStack.getItem() instanceof ItemTuningRod)) {
|
||||
return itemStack;
|
||||
}
|
||||
if (entityPlayer.isSneaking()) {
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
setVideoChannel(itemStack, world.rand.nextInt(32768));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.use.getVideoChannel",
|
||||
getVideoChannel(itemStack)));
|
||||
return itemStack;
|
||||
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
setBeamFrequency(itemStack, world.rand.nextInt(65000));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.use.getBeamFrequency",
|
||||
getBeamFrequency(itemStack)));
|
||||
return itemStack;
|
||||
|
||||
default:
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
itemStack.setItemDamage(MODE_BEAM_FREQUENCY);
|
||||
entityPlayer.setCurrentItemOrArmor(0, itemStack);
|
||||
break;
|
||||
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
itemStack.setItemDamage(MODE_VIDEO_CHANNEL);
|
||||
entityPlayer.setCurrentItemOrArmor(0, itemStack);
|
||||
break;
|
||||
|
||||
default:
|
||||
itemStack.setItemDamage(MODE_VIDEO_CHANNEL);
|
||||
break;
|
||||
}
|
||||
world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
@ -155,42 +91,29 @@ public class ItemTuningRod extends Item {
|
|||
return false;
|
||||
}
|
||||
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
if (tileEntity instanceof IVideoChannel) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
setVideoChannel(itemStack, ((IVideoChannel)tileEntity).getVideoChannel());
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.use.getVideoChannel",
|
||||
getVideoChannel(itemStack)));
|
||||
} else {
|
||||
boolean hasVideoChannel = tileEntity instanceof IVideoChannel;
|
||||
boolean hasBeamFrequency = tileEntity instanceof IBeamFrequency;
|
||||
if (!hasVideoChannel && !hasBeamFrequency) {
|
||||
return false;
|
||||
}
|
||||
if (hasVideoChannel && !(entityPlayer.isSneaking() && hasBeamFrequency)) {
|
||||
((IVideoChannel)tileEntity).setVideoChannel(getVideoChannel(itemStack));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.use.setVideoChannel",
|
||||
tileEntity.getBlockType().getLocalizedName(),
|
||||
getVideoChannel(itemStack)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
if (tileEntity instanceof IBeamFrequency) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
setBeamFrequency(itemStack, ((IBeamFrequency)tileEntity).getBeamFrequency());
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.use.getBeamFrequency",
|
||||
getBeamFrequency(itemStack)));
|
||||
} else {
|
||||
world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F);
|
||||
} else if (hasBeamFrequency) {
|
||||
((IBeamFrequency)tileEntity).setBeamFrequency(getBeamFrequency(itemStack));
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.use.setBeamFrequency",
|
||||
tileEntity.getBlockType().getLocalizedName(),
|
||||
getBeamFrequency(itemStack)));
|
||||
world.playSoundAtEntity(entityPlayer, "WarpDrive:ding", 0.1F, 1F);
|
||||
} else {
|
||||
WarpDrive.addChatMessage(entityPlayer, "Error: invalid state, please contact the mod authors"
|
||||
+ "\nof " + itemStack
|
||||
+ "\nand " + tileEntity);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,19 +121,8 @@ public class ItemTuningRod extends Item {
|
|||
super.addInformation(itemStack, entityPlayer, list, advancedItemTooltips);
|
||||
|
||||
String tooltip = "";
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case MODE_VIDEO_CHANNEL:
|
||||
tooltip += StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.tooltip.videoChannel", getVideoChannel(itemStack));
|
||||
// String.format("Video channel set to %1$d", getVideoChannel(itemStack));
|
||||
break;
|
||||
case MODE_BEAM_FREQUENCY:
|
||||
tooltip += StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.tooltip.beamFrequency", getBeamFrequency(itemStack));
|
||||
// tooltip = String.format("Laser frequency set to %{0}i", getBeamFrequency(itemStack));
|
||||
break;
|
||||
default:
|
||||
tooltip += "I'm broken :(";
|
||||
break;
|
||||
}
|
||||
tooltip += "\n" + StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningRod.tooltip.beamFrequency", getBeamFrequency(itemStack));
|
||||
|
||||
tooltip += StatCollector.translateToLocal("item.warpdrive.tool.TuningRod.tooltip.usage");
|
||||
|
||||
|
|
|
@ -28,12 +28,10 @@ item.warpdrive.upgrade.Range.name=Range Upgrade
|
|||
item.warpdrive.upgrade.Energy.name=Energy Upgrade
|
||||
|
||||
item.warpdrive.tool.TuningRod.name=Tuning rod
|
||||
item.warpdrive.tool.TuningRod.tooltip.videoChannel=Video channel set to %1$d
|
||||
item.warpdrive.tool.TuningRod.tooltip.beamFrequency=Laser frequency set to %1$d
|
||||
item.warpdrive.tool.TuningRod.tooltip.usage=\n\n§bRight click a block§7 to tune its crystals\n§bSneak right click a block§7 to fetch its frequency\n§bRight click in air§7 to change mode\n§bSneak right click§7 in air to generate a random frequency
|
||||
item.warpdrive.tool.TuningRod.use.getVideoChannel=Tuning rod is now tuned to Video channel %1$d
|
||||
item.warpdrive.tool.TuningRod.tooltip.videoChannel=Video channel is set to %1$d
|
||||
item.warpdrive.tool.TuningRod.tooltip.beamFrequency=Beam frequency is set to %1$d
|
||||
item.warpdrive.tool.TuningRod.tooltip.usage=\n\n§bRight click a block§7 to tune its crystals\n§bSneak§7 to tune alternate crystals
|
||||
item.warpdrive.tool.TuningRod.use.setVideoChannel=%1$s is now tuned to Video channel %2$d
|
||||
item.warpdrive.tool.TuningRod.use.getBeamFrequency=Tuning rod is now aligned with Beam frequency %1$d
|
||||
item.warpdrive.tool.TuningRod.use.setBeamFrequency=%1$s is now aligned with Beam frequency %2$d
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue