Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
buildnumber=h1
buildnumber=h8
mod_version=0.9

minecraft_version=1.7.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public void dirtyInventory()
@Override
public void dirtyTanks()
{
// for now none is calling this for tile.backpack
// if we really want to use it, we have to re-implement it, more efficient way
dirtyInventory();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ public boolean updateTankSlots()
@Override
public void dirtyExtended()
{
// for now none is calling this for tile.backpack
// if we really want to use it, we have to re-implement it, more efficient way
dirtyInventory();
}
Expand All @@ -208,7 +207,6 @@ public void dirtyExtended()
@Override
public void dirtyTime()
{
// for now none is calling this for tile.backpack
// if we really want to use it, we have to re-implement it, more efficient way
dirtyInventory();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ else if (!GuiScreen.isCtrlKeyDown())
tooltips.add(TipUtils.pressKeyFormat(TipUtils.actionKeyFormat()) + l10n("backpack.cycling.key1"));
tooltips.add(l10n("backpack.cycling.key2") + " " + TipUtils.switchTooltip(!cycling, false));

if (BackpackTypes.isNightVision(BackpackTypes.getType(backpackTag.getByte(TAG_TYPE))))
if (BackpackTypes.isNightVision(type))
{
boolean vision = !backpackTag.getBoolean(TAG_DISABLE_NVISION);
tooltips.add(l10n("backpack.vision") + ": " + TipUtils.switchTooltip(vision, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;

import com.darkona.adventurebackpack.util.BackpackUtils;

Expand Down Expand Up @@ -192,6 +193,11 @@ public static String getSkinName(ItemStack backpack)
return getSkinName(getType(backpack));
}

public static String getLocalizedName(BackpackTypes type)
{
return StatCollector.translateToLocal("adventurebackpack:skin.name." + type.name().toLowerCase());
}

public static byte getMeta(BackpackTypes type)
{
return type.meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static ChunkCoordinates checkCoordsForBackpack(IBlockAccess world, int c

private static boolean isAirOrReplaceable(IBlockAccess world, int cX, int cY, int cZ)
{
return world.isAirBlock(cX, cY, cZ) && world.getBlock(cX, cY, cZ).isReplaceable(world, cX, cY, cZ);
return world.isAirBlock(cX, cY, cZ) || world.getBlock(cX, cY, cZ).isReplaceable(world, cX, cY, cZ);
}

private static ChunkCoordinates checkCoordsForPlayer(IBlockAccess world, int origX, int origZ, int cX, int cY, int cZ, boolean except)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ private static String holdThe(boolean button)
: l10n("hold.ctrl")) + ">");
}

public static String whiteFormat(String theString)
public static String whiteFormat(String stringIn)
{
return EnumChatFormatting.WHITE + theString + EnumChatFormatting.GRAY;
return EnumChatFormatting.WHITE + stringIn + EnumChatFormatting.GRAY;
}

public static String actionKeyFormat()
Expand Down
56 changes: 37 additions & 19 deletions src/main/java/com/darkona/adventurebackpack/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,63 +53,80 @@ public static int[] createSlotArray(int first, int count)
EnumChatFormatting.YELLOW, EnumChatFormatting.GREEN, EnumChatFormatting.AQUA, EnumChatFormatting.BLUE,
EnumChatFormatting.DARK_PURPLE};

public static String makeItRainbow(String theString)
public static String makeItRainbow(String stringIn)
{
StringBuilder rainbowed = new StringBuilder(theString.length() * 3); // special characters = length * 2
for (int i = 0; i < theString.length(); i++)
StringBuilder rainbowed = new StringBuilder(stringIn.length() * 3); // special characters = length * 2
for (int i = 0; i < stringIn.length(); i++)
{
rainbowed.append(RAINBOW_SEQUENCE[i % RAINBOW_SEQUENCE.length]).append(theString.charAt(i));
rainbowed.append(RAINBOW_SEQUENCE[i % RAINBOW_SEQUENCE.length]).append(stringIn.charAt(i));
}
return rainbowed.toString();
}

public static String getColoredSkinName(BackpackTypes type)
{
String result = "";
String skinName = BackpackTypes.getSkinName(type);
String result;
String name = BackpackTypes.getLocalizedName(type);
switch (type)
{
case BAT:
result += EnumChatFormatting.DARK_PURPLE + skinName;
result = EnumChatFormatting.DARK_PURPLE + name;
break;
case EMERALD:
result = animateString(name, EnumChatFormatting.GREEN);
break;
case DIAMOND:
result = animateString(name, EnumChatFormatting.AQUA);
break;
case DRAGON:
result += EnumChatFormatting.LIGHT_PURPLE + skinName;
result = EnumChatFormatting.LIGHT_PURPLE + name;
break;
case GOLD:
result = animateString(name, EnumChatFormatting.YELLOW);
break;
case IRON_GOLEM:
result = EnumChatFormatting.WHITE + name;
break;
case OBSIDIAN:
result = animateString(name, EnumChatFormatting.DARK_PURPLE);
break;
case PIGMAN:
result += EnumChatFormatting.RED + skinName;
result = EnumChatFormatting.RED + name;
break;
case QUARTZ:
result += makeWhiteAnimation(skinName);
result = animateString(name, EnumChatFormatting.WHITE);
break;
case RAINBOW:
result += makeItRainbow(skinName);
result = makeItRainbow(name);
break;
case SQUID:
result += EnumChatFormatting.DARK_AQUA + skinName;
result = EnumChatFormatting.DARK_AQUA + name;
break;
default:
result += skinName;
result = name;
break;
}
return result;
}

private static String makeWhiteAnimation(String string)
private static String animateString(String stringIn, EnumChatFormatting bold)
{
return animateString(string, EnumChatFormatting.GRAY, EnumChatFormatting.WHITE);
return animateString(stringIn, EnumChatFormatting.GRAY, bold);
}

private static String animateString(String stringIn, EnumChatFormatting regular, EnumChatFormatting bold)
{
int len = stringIn.length();
int time = Math.abs((int) Minecraft.getMinecraft().theWorld.getWorldTime());
int charID = time % len;

int n = 10;
int phaseFactor = time % (n * len); // makes n phases with len length
int k = 1; // animation slowness coefficient, changes charID every k ticks, k = 1 for max speed
int charID = (time / k) % len ;

int n = 100 / len; // makes n phases with len length
int phaseFactor = (time / k) % (len * n);
int phase = 1 + phaseFactor / len;

if (phase < 3)
if (phase == 1)
{
return decorateCharInString(stringIn, charID, regular, bold, phase % 2 != 0);
}
Expand All @@ -130,4 +147,5 @@ else if (i == (dir ? charID + 1 : charID - 1) && regular != null)
}
return decorated.toString();
}

}
80 changes: 80 additions & 0 deletions src/main/resources/assets/adventurebackpack/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,83 @@ adventurebackpack:tooltips.hose.key.mode=to change mode
adventurebackpack:tooltips.hose.dump1=Put Hose into bucketOut slot of wearable pack
adventurebackpack:tooltips.hose.dump2=to empty corresponded tank
adventurebackpack:tooltips.hose.dump.warn=WARNING! Fluid will be dumped and lost. Forever.

## Skins
adventurebackpack:skin.name.standard=Standard
adventurebackpack:skin.name.bat=Bat
adventurebackpack:skin.name.black=Black
adventurebackpack:skin.name.blaze=Blaze
adventurebackpack:skin.name.blue=Blue
adventurebackpack:skin.name.bookshelf=Bookshelf
adventurebackpack:skin.name.brown=Brown
adventurebackpack:skin.name.brown_mushroom=Brown Mushroom
adventurebackpack:skin.name.cactus=Cactus
adventurebackpack:skin.name.cake=Cake
adventurebackpack:skin.name.carrot=Carrot
adventurebackpack:skin.name.chest=Chest
adventurebackpack:skin.name.chicken=Chicken
adventurebackpack:skin.name.coal=Coal
adventurebackpack:skin.name.cookie=Cookie
adventurebackpack:skin.name.cow=Cow
adventurebackpack:skin.name.creeper=Creeper
adventurebackpack:skin.name.cyan=Cyan
adventurebackpack:skin.name.deluxe=Deluxe
adventurebackpack:skin.name.diamond=Diamond
adventurebackpack:skin.name.dragon=Dragon
adventurebackpack:skin.name.egg=Egg
adventurebackpack:skin.name.electric=Electric
adventurebackpack:skin.name.emerald=Emerald
adventurebackpack:skin.name.end=End
adventurebackpack:skin.name.enderman=Enderman
adventurebackpack:skin.name.ghast=Ghast
adventurebackpack:skin.name.glowstone=Glowstone
adventurebackpack:skin.name.gold=Gold
adventurebackpack:skin.name.gray=Gray
adventurebackpack:skin.name.green=Green
adventurebackpack:skin.name.haybale=Haybale
adventurebackpack:skin.name.horse=Horse
adventurebackpack:skin.name.iron=Iron
adventurebackpack:skin.name.iron_golem=Iron Golem
adventurebackpack:skin.name.lapis=Lapis
adventurebackpack:skin.name.leather=Leather
adventurebackpack:skin.name.light_blue=Light Blue
adventurebackpack:skin.name.light_gray=Light Gray
adventurebackpack:skin.name.lime=Lime
adventurebackpack:skin.name.magenta=Magenta
adventurebackpack:skin.name.magma_cube=Magma Cube
adventurebackpack:skin.name.melon=Melon
adventurebackpack:skin.name.modded_network=Modded Network
adventurebackpack:skin.name.mooshroom=Mooshroom
adventurebackpack:skin.name.nether=Nether
adventurebackpack:skin.name.obsidian=Obsidian
adventurebackpack:skin.name.ocelot=Ocelot
adventurebackpack:skin.name.orange=Orange
adventurebackpack:skin.name.overworld=Overworld
adventurebackpack:skin.name.pig=Pig
adventurebackpack:skin.name.pigman=Pigman
adventurebackpack:skin.name.pink=Pink
adventurebackpack:skin.name.pumpkin=Pumpkin
adventurebackpack:skin.name.purple=Purple
adventurebackpack:skin.name.quartz=Quartz
adventurebackpack:skin.name.rainbow=Rainbow
adventurebackpack:skin.name.red=Red
adventurebackpack:skin.name.red_mushroom=Red Mushroom
adventurebackpack:skin.name.redstone=Redstone
adventurebackpack:skin.name.sandstone=Sandstone
adventurebackpack:skin.name.sheep=Sheep
adventurebackpack:skin.name.silverfish=Silverfish
adventurebackpack:skin.name.skeleton=Skeleton
adventurebackpack:skin.name.slime=Slime
adventurebackpack:skin.name.snow=Snow
adventurebackpack:skin.name.spider=Spider
adventurebackpack:skin.name.sponge=Sponge
adventurebackpack:skin.name.squid=Squid
adventurebackpack:skin.name.sunflower=Sunflower
adventurebackpack:skin.name.villager=Villager
adventurebackpack:skin.name.white=White
adventurebackpack:skin.name.wither=Wither
adventurebackpack:skin.name.wither_skeleton=Wither Skeleton
adventurebackpack:skin.name.wolf=Wolf
adventurebackpack:skin.name.yellow=Yellow
adventurebackpack:skin.name.zombie=Zombie
adventurebackpack:skin.name.unknown=UNKNOWN