diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-09-05 20:11:13 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-09-05 20:11:13 -0400 |
| commit | 6e097a5056ad343271e21109f593f7cb77e4667e (patch) | |
| tree | bcd4953e8200ef33b727b1c0afe7b7265647f50e | |
| parent | cdbbd891c43e082a36a32e49420bf87b6edd28e0 (diff) | |
More affix work, and some other cleanups
13 files changed, 446 insertions, 177 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/affixes/DamageAffix.java b/src/main/java/darkknight/jewelrycraft/affixes/DamageAffix.java index 30c89ae..2cbfce3 100644 --- a/src/main/java/darkknight/jewelrycraft/affixes/DamageAffix.java +++ b/src/main/java/darkknight/jewelrycraft/affixes/DamageAffix.java @@ -1,16 +1,30 @@ package darkknight.jewelrycraft.affixes; import darkknight.jewelrycraft.api.ModifierEffect; -import net.minecraft.entity.Entity; +import darkknight.jewelrycraft.item.ItemBaseJewelry; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; public class DamageAffix extends ModifierEffect { - - public DamageAffix() { + private float befFlat; + private float affFlat; + + private float mult; + + public DamageAffix(float befFlat, float affFlat, float mult) { super(null); + + this.befFlat = befFlat; + this.affFlat = affFlat; + + this.mult = mult; + } + + @Override + public void onEntityHurt(ItemStack item, EntityPlayer player, LivingHurtEvent event, ItemBaseJewelry jewelry) { + event.ammount += befFlat; + event.ammount *= mult; + event.ammount += affFlat; } - } diff --git a/src/main/java/darkknight/jewelrycraft/affixes/HealthAffix.java b/src/main/java/darkknight/jewelrycraft/affixes/HealthAffix.java index 56ec244..90fc1a4 100644 --- a/src/main/java/darkknight/jewelrycraft/affixes/HealthAffix.java +++ b/src/main/java/darkknight/jewelrycraft/affixes/HealthAffix.java @@ -23,7 +23,7 @@ public class HealthAffix extends ModifierEffect { @Override public void onJewelryUnequipped(ItemStack item, Item jewelry, EntityPlayer player) { - player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + health); - player.setHealth(player.getHealth() + health); + player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - health); + player.setHealth(player.getHealth() - health); } } diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java index 6bf37ee..7f22b3e 100755 --- a/src/main/java/darkknight/jewelrycraft/api/Curse.java +++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java @@ -15,6 +15,7 @@ import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingHealEvent;
+import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.event.world.BlockEvent;
@@ -355,4 +356,14 @@ public abstract class Curse { public void playerSleepAction(World worldObj, EntityPlayer player, PlayerSleepInBedEvent event) {
}
+
+ public void onEntityHurt(World worldObj, EntityPlayer player, LivingHurtEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onPlayerHurt(World worldObj, EntityPlayer player, LivingHurtEvent event) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java index 34d32bf..5ee4e22 100755 --- a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java +++ b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
/**
@@ -110,4 +111,8 @@ public interface IJewelryItem { public void onJewelryUnequipped(ItemStack item);
public void onLivingDropItems(ItemStack item, EntityPlayer player, LivingDropsEvent event);
+
+ public void onPlayerHurt(ItemStack jewelryItems, EntityPlayer player, LivingHurtEvent event);
+
+ public void onEntityHurt(ItemStack jewelryItems, EntityPlayer player, LivingHurtEvent event);
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/ModifierEffect.java b/src/main/java/darkknight/jewelrycraft/api/ModifierEffect.java index cbd740b..61358cf 100755 --- a/src/main/java/darkknight/jewelrycraft/api/ModifierEffect.java +++ b/src/main/java/darkknight/jewelrycraft/api/ModifierEffect.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
public class ModifierEffect {
@@ -204,4 +205,16 @@ public class ModifierEffect { // TODO Auto-generated method stub
}
+
+ public void onPlayerHurt(ItemStack item, EntityPlayer player, LivingHurtEvent event,
+ ItemBaseJewelry jewelry) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onEntityHurt(ItemStack item, EntityPlayer player, LivingHurtEvent event,
+ ItemBaseJewelry jewelry) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java b/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java index b39f1c9..97b4406 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; public class CurseDoubleDown extends Curse { public CurseDoubleDown(String name, int txtID, String pack) { @@ -21,7 +22,9 @@ public class CurseDoubleDown extends Curse { return; // Don't stack double down } - player.attackEntityFrom(DamageSourceList.doubleDown, event.ammount); + if (!world.isRemote) { + player.attackEntityFrom(DamageSourceList.doubleDown, event.ammount); + } } @Override @@ -30,7 +33,9 @@ public class CurseDoubleDown extends Curse { return; // Don't stack double down } - target.attackEntityFrom(DamageSourceList.doubleDown, event.ammount); + if (!world.isRemote) { + target.attackEntityFrom(DamageSourceList.doubleDown, event.ammount); + } } @Override diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java b/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java index 41219f2..2818d88 100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java @@ -37,18 +37,25 @@ public class CurseHumbleBundle extends Curse { @Override
public void onBlockItemsDrop(EntityPlayer player, BlockEvent.HarvestDropsEvent event) {
for (ItemStack item : event.drops) {
- ItemStack drop = item.copy();
+ if (item.isStackable()) {
+ item.stackSize = Math.min(item.stackSize + 1, item.getMaxStackSize());
+ } else {
+ ItemStack drop = item.copy();
- if (drop.getItem() != Item.getItemFromBlock(event.block))
- dropItem(event.world, event.x, event.y, event.z, drop);
+ if (drop.getItem() != Item.getItemFromBlock(event.block)) {
+ dropItem(event.world, event.x, event.y, event.z, drop);
+ }
+ }
}
}
public void dropItem(World world, double x, double y, double z, ItemStack stack) {
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
+
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
+
world.spawnEntityInWorld(entityitem);
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java index 6b30bb4..b179391 100755 --- a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java @@ -34,11 +34,8 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.*;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
-import net.minecraftforge.event.entity.living.LivingAttackEvent;
-import net.minecraftforge.event.entity.living.LivingDeathEvent;
-import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
-import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
@@ -327,8 +324,8 @@ public class EntityEventHandler { event.setCanceled(true);
}
if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem)
- ((IJewelryItem) getJewelryItems(playerInfo, i).getItem()).onEntityAttackedByPlayer(
- getJewelryItems(playerInfo, i), player, entity, event);
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem())
+ .onEntityAttackedByPlayer(getJewelryItems(playerInfo, i), player, entity, event);
}
}
@@ -564,7 +561,7 @@ public class EntityEventHandler { curse.playerDeathAction(player.worldObj, player, event);
}
- for (int i = 0; i < 18; i++)
+ for (int i = 0; i < 18; i++) {
if (getJewelryItems(playerInfo, i) != null) {
if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry)
((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
@@ -573,6 +570,7 @@ public class EntityEventHandler { ((IJewelryItem) getJewelryItems(playerInfo, i).getItem())
.onPlayerDeadAction(getJewelryItems(playerInfo, i), player, event.source);
}
+ }
}
if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP))
JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
@@ -605,4 +603,49 @@ public class EntityEventHandler { }
}
}
+
+ @SubscribeEvent
+ public void onLivingHurt(LivingHurtEvent event) {
+ if (event.entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.entity;
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+
+ for (int i = 0; i < 18; i++) {
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .onPlayerHurt(getJewelryItems(playerInfo, i), player, event);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem())
+ .onPlayerHurt(getJewelryItems(playerInfo, i), player, event);
+ }
+ }
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.onPlayerHurt(player.worldObj, player, event);
+ }
+ } else if (event.source.getEntity() instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+
+ for (int i = 0; i < 18; i++) {
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i).getItem())
+ .onEntityHurt(getJewelryItems(playerInfo, i), player, event);
+ if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i).getItem())
+ .onEntityHurt(getJewelryItems(playerInfo, i), player, event);
+ }
+ }
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0)
+ curse.onEntityHurt(player.worldObj, player, event);
+ }
+ }
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java index 8b477c6..c658f8d 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java @@ -22,6 +22,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -52,7 +53,7 @@ public abstract class ItemBaseJewelry extends Item { return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
}
- return 16777215;
+ return 0xFFFFFF;
}
/**
@@ -66,12 +67,21 @@ public abstract class ItemBaseJewelry extends Item { String baseName = itemName;
+ ItemStack gem = JewelryNBT.gem(stack);
+ if (gem != null) {
+ if (Item.getIdFromItem(gem.getItem()) > 0) {
+ String gemName = gem.getDisplayName().replace("Gem|Crystal|Jewel", " ").trim();
+
+ baseName = gemName + " " + itemName;
+ }
+ }
+
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null) {
if (Item.getIdFromItem(ingot.getItem()) > 0) {
String ingotName = ingot.getDisplayName().replace("Ingot", " ").trim();
- baseName = ingotName + " " + itemName;
+ baseName = ingotName + " " + baseName;
}
}
@@ -119,39 +129,33 @@ public abstract class ItemBaseJewelry extends Item { + EnumChatFormatting.BLUE + gem.getDisplayName());
}
- if (player.isSneaking()) {
- ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack);
+ ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack);
- if (!modifier.isEmpty()) {
- list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".modifiers") + ": ");
- }
+ if (!modifier.isEmpty()) {
+ list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".modifiers") + ": ");
+ }
- for (ItemStack is : modifier) {
- list.add(EnumChatFormatting.DARK_PURPLE + is.getDisplayName() + " x" + is.stackSize);
- }
+ for (ItemStack is : modifier) {
+ list.add(EnumChatFormatting.DARK_PURPLE + is.getDisplayName() + " x" + is.stackSize);
+ }
- String prefix = JewelryNBT.prefix(stack);
- String suffix = JewelryNBT.suffix(stack);
+ String prefix = JewelryNBT.prefix(stack);
+ String suffix = JewelryNBT.suffix(stack);
- if (prefix != null && !prefix.equals("")) {
- String translatedPrefix = StatCollector
- .translateToLocal("prefix." + Variables.MODID + "." + prefix);
- String translatedDesc = StatCollector
- .translateToLocal("prefix." + Variables.MODID + "." + prefix + ".desc");
+ if (prefix != null && !prefix.equals("")) {
+ String translatedPrefix = StatCollector.translateToLocal("prefix." + Variables.MODID + "." + prefix);
+ String translatedDesc = StatCollector
+ .translateToLocal("prefix." + Variables.MODID + "." + prefix + ".desc");
- list.add(translatedPrefix + ": " + translatedDesc);
- }
+ list.add(EnumChatFormatting.AQUA + translatedPrefix + ": " + translatedDesc);
+ }
- if (suffix != null && !suffix.equals("")) {
- String translatedSuffix = StatCollector
- .translateToLocal("suffix." + Variables.MODID + "." + prefix);
- String translatedDesc = StatCollector
- .translateToLocal("suffix." + Variables.MODID + "." + prefix + ".desc");
+ if (suffix != null && !suffix.equals("")) {
+ String translatedSuffix = StatCollector.translateToLocal("suffix." + Variables.MODID + "." + suffix);
+ String translatedDesc = StatCollector
+ .translateToLocal("suffix." + Variables.MODID + "." + suffix + ".desc");
- list.add(translatedSuffix + ": " + translatedDesc);
- }
- } else {
- list.add("<Sneak to see modifier info>");
+ list.add(EnumChatFormatting.AQUA + translatedSuffix + ": " + translatedDesc);
}
}
}
@@ -378,4 +382,38 @@ public abstract class ItemBaseJewelry extends Item { if (suffix != null)
suffix.onLivingDropItems(item, player, event, this);
}
+
+ public void onPlayerHurt(ItemStack item, EntityPlayer player, LivingHurtEvent event) {
+ for (ModifierEffect mod : ModifierEffect.getEffects()) {
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier())) {
+ mod.onPlayerHurt(item, player, event, this);
+ }
+ }
+
+ ModifierEffect prefix = AffixMods.getPrefix(JewelryNBT.prefix(item));
+ ModifierEffect suffix = AffixMods.getSuffix(JewelryNBT.suffix(item));
+
+ if (prefix != null)
+ prefix.onPlayerHurt(item, player, event, this);
+
+ if (suffix != null)
+ suffix.onPlayerHurt(item, player, event, this);
+ }
+
+ public void onEntityHurt(ItemStack item, EntityPlayer player, LivingHurtEvent event) {
+ for (ModifierEffect mod : ModifierEffect.getEffects()) {
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier())) {
+ mod.onEntityHurt(item, player, event, this);
+ }
+ }
+
+ ModifierEffect prefix = AffixMods.getPrefix(JewelryNBT.prefix(item));
+ ModifierEffect suffix = AffixMods.getSuffix(JewelryNBT.suffix(item));
+
+ if (prefix != null)
+ prefix.onEntityHurt(item, player, event, this);
+
+ if (suffix != null)
+ suffix.onEntityHurt(item, player, event, this);
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java index 65be5cb..4cfbbc8 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.affixes.AffixMods;
import darkknight.jewelrycraft.block.BlockHandPedestal;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -61,10 +62,30 @@ public class TileEntityShadowEye extends TileEntity { @Override
public void updateEntity() {
super.updateEntity();
- boolean valid = isValidStructure(worldObj, xCoord, yCoord, zCoord, blockMetadata);
- boolean canStartRitual = valid
- && ((TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord)).heldItemStack != null
- && getNumberOfItems(worldObj, xCoord, yCoord, zCoord) > 0;
+ StringBuilder er = new StringBuilder();
+ boolean valid = isValidStructure(worldObj, xCoord, yCoord, zCoord, blockMetadata, er);
+ boolean centerHasItem = false, hasMods = false, hasAffixes = false;
+ if (valid) {
+ TileEntity te = worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
+ if (te instanceof TileEntityHandPedestal) {
+ centerHasItem = ((TileEntityHandPedestal) te).heldItemStack != null;
+ }
+
+ hasMods = getNumberOfItems(worldObj, xCoord, yCoord, zCoord) > 0;
+
+ hasAffixes = worldObj.getBlock(xCoord, yCoord + 2, zCoord) == Blocks.enchanting_table;
+ }
+
+ boolean canStartRitual = valid && centerHasItem && (hasMods || hasAffixes);
+ if (!canStartRitual && valid) {
+ if (!centerHasItem) {
+ er.append("Center pedestal requires an item");
+ } else if (!hasMods && !hasAffixes) {
+ er.append("Need at least one modifier, or an enchanting table for affixes.");
+ } else {
+ er.append("Unknown issue");
+ }
+ }
if (active) {
timer--;
if (canStartRitual && canChangePedestals(worldObj, xCoord, yCoord, zCoord) && opening == 4)
@@ -88,9 +109,39 @@ public class TileEntityShadowEye extends TileEntity { }
if (opening == 2 && timer <= 0 && t == 10 && shouldAddData) {
addData(worldObj, xCoord, yCoord, zCoord);
- TileEntityHandPedestal target = (TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
- if (target != null && target.getHeldItemStack() != null)
- JewelryNBT.addModifiers(target.getHeldItemStack(), pedestalItems);
+ TileEntityHandPedestal pedstl = (TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
+ if (pedstl != null && pedstl.getHeldItemStack() != null) {
+ JewelryNBT.addModifiers(pedstl.getHeldItemStack(), pedestalItems);
+
+ if (!worldObj.isRemote)
+ if (worldObj.getBlock(xCoord, yCoord + 2, zCoord) == Blocks.enchanting_table) {
+ if (worldObj.rand.nextBoolean()) {
+ JewelryNBT.addPrefix(pedstl.getHeldItemStack(), AffixMods.pickPrefix(worldObj.rand));
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + "The item is infused with a prefix"));
+ } else if (target.experienceLevel > 2) {
+ target.addExperienceLevel(-2);
+ JewelryNBT.addPrefix(pedstl.getHeldItemStack(), AffixMods.pickPrefix(worldObj.rand));
+ if (!worldObj.isRemote)
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + "You infuse the item with a prefix"));
+ }
+
+ if (worldObj.rand.nextBoolean()) {
+ JewelryNBT.addSuffix(pedstl.getHeldItemStack(), AffixMods.pickSuffix(worldObj.rand));
+ if (!worldObj.isRemote)
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + "The item is infused with a suffix"));
+ } else if (target.experienceLevel > 2) {
+ target.addExperienceLevel(-2);
+ JewelryNBT.addSuffix(pedstl.getHeldItemStack(), AffixMods.pickSuffix(worldObj.rand));
+ if (!worldObj.isRemote)
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + "You infuse the item with a suffix"));
+ }
+ }
+ }
+
revertPedestals(worldObj, xCoord, yCoord, zCoord);
}
if (active && timer <= 0) {
@@ -109,6 +160,11 @@ public class TileEntityShadowEye extends TileEntity { JewelrycraftUtil.addCursePoints(target, 50);
target.addChatMessage(new ChatComponentText(
EnumChatFormatting.BLACK + "The Shadows don't like to be disturbed for no reason!"));
+ String str = er.toString();
+ if (!str.equals("")) {
+ target.addChatMessage(
+ new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "Check the following: " + er));
+ }
target.addChatMessage(new ChatComponentText(
EnumChatFormatting.DARK_PURPLE + "You feel a strange aura encumbering you."));
}
@@ -130,137 +186,231 @@ public class TileEntityShadowEye extends TileEntity { }
}
- public boolean isValidStructure(World world, int x, int y, int z, int metadata) {
+ public boolean isValidStructure(World world, int x, int y, int z, int metadata, StringBuilder err) {
if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2) {
// Layers from top to bottom
// 1st Layer
- if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5)
+ if (world.getBlock(x, y + 1, z) != Blocks.stone_slab) {
+ err.append(String.format("Missing stone slab at <%d, %d, %d>", x, y + 1, z));
return false;
- if (world.getBlock(x + 1, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x + 1, y + 1, z) != 5)
+ }
+ if (world.getBlock(x + 1, y + 1, z) != Blocks.stone_slab) {
+ err.append(String.format("Missing stone slab at <%d, %d, %d>", x + 1, y + 1, z));
return false;
- if (world.getBlock(x - 1, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x - 1, y + 1, z) != 5)
+ }
+ if (world.getBlock(x - 1, y + 1, z) != Blocks.stone_slab) {
+ err.append(String.format("Missing stone slab at <%d, %d, %d>", x - 1, y + 1, z));
return false;
+ }
// 2nd Layer
- if (world.getBlock(x + 2, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x + 2, y, z) != 1)
+ if (world.getBlock(x + 2, y, z) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x + 2, y, z));
return false;
- if (world.getBlock(x + 1, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x + 1, y, z) != 4)
+ }
+ if (world.getBlock(x + 1, y, z) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x + 1, y, z));
return false;
- if (world.getBlock(x - 1, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x - 1, y, z) != 5)
+ }
+ if (world.getBlock(x - 1, y, z) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x - 1, y, z));
return false;
- if (world.getBlock(x - 2, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x - 2, y, z) != 0)
+ }
+ if (world.getBlock(x - 2, y, z) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x - 2, y, z));
return false;
+ }
// 3rd Layer
- if (world.getBlock(x + 2, y - 1, z) != Blocks.stonebrick)
+ if (world.getBlock(x + 2, y - 1, z) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x + 2, y - 1, z));
return false;
- if (world.getBlock(x - 2, y - 1, z) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x - 2, y - 1, z) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x - 2, y - 1, z));
return false;
+ }
// 4th Layer
- if (world.getBlock(x + 2, y - 2, z) != Blocks.stonebrick)
+ if (world.getBlock(x + 2, y - 2, z) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x + 2, y - 2, z));
return false;
- if (world.getBlock(x - 2, y - 2, z) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x - 2, y - 2, z) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x - 2, y - 2, z));
return false;
+ }
// 5th Layer
- if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick)
+ if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x + 2, y - 3, z));
return false;
- if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x - 2, y - 3, z));
return false;
+ }
} else if (world.getBlockMetadata(x, y, z) == 1 || world.getBlockMetadata(x, y, z) == 3) {
// Layers from top to bottom
// 1st Layer
- if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5)
+ if (world.getBlock(x, y + 1, z) != Blocks.stone_slab) {
+ err.append(String.format("Missing stone brick slab at <%d, %d, %d>", x, y + 1, z));
return false;
- if (world.getBlock(x, y + 1, z + 1) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z + 1) != 5)
+ }
+ if (world.getBlock(x, y + 1, z + 1) != Blocks.stone_slab) {
+ err.append(String.format("Missing stone brick slab at <%d, %d, %d>", x, y + 1, z + 1));
return false;
- if (world.getBlock(x, y + 1, z - 1) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z - 1) != 5)
+ }
+ if (world.getBlock(x, y + 1, z - 1) != Blocks.stone_slab) {
+ err.append(String.format("Missing stone brick slab at <%d, %d, %d>", x, y + 1, z - 1));
return false;
+ }
// 2nd Layer
- if (world.getBlock(x, y, z + 2) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z + 2) != 3)
+ if (world.getBlock(x, y, z + 2) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x, y, z + 2));
return false;
- if (world.getBlock(x, y, z + 1) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z + 1) != 6)
+ }
+ if (world.getBlock(x, y, z + 1) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x, y, z + 1));
return false;
- if (world.getBlock(x, y, z - 1) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z - 1) != 7)
+ }
+ if (world.getBlock(x, y, z - 1) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x, y, z - 1));
return false;
- if (world.getBlock(x, y, z - 2) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z - 2) != 2)
+ }
+ if (world.getBlock(x, y, z - 2) != Blocks.stone_brick_stairs) {
+ err.append(String.format("Missing stone brick stairs at <%d, %d, %d>", x, y, z - 2));
return false;
+ }
// 3rd Layer
- if (world.getBlock(x, y - 1, z + 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 1, z + 2) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x, y - 1, z + 2));
return false;
- if (world.getBlock(x, y - 1, z - 2) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x, y - 1, z - 2) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x, y - 1, z - 2));
return false;
+ }
// 4th Layer
- if (world.getBlock(x, y - 2, z + 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 2, z + 2) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x, y - 2, z + 2));
return false;
- if (world.getBlock(x, y - 2, z - 2) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x, y - 2, z - 2) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x, y - 2, z - 2));
return false;
+ }
// 5th Layer
- if (world.getBlock(x, y - 3, z + 2) != Blocks.stonebrick)
+ if (world.getBlock(x, y - 3, z + 2) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x, y - 3, z + 2));
return false;
- if (world.getBlock(x, y - 3, z - 2) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x, y - 3, z - 2) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone bricks at <%d, %d, %d>", x, y - 3, z - 2));
return false;
+ }
}
// 3rd Layer
- if (world.getBlock(x - 4, y - 1, z - 4) != BlockList.shadowBlock)
+ if (world.getBlock(x - 4, y - 1, z - 4) != BlockList.shadowBlock) {
+ err.append(String.format("Missing shadow block at <%d, %d, %d>", x - 4, y - 1, z - 4));
return false;
- if (world.getBlock(x - 4, y - 1, z + 4) != BlockList.shadowBlock)
+ }
+ if (world.getBlock(x - 4, y - 1, z + 4) != BlockList.shadowBlock) {
+ err.append(String.format("Missing shadow block at <%d, %d, %d>", x - 4, y - 1, z + 4));
return false;
- if (world.getBlock(x + 4, y - 1, z - 4) != BlockList.shadowBlock)
+ }
+ if (world.getBlock(x + 4, y - 1, z - 4) != BlockList.shadowBlock) {
+ err.append(String.format("Missing shadow block at <%d, %d, %d>", x + 4, y - 1, z - 4));
return false;
- if (world.getBlock(x + 4, y - 1, z + 4) != BlockList.shadowBlock)
+ }
+ if (world.getBlock(x + 4, y - 1, z + 4) != BlockList.shadowBlock) {
+ err.append(String.format("Missing shadow block at <%d, %d, %d>", x + 4, y - 1, z + 4));
return false;
+ }
// 4th Layer
- if (world.getBlock(x - 4, y - 2, z - 4) != Blocks.stonebrick)
+ if (world.getBlock(x - 4, y - 2, z - 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x - 4, y - 2, z - 4));
return false;
- if (world.getBlock(x - 4, y - 2, z + 4) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x - 4, y - 2, z + 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x - 4, y - 2, z + 4));
return false;
- if (world.getBlock(x + 4, y - 2, z - 4) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x + 4, y - 2, z - 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x + 4, y - 2, z - 4));
return false;
- if (world.getBlock(x + 4, y - 2, z + 4) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x + 4, y - 2, z + 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x + 4, y - 2, z + 4));
return false;
+ }
// 5th Layer
// Pillars
- if (world.getBlock(x - 4, y - 3, z - 4) != Blocks.stonebrick)
+ if (world.getBlock(x - 4, y - 3, z - 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x - 4, y - 3, z - 4));
return false;
- if (world.getBlock(x - 4, y - 3, z + 4) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x - 4, y - 3, z + 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x - 4, y - 3, z + 4));
return false;
- if (world.getBlock(x + 4, y - 3, z - 4) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x + 4, y - 3, z - 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x + 4, y - 3, z - 4));
return false;
- if (world.getBlock(x + 4, y - 3, z + 4) != Blocks.stonebrick)
+ }
+ if (world.getBlock(x + 4, y - 3, z + 4) != Blocks.stonebrick) {
+ err.append(String.format("Missing stone brick at <%d, %d, %d>", x + 4, y - 3, z + 4));
return false;
+ }
// Pedestals
- if (!(world.getBlock(x, y - 3, z) instanceof BlockHandPedestal))
+ if (world.getBlock(x, y - 3, z) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x, y - 3, z));
return false;
- if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal
- || world.getBlockMetadata(x - 4, y - 3, z + 2) != 1)
+ }
+ if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x - 4, y - 3, z + 2));
return false;
- if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x - 5, y - 3, z) != 2)
+ }
+ if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x - 5, y - 3, z));
return false;
- if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal
- || world.getBlockMetadata(x - 4, y - 3, z - 2) != 3)
+ }
+ if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x - 4, y - 3, z - 2));
return false;
- if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal
- || world.getBlockMetadata(x - 2, y - 3, z - 4) != 3)
+ }
+ if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x - 2, y - 3, z - 4));
return false;
- if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z - 5) != 4)
+ }
+ if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x, y - 3, z - 5));
return false;
- if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal
- || world.getBlockMetadata(x + 2, y - 3, z - 4) != 5)
+ }
+ if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x + 2, y - 3, z - 4));
return false;
- if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal
- || world.getBlockMetadata(x + 4, y - 3, z - 2) != 5)
+ }
+ if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x + 4, y - 3, z - 2));
return false;
- if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x + 5, y - 3, z) != 6)
+ }
+ if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x + 5, y - 3, z));
return false;
- if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal
- || world.getBlockMetadata(x + 4, y - 3, z + 2) != 7)
+ }
+ if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x + 4, y - 3, z + 2));
return false;
- if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal
- || world.getBlockMetadata(x + 2, y - 3, z + 4) != 7)
+ }
+ if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x + 2, y - 3, z + 4));
return false;
- if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z + 5) != 0)
+ }
+ if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x, y - 3, z + 5));
return false;
- if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal
- || world.getBlockMetadata(x - 2, y - 3, z + 4) != 1)
+ }
+ if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal) {
+ err.append(String.format("Missing hand pedestal at <%d, %d, %d>", x - 2, y - 3, z + 4));
return false;
+ }
return true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java index 1592609..7a85cff 100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java @@ -1,5 +1,6 @@ package darkknight.jewelrycraft.util;
+import java.awt.Color;
import java.lang.reflect.Field;
import java.util.*;
@@ -58,13 +59,32 @@ public class JewelrycraftUtil { * Adds gems and jewelry to their appropriate lists
*/
public static void addStuff() {
+ // Metals
+ metal.add(new ItemStack(Items.bone));
+ metal.add(new ItemStack(Items.brick));
+ metal.add(new ItemStack(Items.gold_ingot));
+ metal.add(new ItemStack(Items.iron_ingot));
+ metal.add(new ItemStack(Items.paper));
+ metal.add(new ItemStack(Items.netherbrick));
+ metal.add(new ItemStack(Blocks.clay));
+ metal.add(new ItemStack(Blocks.cobblestone));
+ metal.add(new ItemStack(Blocks.glass));
+ metal.add(new ItemStack(Blocks.ice));
+ metal.add(new ItemStack(Blocks.mossy_cobblestone));
+ metal.add(new ItemStack(Blocks.netherrack));
+ metal.add(new ItemStack(Blocks.obsidian));
+ metal.add(new ItemStack(Blocks.sandstone));
+ metal.add(new ItemStack(Blocks.stone));
+
// Jewels
for (int i = 0; i < 16; i++) {
gem.add(new ItemStack(BlockList.crystal, 1, i));
}
+ gem.add(new ItemStack(Blocks.glowstone));
gem.add(new ItemStack(Blocks.redstone_block));
gem.add(new ItemStack(Blocks.lapis_block));
+ gem.add(new ItemStack(Items.quartz));
gem.add(new ItemStack(Blocks.obsidian));
gem.add(new ItemStack(Items.diamond));
gem.add(new ItemStack(Items.emerald));
@@ -89,7 +109,6 @@ public class JewelrycraftUtil { objects.add(new ItemStack(Items.ender_eye));
objects.add(new ItemStack(Items.ender_pearl));
objects.add(new ItemStack(Items.feather));
- objects.add(new ItemStack(Blocks.obsidian));
// Structures
try {
@@ -106,7 +125,20 @@ public class JewelrycraftUtil { @SideOnly(Side.CLIENT)
public static void generateColors() {
+ for (ItemStack is : objects) {
+ int rgb = getRandomRGBColor();
+ colors.put(is, rgb);
+ }
+ }
+
+ public static int getRandomRGBColor() {
+ float r = rand.nextFloat();
+ float g = rand.nextFloat();
+ float b = rand.nextFloat();
+ Color clr = new Color(r, g, b);
+ int rgb = clr.getRGB();
+ return rgb;
}
@SideOnly(Side.CLIENT)
@@ -121,7 +153,9 @@ public class JewelrycraftUtil { }
}
- return 0xFFFFFF;
+ int rgb = getRandomRGBColor();
+ colors.put(item, rgb);
+ return rgb;
}
@SideOnly(Side.CLIENT)
@@ -139,61 +173,6 @@ public class JewelrycraftUtil { return (int) Math.random() * 16777215;
}
- public static ResourceLocation getLocation(ItemStack item) {
- String domain = "";
-
- String texture;
-
- IIcon itemIcon = item.getItem().getIcon(item, 0);
-
- if (isValidBlockFromItem(item)) {
- itemIcon = Block.getBlockFromItem(item.getItem()).getIcon(0, item.getItemDamage());
- }
-
- String iconName = itemIcon.getIconName();
-
- if (iconName.substring(0, iconName.indexOf(":") + 1) != "") {
- domain = iconName.substring(0, iconName.indexOf(":") + 1).replace(":", " ").trim();
- } else {
- domain = "minecraft";
- }
-
- texture = iconName.substring(iconName.lastIndexOf(":") + 1) + ".png";
-
- ResourceLocation textureLocation = null;
-
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
-
- String textureBase = texturemanager.getResourceLocation(item.getItemSpriteNumber()).toString();
-
- if (textureBase.contains("items")) {
- textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
- } else {
- textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
- }
-
- return textureLocation;
- }
-
- private static boolean isValidBlockFromItem(ItemStack item) {
- boolean isAirBlock = Block.getBlockFromItem(item.getItem()) instanceof BlockAir;
- boolean isSoulSand = Block.getBlockFromItem(item.getItem()).getIcon(0, item.getItemDamage()).getIconName()
- .equals("soul_sand");
-
- return !(isAirBlock || isSoulSand);
- }
-
- @SideOnly(Side.CLIENT)
- public static boolean isGray(int[] rgbArr) {
- int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
-
- if (rgbSum > 0 && rgbSum < 256 * 3) {
- return false;
- }
-
- return true;
- }
-
public static WeightedRandomCurse[] getCurses(World world, EntityPlayer player, Random random) {
WeightedRandomCurse[] curses = new WeightedRandomCurse[Curse.availableCurses.size()];
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java index 3c304b0..afde2b1 100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java @@ -41,7 +41,9 @@ public class WorldGenStructure2 extends WorldGenStructure { world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
world.setBlock(x, y, z, Blocks.air);
ItemStack stack = new ItemStack(ItemList.bucket);
- JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
+ if (JewelrycraftUtil.metal.size() > 0) {
+ JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
+ }
if (stack != null && JewelryNBT.ingot(stack) != null) {
if (!world.isRemote)
world.func_147480_a(x, y, z, true);
diff --git a/src/main/resources/assets/jewelrycraft2/lang/en_US.lang b/src/main/resources/assets/jewelrycraft2/lang/en_US.lang index 9605fec..91d393c 100755 --- a/src/main/resources/assets/jewelrycraft2/lang/en_US.lang +++ b/src/main/resources/assets/jewelrycraft2/lang/en_US.lang @@ -196,15 +196,17 @@ achievement.jewelrycraft.pentagram.desc=§4Challenge:§7 Do not steal health fro challenge.failed=You failed the challenge:
prefix.jewelrycraft2.health1=Bright
-prefix.jewelrycraft2.health1.desc=+1/2 Heart
prefix.jewelrycraft2.health2=Solar
-prefix.jewelrycraft2.health2.desc=+1 Heart
prefix.jewelrycraft2.health3=Vivid
+
+prefix.jewelrycraft2.health1.desc=+1/2 Heart
+prefix.jewelrycraft2.health2.desc=+1 Heart
prefix.jewelrycraft2.health3.desc=+3/2 Hearts
suffix.jewelrycraft2.health1=of the Jackal
-suffix.jewelrycraft2.health1.desc=+1/2 Heart
suffix.jewelrycraft2.health2=of the Fox
-suffix.jewelrycraft2.health2=+1 Heart
suffix.jewelrycraft2.health3=of the Wolf
+
+suffix.jewelrycraft2.health1.desc=+1/2 Heart
+suffix.jewelrycraft2.health2.desc=+1 Heart
suffix.jewelrycraft2.health3.desc=+3/2 Hearts
\ No newline at end of file |
